aboutsummaryrefslogtreecommitdiff
path: root/src/protected_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/protected_mode')
-rw-r--r--src/protected_mode/mod.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs
index 0df8cee..10bc9d6 100644
--- a/src/protected_mode/mod.rs
+++ b/src/protected_mode/mod.rs
@@ -8679,31 +8679,58 @@ fn read_operands<
instruction.regs[0] = RegSpec::cs();
instruction.operands[0] = OperandSpec::RegRRR;
instruction.operand_count = 1;
+
+ // see the comment on mem size as written in OperandCase::FS
+ instruction.mem_size = 2;
}
OperandCase::DS => {
instruction.regs[0] = RegSpec::ds();
instruction.operands[0] = OperandSpec::RegRRR;
instruction.operand_count = 1;
+
+ // see the comment on mem size as written in OperandCase::FS
+ instruction.mem_size = 2;
}
OperandCase::ES => {
instruction.regs[0] = RegSpec::es();
instruction.operands[0] = OperandSpec::RegRRR;
instruction.operand_count = 1;
+
+ // see the comment on mem size as written in OperandCase::FS
+ instruction.mem_size = 2;
}
OperandCase::SS => {
instruction.regs[0] = RegSpec::ss();
instruction.operands[0] = OperandSpec::RegRRR;
instruction.operand_count = 1;
+
+ // see the comment on mem size as written in OperandCase::FS
+ instruction.mem_size = 2;
}
OperandCase::FS => {
instruction.regs[0] = RegSpec::fs();
instruction.operands[0] = OperandSpec::RegRRR;
instruction.operand_count = 1;
+
+ // good grief. from the SDM:
+ //
+ // > If the source operand is a segment register (16 bits) and the operand size is
+ // > 64-bits, a zero-extended value is pushed on the stack; if the operand size is
+ // > 32-bits, either a zero-extended value is pushed on the stack or the segment selector
+ // > is written on the stack using a 16-bit move
+ //
+ // the memory size here really depends on the `Default` bit in the CS descriptor. if
+ // the default operand size is 64 bits (basically all long-mode code), the acccess is
+ // 8 bytes (zero extended). if the default operand size is 32 bits, this is more complex.
+ instruction.mem_size = 4;
}
OperandCase::GS => {
instruction.regs[0] = RegSpec::gs();
instruction.operands[0] = OperandSpec::RegRRR;
instruction.operand_count = 1;
+
+ // see the comment on mem size as written in OperandCase::FS
+ instruction.mem_size = 4;
}
OperandCase::AL_Ib => {
instruction.regs[0] =