Fix user apps randomly crashing (APIC, GDT layout, syscall entry)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 23s

This commit is contained in:
2026-01-14 19:51:18 +01:00
parent 0d8f9e565f
commit d1d772cb42
23 changed files with 276 additions and 204 deletions

View File

@@ -37,7 +37,11 @@ static uintptr_t amd64_current_cr3 (void) {
/* Load kernel CR3 as current CR3 */
void amd64_load_kernel_cr3 (void) {
__asm__ volatile ("movq %0, %%cr3" ::"r"(kernel_pd.cr3_paddr) : "memory");
uintptr_t cr3 = amd64_current_cr3 ();
if (cr3 != kernel_pd.cr3_paddr) {
__asm__ volatile ("movq %0, %%cr3" ::"r"(kernel_pd.cr3_paddr) : "memory");
}
}
/* Extract PML info from virtual address */