X86: Fix segment limit checking.

This commit is contained in:
Gabe Black 2009-02-25 10:17:08 -08:00
parent 2f31643db5
commit 08f3a126d5

View file

@ -1192,10 +1192,12 @@ let {{
attr.dpl = desc.dpl; attr.dpl = desc.dpl;
attr.defaultSize = desc.d; attr.defaultSize = desc.d;
if (!desc.s) { if (!desc.s) {
SegBaseDest = SegBaseDest; // The expand down bit happens to be set for gates.
SegLimitDest = SegLimitDest; if (desc.type.e) {
SegAttrDest = SegAttrDest; panic("Gate descriptor encountered.\\n");
panic("System segment encountered.\\n"); }
attr.readable = 1;
attr.writable = 1;
} else { } else {
if (!desc.p) if (!desc.p)
panic("Segment not present.\\n"); panic("Segment not present.\\n");
@ -1207,6 +1209,7 @@ let {{
attr.readable = 1; attr.readable = 1;
attr.writable = desc.type.w; attr.writable = desc.type.w;
} }
}
Addr base = desc.baseLow | (desc.baseHigh << 24); Addr base = desc.baseLow | (desc.baseHigh << 24);
Addr limit = desc.limitLow | (desc.limitHigh << 16); Addr limit = desc.limitLow | (desc.limitHigh << 16);
if (desc.g) if (desc.g)
@ -1214,7 +1217,6 @@ let {{
SegBaseDest = base; SegBaseDest = base;
SegLimitDest = limit; SegLimitDest = limit;
SegAttrDest = attr; SegAttrDest = attr;
}
} else { } else {
SegBaseDest = SegBaseDest; SegBaseDest = SegBaseDest;
SegLimitDest = SegLimitDest; SegLimitDest = SegLimitDest;