Page 1 of 1
Enabling interupts in longmode
Posted: Sat Jan 07, 2006 8:26 pm
by pkd
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.
Re:Enabling interupts in longmode
Posted: Sun Jan 08, 2006 3:16 am
by Candy
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.
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.
Re:Enabling interupts in longmode
Posted: Sun Jan 08, 2006 8:28 pm
by pkd
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.
Re:Enabling interupts in longmode
Posted: Wed Jan 11, 2006 8:02 am
by pkd
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}
mov 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
and this to my exception handler for #GP
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
ok bye
pkd.