diff options
author | dg <dg@FreeBSD.org> | 1995-12-30 23:13:32 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-12-30 23:13:32 +0000 |
commit | 6f6e7c6fd8cfe5f20cb112c846547b702cb34f46 (patch) | |
tree | 817d5c2393469546e7570f85914a8a19b2ecfaac | |
parent | 8afe324a8c4b9c81b15a899f9d39f7f38b253f13 (diff) | |
download | FreeBSD-src-6f6e7c6fd8cfe5f20cb112c846547b702cb34f46.zip FreeBSD-src-6f6e7c6fd8cfe5f20cb112c846547b702cb34f46.tar.gz |
In memory test, cast pointer as "volatile int *", not "int *" to make sure
that gcc doesn't cache the value used in the test. Pointed out by Erich
Boleyn <erich@uruk.org>.
-rw-r--r-- | sys/amd64/amd64/machdep.c | 18 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index b001966..aafa7f8 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.164 1995/12/25 01:02:32 davidg Exp $ + * $Id: machdep.c,v 1.165 1995/12/28 23:14:35 davidg Exp $ */ #include "npx.h" @@ -1493,29 +1493,29 @@ init386(first) /* * Test for alternating 1's and 0's */ - *(int *)CADDR1 = 0xaaaaaaaa; - if (*(int *)CADDR1 != 0xaaaaaaaa) { + *(volatile int *)CADDR1 = 0xaaaaaaaa; + if (*(volatile int *)CADDR1 != 0xaaaaaaaa) { page_bad = TRUE; } /* * Test for alternating 0's and 1's */ - *(int *)CADDR1 = 0x55555555; - if (*(int *)CADDR1 != 0x55555555) { + *(volatile int *)CADDR1 = 0x55555555; + if (*(volatile int *)CADDR1 != 0x55555555) { page_bad = TRUE; } /* * Test for all 1's */ - *(int *)CADDR1 = 0xffffffff; - if (*(int *)CADDR1 != 0xffffffff) { + *(volatile int *)CADDR1 = 0xffffffff; + if (*(volatile int *)CADDR1 != 0xffffffff) { page_bad = TRUE; } /* * Test for all 0's */ - *(int *)CADDR1 = 0x0; - if (*(int *)CADDR1 != 0x0) { + *(volatile int *)CADDR1 = 0x0; + if (*(volatile int *)CADDR1 != 0x0) { /* * test of page failed */ diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index b001966..aafa7f8 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.164 1995/12/25 01:02:32 davidg Exp $ + * $Id: machdep.c,v 1.165 1995/12/28 23:14:35 davidg Exp $ */ #include "npx.h" @@ -1493,29 +1493,29 @@ init386(first) /* * Test for alternating 1's and 0's */ - *(int *)CADDR1 = 0xaaaaaaaa; - if (*(int *)CADDR1 != 0xaaaaaaaa) { + *(volatile int *)CADDR1 = 0xaaaaaaaa; + if (*(volatile int *)CADDR1 != 0xaaaaaaaa) { page_bad = TRUE; } /* * Test for alternating 0's and 1's */ - *(int *)CADDR1 = 0x55555555; - if (*(int *)CADDR1 != 0x55555555) { + *(volatile int *)CADDR1 = 0x55555555; + if (*(volatile int *)CADDR1 != 0x55555555) { page_bad = TRUE; } /* * Test for all 1's */ - *(int *)CADDR1 = 0xffffffff; - if (*(int *)CADDR1 != 0xffffffff) { + *(volatile int *)CADDR1 = 0xffffffff; + if (*(volatile int *)CADDR1 != 0xffffffff) { page_bad = TRUE; } /* * Test for all 0's */ - *(int *)CADDR1 = 0x0; - if (*(int *)CADDR1 != 0x0) { + *(volatile int *)CADDR1 = 0x0; + if (*(volatile int *)CADDR1 != 0x0) { /* * test of page failed */ |