x86: add kpptr_to_paddr
This commit introduces the idea of a 'kpptr', which is simply an address that is a kernel symbol. This allows for, in the future, to have two different translations (between pointers and physical addresses) one for kernel symbols, and one for other memory
This commit is contained in:
parent
486a80fe78
commit
933bd8b00a
2 changed files with 7 additions and 2 deletions
|
|
@ -46,6 +46,11 @@ pptr_to_paddr(void* pptr)
|
|||
return (paddr_t)pptr - BASE_OFFSET;
|
||||
}
|
||||
|
||||
/* For a 32-bit system there is no difference in how we translates
|
||||
* physical address for the kernel symbols or anything else */
|
||||
#define paddr_to_kpptr(x) paddr_to_pptr(x)
|
||||
#define kpptr_to_paddr(x) pptr_to_paddr(x)
|
||||
|
||||
static inline region_t CONST
|
||||
paddr_to_pptr_reg(p_region_t p_reg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ try_boot_sys_node(cpu_id_t cpu_id)
|
|||
)) {
|
||||
return false;
|
||||
}
|
||||
write_cr3(pptr_to_paddr(X86_GLOBAL_VSPACE_ROOT));
|
||||
write_cr3(kpptr_to_paddr(X86_GLOBAL_VSPACE_ROOT));
|
||||
/* Sync up the compilers view of the world here to force the PD to actually
|
||||
* be set *right now* instead of delayed */
|
||||
asm volatile("" ::: "memory");
|
||||
|
|
@ -296,7 +296,7 @@ try_boot_sys(
|
|||
);
|
||||
|
||||
boot_state.ki_p_reg.start = PADDR_LOAD;
|
||||
boot_state.ki_p_reg.end = pptr_to_paddr(ki_end);
|
||||
boot_state.ki_p_reg.end = kpptr_to_paddr(ki_end);
|
||||
|
||||
printf("Kernel loaded to: start=0x%lx end=0x%lx size=0x%lx entry=0x%lx\n",
|
||||
boot_state.ki_p_reg.start,
|
||||
|
|
|
|||
Loading…
Reference in a new issue