Created
May 14, 2014 20:32
-
-
Save Mischa-Alff/a5ff651c8de3c4655726 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef uint64_t page_t; | |
typedef page_t page_table_t[0x200]; | |
typedef page_table_t *page_directory_t[0x200]; | |
typedef page_directory_t *page_directory_pointer_t[0x200]; | |
typedef page_directory_pointer_t *pml4_t[0x200]; | |
pml4_t pml4; | |
extern "C" | |
void setup_paging() | |
{ | |
set_cr3(static_cast<uint32_t>(*******pml4)); | |
for(auto i = 0; i < 0x200; ++i) | |
pml4[i] = 0; | |
******pml4[0] |= 3; | |
*****pml4[0][0] |= 3; | |
****pml4[0][0][0] |= 3; | |
for(auto t = 0; t < 0x2; ++t) | |
for(auto p = 0; p < 0x200; ++p) | |
***pml4[0][0][t][p] = 3 + t*0x200*0x1000 + p * 0x1000; | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment