Subject: Re: kaffe 0.9 and gnuwin b18 don't mix
From: [email-masked] (Fergus Henderson)

18 May 1997 01:53:38 -0700
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
Original-Cc: [email-masked] (Cygnus GNU-win32 mailing list)
In-Reply-To: <[email-masked]> from "Peter Ham" at May 17, 97 08:56:12 pm
X-Mailer: ELM [version 2.4 PL24]
Content-Type: text
Original-Sender: [email-masked]

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 <[email-masked]>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger [email-masked]         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".