mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
mmu: fix a lower half strcpy and add ismapped()
This commit is contained in:
@@ -24,6 +24,7 @@ typedef uint64_t* arch_mmu_tableptr;
|
||||
int arch_mmu_map(arch_mmu_tableptr, void*, void*, size_t);
|
||||
bool arch_mmu_isaccessed(arch_mmu_tableptr, void*);
|
||||
void* arch_mmu_getphysicaladdr(arch_mmu_tableptr, void*);
|
||||
bool arch_mmu_ismapped(arch_mmu_tableptr, void*);
|
||||
void arch_mmu_unmap(arch_mmu_tableptr, void*);
|
||||
void arch_mmu_init();
|
||||
void arch_mmu_apinit();
|
||||
|
||||
+10
-2
@@ -133,6 +133,14 @@ static uint64_t getmapping(arch_mmu_tableptr context, void* vaddr){
|
||||
|
||||
}
|
||||
|
||||
bool arch_mmu_ismapped(arch_mmu_tableptr context, void* vaddr){
|
||||
|
||||
uint64_t mapping = getmapping(context, vaddr);
|
||||
|
||||
return mapping != 0;
|
||||
|
||||
}
|
||||
|
||||
void* arch_mmu_getphysicaladdr(arch_mmu_tableptr context, void* addr){
|
||||
uint64_t paddr = getmapping(context, addr);
|
||||
paddr &= ~((uint64_t)0xFFF);
|
||||
@@ -189,10 +197,10 @@ arch_mmu_tableptr arch_mmu_newcontext(){
|
||||
if(!newcontext)
|
||||
return NULL;
|
||||
|
||||
memcpy((void*)newcontext + (size_t)limine_hhdm_offset, context, PAGE_SIZE);
|
||||
memcpy((void*)newcontext + (size_t)limine_hhdm_offset, (void*)context + (uintptr_t)limine_hhdm_offset, PAGE_SIZE);
|
||||
|
||||
memset((void*)newcontext + (size_t)limine_hhdm_offset, 0, PAGE_SIZE / 2);
|
||||
|
||||
|
||||
return newcontext;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user