My kernel is loaded into 0x500.
Before the first jump cx contains 0x3.
After the first jump it contains 0x0.
After the second jump it contains 0x0
Help with activating pmode
JMP/CALL do not change CX (although SYSCALL does). If CX changes just due to a JMP, you should seriously check whether:
1) EIP is where you would expect.
2) The code you want to run is where you expect it to be.
Is the entry point of your kernel in the same place as the start of the kernel's memory image? If not, you need to either ensure that it is, or know the offset of the kernel entry point.
Oh - and about that GPF:
indicates that your GDT has no entries (limit (0)) and you therefore need to load GDTR with the correct value.
Cheers,
Adam
1) EIP is where you would expect.
2) The code you want to run is where you expect it to be.
Is the entry point of your kernel in the same place as the start of the kernel's memory image? If not, you need to either ensure that it is, or know the offset of the kernel entry point.
Oh - and about that GPF:
Code: Select all
00002626616e[CPU0 ] fetch_raw_descriptor: GDT: index (f)1 > limit (0)
Cheers,
Adam
Finally got it working =]. Now it will go into pmode happily. The thing now is I want my OS to be loaded to the 1 Mib mark. The actual loading it is easy. The problem is with the GDT. I believe the GDT entry for the CodeEntry should have its Base changed but there is 3 different bases (low middle and high) and I don't know which ones to change.
My OS: SOS (Simple Operating System).
There is only one base, they just represent the low, middle, and high bits of the base address. This represents the lowest physical address that you can access.
You shouldn't need to change it at all. If you do decide to, just create a new GDT in your kernel once you load and execute it.
You shouldn't need to change it at all. If you do decide to, just create a new GDT in your kernel once you load and execute it.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}