Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdint.h>
- typedef struct page_map_level_4
- {
- page_map_level_4_entry_t *map;
- } page_map_level_4_t;
- typedef struct page_map_level_4_entry {
- /// @brief Is this a valid entry?
- uint64_t present:1;
- /// @brief If clear, this page is read only;
- uint64_t writable:1;
- /// @brief If set, this page is user accessable;
- uint64_t user:1;
- /// @brief If set, write through caching is enabled
- uint64_t write_through:1;
- /// @brief Page will not be cached
- uint64_t cache_disable:1;
- /// @brief If set, this page has been recently accessed by the CPU
- uint64_t accessed:1;
- uint64_t unused_0:1;
- uint64_t reserved_0:1;
- uint64_t unused_1:4;
- /// @brief The address of the page directory pointer table
- uint64_t address:36;
- uint64_t reserved_1:4;
- uint64_t unused_2:11;
- uint64_t disable_execution:1;
- } __attribute__((packed)) page_map_level_4_entry_t;
- typedef struct page_directory_pointer_table
- {
- page_directory_pointer_table_entry_t *map;
- } page_directory_pointer_table_t;
- typedef struct page_directory_pointer_table_entry {
- /// @brief Is this a valid entry?
- uint64_t present:1;
- /// @brief If clear, this page is read only;
- uint64_t writable:1;
- /// @brief If set, this page is user accessable;
- uint64_t user:1;
- /// @brief If set, write through caching is enabled
- uint64_t write_through:1;
- /// @brief Page will not be cached
- uint64_t cache_disable:1;
- /// @brief If set, this page has been recently accessed by the CPU
- uint64_t accessed:1;
- uint64_t unused_0:1;
- /// @brief Set to 0
- uint64_t page_size:1;
- uint64_t unused_1:4;
- /// @brief The address of the page directory pointer table
- uint64_t address:36;
- uint64_t reserved_1:4;
- uint64_t unused_2:11;
- uint64_t disable_execution:1;
- } __attribute__((packed)) page_directory_pointer_table_entry_t;
- typedef struct page_directory
- {
- page_directory_entry_t *map;
- } page_directory_t;
- typedef struct page_directory_entry {
- /// @brief Is this a valid entry?
- uint64_t present:1;
- /// @brief If clear, this page is read only;
- uint64_t writable:1;
- /// @brief If set, this page is user accessable;
- uint64_t user:1;
- /// @brief If set, write through caching is enabled
- uint64_t write_through:1;
- /// @brief Page will not be cached
- uint64_t cache_disable:1;
- /// @brief If set, this page has been recently accessed by the CPU
- uint64_t accessed:1;
- uint64_t unused_0:1;
- /// @brief Set to 0
- uint64_t page_size:1;
- uint64_t unused_1:4;
- /// @brief The address of the page directory pointer table
- uint64_t address:36;
- uint64_t reserved_1:4;
- uint64_t unused_2:11;
- uint64_t disable_execution:1;
- } __attribute__((packed)) page_directory_entry_t;
- typedef struct page_table
- {
- page_directory_entry_t *map;
- } page_table_t;
- typedef struct page_table_entry
- {
- /// @brief Is this a valid entry?
- uint64_t present:1;
- /// @brief If clear, this page is read only;
- uint64_t writable:1;
- /// @brief If set, this page is user accessable;
- uint64_t user:1;
- /// @brief If set, write through caching is enabled
- uint64_t write_through:1;
- /// @brief Page will not be cached
- uint64_t cache_disable:1;
- /// @brief If set, this page has been recently accessed by the CPU
- uint64_t avalible:3;
- /// @brief The page has been written to
- uint64_t ditry:1;
- /// @brief Use Page Attribute Table
- uint64_t pat:1;
- uint64_t global:1;
- uint64_t unused_0:3;
- uint64_t address:36;
- uint64_t reserved:2;
- uint64_t unused_1:7;
- uint64_t protection_key:4;
- uint64_t execution_disable:1;
- } __attribute__((packed)) page_table_entry_t;
Advertisement
Add Comment
Please, Sign In to add comment