summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-04 21:38:16 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-04 21:38:16 -0400
commit69a27cf95a8a8e3bbbd5e3d81a36893bf312cf3e (patch)
tree47ff56106345e43fbb5184071c8fe72987fe62bb /arch/x86_64/hal
parent1768abb217f974cf96448ee847453b604800c546 (diff)
downloadjove-kernel-69a27cf95a8a8e3bbbd5e3d81a36893bf312cf3e.tar.gz
jove-kernel-69a27cf95a8a8e3bbbd5e3d81a36893bf312cf3e.tar.bz2
jove-kernel-69a27cf95a8a8e3bbbd5e3d81a36893bf312cf3e.zip
add usermode jump into init
Diffstat (limited to 'arch/x86_64/hal')
-rw-r--r--arch/x86_64/hal/paging.c2
-rw-r--r--arch/x86_64/hal/paging.h4
-rw-r--r--arch/x86_64/hal/smp.c1
3 files changed, 4 insertions, 3 deletions
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);