diff --git a/arch/amd64/hw/timer.c b/arch/amd64/hw/timer.c index 1df29ae..8e089fc 100644 --- a/arch/amd64/hw/timer.c +++ b/arch/amd64/hw/timer.c @@ -129,8 +129,9 @@ void amd64_timer_init(void) { // LAPIC Timer is only used to trigger task switches LAPIC(LAPIC_REG_TMRDIV) = 0x3; LAPIC(LAPIC_REG_LVTT) = 32 | (1 << 17); - LAPIC(LAPIC_REG_TMRINITCNT) = 1562500; + LAPIC(LAPIC_REG_TMRINITCNT) = 150000; LAPIC(LAPIC_REG_TMRCURRCNT) = 0; get_cpu()->ticks = 0; + asm volatile ("cli"); } diff --git a/sys/thread.c b/sys/thread.c index d7281a6..bac5c0c 100644 --- a/sys/thread.c +++ b/sys/thread.c @@ -562,14 +562,17 @@ int sys_execve(const char *path, const char **argv, const char **envp) { thr->sigq = 0; thr->space = amd64_mm_pool_alloc(); - _assert(thr->space); - thr->data.cr3 = MM_PHYS(thr->space); thr->flags = 0; + _assert(thr->space); + mm_space_clone(thr->space, mm_kernel, MM_CLONE_FLG_KERNEL); + + asm volatile ("cli"); thr->data.fxsave = kmalloc(FXSAVE_REGION); _assert(thr->data.fxsave); - mm_space_clone(thr->space, mm_kernel, MM_CLONE_FLG_KERNEL); + thr->data.cr3 = MM_PHYS(thr->space); + asm volatile ("sti"); } else { mm_space_release(thr); }