提交 2ee21cd7 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Switch T_SYSCALL to interrupt gate, call sti before syscall handling.

上级 778e40e8
...@@ -42,11 +42,8 @@ extern u64 trapentry[]; ...@@ -42,11 +42,8 @@ extern u64 trapentry[];
void void
trap(struct trapframe *tf) trap(struct trapframe *tf)
{ {
// XXX(sbw) eventually these should be moved into trapasm.S
cli();
writegs(KDSEG); writegs(KDSEG);
writemsr(MSR_GS_BASE, (u64)&cpus[cpunum()].cpu); writemsr(MSR_GS_BASE, (u64)&cpus[cpunum()].cpu);
sti();
if (tf->trapno == T_NMI) { if (tf->trapno == T_NMI) {
// The only locks that we can acquire during NMI are ones // The only locks that we can acquire during NMI are ones
...@@ -58,6 +55,7 @@ trap(struct trapframe *tf) ...@@ -58,6 +55,7 @@ trap(struct trapframe *tf)
// XXX(sbw) sysenter/sysexit // XXX(sbw) sysenter/sysexit
if(tf->trapno == T_SYSCALL){ if(tf->trapno == T_SYSCALL){
sti();
if(myproc()->killed) { if(myproc()->killed) {
mtstart(trap, myproc()); mtstart(trap, myproc());
exit(); exit();
...@@ -180,7 +178,7 @@ inittrap(void) ...@@ -180,7 +178,7 @@ inittrap(void)
idt[i] = INTDESC(KCSEG, entry, bits); idt[i] = INTDESC(KCSEG, entry, bits);
} }
entry = trapentry[T_SYSCALL]; entry = trapentry[T_SYSCALL];
idt[T_SYSCALL] = INTDESC(KCSEG, entry, SEG_DPL(3) | SEG_TRAP64 |INT_P); idt[T_SYSCALL] = INTDESC(KCSEG, entry, SEG_DPL(3) | SEG_INTR64 |INT_P);
} }
void void
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论