Paging faults when accessing last 3 bytes of last page

Programming, for all ages and all languages.
Post Reply
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Paging faults when accessing last 3 bytes of last page

Post by max »

Hey guys,

I'm currently developing my memory management system. Now I set up the kernels page directory with one page table, identity mapping the first 4 Mebibyte of memory.

Now when activating paging, I am able to access the memory from 0x000000 to 0x3FFFFC, but when I want to use 0x3FFFFD, 0x3FFFFE or 0x3FFFFF I get a page fault.

So I just set up the directory, zero each entry, then set up the first table, map 4MiB and enable paging. Do you have an idea whats wrong with it (allocator.getPage() returns a value higher than 0x400000 representing a free memory area)?

http://pastebin.com/Ts4SJt5v

Thanks in advance :)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Paging faults when accessing last 3 bytes of last page

Post by Solar »

\me holds his eyes closed, trying to nail this one without looking at the code

Could it be that your "access" is accessing an int (4 bytes)?
Every good solution is obvious once you've found it.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Paging faults when accessing last 3 bytes of last page

Post by max »

You are right, thank you very much for your help.

Problem solved :D
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Paging faults when accessing last 3 bytes of last page

Post by Kevin »

You seem to have serious trouble with the idea that data has a length. ;)
Developer of tyndur - community OS of Lowlevel (German)
Post Reply