Loading new GDT ?
Posted: Sat Feb 22, 2003 3:00 pm
before I use only data and code segment for the kernel,
but now I would like to make my gdt flexible, so that I can change it during execution. therefore I have write a code which do that. but when I try to load the new gdt a receive CPU Panic from Bochs.
I have attached the source code also.
this struct define the segment descriptor :
struct seg_descriptor {
unsigned short limit1; // 0 - 15
unsigned short base1; // 16 - 31
unsigned char base2; // 0 - 7
unsigned char type_s_dpl_p ;// type : 8 - 11 , S : 12, DPL : 13-14, P:15
unsigned char limit2_avl_O_DB_G; // limit 16 - 19, AVL 20 ,bit 21 : 0, D/B : 22, G: 23
unsigned char base3; // 24 - 31
};
this assembler code that load the gdt register:
load_gdt:???
???; stop using my old GDT, and load new GDT
???
???lgdt [gdt_descs_ptr]
???
???retn
there is an error which I have change it, but still does not work. it was the KERNEL_CODE_SEG it has 0x92 but it should be 0x9A.
[attachment deleted by admin]
but now I would like to make my gdt flexible, so that I can change it during execution. therefore I have write a code which do that. but when I try to load the new gdt a receive CPU Panic from Bochs.
I have attached the source code also.
this struct define the segment descriptor :
struct seg_descriptor {
unsigned short limit1; // 0 - 15
unsigned short base1; // 16 - 31
unsigned char base2; // 0 - 7
unsigned char type_s_dpl_p ;// type : 8 - 11 , S : 12, DPL : 13-14, P:15
unsigned char limit2_avl_O_DB_G; // limit 16 - 19, AVL 20 ,bit 21 : 0, D/B : 22, G: 23
unsigned char base3; // 24 - 31
};
this assembler code that load the gdt register:
load_gdt:???
???; stop using my old GDT, and load new GDT
???
???lgdt [gdt_descs_ptr]
???
???retn
there is an error which I have change it, but still does not work. it was the KERNEL_CODE_SEG it has 0x92 but it should be 0x9A.
[attachment deleted by admin]