Import backup from 2005-08-25
This commit is contained in:
1 parent
345ef6c9f3
commit
83a5b032f8
15 files changed
+244
-92
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
||||
// mm.c
|
||||
// Author: Josh Holtrop
|
||||
// Created: 09/01/03
|
||||
// Modified: 07/12/04
|
||||
// Modified: 08/19/04
|
||||
|
||||
#include "kernel.h"
|
||||
#include "mm/mm.h"
|
||||
@@ -48,7 +48,7 @@ void mm_init()
|
||||
int i;
|
||||
for (i = 0; i < mb_info_block.mods_count; i++) //reserve module memory
|
||||
{
|
||||
mm_preserven(mb_modules[i].mod_start - VIRT_OFFSET, (mb_modules[i].mod_end - mb_modules[i].mod_start) >> 12);
|
||||
mm_preserven(mb_modules[i].mod_start - VIRT_OFFSET, (mb_modules[i].mod_end - mb_modules[i].mod_start + 4095) >> 12);
|
||||
}
|
||||
mm_megabytes = (mm_totalmem >> 20) + ((mm_totalmem % 0x100000) ? 1 : 0);
|
||||
}
|
||||
|
||||
+3
-1
@@ -72,6 +72,8 @@ int vmm_map_addr(void *virt, u32_t *phys_addr)
|
||||
// This function maps a virtual address to a physical address using the page directory / page table
|
||||
int vmm_map1(u32_t virt, u32_t physical)
|
||||
{
|
||||
virt &= 0xFFFFF000;
|
||||
physical &= 0xFFFFF000;
|
||||
u32_t pde = virt >> 22;
|
||||
u32_t pte = (virt & 0x003FF000) >> 12;
|
||||
u32_t *pageTables = (u32_t *)0xFFFFF000; //this is the location of the page directory
|
||||
@@ -85,7 +87,7 @@ int vmm_map1(u32_t virt, u32_t physical)
|
||||
invlpg_(virt); //in case it was cached, so we can fill page table safely
|
||||
memsetd((void*)(0xFFC00000 | (pde << 12)), 0, 1024); //zero out new page table
|
||||
}
|
||||
*(u32_t *)(0xFFC00000 | (pde << 12) | (pte << 2)) = (physical & 0xFFFFF000) | 0x03;
|
||||
*(u32_t *)(0xFFC00000 | (pde << 12) | (pte << 2)) = physical | 0x03;
|
||||
invlpg_((0xFFC00000 | (pde << 12) | (pte << 2)));
|
||||
invlpg_(virt);
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user