x86: Use faster accessors for MSR_KERNEL_GS_BASE
[akaros.git] / kern / arch / x86 / trap.c
index 2a6134c..75ab49d 100644 (file)
@@ -162,10 +162,6 @@ void idt_init(void)
        x86_sysenter_init();
        set_stack_top((uintptr_t)bootstacktop);
 
-#ifdef CONFIG_KTHREAD_POISON
-       *kstack_bottom_addr((uintptr_t)bootstacktop) = 0xdeadbeef;
-#endif /* CONFIG_KTHREAD_POISON */
-
        /* Initialize the TSS field of the gdt.  The size of the TSS desc differs
         * between 64 and 32 bit, hence the pointer acrobatics */
        syssegdesc_t *ts_slot = (syssegdesc_t*)&gdt[GD_TSS >> 3];
@@ -1132,16 +1128,16 @@ void handle_vmexit(struct vm_trapframe *tf)
  * loaded with the current GS (the kernel's). */
 static void x86_finalize_hwtf(struct hw_trapframe *tf)
 {
-       tf->tf_gsbase = read_msr(MSR_KERNEL_GS_BASE);
-       write_msr(MSR_KERNEL_GS_BASE, read_gsbase());
+       tf->tf_gsbase = read_kern_gsbase();
+       write_kern_gsbase(read_gsbase());
        tf->tf_fsbase = read_fsbase();
        x86_hwtf_clear_partial(tf);
 }
 
 static void x86_finalize_swtf(struct sw_trapframe *tf)
 {
-       tf->tf_gsbase = read_msr(MSR_KERNEL_GS_BASE);
-       write_msr(MSR_KERNEL_GS_BASE, read_gsbase());
+       tf->tf_gsbase = read_kern_gsbase();
+       write_kern_gsbase(read_gsbase());
        tf->tf_fsbase = read_fsbase();
        x86_swtf_clear_partial(tf);
 }