Subject: Re: My problems with merged memory
To: None <amiga-dev@sun-lamp.cs.berkeley.edu>
From: Niklas Hallqvist <niklas@appli.se>
List: amiga-dev
Date: 03/07/1994 16:45:46
More info:
I can now recreate the error with a small program:
int
main ()
{
int *ip, i;
/* Acquire a page and reset the first word to a known state */
ip = (int*)malloc (4096);
*ip = 0;
/* Force the page to swap (I just have 6 Megs on my machine) */
bzero (malloc(6 * 1024 * 1024));
/* Odd-aligned bitfield access */
asm volatile ("bftst %1@(1){#0:#24};movel %1,%0" : "=g" (i) : "a" (*ip) : "cc");
/* Check the longword we know should be zero */
printf ("0x%08x\n", i);
return 0;
}
The key is that an odd-aligned bitfield access which causes a page-fault
makes the page get incorrectly read from 16-bit mem. Longword align the
test, or use tstb or tstl, or don't force the page to swap and you'll
get by just fine.
What on earth can be done about this short off hacking the compiler? I know
how to do that, but I really don't want to play with a customized compiler
here. Can something be done in the pmap module?
Niklas
------------------------------------------------------------------------------