Page table abuse.


R. Clayton (rclayton@clayton.cs.monmouth.edu)
(no date)


If you're having trouble getting your os to run the assignment 3 disks,

  $ os -d pa3-lheapsort.dsk
  * * * array isn't sorted in ascending order: a[2] = 3.
  Segmentation Fault(coredump)

  $

it could be because your code is abusing the page table. You can check this by
adding the code

  #include <cstdlib>
  #include <iostream>
  #include "mass.h"

  Memory::Page_Table_Entry & pte(unsigned i) {
    if (i >= pages_in_user_space) {
      cerr << "Page-table index " << i << " is outside the range of valid"
           << " indices [0.." << pages_in_user_space - 1 << "].\n";
      abort();
      }
    return mass.memory->page_table[i];
    }

to any file that manipulates the page table, and then changing the page table
accesses from

  mass.memory->page_table[i].valid = true;

to

  pte(i).valid = true;

(for example). pte() catches attempts to access a page-table element that's
not in the page table:

  $ os3 -d pa3-lheapsort.dsk
  * * * array isn't sorted in ascending order: a[2] = 3.
  Page-table index 32 is outside the range of valid indices [0..31].
  Abort(coredump)

  $

Let me know if you have any questions.



This archive was generated by hypermail 2.0b3 on Mon Dec 17 2001 - 19:30:04 EST