OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 6:10 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: UEFI :: Paging problems
PostPosted: Sat Mar 23, 2024 11:59 am 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 69
Hello everyone!

I have a question regarding paging.
The code bellow works on Virtual Box and QEMU , on real hardware in 32 bit mode, and on 2 real hardware supporting UEFI.
On me 3d piece of hardware, which boots via UEFI, the system tripple faults.
What have I done wrong?

C code paging driver
C header paging driver

I have the feeling it has something to do with line 107:
Code:
for(upointer_t valve = 0 ; valve < (0xFFFFF000/PAGE_GAP_SIZE) ; valve++){
        map_memory(pagemaplevel4,(void*)(valve*PAGE_GAP_SIZE),(void*)(valve*PAGE_GAP_SIZE));
}


The thing is, if I replace the value of 0xFFFFF000 with the value I got from my memory driver, the system still does not like it.
The code for the memory driver is this: C code memory driver

Could someone please tell me what I did wrong?


Top
 Profile  
 
 Post subject: Re: UEFI :: Paging problems
PostPosted: Sat Mar 23, 2024 8:24 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5146
SanderR wrote:
What have I done wrong?

You allocate memory for the PML4, but it doesn't look like you allocate memory for the other tables.

You also don't check the ExitBootServices() return value.

Maybe other things too, I didn't look for very long.

SanderR wrote:
I have the feeling it has something to do with line 107:

Why do you think so? What debugging have you done so far?


Top
 Profile  
 
 Post subject: Re: UEFI :: Paging problems
PostPosted: Wed Mar 27, 2024 4:23 pm 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 69
Thank you for your answer.
I implemented the things you mentioned.
Right now, I can see the text "All pages are filled now load it to the cr3 register!"
Then it takes like 15 seconds and the PC resets.
It never reaches "When we hit this point, we are safe! (new method)"
When I take the maximum physical address value mentioned by EFI, and do it +1 page, then it does give me a pagefault.
Why it doesnt trigger a pagefault for me current issue?


Top
 Profile  
 
 Post subject: Re: UEFI :: Paging problems
PostPosted: Wed Mar 27, 2024 7:37 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5146
SanderR wrote:
I implemented the things you mentioned.

You still aren't checking all of the return values.

SanderR wrote:
Why it doesnt trigger a pagefault for me current issue?

It probably does, but there's still something wrong with your page tables, so your page fault handler causes another page fault.

Have you checked the contents of the page tables? A serial port you could use to send them all to another PC would be really helpful...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Google [Bot] and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group