Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Whenever I do a syscall, the system triple faults. I'm not sure what's causing it. Currently I'm using the code from JamesM's tutorial, but I eventually plan on writing my own code.
If I understand that log correctly, CS = 0x1B... 0x1B is not a valid selector... it must be a multiple of 0x08 e.g. 0x08, 0x10 as it points to an entry in the GDT and entries in the GDT are 0x08 bytes in size.
BMW wrote:If I understand that log correctly, CS = 0x1B... 0x1B is not a valid selector... it must be a multiple of 0x08 e.g. 0x08, 0x10 as it points to an entry in the GDT and entries in the GDT are 0x08 bytes in size.
No. Descriptor table entries are 8 bytes in size, but the third from lowest bit of a selector selects whether the segment should be taken from the LDT or GDT, and the low two bits determine the requested privilege level.
BMW wrote:If I understand that log correctly, CS = 0x1B... 0x1B is not a valid selector... it must be a multiple of 0x08 e.g. 0x08, 0x10 as it points to an entry in the GDT and entries in the GDT are 0x08 bytes in size.
No. Descriptor table entries are 8 bytes in size, but the third from lowest bit of a selector selects whether the segment should be taken from the LDT or GDT, and the low two bits determine the requested privilege level.
0x1B is selector 0x18 with an RPL of 3.
My GDT and such seem to be working correctly, but who knows it might be breaking whenever I write the TSS. I'm able to enter ring 3 fine, but the issue I'm having is that whenever I do any system call it triple faults.
The original exception number is 14 (in brackets after '3rd'), this is a page fault. The address that caused the page fault is stored in CR2, and is 0xfffffffc.
This looks to me like your TSS's ESP0 field is currently set to 0, instead of the kernel stack's top.