summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand/libsa/debug_i386.S
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/i386/stand/libsa/debug_i386.S')
-rw-r--r--sys/arch/i386/stand/libsa/debug_i386.S79
1 files changed, 45 insertions, 34 deletions
diff --git a/sys/arch/i386/stand/libsa/debug_i386.S b/sys/arch/i386/stand/libsa/debug_i386.S
index 35da12bed59..ffce538bade 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.8 1998/02/24 22:06:48 weingart Exp $ */
+/* $OpenBSD: debug_i386.S,v 1.9 1998/04/18 07:39:46 deraadt Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -40,30 +40,37 @@
#include <debug_md.h>
#undef _LOCORE
+ /* do this way because some cpus (like cyrix 6x86) store garbage
+ * into high word, instead of zeroes.
+ */
+#define pushsr(sr) movl sr, %eax; pushl %eax
+
.text
.globl alltraps
alltraps:
pushal
- pushl %ds
- pushl %es
- pushl %fs
- pushl %gs
-#ifdef DEBUG
+ pushsr(%ds)
+ pushsr(%es)
+ pushsr(%fs)
+ pushsr(%gs)
+ /* muck %cs, see note about pushsr() above */
+ movl 0xf*4(%esp), %eax
+ movzwl %ax, %eax
+ movl %eax, 0xf*4(%esp)
+#ifdef DEBUG_DEBUG
movl $0xb8280, %edi
- movl 0x0c*4(%esp), %eax # trapno
+ movl 0x0c*4(%esp), %eax /* trapno */
addb $'0', %al
movb $0x17, %ah
shll $16, %eax
- movb 0x0d*4(%esp), %al # error
- addl $'0', %al
+ movb 0x0d*4(%esp), %al /* error */
+ addb $'0', %al
movb $0x17, %ah
- movl %ax, (%edi)
- hlt
+ movl %eax, (%edi)
#endif
- call _check_regs
-1:
-#ifdef DEBUG
+ call _C_LABEL(check_regs)
+#ifdef DEBUG_DEBUG
movl $0xb8290, %edi
movl $0x47394738, (%edi)
#endif
@@ -77,41 +84,45 @@ alltraps:
iret
ENTRY(check_regs)
-#ifdef DEBUG
+#ifdef DEBUG_DEBUG
movl $0xb8284, %edi
movl $0x47334732, (%edi)
#endif
movl $0x10, %eax
movl %ax, %ds
+ movl %ax, %es
movl $_reg, %edi
cld
- movl 0x0c*4(%esp), %eax; stosl # %eax
- movl 0x0b*4(%esp), %eax; stosl # %ecx
- movl 0x0a*4(%esp), %eax; stosl # %edx
- movl 0x09*4(%esp), %eax; stosl # %ebx
- movl 0x08*4(%esp), %eax; stosl # %esp
- movl 0x07*4(%esp), %eax; stosl # %ebp
- movl 0x06*4(%esp), %eax; stosl # %esi
- movl 0x05*4(%esp), %eax; stosl # %edi
- movl 0x0f*4(%esp), %eax; stosl # %eip
- movl 0x11*4(%esp), %eax; stosl # %eflags
- movl 0x10*4(%esp), %eax; stosl # %cs
- movl %ss, %eax; stosl # %ss
- movl 0x04*4(%esp), %eax; stosl # %ds
- movl 0x03*4(%esp), %eax; stosl # %es
- movl 0x02*4(%esp), %eax; stosl # %fs
- movl 0x01*4(%esp), %eax; stosl # %gs
+ movl 0x0c*4(%esp), %eax; stosl /* %eax */
+ movl 0x0b*4(%esp), %eax; stosl /* %ecx */
+ movl 0x0a*4(%esp), %eax; stosl /* %edx */
+ movl 0x09*4(%esp), %eax; stosl /* %ebx */
+ movl 0x08*4(%esp), %eax; stosl /* %esp */
+ movl 0x07*4(%esp), %eax; stosl /* %ebp */
+ movl 0x06*4(%esp), %eax; stosl /* %esi */
+ movl 0x05*4(%esp), %eax; stosl /* %edi */
+ movl 0x0f*4(%esp), %eax; stosl /* %eip */
+ movl 0x11*4(%esp), %eax; stosl /* %eflags */
+ movl 0x10*4(%esp), %eax; stosl /* %cs */
+ movl %ss, %ax ; stosl /* %ss */
+ movl 0x04*4(%esp), %eax; stosl /* %ds */
+ movl 0x03*4(%esp), %eax; stosl /* %es */
+ movl 0x02*4(%esp), %eax; stosl /* %fs */
+ movl 0x01*4(%esp), %eax; stosl /* %gs */
-#ifdef DEBUG
+#ifdef DEBUG_DEBUG
movl $0xb8288, %edi
movl $0x47354734, (%edi)
#endif
- movl 0x0d*4(%esp), %eax # trapno
+ movl 0x0e*4(%esp), %ecx /* error */
+ movl 0x0d*4(%esp), %eax /* trapno */
+ pushl %ecx
pushl %eax
call _C_LABEL(dump_regs)
popl %eax
+ popl %eax
-#ifdef DEBUG
+#ifdef DEBUG_DEBUG
movl $0xb828c, %edi
movl $0x47374736, (%edi)
#endif