summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-14 04:55:45 +0000
committerrsc <rsc>2007-08-14 04:55:45 +0000
commit2ef3a64bb4923d3458bac1393dd9e205f0acd93a (patch)
tree2f56b815b2a7182b9d029cb71f75f4d7df6a676a /proc.c
parent64659055bd8ed3717a691d0311666d94195aebee (diff)
downloadxv6-labs-2ef3a64bb4923d3458bac1393dd9e205f0acd93a.tar.gz
xv6-labs-2ef3a64bb4923d3458bac1393dd9e205f0acd93a.tar.bz2
xv6-labs-2ef3a64bb4923d3458bac1393dd9e205f0acd93a.zip
Because limit gives the address of the last addressable
byte in the segment, the limit argument to SEG16 and SEG needs to have 1 subtracted from it.
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/proc.c b/proc.c
index 6df3814..dfa988e 100644
--- a/proc.c
+++ b/proc.c
@@ -38,13 +38,13 @@ setupsegs(struct proc *p)
}
c->gdt[0] = SEG_NULL;
- c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024, 0);
+ c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024-1, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
- c->gdt[SEG_TSS] = SEG16(STS_T32A, (uint) &c->ts, sizeof(c->ts), 0);
+ c->gdt[SEG_TSS] = SEG16(STS_T32A, (uint)&c->ts, sizeof(c->ts)-1, 0);
c->gdt[SEG_TSS].s = 0;
if(p){
- c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, (uint)p->mem, p->sz, DPL_USER);
- c->gdt[SEG_UDATA] = SEG(STA_W, (uint)p->mem, p->sz, DPL_USER);
+ c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, (uint)p->mem, p->sz-1, DPL_USER);
+ c->gdt[SEG_UDATA] = SEG(STA_W, (uint)p->mem, p->sz-1, DPL_USER);
} else {
c->gdt[SEG_UCODE] = SEG_NULL;
c->gdt[SEG_UDATA] = SEG_NULL;