Annotation of sys/arch/i386/stand/libsa/debug_i386.S, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: debug_i386.S,v 1.12 2004/03/09 19:12:12 tom Exp $ */
2:
3: /*
4: * Copyright (c) 1997 Michael Shalayeff
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: *
16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26: * SUCH DAMAGE.
27: *
28: */
29:
30: #include <machine/asm.h>
31: #include <machine/psl.h>
32: #define _LOCORE
33: #include <machine/segments.h>
34: #include <machine/trap.h>
35: #include <debug_md.h>
36: #undef _LOCORE
37:
38: /* do this way because some cpus (like cyrix 6x86) store garbage
39: * into high word, instead of zeroes.
40: */
41: #define pushsr(sr) movl sr, %eax; pushl %eax
42:
43: .text
44: .globl alltraps
45:
46: alltraps:
47: pushal
48: pushsr(%ds)
49: pushsr(%es)
50: pushsr(%fs)
51: pushsr(%gs)
52: /* muck %cs, see note about pushsr() above */
53: movl 0xf*4(%esp), %eax
54: movzwl %ax, %eax
55: movl %eax, 0xf*4(%esp)
56: #ifdef DEBUG_DEBUG
57: movl $0xb8280, %edi
58: movl 0x0c*4(%esp), %eax /* trapno */
59: addb $'0', %al
60: movb $0x17, %ah
61: shll $16, %eax
62: movb 0x0d*4(%esp), %al /* error */
63: addb $'0', %al
64: movb $0x17, %ah
65: movl %eax, (%edi)
66: #endif
67: call _C_LABEL(check_regs)
68: #ifdef DEBUG_DEBUG
69: movl $0xb8290, %edi
70: movl $0x47394738, (%edi)
71: #endif
72: popl %gs
73: popl %fs
74: popl %es
75: popl %ds
76: popal
77: addl $0x8, %esp
78: hlt
79: iret
80:
81: ENTRY(check_regs)
82: #ifdef DEBUG_DEBUG
83: movl $0xb8284, %edi
84: movl $0x47334732, (%edi)
85: #endif
86: movl $0x10, %eax
87: mov %ax, %ds
88: mov %ax, %es
89: movl $reg, %edi
90: cld
91: movl 0x0c*4(%esp), %eax; stosl /* %eax */
92: movl 0x0b*4(%esp), %eax; stosl /* %ecx */
93: movl 0x0a*4(%esp), %eax; stosl /* %edx */
94: movl 0x09*4(%esp), %eax; stosl /* %ebx */
95: movl 0x08*4(%esp), %eax; stosl /* %esp */
96: movl 0x07*4(%esp), %eax; stosl /* %ebp */
97: movl 0x06*4(%esp), %eax; stosl /* %esi */
98: movl 0x05*4(%esp), %eax; stosl /* %edi */
99: movl 0x0f*4(%esp), %eax; stosl /* %eip */
100: movl 0x11*4(%esp), %eax; stosl /* %eflags */
101: movl 0x10*4(%esp), %eax; stosl /* %cs */
102: mov %ss, %ax ; stosl /* %ss */
103: movl 0x04*4(%esp), %eax; stosl /* %ds */
104: movl 0x03*4(%esp), %eax; stosl /* %es */
105: movl 0x02*4(%esp), %eax; stosl /* %fs */
106: movl 0x01*4(%esp), %eax; stosl /* %gs */
107:
108: #ifdef DEBUG_DEBUG
109: movl $0xb8288, %edi
110: movl $0x47354734, (%edi)
111: #endif
112: movl 0x0e*4(%esp), %ecx /* error */
113: movl 0x0d*4(%esp), %eax /* trapno */
114: pushl %ecx
115: pushl %eax
116: call _C_LABEL(dump_regs)
117: popl %eax
118: popl %eax
119:
120: #ifdef DEBUG_DEBUG
121: movl $0xb828c, %edi
122: movl $0x47374736, (%edi)
123: #endif
124: ret
CVSweb