This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
mmap on 4k boundaries
- From: "Chris January" <chris at atomice dot net>
- To: "Cygwin-Developers at Cygwin dot Com" <cygwin-developers at cygwin dot com>
- Date: Tue, 8 Jul 2003 10:16:37 +0100
- Subject: mmap on 4k boundaries
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