How to test Paging?

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
leledumbo
Member
Member
Posts: 103
Joined: Wed Apr 23, 2008 8:46 pm

How to test Paging?

Post by leledumbo »

I've set cr3 to point to my pagedirectory and set 31th bit of cr0 to enable paging. Nothing wrong, everything runs smoothly. But, how do I know if it works?
thooot
Member
Member
Posts: 30
Joined: Sun Jun 01, 2008 11:20 am

Re: How to test Paging?

Post by thooot »

Try setting two virtual address to point to the same physical page. Then write to the page using one address and check if the other one can read it.
leledumbo
Member
Member
Posts: 103
Joined: Wed Apr 23, 2008 8:46 pm

Re: How to test Paging?

Post by leledumbo »

Just to clarify, is this correct?

Code: Select all

type
  PageTable: PLongWord; // pointer to unsigned 32-bit Integer
var
  PageDirectory: array [0..255] of PageTable;
... // assume that PageDirectory has been initialized
var
  p,q: PageTable;
begin
  p:=PageDirectory[5];
  q:=PageDirectory[5];
  p^:=255;
  WriteLn(q^);
end;
Post Reply