|
|
1.1 root 1: /*
2: * asm.s contains the low-level code for most hardware faults.
3: * page_exception is handled by the mm, so that isn't here. This
4: * file also handles (hopefully) fpu-exceptions due to TS-bit, as
5: * the fpu must be properly saved/resored. This hasn't been tested.
6: */
7:
8: .globl _divide_error,_debug,_nmi,_int3,_overflow,_bounds,_invalid_op
9: .globl _device_not_available,_double_fault,_coprocessor_segment_overrun
10: .globl _invalid_TSS,_segment_not_present,_stack_segment
11: .globl _general_protection,_coprocessor_error,_reserved
12:
13: _divide_error:
14: pushl $_do_divide_error
15: no_error_code:
16: xchgl %eax,(%esp)
17: pushl %ebx
18: pushl %ecx
19: pushl %edx
20: pushl %edi
21: pushl %esi
22: pushl %ebp
23: push %ds
24: push %es
25: push %fs
26: pushl $0 # "error code"
27: lea 44(%esp),%edx
28: pushl %edx
29: movl $0x10,%edx
30: mov %dx,%ds
31: mov %dx,%es
32: mov %dx,%fs
33: call *%eax
34: addl $8,%esp
35: pop %fs
36: pop %es
37: pop %ds
38: popl %ebp
39: popl %esi
40: popl %edi
41: popl %edx
42: popl %ecx
43: popl %ebx
44: popl %eax
45: iret
46:
47: _debug:
48: pushl $_do_int3 # _do_debug
49: jmp no_error_code
50:
51: _nmi:
52: pushl $_do_nmi
53: jmp no_error_code
54:
55: _int3:
56: pushl $_do_int3
57: jmp no_error_code
58:
59: _overflow:
60: pushl $_do_overflow
61: jmp no_error_code
62:
63: _bounds:
64: pushl $_do_bounds
65: jmp no_error_code
66:
67: _invalid_op:
68: pushl $_do_invalid_op
69: jmp no_error_code
70:
71: math_emulate:
72: popl %eax
73: pushl $_do_device_not_available
74: jmp no_error_code
75: _device_not_available:
76: pushl %eax
77: movl %cr0,%eax
78: bt $2,%eax # EM (math emulation bit)
79: jc math_emulate
80: clts # clear TS so that we can use math
81: movl _current,%eax
82: cmpl _last_task_used_math,%eax
83: je 1f # shouldn't happen really ...
84: pushl %ecx
85: pushl %edx
86: push %ds
87: movl $0x10,%eax
88: mov %ax,%ds
89: call _math_state_restore
90: pop %ds
91: popl %edx
92: popl %ecx
93: 1: popl %eax
94: iret
95:
96: _coprocessor_segment_overrun:
97: pushl $_do_coprocessor_segment_overrun
98: jmp no_error_code
99:
100: _reserved:
101: pushl $_do_reserved
102: jmp no_error_code
103:
104: _coprocessor_error:
105: pushl $_do_coprocessor_error
106: jmp no_error_code
107:
108: _double_fault:
109: pushl $_do_double_fault
110: error_code:
111: xchgl %eax,4(%esp) # error code <-> %eax
112: xchgl %ebx,(%esp) # &function <-> %ebx
113: pushl %ecx
114: pushl %edx
115: pushl %edi
116: pushl %esi
117: pushl %ebp
118: push %ds
119: push %es
120: push %fs
121: pushl %eax # error code
122: lea 44(%esp),%eax # offset
123: pushl %eax
124: movl $0x10,%eax
125: mov %ax,%ds
126: mov %ax,%es
127: mov %ax,%fs
128: call *%ebx
129: addl $8,%esp
130: pop %fs
131: pop %es
132: pop %ds
133: popl %ebp
134: popl %esi
135: popl %edi
136: popl %edx
137: popl %ecx
138: popl %ebx
139: popl %eax
140: iret
141:
142: _invalid_TSS:
143: pushl $_do_invalid_TSS
144: jmp error_code
145:
146: _segment_not_present:
147: pushl $_do_segment_not_present
148: jmp error_code
149:
150: _stack_segment:
151: pushl $_do_stack_segment
152: jmp error_code
153:
154: _general_protection:
155: pushl $_do_general_protection
156: jmp error_code
157:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.