Advertisement
Guest User

Paging

a guest
Mar 14th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement