Code: Select all
gdpt.limit = (sizeof(struct gdt_entry)*3)-1;
gdpt.base = (u32)&gp;
set_gdt(0, 0, 0, 0, 0);
set_gdt(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); /* kernel code segment */
set_gdt(2, 0, 0xFFFFFFFF, 0x92, 0xCF); /* kernel data segment */
set_gdt(3, 0, 0xFFFFFFFF, 0xFA, 0xCF); /* User mode code segment */
set_gdt(4, 0, 0xFFFFFFFF, 0xF2, 0xCF); /* User mode data segment */
gdt_flush((u32)&gdpt);
Code: Select all
0x10021e <gdt_flush>: mov eax,DWORD PTR [esp+0x4]
0x100222 <gdt_flush+4>: lgdtd [eax]
0x100225 <gdt_flush+7>: mov ax,0x10
0x100229 <gdt_flush+11>: mov ds,eax
0x10022b <gdt_flush+13>: mov es,eax
0x10022d <gdt_flush+15>: mov fs,eax
0x10022f <gdt_flush+17>: mov gs,eax
0x100231 <gdt_flush+19>: mov ss,eax
0x100233 <gdt_flush+21>: jmp 0x8:0x10023a
0x10023a <flush2>: retw