Rev 1021 | Rev 1212 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1021 | Rev 1100 | ||
|---|---|---|---|
| Line 66... | Line 66... | ||
| 66 | wrmsr |
66 | wrmsr |
| 67 | 67 | ||
| 68 | pop %eax |
68 | pop %eax |
| 69 | ret |
69 | ret |
| 70 | 70 | ||
| - | 71 | # Clear nested flag |
|
| - | 72 | # overwrites %ecx |
|
| - | 73 | .macro CLEAR_NT_FLAG |
|
| - | 74 | pushfl |
|
| - | 75 | pop %ecx |
|
| - | 76 | and $0xffffbfff,%ecx |
|
| - | 77 | push %ecx |
|
| - | 78 | popfl |
|
| - | 79 | .endm |
|
| 71 | 80 | ||
| 72 | ## Declare interrupt handlers |
81 | ## Declare interrupt handlers |
| 73 | # |
82 | # |
| 74 | # Declare interrupt handlers for n interrupt |
83 | # Declare interrupt handlers for n interrupt |
| 75 | # vectors starting at vector i. |
84 | # vectors starting at vector i. |
| 76 | # |
85 | # |
| 77 | # The handlers setup data segment registers |
86 | # The handlers setup data segment registers |
| 78 | # and call exc_dispatch(). |
87 | # and call exc_dispatch(). |
| 79 | # |
88 | # |
| - | 89 | #define INTERRUPT_ALIGN 64 |
|
| 80 | .macro handler i n |
90 | .macro handler i n |
| 81 | 91 | ||
| - | 92 | .ifeq \i-0x30 # Syscall handler |
|
| - | 93 | push %ds |
|
| - | 94 | push %es |
|
| - | 95 | push %fs |
|
| - | 96 | push %gs |
|
| - | 97 | ||
| - | 98 | # Push arguments on stack |
|
| - | 99 | push %edi |
|
| - | 100 | push %esi |
|
| - | 101 | push %edx |
|
| - | 102 | push %ecx |
|
| - | 103 | push %eax |
|
| - | 104 | ||
| - | 105 | # we must fill the data segment registers |
|
| - | 106 | movw $16,%ax |
|
| - | 107 | movw %ax,%ds |
|
| - | 108 | movw %ax,%es |
|
| - | 109 | ||
| - | 110 | sti |
|
| - | 111 | call syscall_handler # syscall_handler(ax,cx,dx,si,di) |
|
| - | 112 | cli |
|
| - | 113 | addl $20, %esp # clean-up of parameters |
|
| - | 114 | ||
| - | 115 | pop %gs |
|
| - | 116 | pop %fs |
|
| - | 117 | pop %es |
|
| - | 118 | pop %ds |
|
| - | 119 | ||
| - | 120 | CLEAR_NT_FLAG |
|
| - | 121 | iret |
|
| - | 122 | .else |
|
| 82 | /* |
123 | /* |
| 83 | * This macro distinguishes between two versions of ia32 exceptions. |
124 | * This macro distinguishes between two versions of ia32 exceptions. |
| 84 | * One version has error word and the other does not have it. |
125 | * 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 |
126 | * The latter version fakes the error word on the stack so that the |
| 86 | * handlers and istate_t can be the same for both types. |
127 | * handlers and istate_t can be the same for both types. |
| 87 | */ |
128 | */ |
| 88 | - | ||
| 89 | .iflt \i-32 |
129 | .iflt \i-32 |
| 90 | .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST |
130 | .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST |
| 91 | /* |
131 | /* |
| 92 | * Version with error word. |
132 | * With error word, do nothing |
| 93 | * Just take space equal to subl $4, %esp. |
- | |
| 94 | */ |
133 | */ |
| 95 | nop |
- | |
| 96 | nop |
- | |
| 97 | nop |
- | |
| 98 | .else |
134 | .else |
| 99 | /* |
135 | /* |
| 100 | * Version without error word, |
136 | * Version without error word, |
| 101 | */ |
137 | */ |
| 102 | subl $4, %esp |
138 | subl $4, %esp |
| Line 104... | Line 140... | ||
| 104 | .else |
140 | .else |
| 105 | /* |
141 | /* |
| 106 | * Version without error word, |
142 | * Version without error word, |
| 107 | */ |
143 | */ |
| 108 | subl $4, %esp |
144 | subl $4, %esp |
| 109 | .endif |
145 | .endif |
| 110 | 146 | ||
| 111 | pusha |
- | |
| 112 | movl %esp, %ebp |
- | |
| 113 | push %ds |
147 | push %ds |
| 114 | push %es |
148 | push %es |
| 115 | push %fs |
149 | push %fs |
| 116 | push %gs |
150 | push %gs |
| 117 | 151 | ||
| - | 152 | #ifdef CONFIG_DEBUG_ALLREGS |
|
| - | 153 | push %ebx |
|
| - | 154 | push %ebp |
|
| - | 155 | push %edi |
|
| - | 156 | push %esi |
|
| - | 157 | #else |
|
| - | 158 | sub $16, %esp |
|
| - | 159 | #endif |
|
| - | 160 | push %edx |
|
| - | 161 | push %ecx |
|
| - | 162 | push %eax |
|
| - | 163 | ||
| 118 | # we must fill the data segment registers |
164 | # we must fill the data segment registers |
| 119 | movw $16,%ax |
165 | movw $16,%ax |
| 120 | movw %ax,%ds |
166 | movw %ax,%ds |
| 121 | movw %ax,%es |
167 | movw %ax,%es |
| 122 | 168 | ||
| 123 | pushl %ebp |
169 | pushl %esp # *istate |
| 124 | pushl $(\i) |
170 | pushl $(\i) # intnum |
| 125 | call exc_dispatch |
171 | call exc_dispatch # excdispatch(intnum, *istate) |
| 126 | addl $8,%esp |
172 | addl $8,%esp # Clear arguments from stack |
| 127 | 173 | ||
| - | 174 | CLEAR_NT_FLAG # Modifies %ecx |
|
| - | 175 | ||
| - | 176 | pop %eax |
|
| - | 177 | pop %ecx |
|
| - | 178 | pop %edx |
|
| - | 179 | #ifdef CONFIG_DEBUG_ALLREGS |
|
| - | 180 | pop %esi |
|
| - | 181 | pop %edi |
|
| - | 182 | pop %ebp |
|
| - | 183 | pop %ebx |
|
| - | 184 | #else |
|
| - | 185 | add $16, %esp |
|
| - | 186 | #endif |
|
| - | 187 | ||
| 128 | pop %gs |
188 | pop %gs |
| 129 | pop %fs |
189 | pop %fs |
| 130 | pop %es |
190 | pop %es |
| 131 | pop %ds |
191 | pop %ds |
| 132 | 192 | ||
| 133 | # Clear Nested Task flag. |
- | |
| 134 | pushfl |
- | |
| 135 | pop %eax |
- | |
| 136 | and $0xffffbfff,%eax |
- | |
| 137 | push %eax |
- | |
| 138 | popfl |
- | |
| 139 | - | ||
| 140 | popa |
- | |
| 141 | addl $4,%esp # Skip error word, no matter whether real or fake. |
193 | addl $4,%esp # Skip error word, no matter whether real or fake. |
| 142 | iret |
194 | iret |
| - | 195 | .endif |
|
| 143 | 196 | ||
| - | 197 | .align INTERRUPT_ALIGN |
|
| 144 | .if (\n-\i)-1 |
198 | .if (\n-\i)-1 |
| 145 | handler "(\i+1)",\n |
199 | handler "(\i+1)",\n |
| 146 | .endif |
200 | .endif |
| 147 | .endm |
201 | .endm |
| 148 | 202 | ||
| 149 | # keep in sync with pm.h !!! |
203 | # keep in sync with pm.h !!! |
| 150 | IDT_ITEMS=64 |
204 | IDT_ITEMS=64 |
| - | 205 | .align INTERRUPT_ALIGN |
|
| 151 | interrupt_handlers: |
206 | interrupt_handlers: |
| 152 | h_start: |
207 | h_start: |
| 153 | handler 0 64 |
208 | handler 0 IDT_ITEMS |
| 154 | # handler 64 128 |
- | |
| 155 | # handler 128 192 |
- | |
| 156 | # handler 192 256 |
- | |
| 157 | h_end: |
209 | h_end: |
| 158 | 210 | ||
| 159 | .data |
211 | .data |
| 160 | .global interrupt_handler_size |
212 | .global interrupt_handler_size |
| 161 | 213 | ||