mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
mmu: make sure a few constants are 64 bit
This commit is contained in:
@@ -52,14 +52,14 @@ static void invalidate(void* addr){
|
|||||||
|
|
||||||
static uint64_t* next(uint64_t* table, size_t offset){
|
static uint64_t* next(uint64_t* table, size_t offset){
|
||||||
|
|
||||||
table = (uint64_t)table & ~(0xFFF);
|
table = (uint64_t)table & ~((uint64_t)0xFFF);
|
||||||
|
|
||||||
if(table < limine_hhdm_offset){
|
if(table < limine_hhdm_offset){
|
||||||
table = (uint64_t)table & ~(1 << 63); // remove NX
|
table = (uint64_t)table & ~(1 << (uint64_t)63); // remove NX
|
||||||
table = (uint64_t)table + (uint64_t)limine_hhdm_offset;
|
table = (uint64_t)table + (uint64_t)limine_hhdm_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return table[offset] & ~(0xFFF);
|
return table[offset] & ~((uint64_t)0xFFF);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +135,8 @@ static uint64_t getmapping(arch_mmu_tableptr context, void* vaddr){
|
|||||||
|
|
||||||
void* arch_mmu_getphysicaladdr(arch_mmu_tableptr context, void* addr){
|
void* arch_mmu_getphysicaladdr(arch_mmu_tableptr context, void* addr){
|
||||||
uint64_t paddr = getmapping(context, addr);
|
uint64_t paddr = getmapping(context, addr);
|
||||||
paddr &= ~(0xFFF);
|
paddr &= ~((uint64_t)0xFFF);
|
||||||
paddr &= ~ARCH_MMU_MAP_NOEXEC;
|
paddr &= ~(uint64_t)ARCH_MMU_MAP_NOEXEC;
|
||||||
return paddr;
|
return paddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,12 +145,14 @@ bool arch_mmu_isaccessed(arch_mmu_tableptr context, void* addr){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void arch_mmu_changeflags(arch_mmu_tableptr context, void* addr, size_t flags, size_t count){
|
void arch_mmu_changeflags(arch_mmu_tableptr context, void* addr, size_t flags, size_t count){
|
||||||
|
|
||||||
for(size_t i = 0; i < count; ++i){
|
for(size_t i = 0; i < count; ++i){
|
||||||
uint64_t mapping = getmapping(context, addr);
|
uint64_t mapping = getmapping(context, addr);
|
||||||
if(!mapping)
|
if(!mapping)
|
||||||
continue;
|
continue;
|
||||||
mapping &= ~(0xFFF); // get addr
|
|
||||||
mapping &= ~ARCH_MMU_MAP_NOEXEC;
|
mapping &= ~((uint64_t)0xFFF); // get addr
|
||||||
|
mapping &= ~((uint64_t)1 << 63);
|
||||||
mapping |= flags;
|
mapping |= flags;
|
||||||
setpage(context, addr, mapping);
|
setpage(context, addr, mapping);
|
||||||
addr += PAGE_SIZE;
|
addr += PAGE_SIZE;
|
||||||
@@ -166,7 +168,6 @@ int arch_mmu_map(arch_mmu_tableptr context, void* paddr, void* vaddr, size_t fla
|
|||||||
|
|
||||||
int ret = setpage(context, vaddr, entry);
|
int ret = setpage(context, vaddr, entry);
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user