|
|
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:
1.1.1.2 ! root 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
1.1 root 12:
1.1.1.2 ! root 13: divide_error:
! 14: pushl $do_divide_error
1.1 root 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:
1.1.1.2 ! root 47: debug:
! 48: pushl $do_int3 # _do_debug
1.1 root 49: jmp no_error_code
50:
1.1.1.2 ! root 51: nmi:
! 52: pushl $do_nmi
1.1 root 53: jmp no_error_code
54:
1.1.1.2 ! root 55: int3:
! 56: pushl $do_int3
1.1 root 57: jmp no_error_code
58:
1.1.1.2 ! root 59: overflow:
! 60: pushl $do_overflow
1.1 root 61: jmp no_error_code
62:
1.1.1.2 ! root 63: bounds:
! 64: pushl $do_bounds
1.1 root 65: jmp no_error_code
66:
1.1.1.2 ! root 67: invalid_op:
! 68: pushl $do_invalid_op
1.1 root 69: jmp no_error_code
70:
71: math_emulate:
72: popl %eax
1.1.1.2 ! root 73: pushl $do_device_not_available
1.1 root 74: jmp no_error_code
1.1.1.2 ! root 75: device_not_available:
1.1 root 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
1.1.1.2 ! root 81: movl current,%eax
! 82: cmpl last_task_used_math,%eax
1.1 root 83: je 1f # shouldn't happen really ...
84: pushl %ecx
85: pushl %edx
86: push %ds
87: movl $0x10,%eax
88: mov %ax,%ds
1.1.1.2 ! root 89: call math_state_restore
1.1 root 90: pop %ds
91: popl %edx
92: popl %ecx
93: 1: popl %eax
94: iret
95:
1.1.1.2 ! root 96: coprocessor_segment_overrun:
! 97: pushl $do_coprocessor_segment_overrun
1.1 root 98: jmp no_error_code
99:
1.1.1.2 ! root 100: reserved:
! 101: pushl $do_reserved
1.1 root 102: jmp no_error_code
103:
1.1.1.2 ! root 104: coprocessor_error:
! 105: pushl $do_coprocessor_error
1.1 root 106: jmp no_error_code
107:
1.1.1.2 ! root 108: double_fault:
! 109: pushl $do_double_fault
1.1 root 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:
1.1.1.2 ! root 142: invalid_TSS:
! 143: pushl $do_invalid_TSS
1.1 root 144: jmp error_code
145:
1.1.1.2 ! root 146: segment_not_present:
! 147: pushl $do_segment_not_present
1.1 root 148: jmp error_code
149:
1.1.1.2 ! root 150: stack_segment:
! 151: pushl $do_stack_segment
1.1 root 152: jmp error_code
153:
1.1.1.2 ! root 154: general_protection:
! 155: pushl $do_general_protection
1.1 root 156: jmp error_code
157:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.