diff --git a/sys/arch/luna68k/luna68k/locore.s b/sys/arch/luna68k/luna68k/locore.s index 25c93fded87c..5485aee70258 100644 --- a/sys/arch/luna68k/luna68k/locore.s +++ b/sys/arch/luna68k/luna68k/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.2 2000/01/14 02:39:22 nisimura Exp $ */ +/* $NetBSD: locore.s,v 1.3 2000/01/15 10:06:21 nisimura Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -1330,54 +1330,6 @@ Lbootcommon: movl a0@(4),a0 | *((int (*)(void))base[1]) jmp a0@ | go cold boot! -#if 0 -/* - * int romcngetc(dev_t) - */ -ENTRY_NOPROFILE(romcngetc) - moveq #0,d1 - movw sr,d1 | get old SR for return - movel d1,a6@(-4) - movw #PSL_HIGHIPL,sr | splhigh() - movc vbr,d1 - movel d1,a6@(-8) - movl #0,d1 - movc d1,vbr - movel #0x41000000,a0 | base = (int **)0x41000000 - movel a0@(16),a0 | getc = (int (*)(void))base[4] - jbsr a0@ | d0 = (*getc)() - movl a6@(-8),d1 | restore previous VBR - movc d1,vbr - movel a6@(-4),d1 - movew d1,sr | splx() - unlk a6 - rts - -/* - * void romcnputc(dev_t, cc) - */ -ENTRY_NOPROFILE(romcnputc) - moveq #0,d1 - movw sr,d1 | get old SR for return - movel d1,a6@(-8) - movw #PSL_HIGHIPL,sr | splhigh() - movc vbr,d1 - movel d1,a6@(-8) - movl #0,d1 - movc d1,vbr | switch to monitor VBR - movel a6@(12),sp@- - movel #0x41000000,a0 | base = (int **)0x41000000 - movl a0@(20),a0 | putc = (void (*)(int))base[5] - jbsr a0@ | (*putc)(cc) - addql #4,sp | pop args - movl a6@(-8),d1 | restore previous VBR - movc d1,vbr - movel a6@(-4),d1 - movew d1,sr | splx() - unlk a6 - rts -#endif - .data GLOBAL(cputype) .long CPU_68030 | default to 68030 diff --git a/sys/arch/luna68k/luna68k/machdep.c b/sys/arch/luna68k/luna68k/machdep.c index 5ff59d0e196b..0558d8c40775 100644 --- a/sys/arch/luna68k/luna68k/machdep.c +++ b/sys/arch/luna68k/luna68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.1 2000/01/05 08:49:03 nisimura Exp $ */ +/* $NetBSD: machdep.c,v 1.2 2000/01/15 10:06:21 nisimura Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2000/01/05 08:49:03 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2000/01/15 10:06:21 nisimura Exp $"); #include "opt_ddb.h" @@ -224,8 +224,10 @@ consinit() if (i++ >= sizeof(bootarg)) break; } +#if 0 /* overload 1:sw1, which now means 'go ROM monitor' after poweron */ if (boothowto == 0) boothowto = (sw1 & 0x1) ? RB_SINGLE : 0; +#endif if (sysconsole == 0) syscnattach(0); @@ -941,7 +943,7 @@ microtime(tvp) splx(s); } -#ifndef ROMCONS +#if 1 struct consdev *cn_tab = &syscons; @@ -964,27 +966,65 @@ struct consdev romcons = { }; struct consdev *cn_tab = &romcons; -extern int romcall __P((int, int)); +#define __ ((int **)0x41000000) +#define GETC() (*(int (*)())__[6])() +#define PUTC(x) (*(void (*)())__[7])(x) -#define ROMGETC() romcall(6, 0) -#define ROMPUTC(x) romcall(7, x) +#define ROMPUTC(x) \ +({ \ + register _r; \ + asm volatile (" \ + movc vbr,%0 ; \ + movel %0,sp@- ; \ + clrl %0 ; \ + movc %0,vbr" \ + : "=r" (_r)); \ + PUTC(x); \ + asm volatile (" \ + movel sp@+,%0 ; \ + movc %0,vbr" \ + : "=r" (_r)); \ +}) + +#define ROMGETC() \ +({ \ + register _r, _c; \ + asm volatile (" \ + movc vbr,%0 ; \ + movel %0,sp@- ; \ + clrl %0 ; \ + movc %0,vbr" \ + : "=r" (_r)); \ + _c = GETC(); \ + asm volatile (" \ + movel sp@+,%0 ; \ + movc %0,vbr" \ + : "=r" (_r)); \ + _c; \ +}) void romcnputc(dev, c) dev_t dev; int c; { + int s; + + s = splhigh(); ROMPUTC(c); + splx(s); } int romcngetc(dev) dev_t dev; { - int c; + int s, c; do { + s = splhigh(); c = ROMGETC(); + splx(s); } while (c == -1); return c; }