Implement the fast syscall challenge.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <inc/stdio.h>
|
||||
#include <inc/string.h>
|
||||
#include <inc/assert.h>
|
||||
#include <inc/x86.h>
|
||||
|
||||
#include <kern/monitor.h>
|
||||
#include <kern/console.h>
|
||||
@@ -11,6 +12,7 @@
|
||||
#include <kern/env.h>
|
||||
#include <kern/trap.h>
|
||||
|
||||
void sysenter_handler();
|
||||
|
||||
void
|
||||
i386_init(void)
|
||||
@@ -34,6 +36,10 @@ i386_init(void)
|
||||
"\33[34m" "r"
|
||||
"\33[0m" " Works!" "\n");
|
||||
|
||||
write_msr(MSR_IA32_SYSENTER_EIP, (uint32_t) sysenter_handler, 0);
|
||||
write_msr(MSR_IA32_SYSENTER_ESP, KSTACKTOP, 0);
|
||||
write_msr(MSR_IA32_SYSENTER_CS, GD_KT, 0);
|
||||
|
||||
// Lab 2 memory management initialization functions
|
||||
mem_init();
|
||||
|
||||
|
||||
@@ -43,6 +43,21 @@
|
||||
|
||||
.text
|
||||
|
||||
.globl sysenter_handler
|
||||
sysenter_handler:
|
||||
push %ebp // holds env's stack pointer
|
||||
push %esi // holds the env's return addr
|
||||
push %edi
|
||||
push %ebx
|
||||
push %ecx
|
||||
push %edx
|
||||
push %eax
|
||||
call syscall
|
||||
add $0x14, %esp
|
||||
pop %edx
|
||||
pop %ecx
|
||||
sysexit
|
||||
|
||||
/*
|
||||
* Lab 3: Your code here for generating entry points for the different traps.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user