From 69a27cf95a8a8e3bbbd5e3d81a36893bf312cf3e Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 4 Sep 2026 21:38:16 -0400 Subject: add usermode jump into init --- arch/x86_64/hal/paging.c | 2 +- arch/x86_64/hal/paging.h | 4 ++-- arch/x86_64/hal/smp.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'arch/x86_64/hal') diff --git a/arch/x86_64/hal/paging.c b/arch/x86_64/hal/paging.c index 9ef67ab..5887e79 100644 --- a/arch/x86_64/hal/paging.c +++ b/arch/x86_64/hal/paging.c @@ -164,7 +164,7 @@ paging_pml4_init(void) size_t l2 = l1 / 512; size_t l1_mod = l1 % 512; - ident_pml2[l2][l1_mod].value = (l1 << 21) | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_PS | PAGE_GLOBAL; + ident_pml2[l2][l1_mod].value = (l1 << 21) | PAGE_PRESENT | PAGE_WRITEABLE | PAGE_PS | PAGE_GLOBAL | PAGE_XD; ident_pml2[l2][l1_mod].xd = 1; } diff --git a/arch/x86_64/hal/paging.h b/arch/x86_64/hal/paging.h index eb916a3..5736326 100644 --- a/arch/x86_64/hal/paging.h +++ b/arch/x86_64/hal/paging.h @@ -40,11 +40,11 @@ typedef union page_table_entry extern void *_kernel_physptr; #define PMLI_SHL(l) (12 + (l * 9)) -#define PMLI_MASK(l) (~0xFFFF << PMLI_SHL(l)) +#define PMLI_MASK(l) (~0xFFFFULL << PMLI_SHL(l)) #define IDENT_VIRT_BASE 0xFFFF800000000000ULL #define KERNEL_VIRT_BASE 0xFFFFFFFF80000000ULL -#define KPTR_TOPHYS(v) ((uintptr_t)v - KERNEL_VIRT_BASE + (uintptr_t)_kernel_physptr) +#define KPTR_TOPHYS(v) (((uintptr_t)v) - KERNEL_VIRT_BASE + (uintptr_t)_kernel_physptr) uintptr_t paging_get_pml4(void); void paging_pml4_init(void); diff --git a/arch/x86_64/hal/smp.c b/arch/x86_64/hal/smp.c index a28fdc1..0b1ed9d 100644 --- a/arch/x86_64/hal/smp.c +++ b/arch/x86_64/hal/smp.c @@ -27,6 +27,7 @@ init_processor(processor_t *processor, jove_owned_obj_t *obj) gdt_setup(processor); idt_setup(processor); + msr_enable_sce(); msr_set_gs_base((uintptr_t)processor); obj_settype(obj, JOVE_OBJ_PROCESSOR); -- cgit v1.2.3