kernel: fpu_init: only enable OSXMMEXCPT in CR4 on at least SSE1 machines.
[minix.git] / test / test44.c
blob4f9e7346601b016d6b8cbb68bd98ebee91bbbc61
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <fcntl.h>
5 #include <unistd.h>
6 #include <sys/mman.h>
8 int
9 main(int argc, char *argv[])
11 #define CHUNKSIZE 8192
12 #define CHUNKS1 3
13 #define CHUNKS2 2
14 #define CHUNKS (CHUNKS1+CHUNKS2)
15 int i, fd;
16 char *v[CHUNKS];
17 #define STARTV 0x90000000
18 char *vaddr = (char *) STARTV;
19 ssize_t l;
21 printf("Test 44 ");
22 fflush(stdout);
24 for(i = 0; i < CHUNKS; i++) {
25 v[i] = mmap(vaddr, CHUNKSIZE, PROT_READ|PROT_WRITE, 0, -1, 0);
26 if(v[i] == MAP_FAILED) {
27 perror("mmap");
28 fprintf(stderr, "mmap failed\n");
29 exit(1);
31 if(v[i] != vaddr) {
32 fprintf(stderr, "mmap said 0x%p but i wanted 0x%p\n",
33 v[i], vaddr);
34 exit(1);
36 vaddr += CHUNKSIZE;
39 #define DEV_ZERO "/dev/zero"
40 if((fd=open(DEV_ZERO, O_RDONLY)) < 0) {
41 perror("open");
42 fprintf(stderr, "open failed for %s\n", DEV_ZERO);
43 exit(1);
46 #define TOTAL1 (CHUNKS1*CHUNKSIZE)
47 /* Make single read cross region boundary. */
48 if((l=read(fd, v[0], TOTAL1)) != TOTAL1) {
49 fprintf(stderr, "read %d but expected %d\n", l, TOTAL1);
50 exit(1);
53 /* Force single copy to cross region boundary. */
55 char *t;
56 t = v[CHUNKS1]+CHUNKSIZE-2;
57 if((l=read(fd, t, CHUNKSIZE)) != CHUNKSIZE) {
58 fprintf(stderr, "read %d but expected %d\n", l, CHUNKSIZE);
59 exit(1);
63 printf("ok\n");
65 exit(0);