Skip to content

Commit

Permalink
Fixed Issue 10: #10.
Browse files Browse the repository at this point in the history
Fixed Issue 10 (#10).

Modified the code to compare a pointer against NULL instead of
against zero.

Modified code that sets the ghostPTP flag for a memory frame so
that it is set only when a free frame is found.
  • Loading branch information
jtcriswell committed Jul 20, 2017
1 parent 8db9425 commit 40c6e6a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions SVA/lib/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ allocPTPage (void) {
/*
* Ask the system software for a page of memory.
*/
if ((p = SVAPTPages[ptindex]) != 0) {
if ((p = SVAPTPages[ptindex]) != NULL) {
/*
* Initialize the memory.
*/
Expand All @@ -939,16 +939,17 @@ allocPTPage (void) {
PTPages[ptindex].vosaddr = p;
PTPages[ptindex].paddr = getPhysicalAddr (p);

/*
* Set the type of the page to be a ghost page table page.
*/
getPageDescPtr(getPhysicalAddr (p))->ghostPTP = 1;

/*
* Return the index in the table.
*/
return ptindex;
}

/*
* Set the type of the page to be a ghost page table page.
*/
getPageDescPtr(getPhysicalAddr (p))->ghostPTP = 1;
return 0;
}

Expand Down

0 comments on commit 40c6e6a

Please sign in to comment.