Changeset 0737078 in mainline
- Timestamp:
- 2010-07-07T19:57:48Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ed7998b
- Parents:
- 77385fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/asm.S
r77385fe r0737078 245 245 .ifeq \i - 0x30 246 246 /* Syscall handler */ 247 pushl %ds 248 pushl %es 249 pushl %fs 250 pushl %gs 251 247 subl $(ISTATE_SOFT_SIZE + 4), %esp 248 252 249 /* 253 250 * Push syscall arguments onto the stack … … 257 254 * first and preserved registers next. An optimized 258 255 * libc syscall wrapper can make use of this setup. 256 * The istate structure is arranged in the way to support 257 * this idea. 259 258 * 260 259 */ 261 pushl %eax 262 pushl %ebp 263 pushl %edi 264 pushl %esi 265 pushl %ebx 266 pushl %ecx 267 pushl %edx 268 269 /* We must fill the data segment registers */ 270 movw $16, %ax 271 movw %ax, %ds 272 movw %ax, %es 273 274 xorl %ebp, %ebp 260 movl %eax, ISTATE_OFFSET_EAX(%esp) 261 movl %ebx, ISTATE_OFFSET_EBX(%esp) 262 movl %ecx, ISTATE_OFFSET_ECX(%esp) 263 movl %edx, ISTATE_OFFSET_EDX(%esp) 264 movl %edi, ISTATE_OFFSET_EDI(%esp) 265 movl %esi, ISTATE_OFFSET_ESI(%esp) 266 movl %ebp, ISTATE_OFFSET_EBP(%esp) 267 268 /* 269 * Save the selector registers. 270 */ 271 movl %gs, %ecx 272 movl %fs, %edx 273 274 movl %ecx, ISTATE_OFFSET_GS(%esp) 275 movl %edx, ISTATE_OFFSET_FS(%esp) 276 277 movl %es, %ecx 278 movl %ds, %edx 279 280 movl %ecx, ISTATE_OFFSET_ES(%esp) 281 movl %edx, ISTATE_OFFSET_DS(%esp) 282 283 /* 284 * Switch to kernel selectors. 285 */ 286 movl $16, %eax 287 movl %eax, %ds 288 movl %eax, %es 289 290 movl $0, ISTATE_OFFSET_EBP_FRAME(%esp) 291 movl ISTATE_OFFSET_EIP(%esp), %eax 292 movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp) 293 leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp 275 294 276 295 cld … … 279 298 /* Call syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) */ 280 299 call syscall_handler 281 cli 282 283 movl 20(%esp), %ebp /* restore EBP */ 284 addl $28, %esp /* clean-up of parameters */ 285 286 popl %gs 287 popl %fs 288 popl %es 289 popl %ds 290 300 291 301 CLEAR_NT_FLAG 302 303 /* 304 * Restore the selector registers. 305 */ 306 movl ISTATE_OFFSET_GS(%esp), %ecx 307 movl ISTATE_OFFSET_FS(%esp), %edx 308 309 movl %ecx, %gs 310 movl %edx, %fs 311 312 movl ISTATE_OFFSET_ES(%esp), %ecx 313 movl ISTATE_OFFSET_DS(%esp), %edx 314 315 movl %ecx, %es 316 movl %edx, %ds 317 318 /* 319 * Restore the preserved registers the handler cloberred itself 320 * (i.e. EBP). 321 */ 322 movl ISTATE_OFFSET_EBP(%esp), %ebp 323 324 addl $(ISTATE_SOFT_SIZE + 4), %esp 292 325 iret 326 293 327 .else 294 328 /*
Note:
See TracChangeset
for help on using the changeset viewer.