Kernel: Make sure stack is aligned on interrupts for i686 target
I just realized that only x86_64 aligns stack pointer when interrupt is triggered.
This commit is contained in:
parent
8fe798de6d
commit
1ee37cb671
|
@ -15,8 +15,14 @@ asm_syscall_handler:
|
|||
pushl %esi
|
||||
pushl %ebp
|
||||
|
||||
# align stack and push arguments
|
||||
pushl %esp
|
||||
# align stack
|
||||
movl %esp, %ebp
|
||||
subl $15, %esp
|
||||
andl $0xFFFFFFF0, %esp
|
||||
|
||||
# push arguments
|
||||
subl $4, %esp
|
||||
pushl %ebp
|
||||
addl $32, (%esp)
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
|
@ -34,7 +40,8 @@ asm_syscall_handler:
|
|||
movw %ax, %gs
|
||||
|
||||
call cpp_syscall_handler
|
||||
addl $28, %esp
|
||||
|
||||
movl %ebp, %esp
|
||||
|
||||
# restore general purpose registers
|
||||
popl %ebp
|
||||
|
|
|
@ -38,13 +38,18 @@ isr_stub:
|
|||
movl 60(%esp), %ecx // error code
|
||||
movl 56(%esp), %edx // isr number
|
||||
|
||||
subl $12, %esp
|
||||
movl %esp, %ebp
|
||||
subl $15, %esp
|
||||
andl $0xFFFFFFF0, %esp
|
||||
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
call cpp_isr_handler
|
||||
addl $44, %esp
|
||||
|
||||
movl %ebp, %esp
|
||||
addl $16, %esp
|
||||
|
||||
pop_userspace
|
||||
addl $8, %esp
|
||||
|
@ -56,10 +61,15 @@ irq_stub:
|
|||
|
||||
movl 40(%esp), %eax # interrupt number
|
||||
|
||||
movl %esp, %ebp
|
||||
subl $15, %esp
|
||||
andl $0xFFFFFFF0, %esp
|
||||
|
||||
subl $12, %esp
|
||||
pushl %eax
|
||||
call cpp_irq_handler
|
||||
addl $16, %esp
|
||||
|
||||
movl %ebp, %esp
|
||||
|
||||
pop_userspace
|
||||
addl $8, %esp
|
||||
|
@ -73,11 +83,16 @@ asm_yield_handler:
|
|||
movl %esp, %eax # interrupt registers ptr
|
||||
leal 32(%esp), %ebx # interrupt stack ptr
|
||||
|
||||
subl $4, %esp
|
||||
movl %esp, %ebp
|
||||
subl $15, %esp
|
||||
andl $0xFFFFFFF0, %esp
|
||||
|
||||
subl $8, %esp
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
call cpp_yield_handler
|
||||
addl $12, %esp
|
||||
|
||||
movl %ebp, %esp
|
||||
|
||||
popal
|
||||
iret
|
||||
|
|
Loading…
Reference in New Issue