OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Jan 16, 2018 9:14 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Page fault on page that is present?
PostPosted: Sat Dec 02, 2017 9:18 am 
Offline
Member
Member

Joined: Sun Sep 06, 2015 5:40 am
Posts: 33
Hi,

I have been trying to move my Rust kernel from identity mapping to instead map the kernel at 0xffffffff80000000. There have been a bunch of problems with this, all of which I've fixed except a weird page fault when trying to create the IDT. I'm using spin::Once to create the IDT which is just a `[IdtEntry; 256]` primitive like so:
Code:
static IDT : Once<Idt> = Once::new();

pub fn init()
{
...
IDT.call_once(
    || {
        let mut idt = Idt::new();
        idt
    });
...
}

On returning the IDT from the closure (`spin` then puts the return value into the static variable), a page fault occurs:
Code:
check_exception old: 0xffffffff new 0xe             
     0: v=0e e=0002 i=0 cpl=0 IP=0008:ffffffff801119fe pc=ffffffff801119fe SP=0010:ffffffff80120db0 CR2=ffffffff80120dd0


From the error code and CR2, I established that the page containing 0xffffffff80120dd0 isn't present. This seemed simple - there was a bug in the code that allocates the ELF sections (this address is within the .bss section) - but the page IS present as far as I can tell.

I suspect I'm just being dim, but I don't know where to proceed from here?

_________________
OS on Github


Top
 Profile  
 
 Post subject: Re: Page fault on page that is present?
PostPosted: Sat Dec 02, 2017 12:25 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3041
Location: Chichester, UK
Perhaps I'm being silly, but your qemu screenshot shows all your page mappings at non-canonical addresses. That doesn't seem right.


Top
 Profile  
 
 Post subject: Re: Page fault on page that is present?
PostPosted: Sun Dec 03, 2017 10:49 am 
Offline
Member
Member

Joined: Sun Sep 06, 2015 5:40 am
Posts: 33
Quote:
Perhaps I'm being silly, but your qemu screenshot shows all your page mappings at non-canonical addresses. That doesn't seem right.

Yeah, I'm not sure what's up with that. The four leading 0s in each address should be Fs (the kernel is mapped at 0xffffffff80000000 + physical address), and other stuff works at these correct addresses, so I assume it's something wrong with the qemu monitor. Is it worth looking into?

_________________
OS on Github


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], JAPH, Yahoo [Bot] and 14 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