wrlimit cs, t1, dataSize=4
# Not writable, read/execute-able, not expandDown,
# dpl=0, defaultSize=0, long mode
- limm t4, ((0 << 0) | (1 << 1) | (0 << 2) | \
- (0 << 3) | (0 << 5) | (1 << 6)), dataSize=8
+ limm t4, ((0 << 0) | (0 << 2) | (0 << 3) | \
+ (1 << 4) | (0 << 5) | (1 << 6) | \
+ (1 << 7) | (10 << 8) | (0 << 12) | \
+ (1 << 13) | (0 << 14) | (1 << 15)), dataSize=8
wrattr cs, t4
# Set up SS.
wrlimit ss, t1, dataSize=4
# Writable, readable, not expandDown,
# dpl=0, defaultSize=0, not long mode
- limm t4, ((1 << 0) | (1 << 1) | (0 << 2) | \
- (0 << 3) | (0 << 5) | (0 << 6)), dataSize=8
+ limm t4, ((0 << 0) | (0 << 2) | (1 << 3) | \
+ (0 << 4) | (0 << 5) | (1 << 6) | \
+ (1 << 7) | (2 << 8) | (1 << 12) | \
+ (1 << 13) | (0 << 14) | (1 << 15)), dataSize=8
wrattr ss, t4
# Set the new rip.
wrlimit cs, t1, dataSize=4
# Not writable, read/execute-able, not expandDown,
# dpl=0, defaultSize=0, long mode
- limm t4, ((0 << 0) | (1 << 1) | (0 << 2) | \
- (0 << 3) | (0 << 5) | (1 << 6)), dataSize=8
+ limm t4, ((0 << 0) | (0 << 2) | (0 << 3) | \
+ (1 << 4) | (0 << 5) | (1 << 6) | \
+ (1 << 7) | (10 << 8) | (0 << 12) | \
+ (1 << 13) | (0 << 14) | (1 << 15)), dataSize=8
wrattr cs, t4
# Set up SS.
wrlimit ss, t1, dataSize=4
# Writable, readable, not expandDown,
# dpl=0, defaultSize=0, not long mode
- limm t4, ((1 << 0) | (1 << 1) | (0 << 2) | \
- (0 << 3) | (0 << 5) | (0 << 6)), dataSize=8
+ limm t4, ((0 << 0) | (0 << 2) | (1 << 3) | \
+ (0 << 4) | (0 << 5) | (1 << 6) | \
+ (1 << 7) | (2 << 8) | (1 << 12) | \
+ (1 << 13) | (0 << 14) | (1 << 15)), dataSize=8
wrattr ss, t4
# Set the new rip.
wrlimit cs, t1, dataSize=4
# Not writable, read/execute-able, not expandDown,
# dpl=3, defaultSize=0, long mode
- limm t4, ((0 << 0) | (1 << 1) | (0 << 2) | \
- (3 << 3) | (0 << 5) | (1 << 6)), dataSize=8
+ limm t4, ((3 << 0) | (0 << 2) | (0 << 3) | \
+ (1 << 4) | (0 << 5) | (1 << 6) | \
+ (1 << 7) | (10 << 8) | (0 << 12) | \
+ (1 << 13) | (0 << 14) | (1 << 15)), dataSize=8
wrattr cs, t4
# Only the selector is changed for SS.
wrlimit cs, t1, dataSize=4
# Not writable, read/execute-able, not expandDown,
# dpl=3, defaultSize=1, not long mode
- limm t4, ((0 << 0) | (1 << 1) | (0 << 2) | \
- (3 << 3) | (1 << 5) | (0 << 6)), dataSize=8
+ limm t4, ((3 << 0) | (0 << 2) | (0 << 3) | \
+ (1 << 4) | (0 << 5) | (1 << 6) | \
+ (1 << 7) | (10 << 8) | (0 << 12) | \
+ (1 << 13) | (0 << 14) | (1 << 15)), dataSize=8
wrattr cs, t4
# Only the selector is changed for SS.
# Check if we're changing privelege level. At this point we can assume
# we're going to a DPL that's less than or equal to the CPL.
rdattr t10, hs, dataSize=8
- srli t10, t10, 3, dataSize=8
andi t10, t10, 3, dataSize=8
rdattr t5, cs, dataSize=8
- srli t5, t5, 3, dataSize=8
andi t5, t5, 0x3, dataSize=8
sub t0, t5, t10, flags=(EZF,), dataSize=8
# We're going to change priviledge, so zero out the stack selector. We
ThreadContext * tc = system->getThreadContext(contextIds[i]);
SegAttr dataAttr = 0;
+ dataAttr.dpl = 3;
+ dataAttr.unusable = 0;
+ dataAttr.defaultSize = 1;
+ dataAttr.longMode = 1;
+ dataAttr.avl = 0;
+ dataAttr.granularity = 1;
+ dataAttr.present = 1;
+ dataAttr.type = 3;
dataAttr.writable = 1;
dataAttr.readable = 1;
dataAttr.expandDown = 0;
- dataAttr.dpl = 3;
- dataAttr.defaultSize = 0;
- dataAttr.longMode = 1;
+ dataAttr.system = 1;
//Initialize the segment registers.
for(int seg = 0; seg < NUM_SEGMENTREGS; seg++) {
}
SegAttr csAttr = 0;
- csAttr.writable = 0;
- csAttr.readable = 1;
- csAttr.expandDown = 0;
csAttr.dpl = 3;
+ csAttr.unusable = 0;
csAttr.defaultSize = 0;
csAttr.longMode = 1;
+ csAttr.avl = 0;
+ csAttr.granularity = 1;
+ csAttr.present = 1;
+ csAttr.type = 10;
+ csAttr.writable = 0;
+ csAttr.readable = 1;
+ csAttr.expandDown = 0;
+ csAttr.system = 1;
tc->setMiscRegNoEffect(MISCREG_CS_ATTR, csAttr);
ThreadContext * tc = system->getThreadContext(contextIds[i]);
SegAttr dataAttr = 0;
- dataAttr.writable = 1;
- dataAttr.readable = 1;
- dataAttr.expandDown = 0;
dataAttr.dpl = 3;
+ dataAttr.unusable = 0;
dataAttr.defaultSize = 1;
dataAttr.longMode = 0;
+ dataAttr.avl = 0;
+ dataAttr.granularity = 1;
+ dataAttr.present = 1;
+ dataAttr.type = 3;
+ dataAttr.writable = 1;
+ dataAttr.readable = 1;
+ dataAttr.expandDown = 0;
+ dataAttr.system = 1;
//Initialize the segment registers.
for(int seg = 0; seg < NUM_SEGMENTREGS; seg++) {
}
SegAttr csAttr = 0;
- csAttr.writable = 0;
- csAttr.readable = 1;
- csAttr.expandDown = 0;
csAttr.dpl = 3;
+ csAttr.unusable = 0;
csAttr.defaultSize = 1;
csAttr.longMode = 0;
+ csAttr.avl = 0;
+ csAttr.granularity = 1;
+ csAttr.present = 1;
+ csAttr.type = 0xa;
+ csAttr.writable = 0;
+ csAttr.readable = 1;
+ csAttr.expandDown = 0;
+ csAttr.system = 1;
tc->setMiscRegNoEffect(MISCREG_CS_ATTR, csAttr);