Turnstone Operating System
Loading...
Searching...
No Matches
paging.64.c File Reference

Paging implementation for x86_64 architecture. More...

#include <types.h>
#include <memory.h>
#include <memory/frame.h>
#include <memory/paging.h>
#include <cpu.h>
#include <cpu/crx.h>
#include <systeminfo.h>
#include <logging.h>
#include <linker.h>
#include <cpu/descriptor.h>
#include <hashmap.h>

Functions

 MODULE ("turnstone.kernel.memory.paging")
 
uint64_t memory_paging_get_internal_frame (memory_page_table_context_t *table_context)
 
static void memory_paging_internal_frame_build (memory_page_table_context_t *table_context)
 
memory_page_table_context_tmemory_paging_switch_table (const memory_page_table_context_t *new_table)
 switches p4 page table More...
 
int8_t memory_paging_add_page_ext (memory_page_table_context_t *table_context, uint64_t virtual_address, uint64_t frame_address, memory_paging_page_type_t type)
 creates virtual address frame mapping with adding page More...
 
int8_t memory_paging_reserve_current_page_table_frames (void)
 
memory_page_table_context_tmemory_paging_build_empty_table (uint64_t internal_frame_address)
 
int8_t memory_paging_clear_page_ext (memory_page_table_context_t *table_context, uint64_t virtual_address, memory_paging_clear_type_t type)
 
int8_t memory_paging_toggle_attributes_ext (memory_page_table_context_t *table_context, uint64_t virtual_address, memory_paging_page_type_t type)
 
int8_t memory_paging_set_user_accessible_ext (memory_page_table_context_t *table_context, uint64_t virtual_address)
 
int8_t memory_paging_delete_page_ext_with_heap (memory_page_table_context_t *table_context, uint64_t virtual_address, uint64_t *frame_address)
 
int8_t memory_paging_get_physical_address_ext (memory_page_table_context_t *table_context, uint64_t virtual_address, uint64_t *physical_address)
 
int8_t memory_paging_add_va_for_frame_ext (memory_page_table_context_t *table_context, uint64_t va_start, frame_t *frm, memory_paging_page_type_t type)
 
int8_t memory_paging_delete_va_for_frame_ext (memory_page_table_context_t *table_context, uint64_t va_start, frame_t *frm)
 

Variables

hashmap_tmemory_paging_page_tables = NULL
 

Detailed Description

Paging implementation for x86_64 architecture.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ memory_paging_add_page_ext()

int8_t memory_paging_add_page_ext ( memory_page_table_context_t p4,
uint64_t  virtual_address,
uint64_t  frame_address,
memory_paging_page_type_t  type 
)

creates virtual address frame mapping with adding page

Parameters
heapthe heap where variables will be created in
p4p4 page table
virtual_addressvirtual start address of page
frame_addressframe address of page links
typepage type, see also memory_paging_page_type_t
Returns
0 if successed

if heap is NULL, the pages created in default heap

◆ memory_paging_switch_table()

memory_page_table_context_t * memory_paging_switch_table ( const memory_page_table_context_t new_table)

switches p4 page table

Parameters
[in]new_tablenew p4 table
Returns
old p4 table

change value of cr3 register. if new_table is NULL returns only current table