#include <agnix/agnix.h>
#include <agnix/init.h>
#include <agnix/memory.h>
#include <asm/paging.h>
#include <asm/cpu_ops.h>
#include <agnix/console.h>
Include dependency graph for pgmap.c:
Go to the source code of this file.
Defines | |
#define | DEBUG_MEM 0 |
#define | MOD_NAME "MEM: " |
Functions | |
pte_s * | pte_ptr (struct pde_s *pde) |
int | remap_page_tables (u32 pd_addr, u32 from, u32 to, u32 len) |
int | remap_kpage_tables (u32 from, u32 to, u32 len) |
int | page_tables_init (struct main_memory_s *mem) |
Variables | |
main_memory_s | main_memory |
|
|
|
|
|
Definition at line 53 of file pgmap.c. References MOD_NAME, printk(), and pte_ptr(). Referenced by bootmem_init_dh(). 00054 { 00055 struct pde_s *pde; 00056 struct pte_s *pte; 00057 u32 page_start; 00058 u32 page_end; 00059 u32 page_len; 00060 u32 page_count; 00061 int i, j; 00062 00063 #if DEBUG_MEM 00064 printk(MOD_NAME "Initializing page tables\n"); 00065 #endif 00066 00067 page_count = 0; 00068 page_start = 0; 00069 page_end = (mem->mem_size) >> 2; // KB >> 2 == pages 00070 page_len = page_end - page_start; 00071 00072 pde = (struct pde_s *)mem->pdbr; 00073 pde += pde_offset(PAGE_OFFSET); 00074 00075 #if DEBUG_MEM 00076 printk(MOD_NAME "page count = %d\n", page_len); 00077 #endif 00078 00079 __cli(); 00080 00081 // write_cr4(read_cr4() | 0x10); 00082 00083 for (i = pde_offset(PAGE_OFFSET); i < PDE_PER_PD; i++) { 00084 00085 // pde->pte_addr = (page_count << PAGE_SHIFT); 00086 // set_pde(pde, make_pde_phys(pde->pte_addr, PDE_FLAG_P | PDE_FLAG_RW | PDE_FLAG_PS)); 00087 // pde++; 00088 // page_count += 1024; 00089 // 00090 pte = pte_ptr(pde); 00091 for (j = 0; j < PTE_PER_PT; j++) { 00092 00093 set_pte(pte, make_pte_phys(page_count << PAGE_SHIFT, (PTE_FLAG_P | PTE_FLAG_RW | PTE_FLAG_A | PTE_FLAG_D))); 00094 00095 if (++page_count >= page_len) 00096 break; 00097 00098 pte++; 00099 } 00100 00101 if (page_count >= page_len) 00102 break; 00103 00104 pde++; 00105 } 00106 00107 00108 #if DEBUG_MEM 00109 printk(MOD_NAME "Loading cr3 (phys_addr=%x) ... ", virt_to_phys(mem->pdbr)); 00110 #endif 00111 00112 load_cr3(mem->pdbr); 00113 00114 #if DEBUG_MEM 00115 printk("ok\n"); 00116 #endif 00117 00118 return 0; 00119 }
Here is the call graph for this function: |
|
Definition at line 26 of file pgmap.c. References get_free_pages(). Referenced by page_tables_init(). 00027 { 00028 struct pte_s *pte; 00029 00030 if (!pte_address(pde)) { 00031 pte = (struct pte_s *)get_free_pages(0); 00032 pde->pte_addr = virt_to_phys((u32)pte); 00033 set_pde(pde, make_pde_phys(pde->pte_addr, PDE_FLAG_P | PDE_FLAG_RW)); 00034 } else { 00035 pte = phys_to_virt(pte_address(pde)); 00036 } 00037 00038 return pte; 00039 }
Here is the call graph for this function: |
|
Definition at line 48 of file pgmap.c. References main_memory, and remap_page_tables(). 00049 { 00050 return remap_page_tables(main_memory.pdbr, from, to, len); 00051 }
Here is the call graph for this function: |
|
Definition at line 41 of file pgmap.c. Referenced by remap_kpage_tables(). 00042 {
00043
00044
00045 return 0;
00046 }
|
|
|