SHARE
TWEET

Paging

a guest Mar 14th, 2012 22 Never
  1. void Paging::createKernelDirectory() {
  2.         kernelDirectory = allocator.getPage();
  3.  
  4.         for (int i = 0; i < 1024; i++) {
  5.                 kernelDirectory[i] = (0 | 2);
  6.         }
  7. }
  8.  
  9. void Paging::identityMapKernelMemory() {
  10.         unsigned int physicalAddress = 0x0;
  11.  
  12.         unsigned int* table = allocator.getPage();
  13.  
  14.         for (int i = 0; i < 1024; i++) {
  15.                 table[i] = physicalAddress;
  16.                 table[i] |= (2 | 1);
  17.  
  18.                 physicalAddress += 0x1000;
  19.         }
  20.  
  21.         kernelDirectory[0] = (unsigned int) table;
  22.         kernelDirectory[0] |= (2 | 1);
  23. }
RAW Paste Data
Top