-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paging Code Restarts Qemu #28
Comments
Run QEMU with |
Here is part of the log output:
|
I put that comment on the wrong post - sorry. |
Hmmm… are you compiling your code without O2 and booting it with multiboot? Edit - are the IDT and GDT being initialized? The bases are wrong. |
Yes - they are, I am using the example code. |
With me is also the error |
@pritamzope it restarts qemu by the line: |
This is the exact same problem I'm having with my OS right now. I'm also quite confused on how some of this even works, like the memory info. The multiboot structure is hardcoded for 0x3 flags but still somehow gets all of them??? I can't even successfully replicate it. Edit: Above issues fixed, I believe the issues with this OS is with IDT/GDT not initializing. |
As well as that, it doesn't even seem to crash/restart. There is no exception log in qEMU. Maybe try with just |
Yeah, I tried it and found out it causes a triple fault. It needs to cause an exception but exceptions are handled via the IDT which is initialized before |
@Toni-Graphics I wouldn't be surprised if they aren't initializing properly. Can you post the output of the fault? I want to take a look. |
Looking closer at the original post, IDT and GDT look bad from what I can tell - if the OS runs in Bochs, one could try to debug it further. |
Well, I'm not entirely sure on the IDT/GDT point, but it's likely related. I'll try and run it in QEMU later and debug it further. |
I ran the code in qEMU and got the following exception back:
CR2 is 001183f0, which is the faulting address. CR3 is correctly pointing towards the page directory, I think. It appears that since e=0000, the page fault was caused because all pages were not properly marked as present. The kernel size may be too big. I will try to resolve this |
Running it in Bochs shows the issue is that the IDT isn't in a present page, and an interrupt coming in likely broke the code:
@pritamzope 's code is not exactly well-suited for adding a secondary page table, and making the page table global doesn't serve much purpose. What you would need to do is add a secondary page table and fill it with pages corresponding to the GDT and IDT bases. I will try and reimplement a version of paging I use into his code. |
Hi, @xing1357 Sorry for the late replies as I have some personal work going on. Try the basic code given on the site page https://wiki.osdev.org/Setting_Up_Paging paging.c:-
load_paging.asm:-
|
The file load_paging.asm is completely optional, as it shows only that the basic code works are given on osdev site.
|
The paging initialization restarts qemu. How do I work around/fix this?
The text was updated successfully, but these errors were encountered: