long mode, interrupt and stack issue
Posted: Mon Oct 05, 2015 1:28 pm
Hello !
i have the current weird issue:
I am just entered in long mode, from a kernel_main() IDT is set up.
At a certain point, after some code is executed, a "Page Fault" interrupt is issued.
Once from asm interrupt handler i call a C generic handler, stack looks messed up,
the stack "rsp" reg seems containing a nonsense value.
Well, the push 1, 2, 3 are just test values. In the C code
i don't receive anything that have sense.
If some idea on the issue it's really welcome.
I was thinking to some calling convention issue from asm to C, but can be completely wrong.
Thanks
i have the current weird issue:
I am just entered in long mode, from a kernel_main() IDT is set up.
At a certain point, after some code is executed, a "Page Fault" interrupt is issued.
Once from asm interrupt handler i call a C generic handler, stack looks messed up,
the stack "rsp" reg seems containing a nonsense value.
Code: Select all
_isr_0E:
cli
pushq $0
pushq $14
jmp _isr_common_stub
....
_isr_common_stub:
save
pushq $0x01
pushq $0x02
pushq $0x03
movq %rsp, %rax
pushq %rax /* push struct _irq_regs* on the stack */
mov $_isr_handler, %rax
call *%rax
mov %rax, retval /* tmp save retval */
pop %rax
restore
add $4, %rsp /* error code and int no */
mov retval, %rax /* set retval in eax */
iretq
i don't receive anything that have sense.
If some idea on the issue it's really welcome.
I was thinking to some calling convention issue from asm to C, but can be completely wrong.
Thanks