set iomb to forbid i/o instructions from user space

add to test that they indeed trap in user space
thanks to pablogventura@gmail.com and nwolovick@gmail.com
This commit is contained in:
Frans Kaashoek 2016-08-26 08:20:11 -04:00
parent 745a4d31a6
commit aff0c8d5c7
2 changed files with 33 additions and 0 deletions

1
vm.c
View file

@ -168,6 +168,7 @@ switchuvm(struct proc *p)
cpu->gdt[SEG_TSS].s = 0;
cpu->ts.ss0 = SEG_KDATA << 3;
cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
cpu->ts.iomb = (ushort) 0xFFFF; // forbid I/O instructions from user space
ltr(SEG_TSS << 3);
if(p->pgdir == 0)
panic("switchuvm: no pgdir");