Page 1 of 1

direct mapping and page fault handler

Posted: Tue Oct 05, 2004 9:52 am
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.

Re:direct mapping and page fault handler

Posted: Tue Oct 05, 2004 11:26 am
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?

Re:direct mapping and page fault handler

Posted: Tue Oct 05, 2004 11:32 am
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

Re:direct mapping and page fault handler

Posted: Tue Oct 05, 2004 11:46 am
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.

Re:direct mapping and page fault handler

Posted: Wed Oct 06, 2004 9:24 am
by aladdin
thank you

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