Changes in kernel/arch/ia32/src/asm.S [8fb47ec0:b8230b9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/asm.S
r8fb47ec0 rb8230b9 198 198 #define INTERRUPT_ALIGN 64 199 199 .macro handler i n 200 201 .ifeq \i - 0x30 # Syscall handler 202 pushl %ds 203 pushl %es 204 pushl %fs 205 pushl %gs 206 207 # 208 # Push syscall arguments onto the stack 209 # 210 # NOTE: The idea behind the order of arguments passed in registers is to 211 # use all scratch registers first and preserved registers next. 212 # An optimized libc syscall wrapper can make use of this setup. 213 # 214 pushl %eax 215 pushl %ebp 216 pushl %edi 217 pushl %esi 218 pushl %ebx 219 pushl %ecx 220 pushl %edx 221 222 # we must fill the data segment registers 223 movw $16, %ax 224 movw %ax, %ds 225 movw %ax, %es 226 227 cld 228 sti 229 # syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) 230 call syscall_handler 231 cli 232 addl $28, %esp # clean-up of parameters 233 234 popl %gs 235 popl %fs 236 popl %es 237 popl %ds 238 239 CLEAR_NT_FLAG 240 iret 241 .else 242 /* 243 * This macro distinguishes between two versions of ia32 exceptions. 244 * One version has error word and the other does not have it. 245 * The latter version fakes the error word on the stack so that the 246 * handlers and istate_t can be the same for both types. 247 */ 248 .iflt \i - 32 249 .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST 250 /* 251 * With error word, do nothing 200 201 .ifeq \i - 0x30 # Syscall handler 202 pushl %ds 203 pushl %es 204 pushl %fs 205 pushl %gs 206 207 # 208 # Push syscall arguments onto the stack 209 # 210 # NOTE: The idea behind the order of arguments passed in registers is to 211 # use all scratch registers first and preserved registers next. 212 # An optimized libc syscall wrapper can make use of this setup. 213 # 214 pushl %eax 215 pushl %ebp 216 pushl %edi 217 pushl %esi 218 pushl %ebx 219 pushl %ecx 220 pushl %edx 221 222 # we must fill the data segment registers 223 movw $16, %ax 224 movw %ax, %ds 225 movw %ax, %es 226 227 cld 228 sti 229 # syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) 230 call syscall_handler 231 cli 232 addl $28, %esp # clean-up of parameters 233 234 popl %gs 235 popl %fs 236 popl %es 237 popl %ds 238 239 CLEAR_NT_FLAG 240 iret 241 .else 242 /* 243 * This macro distinguishes between two versions of ia32 exceptions. 244 * One version has error word and the other does not have it. 245 * The latter version fakes the error word on the stack so that the 246 * handlers and istate_t can be the same for both types. 247 */ 248 .iflt \i - 32 249 .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST 250 /* 251 * With error word, do nothing 252 */ 253 .else 254 /* 255 * Version without error word 256 */ 257 subl $4, %esp 258 .endif 259 .else 260 /* 261 * Version without error word 252 262 */ 253 .else254 /*255 * Version without error word,256 */257 263 subl $4, %esp 258 .endif 259 .else 260 /* 261 * Version without error word, 262 */ 263 subl $4, %esp 264 .endif 265 266 pushl %ds 267 pushl %es 268 pushl %fs 269 pushl %gs 270 271 pushl %ebp 272 pushl %edx 273 pushl %ecx 274 pushl %eax 275 276 # we must fill the data segment registers 277 278 movw $16, %ax 279 movw %ax, %ds 280 movw %ax, %es 281 282 # stop stack traces here 283 xorl %ebp, %ebp 284 285 pushl %esp # *istate 286 pushl $(\i) # intnum 287 call exc_dispatch # exc_dispatch(intnum, *istate) 288 addl $8, %esp # Clear arguments from stack 289 290 CLEAR_NT_FLAG # Modifies %ecx 291 292 popl %eax 293 popl %ecx 294 popl %edx 295 popl %ebp 296 297 popl %gs 298 popl %fs 299 popl %es 300 popl %ds 301 302 # skip error word, no matter whether real or fake 303 addl $4, %esp 304 iret 264 305 .endif 265 306 266 pushl %ds267 pushl %es268 pushl %fs269 pushl %gs270 271 pushl %ebp272 pushl %edx273 pushl %ecx274 pushl %eax275 276 # we must fill the data segment registers277 movw $16, %ax278 movw %ax, %ds279 movw %ax, %es280 281 # stop stack traces here282 xorl %ebp, %ebp283 284 pushl %esp # *istate285 pushl $(\i) # intnum286 call exc_dispatch # excdispatch(intnum, *istate)287 addl $8, %esp # Clear arguments from stack288 289 CLEAR_NT_FLAG # Modifies %ecx290 291 popl %eax292 popl %ecx293 popl %edx294 popl %ebp295 296 popl %gs297 popl %fs298 popl %es299 popl %ds300 301 addl $4, %esp # Skip error word, no matter whether real or fake.302 iret303 .endif304 305 307 .align INTERRUPT_ALIGN 306 308 .if (\n- \i) - 1 307 handler "(\i + 1)", \n309 handler "(\i + 1)", \n 308 310 .endif 309 311 .endm
Note:
See TracChangeset
for help on using the changeset viewer.