direct mapping and page fault handler

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
aladdin

direct mapping and page fault handler

Post by aladdin »

I wrot a basic low level memory manager, that direct map the first 4MB, the rest of pages is marked as not present.
then I wrot a function that dump 512B of memory starting from a given address.

now when I dump this address 0xFFFFFF I get a page fault (which is normal), but what I can't understand is that when I dump address 0x1000000 or 0x2000000 I dont get the page fault and I get it with addresses like 0xFFFxxx ??

normally I must get a page fault for evrry addresse above 0x3FFC00 since only first 4MB are direct mapped.
Dreamsmith

Re:direct mapping and page fault handler

Post by Dreamsmith »

When you setup your page directory, did you set all 1024 entries to appropriate values? There are no "unused" entries in a page directory, entries for pages that are not present must be set to indicate "not present". You said you set these in the page table, just making sure you did in the page directory, too.

This isn't a 286 or 386SX, is it?
aladdin

Re:direct mapping and page fault handler

Post by aladdin »

I set all entries int first page table as direct mapped,
and the rest of entries to not_present|3

not_present=0
Dreamsmith

Re:direct mapping and page fault handler

Post by Dreamsmith »

aladdin wrote: I set all entries int first page table as direct mapped,
and the rest of entries to not_present|3

not_present=0
"|3"? 0|3 == 3, and that would be marking the entries as present rather than not present. The least significant bit must be zero for "not present". You're marking all of these pages as present and writable.
aladdin

Re:direct mapping and page fault handler

Post by aladdin »

thank you

i thought that the "|3" was the DPL but after re-reading intel manual, i found that it was wrong.
Post Reply