GP fault when flushing TSS
Posted: Thu Nov 07, 2019 2:58 pm
Hello, all:
I'm slowly but surely getting my plucky little kernel to ring 3. I've just started trying to load a TSS into the GDT, and I getting a general protection fault at ltr in this bit of code:
I had declared my TSS as a global static variable like this:
I tried setting up virtual memory/paging before and after setting up the GDT, and neither arrangement seemed to have an effect. Then, instead of statically allocating the TSS, I changed my declaration above to a pointer, and used my page allocator to point it to a page-aligned address. Doing that magically made it work. I have other global static declarations elsewhere, and none of them cause GP faults when reading/writing to them- only the TSS was doing this, and the only time it happened was at that ltr instruction. Does anyone have any guesses for why this might happen?
I'm slowly but surely getting my plucky little kernel to ring 3. I've just started trying to load a TSS into the GDT, and I getting a general protection fault at ltr in this bit of code:
Code: Select all
tss_flush:
mov %ax, 0x2B
ltr %ax
ret
Code: Select all
static Tss tss;