summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand/libsa/debug_i386.S
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-04-05 18:56:29 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-04-05 18:56:29 +0000
commitc3434a52deeea17992db2aeb2f67aac615858469 (patch)
treeeca63b219429fb380e4b8ffb232a02c8d02d11a6 /sys/arch/i386/stand/libsa/debug_i386.S
parenteb163fa3768eab110c936707c961febde79f570f (diff)
put gdt & idt in the separate file.
print trapno in dump_regs. no more NO_IDTR.
Diffstat (limited to 'sys/arch/i386/stand/libsa/debug_i386.S')
-rw-r--r--sys/arch/i386/stand/libsa/debug_i386.S162
1 files changed, 34 insertions, 128 deletions
diff --git a/sys/arch/i386/stand/libsa/debug_i386.S b/sys/arch/i386/stand/libsa/debug_i386.S
index fdd4b1b38f2..8c1db5c5b01 100644
--- a/sys/arch/i386/stand/libsa/debug_i386.S
+++ b/sys/arch/i386/stand/libsa/debug_i386.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: debug_i386.S,v 1.2 1997/04/04 04:47:47 mickey Exp $ */
+/* $OpenBSD: debug_i386.S,v 1.3 1997/04/05 18:56:25 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -41,163 +41,69 @@
#undef _LOCORE
.data
-#ifndef NO_IDTR
-
- .globl _Idtr_real
- .align 3
-_Idtr_real:
- .word 1023
- .long 0
-
- .globl _Idtr_prot
-
- .align 3
-idt: /*
- * We beleive that all the boot code fits into
- * 64k, so no need for high 16 bit of procedure address (;
- *
- */
-#define IPROC(n) X/**/n
-#define IDTENTRY(proc) \
- .word IPROC(proc) /* lo offset handler */ ; \
- .word 0x8 /* handler %cs */ ; \
- .byte 0 /* reserved */ ; \
- .byte 0x80 | SDT_SYS386TGT /* present, dpl=0, 32bit trap gate */ ; \
- .word 0 /* hi offset handler */
-
- IDTENTRY(de) /* #DE divide by zero */
- IDTENTRY(db) /* #DB debug */
- IDTENTRY(nmi) /* NMI */
- IDTENTRY(bp) /* #BP breakpoint */
- IDTENTRY(of) /* #OF overflow */
- IDTENTRY(br) /* #BR BOUND range exceeded */
- IDTENTRY(ud) /* #UD invalid opcode */
- IDTENTRY(nm) /* #NM device not available */
- IDTENTRY(df) /* #DF double fault */
- IDTENTRY(fo) /* #FO coprocessor segment overrun */
- IDTENTRY(ts) /* #TS innvalid TSS */
- IDTENTRY(np) /* #NP segmant not present */
- IDTENTRY(ss) /* #SS stack fault */
- IDTENTRY(gp) /* #GP general protection */
- IDTENTRY(pf) /* #PF page fault */
- IDTENTRY(xx) /* Intel reserved */
- IDTENTRY(mf) /* #MF floating point error */
- IDTENTRY(ac) /* #AC alignment check */
- IDTENTRY(mc) /* #MC machine check */
- /* Intel reserved (19-31) */
- IDTENTRY(xx); IDTENTRY(xx); IDTENTRY(xx); IDTENTRY(xx)
- IDTENTRY(xx); IDTENTRY(xx); IDTENTRY(xx); IDTENTRY(xx)
- IDTENTRY(xx); IDTENTRY(xx); IDTENTRY(xx); IDTENTRY(xx)
- IDTENTRY(xx)
- /* Maskable interrupts(32-255) */
-
-_Idtr_prot:
- .word . - idt
- .long idt
-
- .text
-
-#define IENTRY(name,type) \
-IPROC(name): \
- pushl $type ; \
- jmp alltraps
-#define IENTRY_ERR(name,err,type) \
-IPROC(name): \
- pushl $err ; \
- pushl $type ; \
- jmp alltraps
-
-IPROC(xx):
- pushl $1
- pushl $256
- jmp alltraps
-
-IENTRY_ERR(de,0,T_DIVIDE)
-IENTRY_ERR(db,0,T_TRCTRAP)
-IENTRY_ERR(nmi,0,T_NMI)
-IENTRY_ERR(bp,0,T_BPTFLT)
-IENTRY_ERR(of,0,T_OFLOW)
-IENTRY_ERR(br,0,T_BOUND)
-IENTRY_ERR(ud,0,T_PRIVINFLT)
-IENTRY_ERR(nm,0,T_DNA)
-IENTRY(df,T_DOUBLEFLT)
-IENTRY_ERR(fo,0,T_FPOPFLT)
-IENTRY(ts,T_TSSFLT)
-IENTRY(np,T_SEGNPFLT)
-IENTRY(ss,T_STKFLT)
-IENTRY(gp,T_PROTFLT)
-IENTRY(pf,T_PAGEFLT)
-IENTRY_ERR(mf,0,T_ARITHTRAP)
-IENTRY(ac,T_ALIGNFLT)
-IENTRY(mc,T_MACHK)
+ .globl alltraps
alltraps:
+ pushal
+ pushl %ds
+ pushl %es
#ifdef DEBUG
movl $0xb8280, %edi
- movl $0x47304731, (%edi)
+ movl $0x47314730, (%edi)
#endif
- /* lcall is busted */
- pushl $0x8
- pushl $1f
- ljmp $0x8, $_check_regs
+ call _check_regs
1:
- addl $0x8, %esp
#ifdef DEBUG
movl $0xb8290, %edi
- movl $0x47384739, (%edi)
+ movl $0x47394738, (%edi)
#endif
+ popl %es
+ popl %ds
+ popal
+ addl $0x8, %esp
iret
-#endif
-
.text
ENTRY(check_regs)
#ifdef DEBUG
movl $0xb8284, %edi
- movl $0x47324733, (%edi)
+ movl $0x47334732, (%edi)
#endif
- pushal # 8 ones
- pushl %ds
- pushl %es
- pushl %fs
- pushl %gs
movl $0x10, %eax
movl %ax, %ds
movl $_reg, %edi
cld
- movl 0x0b*4(%esp), %eax; stosl # %eax
- movl 0x0a*4(%esp), %eax; stosl # %ecx
- movl 0x09*4(%esp), %eax; stosl # %edx
- movl 0x08*4(%esp), %eax; stosl # %ebx
- movl 0x07*4(%esp), %eax; stosl # %esp
- movl 0x06*4(%esp), %eax; stosl # %ebp
- movl 0x05*4(%esp), %eax; stosl # %esi
- movl 0x04*4(%esp), %eax; stosl # %edi
- movl 0x10*4(%esp), %eax; stosl # %eip
- movl 0x12*4(%esp), %eax; stosl # %eflags
- movl 0x11*4(%esp), %eax; stosl # %cs
+ movl 0x0a(%esp,4), %eax; stosl # %eax
+ movl 0x09(%esp,4), %eax; stosl # %ecx
+ movl 0x08(%esp,4), %eax; stosl # %edx
+ movl 0x07(%esp,4), %eax; stosl # %ebx
+ movl 0x06(%esp,4), %eax; stosl # %esp
+ movl 0x05(%esp,4), %eax; stosl # %ebp
+ movl 0x04(%esp,4), %eax; stosl # %esi
+ movl 0x03(%esp,4), %eax; stosl # %edi
+ movl 0x0d(%esp,4), %eax; stosl # %eip
+ movl 0x0f(%esp,4), %eax; stosl # %eflags
+ movl 0x0e(%esp,4), %eax; stosl # %cs
movl %ss, %eax; stosl # %ss
- movl 0x03*4(%esp), %eax; stosl # %ds
- movl 0x02*4(%esp), %eax; stosl # %es
- movl 0x01*4(%esp), %eax; stosl # %fs
- movl 0x00*4(%esp), %eax; stosl # %gs
+ movl 0x02(%esp,4), %eax; stosl # %ds
+ movl 0x01(%esp,4), %eax; stosl # %es
+ movl %fs, %eax; stosl # %fs
+ movl %gs, %eax; stosl # %gs
#ifdef DEBUG
movl $0xb8288, %edi
- movl $0x47344735, (%edi)
+ movl $0x47354734, (%edi)
#endif
+ movl 0x0b(%esp,4), %eax # trapno
+ pushl %eax
call _C_LABEL(dump_regs)
+ popl %eax
#ifdef DEBUG
movl $0xb828c, %edi
- movl $0x47364737, (%edi)
+ movl $0x47374736, (%edi)
#endif
- popl %gs
- popl %fs
- popl %es
- popl %ds
- popal
- lret
+ ret