summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2016-08-26 08:20:11 -0400
committerFrans Kaashoek <[email protected]>2016-08-26 08:20:11 -0400
commitaff0c8d5c709dc02669fbaa4b5ff2cfdda122a61 (patch)
treef369242b79c3d6ac61d21ba5fbc526b815096260 /vm.c
parent745a4d31a6221c2c4b2b78f308c84edcbfb471d5 (diff)
downloadxv6-labs-aff0c8d5c709dc02669fbaa4b5ff2cfdda122a61.tar.gz
xv6-labs-aff0c8d5c709dc02669fbaa4b5ff2cfdda122a61.tar.bz2
xv6-labs-aff0c8d5c709dc02669fbaa4b5ff2cfdda122a61.zip
set iomb to forbid i/o instructions from user space
add to test that they indeed trap in user space thanks to [email protected] and [email protected]
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 16fb03b..d4982ee 100644
--- a/vm.c
+++ b/vm.c
@@ -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");