So I switch into Pmode and I call my kernel when
Posted: Sun Aug 20, 2006 5:04 pm
BOCHS (and my systems) reboot. I setup the GDT properly and call everything correctly. All my PMode code is in my bootloader for now. (My RAW bootloader >: for now).
So it loads my kernel at 1000:0000 (0x10000) and then it opens the A20 gate, sets up the GDT, sets the 386 PM bit then clears the pipe. After that it sets up the other segment registers. Ok so were all happy for now. When I go to jump to my kernel it resets. Looking at the register dump it reveals to me:
[tt]
00000794840e[CPU0 ] interrupt(): gate descriptor is not valid sys seg
00000794840e[CPU0 ] interrupt(): gate descriptor is not valid sys seg
00000794840i[CPU0 ] protected mode
00000794840i[CPU0 ] CS.d_b = 32 bit
00000794840i[CPU0 ] SS.d_b = 32 bit
00000794840i[CPU0 ] | EAX=00000010 EBX=00000000 ECX=00000002 EDX=00000000
00000794840i[CPU0 ] | ESP=00015000 EBP=00000000 ESI=00007343 EDI=0000ffde
00000794840i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00000794840i[CPU0 ] | SEG selector base limit G D
00000794840i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00000794840i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00000794840i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00000794840i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00000794840i[CPU0 ] | ES:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00000794840i[CPU0 ] | FS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00000794840i[CPU0 ] | GS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00000794840i[CPU0 ] | EIP=00007c73 (00007c73)
00000794840i[CPU0 ] | CR0=0x00000011 CR1=0 CR2=0x00000000
00000794840i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00000794840i[CPU0 ] >> jmp far 1000:00000000 : EA000000000010
00000794840e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
[/tt]
Not a valid descriptor. It seems pretty valid to me
Now I want to get into the flat memory model like Windows NT and Linux.
My GDT is valid and all the segment registers contain the index value. Code = 08h and Data/Stack = 10h.
I think it is how my kernel is being called.
I do it like "jmp 0x1000:0000". NASM syntax. I know thats prolly whats causing this. But with assembly it could be anything. Can anyone help?
So it loads my kernel at 1000:0000 (0x10000) and then it opens the A20 gate, sets up the GDT, sets the 386 PM bit then clears the pipe. After that it sets up the other segment registers. Ok so were all happy for now. When I go to jump to my kernel it resets. Looking at the register dump it reveals to me:
[tt]
00000794840e[CPU0 ] interrupt(): gate descriptor is not valid sys seg
00000794840e[CPU0 ] interrupt(): gate descriptor is not valid sys seg
00000794840i[CPU0 ] protected mode
00000794840i[CPU0 ] CS.d_b = 32 bit
00000794840i[CPU0 ] SS.d_b = 32 bit
00000794840i[CPU0 ] | EAX=00000010 EBX=00000000 ECX=00000002 EDX=00000000
00000794840i[CPU0 ] | ESP=00015000 EBP=00000000 ESI=00007343 EDI=0000ffde
00000794840i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00000794840i[CPU0 ] | SEG selector base limit G D
00000794840i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00000794840i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00000794840i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00000794840i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00000794840i[CPU0 ] | ES:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00000794840i[CPU0 ] | FS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00000794840i[CPU0 ] | GS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00000794840i[CPU0 ] | EIP=00007c73 (00007c73)
00000794840i[CPU0 ] | CR0=0x00000011 CR1=0 CR2=0x00000000
00000794840i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00000794840i[CPU0 ] >> jmp far 1000:00000000 : EA000000000010
00000794840e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
[/tt]
Not a valid descriptor. It seems pretty valid to me
Now I want to get into the flat memory model like Windows NT and Linux.
My GDT is valid and all the segment registers contain the index value. Code = 08h and Data/Stack = 10h.
I think it is how my kernel is being called.
I do it like "jmp 0x1000:0000". NASM syntax. I know thats prolly whats causing this. But with assembly it could be anything. Can anyone help?