LDT and Software Task Switching
Posted: Tue Mar 16, 2004 4:33 pm
Do you need a valid value in the LDTR register when you do a software task switch?? I am getting a fetch_raw_descriptor: LDTR.valid=0
error in bochs when I attempt to do a Ring0->Ring3 iret
I have one TSS structure that I loaded with the ss0 of my kernel data segment, and esp0 I loaded with the current value of the esp register
I have in my GDT a
NULL descriptor, a 16MB Ring0 Code seg, a 16MB Ring0 Data Seg, a TSS descriptor, a 16MB Ring3 Code seg and a 16MB Ring3 Data seg
I loaded the TR with a ltr command passing it the segment of my TSS in GDT
I wrote a test function (test_function() <= to test my ring 3 stuff)
Then I use a #define move_to_user_mode from Tabos os
I push my USER_DATA segment selector onto stack
I push the address of my user_stack onto the stack
I push the eflags on to the stack
I push the USER_CODE segment selector onto the stack
I push the &test_function onto the stack
then issue iret
thats when I get the error listed above
So do I need a valid LDT?? Or maybe I have something else wrong?
THanks
error in bochs when I attempt to do a Ring0->Ring3 iret
I have one TSS structure that I loaded with the ss0 of my kernel data segment, and esp0 I loaded with the current value of the esp register
I have in my GDT a
NULL descriptor, a 16MB Ring0 Code seg, a 16MB Ring0 Data Seg, a TSS descriptor, a 16MB Ring3 Code seg and a 16MB Ring3 Data seg
I loaded the TR with a ltr command passing it the segment of my TSS in GDT
I wrote a test function (test_function() <= to test my ring 3 stuff)
Then I use a #define move_to_user_mode from Tabos os
I push my USER_DATA segment selector onto stack
I push the address of my user_stack onto the stack
I push the eflags on to the stack
I push the USER_CODE segment selector onto the stack
I push the &test_function onto the stack
then issue iret
thats when I get the error listed above
So do I need a valid LDT?? Or maybe I have something else wrong?
THanks