I can't install Task Register(
Posted: Sat Sep 05, 2020 6:20 am
Hi.
I have previously discussed this issue here, but we have not been able to achieve a solution, so I have to write about it again...
So, here is my code that deals with setting up GDT and trying to load TR.
First it creates 6 entries in gdt_entries array
0. NULL
1. Kernel Code
2. Kernel Data
3. Usermode Code
4. Usermode Data
5. TSS
After that, everything is successfully flush GDT.
Then I take the ESP to use it in the write_tss() function that configures the TSS.
Then I configure the IDT to track exceptions that may occur when trying to execute the LTR statement.
And finally I try to load TR using the function tss_flush(), as a parameter I specify the number offset to the TSS entry in GDT(0x5 * 0x8 = 0x28).
While calling the tss_flush() function, while trying to execute the LTR statement, I encounter an exception #GP, with the error code d440.
Here's what it means:
Exception inside the processor
The Selector Index references a descriptor in the GDT.
index = 6792
However, the problem is that there is no such index in my GDT, I do not know what exactly it does not like.
I have previously discussed this issue here, but we have not been able to achieve a solution, so I have to write about it again...
So, here is my code that deals with setting up GDT and trying to load TR.
First it creates 6 entries in gdt_entries array
0. NULL
1. Kernel Code
2. Kernel Data
3. Usermode Code
4. Usermode Data
5. TSS
After that, everything is successfully flush GDT.
Then I take the ESP to use it in the write_tss() function that configures the TSS.
Then I configure the IDT to track exceptions that may occur when trying to execute the LTR statement.
And finally I try to load TR using the function tss_flush(), as a parameter I specify the number offset to the TSS entry in GDT(0x5 * 0x8 = 0x28).
While calling the tss_flush() function, while trying to execute the LTR statement, I encounter an exception #GP, with the error code d440.
Here's what it means:
Exception inside the processor
The Selector Index references a descriptor in the GDT.
index = 6792
However, the problem is that there is no such index in my GDT, I do not know what exactly it does not like.