[parisc-linux-cvs] linux-2.6 tausq
Randolph Chung
Randolph Chung <randolph@tausq.org>
Tue, 21 Oct 2003 08:54:11 -0700
> . : Makefile
> arch/parisc/kernel: unaligned.c
>
> Log message:
> 2.6.0-test8-pa3: handle page faults during unaligned accesses
Patch posted previously on the list. Here's a test program.
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
int main(int argc, char **argv)
{
void *addr;
int ps;
int *p, t;
ps = getpagesize() * 8;
addr = mmap(NULL, ps*2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (addr == NULL)
{
fprintf(stderr, "mmap() failed\n");
return 0;
}
memset(addr, 0, ps*2);
if (munmap(addr+ps, ps) < 0)
{
perror("munmap");
return 0;
}
printf("1st load\n");
p = (addr+ps-5);
t = *p;
printf("2nd load\n");
p = (addr+ps-1);
t = *p;
printf("3rd load\n");
p = (addr+ps+1);
t = *p;
printf("1st store\n");
p = (addr+ps-5);
*p = t;
printf("2nd store\n");
p = (addr+ps-1);
*p = t;
printf("3rd store\n");
p = (addr+ps+1);
*p = t;
return 0;
}
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/