Hi,
Ive recently started programming for the x86_64 and have successfully entered long mode, the problem i am having is with enabling interrupts when using
sti - I am getting a General protection fault.
{works fine in Real & 32PMode}
I was wondering if anyone has come accross this problem and knows how to solve it.
I have googled but am yet to find anything to help.
bye pkd.
Enabling interupts in longmode
Re:Enabling interupts in longmode
My guess is on the interrupt stack mechanism x86_64 introduced. I don't have any experience with interrupts in it, so I can't help you there.pkd wrote: Hi,
Ive recently started programming for the x86_64 and have successfully entered long mode, the problem i am having is with enabling interrupts when using
sti - I am getting a General protection fault.
{works fine in Real & 32PMode}
I was wondering if anyone has come accross this problem and knows how to solve it.
Re:Enabling interupts in longmode
Hi again,
Still havent got it working yet, but am about to compile bochs and hopefully willmget some extended error information, Ill post again if i work it out.
Thanks for your reply.
bye pkd.
Still havent got it working yet, but am about to compile bochs and hopefully willmget some extended error information, Ill post again if i work it out.
Thanks for your reply.
bye pkd.
Re:Enabling interupts in longmode
hi again,
Ive got it fixed sortof, for some reason the first STI is causing a General protection fault but once ive been through the exception handler once STI works fine
It is a bit of a workaround but at least i can get on with writing now.
By the way it works without the #GP in bochs
To do this ive added the following code.{ rcx points to the return address}
pkd.
Ive got it fixed sortof, for some reason the first STI is causing a General protection fault but once ive been through the exception handler once STI works fine
It is a bit of a workaround but at least i can get on with writing now.
By the way it works without the #GP in bochs
To do this ive added the following code.{ rcx points to the return address}
and this to my exception handler for #GPmov rcx,Entry
call 0x11000 ;My current INT/Exception Setup
Entry:
mov rsi,EntryMsg
mov rdi,0xb8a00
call print64
mov r15,0x1234567812345678 ;my STI signature
sti
END:
hlt
jmp END ;TEMP MSGLOOP
ok bye
Setup ints/Exceptions
mov rdi,ENTRY ;this just stores the iretq return address
mov [rdi],rcx
;-------------------------------------------------
Exc13:
mov r14,0x1234567812345678 ;check for STI signature
cmp r15,r14
jnz Exc13a
add rsp,8
mov rdi,[ENTRY]
mov [rsp],rdi
iretq
Exc13a:
mov rsi,Ex13txt
jmp ExcPrint
pkd.