switching from real to protected in assembly
Posted: Sun Jul 15, 2007 1:32 pm
ok. using a .386p
theres a struct for Desc and a struct for table reg
temp_gdt_null_desc is a Desc
temp_gdt_scratch is a table_reg
the following code has a 66h proceding it
mov ebx, offset temp_gdt
mov dword ptr [ebx], 0
mov dword ptr [ebx] + 4, 0
mov dword ptr [ebx] + 8, Linear_Proto_hi //0000ffffh
mov dword ptr [ebx] + 12, linear_proto_lo //000cf9200h
mov temp_gdt_scratch.table_linear, ebx
mov temp_gdt_scratch.table_lim, 15
lgdt temp_gdt_scratch
mov ebx, cr0 // is not lead by a 66h
or ebx, 1
mov cr0, ebx ///////////// for some reason when it executes this line the computer reboots
theres a struct for Desc and a struct for table reg
temp_gdt_null_desc is a Desc
temp_gdt_scratch is a table_reg
the following code has a 66h proceding it
mov ebx, offset temp_gdt
mov dword ptr [ebx], 0
mov dword ptr [ebx] + 4, 0
mov dword ptr [ebx] + 8, Linear_Proto_hi //0000ffffh
mov dword ptr [ebx] + 12, linear_proto_lo //000cf9200h
mov temp_gdt_scratch.table_linear, ebx
mov temp_gdt_scratch.table_lim, 15
lgdt temp_gdt_scratch
mov ebx, cr0 // is not lead by a 66h
or ebx, 1
mov cr0, ebx ///////////// for some reason when it executes this line the computer reboots