mmap on 4k boundaries
Chris January
chris@atomice.net
Tue Jul 8 09:15:00 GMT 2003
I can't make a patch for this at the moment, but FYI you can map a section
on a 4k page bounday using the AT_ROUND_TO_PAGE flag. So on Windows NT, mmap
should be able to map on a 4k page boundary using this function.
NTSTATUS Status = ZwMapViewOfSection (handle, // SectionHandle
NtCurrentProcess (), // ProcessHandle
address, // BaseAddress
0L, // ZeroBits
size, // CommitSize
&offset, // SectionOffset
&size, // ViewSize
ViewShare, // InheritDispostion,
AT_ROUND_TO_PAGE, // AllocationType
PAGE_READWRITE // Protect
);
Prototype:
NTSYSAPI
NTSTATUS
NTAPI
ZwMapViewOfSection(
IN HANDLE SectionHandle,
IN HANDLE ProcessHandle,
IN OUT PVOID *BaseAddress,
IN ULONG ZeroBits,
IN ULONG CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PULONG ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG AllocationType,
IN ULONG Protect
);
typedef enum _SECTION_INHERIT {
ViewShare = 1,
ViewUnmap = 2
} SECTION_INHERIT;
#define AT_EXTENDABLE_FILE 0x00002000
#define SEC_NO_CHANGE 0x00400000
#define AT_RESERVED 0x20000000
#define AT_ROUND_TO_PAGE 0x40000000
More information about the Cygwin-developers
mailing list