From 59aee928d608e01b5a09bacf417f064317e1cf88 Mon Sep 17 00:00:00 2001 From: weingart Date: Thu, 17 Apr 1997 17:21:16 +0000 Subject: [PATCH] New memprobe for weird machines... please test. --- sys/arch/i386/stand/libsa/memprobe.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c index 4dc2ca6d85d..621e1526569 100644 --- a/sys/arch/i386/stand/libsa/memprobe.c +++ b/sys/arch/i386/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.4 1997/04/15 06:43:15 mickey Exp $ */ +/* $OpenBSD: memprobe.c,v 1.5 1997/04/17 17:21:16 weingart Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -47,7 +47,7 @@ memprobe() /* probe extended memory * - * There is no need to do this in assembly language. This are + * There is no need to do this in assembly language. This is * much easier to debug in C anyways. */ for(ram = 1024; ram < 512*1024; ram += 4){ @@ -64,6 +64,12 @@ memprobe() * * This is a hack, but it seems to work ok. Maybe this is * the *real* way that you are supposed to do probing??? + * + * Modify the original a bit. We write everything first, and + * then test for the values. This should croak on machines that + * return values just written on non-existent memory... + * + * BTW: These machines are pretty boken IMHO. */ static int addrprobe(int kloc){ volatile int *loc, i; @@ -82,6 +88,16 @@ static int addrprobe(int kloc){ if(*loc != pat[i]) return(1); } + /* Write address */ + for(i = 0; i < sizeof(pat)/sizeof(pat[0]); i++){ + loc[i] = pat[i]; + } + + /* Read address */ + for(i = 0; i < sizeof(pat)/sizeof(pat[0]); i++){ + if(loc[i] != pat[i]) return(1); + } + return(0); } -- 2.20.1