Re: mmap alignment.
Re: mmap alignment.
- Subject: Re: mmap alignment.
- From: Steven Bytnar <email@hidden>
- Date: Mon, 13 Feb 2006 17:15:07 -0600
mmap is returning 4KB aligned pages.
See xnu/bsd/kern/kern_mman.c
On FreeBSD, MAP_ALIGN is also defined to return a page-aligned hunk of memory.
How about allocating twice the size (128KB), aligning the returned address
to 64KB and internally tracking the difference between the allocated region
and the aligned address that you need?
Are you sure that you need 64KB alignment? Is 4KB alignment not good enough?
--Steve
> Hello all,
>
> I'm porting an app that uses mmap() and banks on its alignment
> behaviour on Solaris and Linux.
>
> I'd like to mmap a 64k and have the resulting address be aligned on a
> 64k boundary. I'm trying with:
> mmap((void *)65536, 65536, PROT_NONE, MAP_PRIVATE | MAP_ANON |
> MAP_NORESERVE | MAP_ALIGN, -1, 0);
>
> However, the return address is not modulo 64k. How do I accomplish
> what I want?
>
> Thanks!
>
> // Theo Schlossnagle
> // Principal Engineer -- http://www.omniti.com/~jesus/
> // OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
> // Ecelerity: Run with it.
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Darwin-dev mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/darwin-dev
>
> End of Darwin-dev Digest, Vol 3, Issue 37
> *****************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden