SYSENTER support on other cores other than core 0.
authorDavid Zhu <yuzhu@cs.berkeley.edu>
Tue, 12 May 2009 00:03:55 +0000 (17:03 -0700)
committerDavid Zhu <yuzhu@cs.berkeley.edu>
Tue, 12 May 2009 00:03:55 +0000 (17:03 -0700)
kern/init.c
kern/smp.c
kern/trap.c
kern/trap.h

index 9f9f8c7..132d07d 100644 (file)
@@ -82,12 +82,13 @@ void kernel_init(multiboot_info_t *mboot_info)
        //ENV_CREATE(user_buggyhello);
        //ENV_CREATE(user_evilhello);
        ENV_CREATE(user_hello);
-       //ENV_CREATE(user_hello);
+       ENV_CREATE(user_hello);
        //ENV_CREATE(user_hello);
        //ENV_CREATE(user_hello);
        //ENV_CREATE(user_null);
        //ENV_CREATE(user_null);
        env_run(&envs[0]);
+       env_run(&envs[1]);
        panic("Don't Panic");
        // ENV_CREATE(user_null);
        /*ENV_CREATE(user_null);
index dd121c0..8c1881c 100644 (file)
@@ -14,6 +14,7 @@
 #include <kern/env.h>
 #include <kern/apic.h>
 #include <kern/atomic.h>
+#include <kern/trap.h>
 
 volatile uint8_t num_cpus = 0xee;
 uintptr_t smp_stack_top;
@@ -170,6 +171,11 @@ uint32_t smp_main(void)
        // Won't actually start using this stack til our first interrupt
        // (issues with changing the stack pointer and then trying to "return")
        uintptr_t my_stack_top = (uintptr_t)my_ts;
+       
+       // Set up MSR for SYSENTER 
+       write_msr(MSR_IA32_SYSENTER_CS, GD_KT);
+       write_msr(MSR_IA32_SYSENTER_ESP, my_stack_top);
+       write_msr(MSR_IA32_SYSENTER_EIP, (uint32_t) &sysenter_handler);
 
        // Build and load the gdt / gdt_pd
        memcpy(my_gdt, gdt, sizeof(segdesc_t)*SEG_COUNT);
index cf80bbb..8186c8d 100644 (file)
@@ -316,7 +316,6 @@ page_fault_handler(trapframe_t *tf)
        print_trapframe(tf);
        env_destroy(curenv);
 }
-extern void sysenter_handler();
 void sysenter_init(void)
 {
        write_msr(MSR_IA32_SYSENTER_CS, GD_KT);
index 5d4ceed..0d68a5b 100644 (file)
@@ -33,5 +33,5 @@ void (IN_HANDLER page_fault_handler)(trapframe_t *tf);
 void backtrace(trapframe_t *tf);
 
 void sysenter_init(void);
-
+extern void sysenter_handler();
 #endif /* ROS_KERN_TRAP_H */