Rev 1016 | Rev 1100 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1016 | Rev 1021 | ||
---|---|---|---|
Line 76... | Line 76... | ||
76 | # |
76 | # |
77 | # The handlers setup data segment registers |
77 | # The handlers setup data segment registers |
78 | # and call exc_dispatch(). |
78 | # and call exc_dispatch(). |
79 | # |
79 | # |
80 | .macro handler i n |
80 | .macro handler i n |
81 | push %eax |
- | |
82 | 81 | ||
83 | /* |
82 | /* |
- | 83 | * This macro distinguishes between two versions of ia32 exceptions. |
|
84 | * Test if this is interrupt with error word or not. |
84 | * One version has error word and the other does not have it. |
- | 85 | * The latter version fakes the error word on the stack so that the |
|
85 | * Be careful about width of the shift. |
86 | * handlers and istate_t can be the same for both types. |
86 | */ |
87 | */ |
- | 88 | ||
87 | .iflt \i-32 |
89 | .iflt \i-32 |
- | 90 | .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST |
|
- | 91 | /* |
|
88 | movl $(1<<\i), %eax |
92 | * Version with error word. |
- | 93 | * Just take space equal to subl $4, %esp. |
|
- | 94 | */ |
|
- | 95 | nop |
|
- | 96 | nop |
|
- | 97 | nop |
|
89 | .else |
98 | .else |
90 | movl $0, %eax |
- | |
91 | .endif |
- | |
92 | andl $ERROR_WORD_INTERRUPT_LIST, %eax |
- | |
93 | movl (%esp), %eax |
- | |
94 | - | ||
95 | /* |
99 | /* |
96 | * If this interrupt/exception stores error word, |
100 | * Version without error word, |
97 | * we need to pop EAX. |
- | |
98 | * If this interrupt doesn't store error word, we emulate it |
- | |
99 | * for the sake of consistent istate structure. In that case |
- | |
100 | * we merely leave the EAX on the stack. |
- | |
101 | */ |
101 | */ |
102 | jz 0f |
102 | subl $4, %esp |
- | 103 | .endif |
|
103 | 104 | .else |
|
104 | /* |
105 | /* |
105 | * This exception stores error word. |
106 | * Version without error word, |
106 | * Remove EAX from the stack. |
- | |
107 | */ |
107 | */ |
108 | addl $4, %esp |
108 | subl $4, %esp |
- | 109 | .endif |
|
109 | 110 | ||
110 | 0: |
- | |
111 | pusha |
111 | pusha |
112 | movl %esp, %ebp |
112 | movl %esp, %ebp |
113 | push %ds |
113 | push %ds |
114 | push %es |
114 | push %es |
115 | push %fs |
115 | push %fs |
Line 136... | Line 136... | ||
136 | and $0xffffbfff,%eax |
136 | and $0xffffbfff,%eax |
137 | push %eax |
137 | push %eax |
138 | popfl |
138 | popfl |
139 | 139 | ||
140 | popa |
140 | popa |
141 | addl $4,%esp # Skip error word, whether real or fake. |
141 | addl $4,%esp # Skip error word, no matter whether real or fake. |
142 | iret |
142 | iret |
143 | 143 | ||
144 | .if (\n-\i)-1 |
144 | .if (\n-\i)-1 |
145 | handler "(\i+1)",\n |
145 | handler "(\i+1)",\n |
146 | .endif |
146 | .endif |