Changes so that the kernel can be compiled under __ELF__.

This commit is contained in:
matt 2000-07-17 02:54:04 +00:00
parent 5d9fda1ecd
commit f96915efa5
5 changed files with 253 additions and 249 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: emulate.s,v 1.2 1997/03/15 16:14:25 ragge Exp $ */ /* $NetBSD: emulate.s,v 1.3 2000/07/17 02:54:04 matt Exp $ */
/* /*
* Copyright (c) 1986, 1987 The Regents of the University of California. * Copyright (c) 1986, 1987 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -37,6 +37,8 @@
* @(#)emulate.s 7.5 (Berkeley) 6/28/90 * @(#)emulate.s 7.5 (Berkeley) 6/28/90
*/ */
#include <machine/asm.h>
/* /*
* String instruction emulation - MicroVAX only. These routines are called * String instruction emulation - MicroVAX only. These routines are called
* from locore.s when an "emulate" fault occurs on the MicroVAX. They are * from locore.s when an "emulate" fault occurs on the MicroVAX. They are
@ -85,8 +87,7 @@
.text .text
.align 1 .align 1
.globl _EMcrc ALTENTRY(EMcrc)
_EMcrc:
argl(1,r11) # (1) table address == r11 argl(1,r11) # (1) table address == r11
argl(2,r0) # (2) initial crc == r0 argl(2,r0) # (2) initial crc == r0
argl(4,r3) # (4) source address == r3 argl(4,r3) # (4) source address == r3
@ -109,8 +110,7 @@ Lcrc_out:
.align 1 .align 1
.globl _EMmovtc ALTENTRY(EMmovtc)
_EMmovtc:
arguw(1,r0) # (1) source length == r0 arguw(1,r0) # (1) source length == r0
argl(2,r1) # (2) source address == r1 argl(2,r1) # (2) source address == r1
argub(3,r11) # (3) fill character == r11 argub(3,r11) # (3) fill character == r11
@ -137,8 +137,7 @@ Lmovtc_out:
.align 1 .align 1
.globl _EMmovtuc ALTENTRY(EMmovtuc)
_EMmovtuc:
arguw(1,r0) # (1) source length == r0 arguw(1,r0) # (1) source length == r0
argl(2,r1) # (2) source address == r1 argl(2,r1) # (2) source address == r1
argub(3,r11) # (3) escape character == r11 argub(3,r11) # (3) escape character == r11
@ -165,8 +164,7 @@ Lmovtuc_out:
.align 1 .align 1
.globl _EMmatchc ALTENTRY(EMmatchc)
_EMmatchc:
argl(2,r10) # (2) substring address == r10 argl(2,r10) # (2) substring address == r10
arguw(3,r2) # (3) source length == r2 arguw(3,r2) # (3) source length == r2
argl(4,r3) # (4) source address == r3 argl(4,r3) # (4) source address == r3
@ -201,8 +199,7 @@ Lmatchc_out:
.align 1 .align 1
.globl _EMspanc ALTENTRY(EMspanc)
_EMspanc:
argl(2,r1) # (2) string address == r1 argl(2,r1) # (2) string address == r1
argub(4,r2) # (4) character-mask == r2 argub(4,r2) # (4) character-mask == r2
argl(3,r3) # (3) table address == r3 argl(3,r3) # (3) table address == r3
@ -222,8 +219,7 @@ Lspanc_out:
.align 1 .align 1
.globl _EMscanc ALTENTRY(EMscanc)
_EMscanc:
argl(2,r1) # (2) string address == r1 argl(2,r1) # (2) string address == r1
argub(4,r2) # (4) character-mask == r2 argub(4,r2) # (4) character-mask == r2
argl(3,r3) # (3) table address == r3 argl(3,r3) # (3) table address == r3
@ -243,8 +239,7 @@ Lscanc_out:
.align 1 .align 1
.globl _EMskpc ALTENTRY(EMskpc)
_EMskpc:
argub(1,r11) # (1) character == r11 argub(1,r11) # (1) character == r11
argl(3,r1) # (3) string address == r1 argl(3,r1) # (3) string address == r1
arguw(2,r0) # (2) string length == r0 arguw(2,r0) # (2) string length == r0
@ -261,8 +256,7 @@ Lskpc_out:
.align 1 .align 1
.globl _EMlocc ALTENTRY(EMlocc)
_EMlocc:
argub(1,r11) # (1) character == r11 argub(1,r11) # (1) character == r11
argl(3,r1) # (3) string address == r1 argl(3,r1) # (3) string address == r1
arguw(2,r0) # (2) string length == r0 arguw(2,r0) # (2) string length == r0
@ -279,8 +273,7 @@ Llocc_out:
.align 1 .align 1
.globl _EMcmpc3 ALTENTRY(EMcmpc3)
_EMcmpc3:
argl(2,r1) # (2) string1 address == r1 argl(2,r1) # (2) string1 address == r1
argl(3,r3) # (3) string2 address == r3 argl(3,r3) # (3) string2 address == r3
arguw(1,r0) # (1) strings length == r0 arguw(1,r0) # (1) strings length == r0
@ -298,8 +291,7 @@ Lcmpc3_out:
.align 1 .align 1
.globl _EMcmpc5 ALTENTRY(EMcmpc5)
_EMcmpc5:
argl(2,r1) # (2) string1 address == r1 argl(2,r1) # (2) string1 address == r1
argub(3,r11) # (1) fill character == r11 argub(3,r11) # (1) fill character == r11
arguw(4,r2) # (1) string2 length == r2 arguw(4,r2) # (1) string2 length == r2
@ -344,8 +336,7 @@ Lcmpc5_out:
.align 1 .align 1
.globl _EMaddp4 ALTENTRY(EMaddp4)
_EMaddp4:
toarg(r9,6) # save register r9 in arg6 spot toarg(r9,6) # save register r9 in arg6 spot
arguw(1,r11) # (1) source length == r11 arguw(1,r11) # (1) source length == r11
argl(2,r10) # (2) source address == r10 argl(2,r10) # (2) source address == r10
@ -584,8 +575,7 @@ Laddp4_out:
.align 1 .align 1
.globl _EMmovp ALTENTRY(EMmovp)
_EMmovp:
arguw(1,r11) # (1) string length == r11 arguw(1,r11) # (1) string length == r11
argl(2,r10) # (1) source address == r10 argl(2,r10) # (1) source address == r10
argl(3,r3) # (1) destination address == r3 argl(3,r3) # (1) destination address == r3
@ -675,8 +665,7 @@ Lmovp_out:
.align 1 .align 1
.globl _EMeditpc ALTENTRY(EMeditpc)
_EMeditpc:
arguw(1,r11) # (1) source length == r11 arguw(1,r11) # (1) source length == r11
argl(2,r10) # (2) source address == r10 argl(2,r10) # (2) source address == r10
argl(3,r3) # (3) pattern address == r3 argl(3,r3) # (3) pattern address == r3
@ -899,8 +888,7 @@ L228:
.align 1 .align 1
.globl _EMashp ALTENTRY(EMashp)
_EMashp:
argb(1,r11) # (1) scale (number to shift) == r11 argb(1,r11) # (1) scale (number to shift) == r11
arguw(2,r10) # (2) source length == r10 arguw(2,r10) # (2) source length == r10
argl(3,r1) # (3) source address == r1 argl(3,r1) # (3) source address == r1
@ -1051,8 +1039,7 @@ Lashp_overfl: # do overflow
.align 1 .align 1
.globl _EMcvtlp ALTENTRY(EMcvtlp)
_EMcvtlp:
arguw(2,r10) # (2) destination length == r10 arguw(2,r10) # (2) destination length == r10
argl(3,r3) # (3) destination address == r3 argl(3,r3) # (3) destination address == r3
ashl $-1,r10,r10 ashl $-1,r10,r10
@ -1104,8 +1091,7 @@ Lcvtlp_out:
.align 1 .align 1
.globl _EMcvtpl ALTENTRY(EMcvtpl)
_EMcvtpl:
arguw(1,r11) # (1) source length == r11 arguw(1,r11) # (1) source length == r11
argl(2,r10) # (2) source address == r10 argl(2,r10) # (2) source address == r10
clrl r3 # r3 == destination clrl r3 # r3 == destination
@ -1143,68 +1129,57 @@ Lcvtpl_out:
.align 1 .align 1
.globl _EMcvtps ALTENTRY(EMcvtps)
_EMcvtps:
return return
.align 1 .align 1
.globl _EMcvtsp ALTENTRY(EMcvtsp)
_EMcvtsp:
return return
.align 1 .align 1
.globl _EMaddp6 ALTENTRY(EMaddp6)
_EMaddp6:
return return
.align 1 .align 1
.globl _EMsubp4 ALTENTRY(EMsubp4)
_EMsubp4:
return return
.align 1 .align 1
.globl _EMsubp6 ALTENTRY(EMsubp6)
_EMsubp6:
return return
.align 1 .align 1
.globl _EMcvtpt ALTENTRY(EMcvtpt)
_EMcvtpt:
return return
.align 1 .align 1
.globl _EMmulp ALTENTRY(EMmulp)
_EMmulp:
return return
.align 1 .align 1
.globl _EMcvttp ALTENTRY(EMcvttp)
_EMcvttp:
return return
.align 1 .align 1
.globl _EMdivp ALTENTRY(EMdivp)
_EMdivp:
return return
.align 1 .align 1
.globl _EMcmpp3 ALTENTRY(EMcmpp3)
_EMcmpp3:
return return
.align 1 .align 1
.globl _EMcmpp4 ALTENTRY(EMcmpp4)
_EMcmpp4:
return return
@ -1217,8 +1192,8 @@ _EMcmpp4:
#define EMUTABLE 0x43 #define EMUTABLE 0x43
#define NOEMULATE .long noemulate #define NOEMULATE .long noemulate
#define EMULATE(a) .long _EM/**/a #define EMULATE(a) .long _EM/**/a
.globl _emJUMPtable .globl _C_LABEL(emJUMPtable)
_emJUMPtable: _C_LABEL(emJUMPtable)
/* f8 */ EMULATE(ashp); EMULATE(cvtlp); NOEMULATE; NOEMULATE /* f8 */ EMULATE(ashp); EMULATE(cvtlp); NOEMULATE; NOEMULATE
/* fc */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE /* fc */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
/* 00 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE /* 00 */ NOEMULATE; NOEMULATE; NOEMULATE; NOEMULATE
@ -1279,7 +1254,8 @@ SCBVEC(emulate):
addl2 $8,r10 # shift negative opcodes addl2 $8,r10 # shift negative opcodes
subl3 r10,$EMUTABLE,r11 # forget it if opcode is out of range subl3 r10,$EMUTABLE,r11 # forget it if opcode is out of range
bcs noemulate bcs noemulate
movl _emJUMPtable[r10],r10 # call appropriate emulation routine movl _C_LABEL(emJUMPtable)[r10],r10
# call appropriate emulation routine
jsb (r10) # routines put return values into regs 0-5 jsb (r10) # routines put return values into regs 0-5
movl 32(sp),r11 # restore register r11 movl 32(sp),r11 # restore register r11
movl 36(sp),r10 # restore register r10 movl 36(sp),r10 # restore register r10

