Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Paging

By: a guest on Mar 14th, 2012  |  syntax: C++  |  size: 0.48 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data