This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: kaffe 0.9 and gnuwin b18 don't mix


Peter Ham, you wrote:
> 
> The memory manager in kaffe-0.9 requires that the operating system
> memory allocator return "page" aligned pointers.
> 
> Unfortunately, gnuwin b18 doesn't support memalign(), or valloc(), and
> malloc doesn't return data aligned to kaffe's
> preference.

Well, if you don't mind wasting a large amount of memory, try
the following (msotly untested) code...

/*
** round_up(amount, align) returns `amount' rounded up to the nearest
** alignment boundary.  `align' must be a power of 2.
*/
#define round_up(amount, align) ((((amount) - 1) | ((align) - 1)) + 1)

#define PAGESIZE 4096
#define memalign(size) round_up(malloc((size) + PAGESIZE), PAGESIZE)

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]