From 89ac8e71d240b595a6c98a82f903839970614834 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 30 Jul 1997 15:37:48 +0000 Subject: [PATCH] Use a buserror handler that just tests for 'nofault' being set when the MMU is not yet initialized. This behaviour is necessary when probing for the machine type - because we need the type before we can setup the tables.... --- sys/arch/atari/atari/atari_init.c | 27 ++++++++++++++++++++------- sys/arch/atari/atari/locore.s | 31 ++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/sys/arch/atari/atari/atari_init.c b/sys/arch/atari/atari/atari_init.c index 693f786e212f..ab82d47f65bc 100644 --- a/sys/arch/atari/atari/atari_init.c +++ b/sys/arch/atari/atari/atari_init.c @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.32 1997/07/05 20:50:41 leo Exp $ */ +/* $NetBSD: atari_init.c,v 1.33 1997/07/30 15:37:48 leo Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -209,17 +209,17 @@ char *esym_addr; /* Address of kernel '_esym' symbol */ PAGE_MASK = NBPG-1; PAGE_SHIFT = PG_SHIFT; + /* + * Determine the type of machine we are running on. This needs + * to be done early (and before initcpu())! + */ + set_machtype(); + /* * Initialize cpu specific stuff */ initcpu(); - /* - * Determine the type of machine we are running on. This needs - * to be done early! - */ - set_machtype(); - /* * We run the kernel from ST memory at the moment. * The kernel segment table is put just behind the loaded image. @@ -968,6 +968,19 @@ initcpu() } break; #endif /* defined(M68040) */ +#if defined(M68030) || defined(M68020) + case CPU_68030: + case CPU_68020: + { + extern trapfun *vectab[256]; + extern trapfun buserr2030, addrerr2030; + + /* bus/addrerr vectors */ + vectab[2] = buserr2030; + vectab[3] = addrerr2030; + } + break; +#endif /* defined(M68030) || defined(M68020) */ } DCIS(); diff --git a/sys/arch/atari/atari/locore.s b/sys/arch/atari/atari/locore.s index 31c6aef30cbb..2737b7295243 100644 --- a/sys/arch/atari/atari/locore.s +++ b/sys/arch/atari/atari/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.45 1997/07/09 14:32:09 leo Exp $ */ +/* $NetBSD: locore.s,v 1.46 1997/07/30 15:37:49 leo Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -158,14 +158,10 @@ Lbe1stpg: jra _ASM_LABEL(faultstkadj) | and deal with it #endif /* defined(M68040) */ - /* - * This is where the default vectors end-up! - */ -_buserr: -_addrerr: -#if !(defined(M68020) || defined(M68030)) - jra _badtrap -#else +#if defined(M68020) || defined(M68030) + .globl _buserr2030, _addrerr2030 +_buserr2030: +_addrerr2030: clrl sp@- | stack adjust count moveml #0xFFFF,sp@- | save user registers movl usp,a0 | save the user SP @@ -256,6 +252,23 @@ LberrIsProbe: movl #T_BUSERR,sp@- | mark bus error jra _ASM_LABEL(faultstkadj) | and deal with it + /* + * This is where the default vectors end-up! + * At the time of the 'machine-type' probes, it seems necessary + * that the 'nofault' test is done first. Because the MMU is not + * yet setup at this point, the real fault handlers sometimes + * misinterpret the cause of the fault. + */ +_buserr: +_addrerr: + tstl _nofault | device probe? + jeq 1f | no, halt... + movl _nofault,sp@- | yes, + jbsr _longjmp | longjmp(nofault) + /* NOTREACHED */ +1: + jra _badtrap | only catch probes! + /* * FP exceptions. */