View File

@ -1,4 +1,4 @@
/* $NetBSD: intvec.s,v 1.50 2000/07/02 04:40:45 cgd Exp $ */ /* $NetBSD: intvec.s,v 1.51 2000/07/17 02:54:04 matt Exp $ */
/* /*
* Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden.
@ -37,27 +37,27 @@
#include "opt_cputype.h" #include "opt_cputype.h"
#define ENTRY(name) \ #define SCBENTRY(name) \
.text ; \ .text ; \
.align 2 ; \ .align 2 ; \
.globl name ; \ .globl name ; \
name /**/: name /**/:
#define TRAPCALL(namn, typ) \ #define TRAPCALL(namn, typ) \
ENTRY(namn) ; \ SCBENTRY(namn) ; \
pushl $0 ; \ pushl $0 ; \
pushl $typ ; \ pushl $typ ; \
jbr trap jbr trap
#define TRAPARGC(namn, typ) \ #define TRAPARGC(namn, typ) \
ENTRY(namn) ; \ SCBENTRY(namn) ; \
pushl $typ ; \ pushl $typ ; \
jbr trap jbr trap
#define FASTINTR(namn, rutin) \ #define FASTINTR(namn, rutin) \
ENTRY(namn) ; \ SCBENTRY(namn) ; \
pushr $0x3f ; \ pushr $0x3f ; \
calls $0,__CONCAT(_,rutin) ; \ calls $0,_C_LABEL(rutin) ; \
popr $0x3f ; \ popr $0x3f ; \
rei rei
@ -69,12 +69,13 @@ ENTRY(namn) ; \
#define NOVEC .long 0 #define NOVEC .long 0
#define INTVEC(label,stack) \ #define INTVEC(label,stack) \
.long label+stack; .long label+stack;
.text
.globl _kernbase, _rpb, _kernel_text .text
.set _kernel_text,KERNBASE
_kernbase: .globl _C_LABEL(kernbase), _C_LABEL(rpb), _C_LABEL(kernel_text)
_rpb: .set _C_LABEL(kernel_text),KERNBASE
_C_LABEL(kernbase):
_C_LABEL(rpb):
/* /*
* First page in memory we have rpb; so that we know where * First page in memory we have rpb; so that we know where
* (must be on a 64k page boundary, easiest here). We use it * (must be on a 64k page boundary, easiest here). We use it
@ -158,18 +159,18 @@ _rpb:
# at when returning from a intentional test. # at when returning from a intentional test.
# #
mcheck: .globl mcheck mcheck: .globl mcheck
tstl _cold # Ar we still in coldstart? tstl _C_LABEL(cold) # Ar we still in coldstart?
bneq L4 # Yes. bneq L4 # Yes.
pushr $0x7f pushr $0x7f
pushab 24(sp) pushab 24(sp)
movl _dep_call,r6 # CPU dependent mchk handling movl _C_LABEL(dep_call),r6 # CPU dependent mchk handling
calls $1,*MCHK(r6) calls $1,*MCHK(r6)
tstl r0 # If not machine check, try memory error tstl r0 # If not machine check, try memory error
beql 1f beql 1f
calls $0,*MEMERR(r6) calls $0,*MEMERR(r6)
pushab 2f pushab 2f
calls $1,_panic calls $1,_C_LABEL(panic)
2: .asciz "mchk" 2: .asciz "mchk"
1: popr $0x7f 1: popr $0x7f
addl2 (sp)+,sp addl2 (sp)+,sp
@ -177,20 +178,20 @@ mcheck: .globl mcheck
rei rei
L4: addl2 (sp)+,sp # remove info pushed on stack L4: addl2 (sp)+,sp # remove info pushed on stack
cmpl _vax_cputype,$1 # Is it a 11/780? cmpl _C_LABEL(vax_cputype),$1 # Is it a 11/780?
bneq 1f # No... bneq 1f # No...
mtpr $0, $PR_SBIFS # Clear SBI fault register mtpr $0, $PR_SBIFS # Clear SBI fault register
brb 2f brb 2f
1: cmpl _vax_cputype,$4 # Is it a 8600? 1: cmpl _C_LABEL(vax_cputype),$4 # Is it a 8600?
bneq 3f bneq 3f
mtpr $0, $PR_EHSR # Clear Error status register mtpr $0, $PR_EHSR # Clear Error status register
brb 2f brb 2f
3: mtpr $0xF,$PR_MCESR # clear the bus error bit 3: mtpr $0xF,$PR_MCESR # clear the bus error bit
2: movl _memtest,(sp) # REI to new adress 2: movl _C_LABEL(memtest),(sp) # REI to new adress
rei rei
TRAPCALL(invkstk, T_KSPNOTVAL) TRAPCALL(invkstk, T_KSPNOTVAL)
@ -213,7 +214,7 @@ transl_v:
pushr $0x3f pushr $0x3f
pushl 28(sp) pushl 28(sp)
pushl 28(sp) pushl 28(sp)
calls $2,_pmap_simulref calls $2,_C_LABEL(pmap_simulref)
tstl r0 tstl r0
bneq 1f bneq 1f
popr $0x3f popr $0x3f
@ -243,14 +244,14 @@ TRAPCALL(breakp, T_BPTFLT)
TRAPARGC(arithflt, T_ARITHFLT) TRAPARGC(arithflt, T_ARITHFLT)
ENTRY(syscall) # Main system call SCBENTRY(syscall) # Main system call
pushl $T_SYSCALL pushl $T_SYSCALL
pushr $0xfff pushr $0xfff
mfpr $PR_USP, -(sp) mfpr $PR_USP, -(sp)
pushl ap pushl ap
pushl fp pushl fp
pushl sp # pointer to syscall frame; defined in trap.h pushl sp # pointer to syscall frame; defined in trap.h
calls $1, _syscall calls $1, _C_LABEL(syscall)
movl (sp)+, fp movl (sp)+, fp
movl (sp)+, ap movl (sp)+, ap
mtpr (sp)+, $PR_USP mtpr (sp)+, $PR_USP
@ -260,34 +261,34 @@ ENTRY(syscall) # Main system call
rei rei
ENTRY(cmrerr) SCBENTRY(cmrerr)
PUSHR PUSHR
movl _dep_call,r0 movl _C_LABEL(dep_call),r0
calls $0,*MEMERR(r0) calls $0,*MEMERR(r0)
POPR POPR
rei rei
ENTRY(sbiflt); SCBENTRY(sbiflt);
pushab sbifltmsg pushab sbifltmsg
calls $1, _panic calls $1, _C_LABEL(panic)
TRAPCALL(astintr, T_ASTFLT) TRAPCALL(astintr, T_ASTFLT)
ENTRY(softclock) SCBENTRY(softclock)
PUSHR PUSHR
calls $0,_softclock calls $0,_C_LABEL(softclock)
incl _softclock_intrcnt+EV_COUNT incl _C_LABEL(softclock_intrcnt)+EV_COUNT
adwc $0,_softclock_intrcnt+EV_COUNT+4 adwc $0,_C_LABEL(softclock_intrcnt)+EV_COUNT+4
POPR POPR
rei rei
ENTRY(softnet) SCBENTRY(softnet)
PUSHR PUSHR
# tstl _netisr # any netisr's set # tstl _C_LABEL(netisr) # any netisr's set
# beql 2f # no, skip looking at them one by one # beql 2f # no, skip looking at them one by one
#define DONETISR(bit, fn) \ #define DONETISR(bit, fn) \
bbcc $bit,_netisr,1f; \ bbcc $bit,_C_LABEL(netisr),1f; \
calls $0,__CONCAT(_,fn); \ calls $0,__CONCAT(_,fn); \
1: 1:
@ -295,19 +296,19 @@ ENTRY(softnet)
#undef DONETISR #undef DONETISR
2: movab _softnet_head,r0 2: movab _C_LABEL(softnet_head),r0
jsb softintr_dispatch jsb softintr_dispatch
incl _softnet_intrcnt+EV_COUNT incl _C_LABEL(softnet_intrcnt)+EV_COUNT
adwc $0,_softnet_intrcnt+EV_COUNT+4 adwc $0,_C_LABEL(softnet_intrcnt)+EV_COUNT+4
POPR POPR
rei rei
ENTRY(softserial) SCBENTRY(softserial)
PUSHR PUSHR
movab _softserial_head,r0 movab _C_LABEL(softserial_head),r0
jsb softintr_dispatch jsb softintr_dispatch
incl _softserial_intrcnt+EV_COUNT incl _C_LABEL(softserial_intrcnt)+EV_COUNT
adwc $0,_softserial_intrcnt+EV_COUNT+4 adwc $0,_C_LABEL(softserial_intrcnt)+EV_COUNT+4
POPR POPR
rei rei
@ -329,22 +330,20 @@ softintr_dispatch:
TRAPCALL(ddbtrap, T_KDBTRAP) TRAPCALL(ddbtrap, T_KDBTRAP)
.align 2 SCBENTRY(hardclock)
.globl hardclock
hardclock:
mtpr $0xc1,$PR_ICCS # Reset interrupt flag mtpr $0xc1,$PR_ICCS # Reset interrupt flag
pushr $0x3f pushr $0x3f
incl _clock_intrcnt+EV_COUNT # count the number of clock interrupts incl _C_LABEL(clock_intrcnt)+EV_COUNT # count the number of clock interrupts
adwc $0,_clock_intrcnt+EV_COUNT+4 adwc $0,_C_LABEL(clock_intrcnt)+EV_COUNT+4
#if VAX46 #if VAX46
cmpl _vax_boardtype,$VAX_BTYP_46 cmpl _C_LABEL(vax_boardtype),$VAX_BTYP_46
bneq 1f bneq 1f
movl _ka46_cpu,r0 movl _C_LABEL(ka46_cpu),r0
clrl VC_DIAGTIMM(r0) clrl VC_DIAGTIMM(r0)
#endif #endif
1: pushl sp 1: pushl sp
addl2 $24,(sp) addl2 $24,(sp)
calls $1,_hardclock calls $1,_C_LABEL(hardclock)
popr $0x3f popr $0x3f
rei rei
@ -355,14 +354,15 @@ hardclock:
* called from user space it doesn't care. * called from user space it doesn't care.
* _sret is used in cpu_set_kpc to jump out to user space first time. * _sret is used in cpu_set_kpc to jump out to user space first time.
*/ */
.globl _sret .globl _C_LABEL(sret)
trap: pushr $0xfff trap: pushr $0xfff
mfpr $PR_USP, -(sp) mfpr $PR_USP, -(sp)
pushl ap pushl ap
pushl fp pushl fp
pushl sp pushl sp
calls $1, _arithflt calls $1, _arithflt
_sret: movl (sp)+, fp _C_LABEL(sret):
movl (sp)+, fp
movl (sp)+, ap movl (sp)+, ap
mtpr (sp)+, $PR_USP mtpr (sp)+, $PR_USP
popr $0xfff popr $0xfff
@ -378,25 +378,42 @@ sbifltmsg:
* Table of emulated Microvax instructions supported by emulate.s. * Table of emulated Microvax instructions supported by emulate.s.
* Use noemulate to convert unimplemented ones to reserved instruction faults. * Use noemulate to convert unimplemented ones to reserved instruction faults.
*/ */
.globl _emtable .globl _C_LABEL(emtable)
_emtable: _C_LABEL(emtable):
/* f8 */ .long _EMashp; .long _EMcvtlp; .long noemulate; .long noemulate /* f8 */ .long _C_LABEL(EMashp); .long _C_LABEL(EMcvtlp)
/* fc */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* fa */ .long noemulate; .long noemulate
/* 00 */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* fc */ .long noemulate; .long noemulate
/* 04 */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* fe */ .long noemulate; .long noemulate
/* 08 */ .long _EMcvtps; .long _EMcvtsp; .long noemulate; .long _EMcrc /* 00 */ .long noemulate; .long noemulate
/* 0c */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* 02 */ .long noemulate; .long noemulate
/* 10 */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* 04 */ .long noemulate; .long noemulate
/* 14 */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* 05 */ .long noemulate; .long noemulate
/* 18 */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* 08 */ .long _C_LABEL(EMcvtps); .long _C_LABEL(EMcvtsp)
/* 1c */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* 0a */ .long noemulate; .long _C_LABEL(EMcrc)
/* 20 */ .long _EMaddp4; .long _EMaddp6; .long _EMsubp4; .long _EMsubp6 /* 0c */ .long noemulate; .long noemulate
/* 24 */ .long _EMcvtpt; .long _EMmulp; .long _EMcvttp; .long _EMdivp /* 0e */ .long noemulate; .long noemulate
/* 28 */ .long noemulate; .long _EMcmpc3; .long _EMscanc; .long _EMspanc /* 10 */ .long noemulate; .long noemulate
/* 2c */ .long noemulate; .long _EMcmpc5; .long _EMmovtc; .long _EMmovtuc /* 12 */ .long noemulate; .long noemulate
/* 30 */ .long noemulate; .long noemulate; .long noemulate; .long noemulate /* 14 */ .long noemulate; .long noemulate
/* 34 */ .long _EMmovp; .long _EMcmpp3; .long _EMcvtpl; .long _EMcmpp4 /* 16 */ .long noemulate; .long noemulate
/* 38 */ .long _EMeditpc; .long _EMmatchc; .long _EMlocc; .long _EMskpc /* 18 */ .long noemulate; .long noemulate
/* 1a */ .long noemulate; .long noemulate
/* 1c */ .long noemulate; .long noemulate
/* 1e */ .long noemulate; .long noemulate
/* 20 */ .long _C_LABEL(EMaddp4); .long _C_LABEL(EMaddp6)
/* 22 */ .long _C_LABEL(EMsubp4); .long _C_LABEL(EMsubp6)
/* 24 */ .long _C_LABEL(EMcvtpt); .long _C_LABEL(EMmulp)
/* 26 */ .long _C_LABEL(EMcvttp); .long _C_LABEL(EMdivp)
/* 28 */ .long noemulate; .long _C_LABEL(EMcmpc3)
/* 2a */ .long _C_LABEL(EMscanc); .long _C_LABEL(EMspanc)
/* 2c */ .long noemulate; .long _C_LABEL(EMcmpc5)
/* 2e */ .long _C_LABEL(EMmovtc); .long _C_LABEL(EMmovtuc)
/* 30 */ .long noemulate; .long noemulate
/* 32 */ .long noemulate; .long noemulate
/* 34 */ .long _C_LABEL(EMmovp); .long _C_LABEL(EMcmpp3)
/* 36 */ .long _C_LABEL(EMcvtpl); .long _C_LABEL(EMcmpp4)
/* 38 */ .long _C_LABEL(EMeditpc); .long _C_LABEL(EMmatchc)
/* 3a */ .long _C_LABEL(EMlocc); .long _C_LABEL(EMskpc)
#endif #endif
/* /*
* The following is called with the stack set up as follows: * The following is called with the stack set up as follows:
@ -445,7 +462,8 @@ emulate:
addl2 $8,r10 # shift negative opcodes addl2 $8,r10 # shift negative opcodes
subl3 r10,$0x43,r11 # forget it if opcode is out of range subl3 r10,$0x43,r11 # forget it if opcode is out of range
bcs noemulate bcs noemulate
movl _emtable[r10],r10 # call appropriate emulation routine movl _C_LABEL(emtable)[r10],r10
# call appropriate emulation routine
jsb (r10) # routines put return values into regs 0-5 jsb (r10) # routines put return values into regs 0-5
movl 32(sp),r11 # restore register r11 movl 32(sp),r11 # restore register r11
movl 36(sp),r10 # restore register r10 movl 36(sp),r10 # restore register r10
@ -457,15 +475,17 @@ noemulate:
#endif #endif
.word 0xffff # "reserved instruction fault" .word 0xffff # "reserved instruction fault"
.globl _intrnames, _eintrnames, _intrcnt, _eintrcnt .globl _C_LABEL(intrnames), _C_LABEL(eintrnames)
_intrnames: _C_LABEL(intrnames):
.long 0 .long 0
_eintrnames: _C_LABEL(eintrnames):
_intrcnt:
.globl _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
_C_LABEL(intrcnt):
.long 0 .long 0
_eintrcnt: _C_LABEL(eintrcnt):
.data .data
_scb: .long 0 .globl _C_LABEL(scb)
.globl _scb _C_LABEL(scb): .long 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.s,v 1.49 2000/07/06 17:37:40 ragge Exp $ */ /* $NetBSD: subr.s,v 1.50 2000/07/17 02:54:04 matt Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -103,23 +103,23 @@ JSBENTRY(start)
#else #else
ASENTRY(start, 0) ASENTRY(start, 0)
#endif #endif
2: bisl3 $0x80000000,r9,_esym # End of loaded code 2: bisl3 $0x80000000,r9,_C_LABEL(esym) # End of loaded code
pushl $0x1f0000 # Push a nice PSL pushl $0x1f0000 # Push a nice PSL
pushl $to # Address to jump to pushl $to # Address to jump to
rei # change to kernel stack rei # change to kernel stack
to: movw $0xfff,_panic # Save all regs in panic to: movw $0xfff,_C_LABEL(panic) # Save all regs in panic
addl3 _esym,$0x3ff,r0 # Round symbol table end addl3 _C_LABEL(esym),$0x3ff,r0 # Round symbol table end
bicl3 $0x3ff,r0,_proc0paddr # save proc0 uarea pointer bicl3 $0x3ff,r0,_C_LABEL(proc0paddr) # save proc0 uarea pointer
bicl3 $0x80000000,_proc0paddr,r0 # get phys proc0 uarea addr bicl3 $0x80000000,_C_LABEL(proc0paddr),r0 # get phys proc0 uarea addr
mtpr r0,$PR_PCBB # Save in IPR PCBB mtpr r0,$PR_PCBB # Save in IPR PCBB
addl3 $USPACE,_proc0paddr,r0 # Get kernel stack top addl3 $USPACE,_C_LABEL(proc0paddr),r0 # Get kernel stack top
mtpr r0,$PR_KSP # put in IPR KSP mtpr r0,$PR_KSP # put in IPR KSP
movl r0,_Sysmap # SPT start addr after KSP movl r0,_Sysmap # SPT start addr after KSP
movab IFTRAP(r0),4(r0) # Save trap address in ESP movab IFTRAP(r0),4(r0) # Save trap address in ESP
mtpr 4(r0),$PR_ESP # Put it in ESP also mtpr 4(r0),$PR_ESP # Put it in ESP also
# Set some registers in known state # Set some registers in known state
movl _proc0paddr,r0 movl _C_LABEL(proc0paddr),r0
clrl P0LR(r0) clrl P0LR(r0)
clrl P1LR(r0) clrl P1LR(r0)
mtpr $0,$PR_P0LR mtpr $0,$PR_P0LR
@ -136,15 +136,15 @@ to: movw $0xfff,_panic # Save all regs in panic
#if defined(COMPAT_14) #if defined(COMPAT_14)
tstl (ap) # Any arguments? tstl (ap) # Any arguments?
bneq 1f # Yes, called from new boot bneq 1f # Yes, called from new boot
movl r11,_boothowto # Howto boot (single etc...) movl r11,_C_LABEL(boothowto) # Howto boot (single etc...)
# movl r10,_bootdev # uninteresting, will complain # movl r10,_C_LABEL(bootdev) # uninteresting, will complain
movl r8,_avail_end # Usable memory (from VMB) movl r8,_C_LABEL(avail_end) # Usable memory (from VMB)
clrl -(sp) # Have no RPB clrl -(sp) # Have no RPB
brb 2f brb 2f
#endif #endif
1: pushl 4(ap) # Address of old rpb 1: pushl 4(ap) # Address of old rpb
2: calls $1,_start # Jump away. 2: calls $1,_C_LABEL(start) # Jump away.
/* NOTREACHED */ /* NOTREACHED */
@ -152,102 +152,105 @@ to: movw $0xfff,_panic # Save all regs in panic
* Signal handler code. * Signal handler code.
*/ */
.align 2 .align 2
.globl _sigcode,_esigcode .globl _C_LABEL(sigcode),_C_LABEL(esigcode)
_sigcode: pushr $0x3f _C_LABEL(sigcode):
subl2 $0xc,sp pushr $0x3f
movl 0x24(sp),r0 subl2 $0xc,sp
calls $3,(r0) movl 0x24(sp),r0
popr $0x3f calls $3,(r0)
chmk $SYS___sigreturn14 popr $0x3f
chmk $SYS_exit chmk $SYS___sigreturn14
halt chmk $SYS_exit
_esigcode: halt
_C_LABEL(esigcode):
#ifdef COMPAT_IBCS2 #ifdef COMPAT_IBCS2
.align 2 .align 2
.globl _ibcs2_sigcode,_ibcs2_esigcode .globl _C_LABEL(ibcs2_sigcode),_C_LABEL(ibcs2_esigcode)
_ibcs2_sigcode: pushr $0x3f _C_LABEL(ibcs2_sigcode):
subl2 $0xc,sp pushr $0x3f
movl 0x24(sp),r0 subl2 $0xc,sp
calls $3,(r0) movl 0x24(sp),r0
popr $0x3f calls $3,(r0)
chmk $SYS___sigreturn14 popr $0x3f
chmk $SYS_exit chmk $SYS___sigreturn14
halt chmk $SYS_exit
_ibcs2_esigcode: halt
_C_LABEL(ibcs2_esigcode):
#endif /* COMPAT_IBCS2 */ #endif /* COMPAT_IBCS2 */
#ifdef COMPAT_ULTRIX #ifdef COMPAT_ULTRIX
.align 2 .align 2
.globl _ultrix_sigcode,_ultrix_esigcode .globl _C_LABEL(ultrix_sigcode),_C_LABEL(ultrix_esigcode)
_ultrix_sigcode: pushr $0x3f _C_LABEL(ultrix_sigcode):
subl2 $0xc,sp pushr $0x3f
movl 0x24(sp),r0 subl2 $0xc,sp
calls $3,(r0) movl 0x24(sp),r0
popr $0x3f calls $3,(r0)
chmk $ULTRIX_SYS_sigreturn popr $0x3f
chmk $SYS_exit chmk $ULTRIX_SYS_sigreturn
halt chmk $SYS_exit
_ultrix_esigcode: halt
_C_LABEL(ultrix_esigcode):
#endif #endif
.align 2 .align 2
.globl _idsptch, _eidsptch .globl _C_LABEL(idsptch), _C_LABEL(eidsptch)
_idsptch: pushr $0x3f _C_LABEL(idsptch): pushr $0x3f
.word 0x9f16 # jsb to absolute address .word 0x9f16 # jsb to absolute address
.long _cmn_idsptch # the absolute address .long _C_LABEL(cmn_idsptch) # the absolute address
.long 0 # the callback interrupt routine .long 0 # the callback interrupt routine
.long 0 # its argument .long 0 # its argument
.long 0 # ptr to correspond evcnt struct .long 0 # ptr to correspond evcnt struct
_eidsptch: _C_LABEL(eidsptch):
_cmn_idsptch: _C_LABEL(cmn_idsptch):
movl (sp)+,r0 # get pointer to idspvec movl (sp)+,r0 # get pointer to idspvec
movl 8(r0),r1 # get evcnt pointer movl 8(r0),r1 # get evcnt pointer
beql 1f # no ptr, skip increment beql 1f # no ptr, skip increment
incl EV_COUNT(r1) # increment low longword incl EV_COUNT(r1) # increment low longword
adwc $0,EV_COUNT+4(r1) # add any carry to hi longword adwc $0,EV_COUNT+4(r1) # add any carry to hi longword
1: pushl 4(r0) # push argument 1: pushl 4(r0) # push argument
calls $1,*(r0) # call interrupt routine calls $1,*(r0) # call interrupt routine
popr $0x3f # pop registers popr $0x3f # pop registers
rei # return from interrut rei # return from interrut
ENTRY(badaddr,0) # Called with addr,b/w/l ENTRY(badaddr,0) # Called with addr,b/w/l
mfpr $PR_IPL,r0 # splhigh() mfpr $PR_IPL,r0 # splhigh()
mtpr $IPL_HIGH,$PR_IPL mtpr $IPL_HIGH,$PR_IPL
movl 4(ap),r2 # First argument, the address movl 4(ap),r2 # First argument, the address
movl 8(ap),r1 # Sec arg, b,w,l movl 8(ap),r1 # Sec arg, b,w,l
pushl r0 # Save old IPL pushl r0 # Save old IPL
clrl r3 clrl r3
movab 4f,_memtest # Set the return address movab 4f,_C_LABEL(memtest) # Set the return address
caseb r1,$1,$4 # What is the size caseb r1,$1,$4 # What is the size
1: .word 1f-1b 1: .word 1f-1b
.word 2f-1b .word 2f-1b
.word 3f-1b # This is unused .word 3f-1b # This is unused
.word 3f-1b .word 3f-1b
1: movb (r2),r1 # Test a byte 1: movb (r2),r1 # Test a byte
brb 5f brb 5f
2: movw (r2),r1 # Test a word 2: movw (r2),r1 # Test a word
brb 5f brb 5f
3: movl (r2),r1 # Test a long 3: movl (r2),r1 # Test a long
brb 5f brb 5f
4: incl r3 # Got machine chk => addr bad 4: incl r3 # Got machine chk => addr bad
5: mtpr (sp)+,$PR_IPL 5: mtpr (sp)+,$PR_IPL
movl r3,r0 movl r3,r0
ret ret
#ifdef DDB #ifdef DDB
/* /*
* DDB is the only routine that uses setjmp/longjmp. * DDB is the only routine that uses setjmp/longjmp.
*/ */
.globl _setjmp, _longjmp .globl _C_LABEL(setjmp), _C_LABEL(longjmp)
_setjmp:.word 0 _C_LABEL(setjmp):.word 0
movl 4(ap), r0 movl 4(ap), r0
movl 8(fp), (r0) movl 8(fp), (r0)
movl 12(fp), 4(r0) movl 12(fp), 4(r0)
@ -256,7 +259,7 @@ _setjmp:.word 0
clrl r0 clrl r0
ret ret
_longjmp:.word 0 _C_LABEL(longjmp):.word 0
movl 4(ap), r1 movl 4(ap), r1
movl 8(ap), r0 movl 8(ap), r0
movl (r1), ap movl (r1), ap
@ -274,27 +277,27 @@ JSBENTRY(Setrq)
tstl 4(r0) # Check that process actually are off the queue tstl 4(r0) # Check that process actually are off the queue
beql 1f beql 1f
pushab setrq pushab setrq
calls $1,_panic calls $1,_C_LABEL(panic)
setrq: .asciz "setrunqueue" setrq: .asciz "setrunqueue"
#endif #endif
1: extzv $2,$6,P_PRIORITY(r0),r1 # get priority 1: extzv $2,$6,P_PRIORITY(r0),r1 # get priority
movaq _sched_qs[r1],r2 # get address of queue movaq _C_LABEL(sched_qs)[r1],r2 # get address of queue
insque (r0),*PH_RLINK(r2) # put proc last in queue insque (r0),*PH_RLINK(r2) # put proc last in queue
bbss r1,_sched_whichqs,1f # set queue bit. bbss r1,_C_LABEL(sched_whichqs),1f # set queue bit.
1: rsb 1: rsb
JSBENTRY(Remrq) JSBENTRY(Remrq)
extzv $2,$6,P_PRIORITY(r0),r1 extzv $2,$6,P_PRIORITY(r0),r1
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
bbs r1,_sched_whichqs,1f bbs r1,_C_LABEL(sched_whichqs),1f
pushab remrq pushab remrq
calls $1,_panic calls $1,_C_LABEL(panic)
remrq: .asciz "remrunqueue" remrq: .asciz "remrunqueue"
#endif #endif
1: remque (r0),r2 1: remque (r0),r2
bneq 1f # Not last process on queue bneq 2f # Not last process on queue
bbsc r1,_sched_whichqs,1f bbsc r1,_C_LABEL(sched_whichqs),2f
1: clrl P_BACK(r0) # saftey belt 2: clrl P_BACK(r0) # saftey belt
rsb rsb
# #
@ -302,12 +305,12 @@ remrq: .asciz "remrunqueue"
# pi or something. # pi or something.
# #
idle: mtpr $IPL_NONE,$PR_IPL # Enable all types of interrupts idle: mtpr $IPL_NONE,$PR_IPL # Enable all types of interrupts
1: tstl _uvm+UVM_PAGE_IDLE_ZERO 1: tstl _C_LABEL(uvm)+UVM_PAGE_IDLE_ZERO
beql 2f beql 2f
#if 0 #if 0
calls $0,_uvm_pageidlezero calls $0,_C_LABEL(uvm_pageidlezero)
#endif #endif
2: tstl _sched_whichqs # Anything ready to run? 2: tstl _C_LABEL(sched_whichqs) # Anything ready to run?
beql 1b # no, continue to loop beql 1b # no, continue to loop
brb Swtch # Yes, goto switch again. brb Swtch # Yes, goto switch again.
@ -320,20 +323,20 @@ JSBENTRY(Swtch)
mfpr $PR_SSP,r1 # Get ptr to this cpu_info struct mfpr $PR_SSP,r1 # Get ptr to this cpu_info struct
clrl CI_CURPROC(r1) # Stop process accounting clrl CI_CURPROC(r1) # Stop process accounting
mtpr $IPL_HIGH,$PR_IPL # block all interrupts mtpr $IPL_HIGH,$PR_IPL # block all interrupts
ffs $0,$32,_sched_whichqs,r3 # Search for bit set ffs $0,$32,_C_LABEL(sched_whichqs),r3 # Search for bit set
beql idle # no bit set, go to idle loop beql idle # no bit set, go to idle loop
movaq _sched_qs[r3],r1 # get address of queue head movaq _C_LABEL(sched_qs)[r3],r1 # get address of queue head
remque *(r1),r2 # remove proc pointed to by queue head remque *(r1),r2 # remove proc pointed to by queue head
# proc ptr is now in r2 # proc ptr is now in r2
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
bvc 1f # check if something on queue bvc 1f # check if something on queue
pushab noque pushab noque
calls $1,_panic calls $1,_C_LABEL(panic)
noque: .asciz "swtch" noque: .asciz "swtch"
#endif #endif
1: bneq 2f # more processes on queue? 1: bneq 2f # more processes on queue?
bbsc r3,_sched_whichqs,2f # no, clear bit in whichqs bbsc r3,_C_LABEL(sched_whichqs),2f # no, clear bit in whichqs
2: clrl P_BACK(r2) # clear proc backpointer 2: clrl P_BACK(r2) # clear proc backpointer
mfpr $PR_SSP,r1 # Get ptr to this cpu_info struct mfpr $PR_SSP,r1 # Get ptr to this cpu_info struct
/* p->p_cpu initialized in fork1() for single-processor */ /* p->p_cpu initialized in fork1() for single-processor */
@ -357,7 +360,7 @@ noque: .asciz "swtch"
# Nice routine to get physical from virtual adresses. # Nice routine to get physical from virtual adresses.
# #
extzv $9,$21,r0,r1 # extract offset extzv $9,$21,r0,r1 # extract offset
ashl $9,*_Sysmap[r1],r3 ashl $9,*_C_LABEL(Sysmap)[r1],r3
# #
# Do the actual process switch. pc + psl are already on stack, from # Do the actual process switch. pc + psl are already on stack, from
@ -365,7 +368,8 @@ noque: .asciz "swtch"
# #
svpctx svpctx
mtpr r3,$PR_PCBB mtpr r3,$PR_PCBB
_tramp: .globl _tramp # used to kick off multiprocessor systems. .globl _C_LABEL(tramp) # used to kick off multiprocessor systems.
_C_LABEL(tramp):
ldpctx ldpctx
rei rei
@ -383,7 +387,7 @@ ENTRY(cpu_exit,0)
mtpr r8,$PR_PCBB # new PCB mtpr r8,$PR_PCBB # new PCB
mtpr r7,$PR_SSP # In case... mtpr r7,$PR_SSP # In case...
pushl r6 pushl r6
calls $1,_exit2 # release last resources. calls $1,_C_LABEL(exit2) # release last resources.
clrl r0 clrl r0
brw Swtch brw Swtch
@ -554,4 +558,6 @@ ENTRY(blkclr,R6)
# #
.data .data
_memtest: .long 0 ; .globl _memtest # Memory test in progress. .globl _C_LABEL(memtest)
_C_LABEL(memtest): # memory test in progress
.long 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.56 2000/06/29 07:14:34 mrg Exp $ */ /* $NetBSD: trap.c,v 1.57 2000/07/17 02:54:05 matt Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -297,9 +297,13 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
return; return;
#endif #endif
} }
if (trapsig) {
if (trapsig) if (sig == SIGSEGV || sig == SIGILL)
printf("pid %d (%s): sig %d: type %lx, code %lx, pc %lx, psl %lx\n",
p->p_pid, p->p_comm, sig, frame->trap,
frame->code, frame->pc, frame->psl);
trapsignal(p, sig, frame->code); trapsignal(p, sig, frame->code);
}
if (umode == 0) if (umode == 0)
return; return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hdc9224.h,v 1.2 2000/06/25 16:00:43 ragge Exp $ */ /* $NetBSD: hdc9224.h,v 1.3 2000/07/17 02:54:06 matt Exp $ */
/* /*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -33,14 +33,12 @@
*/ */
#ifdef notdef
struct hdc9224_DKCreg { struct hdc9224_DKCreg {
unsigned char dkc_reg; /* Disk Register Data Access Port (rw)*/ unsigned char dkc_reg; /* Disk Register Data Access Port (rw)*/
unsigned char fill[3]; /* bytes are longword aligned */ unsigned char fill[3]; /* bytes are longword aligned */
unsigned char dkc_cmd; /* Disk Controller Command Port (wo) */ unsigned char dkc_cmd; /* Disk Controller Command Port (wo) */
#define dkc_stat dkc_cmd /* Interrupt Status Port (ro) */ #define dkc_stat dkc_cmd /* Interrupt Status Port (ro) */
}; };
#endif
/* /*
* definition of some commands (constant bits only, incomplete!) * definition of some commands (constant bits only, incomplete!)