aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2024-04-01 23:38:57 -0700
committeriximeow <me@iximeow.net>2024-04-02 00:29:30 -0700
commitbbdf78c061b6e685d1992dcdeac692fc2f8f0d34 (patch)
tree17e0db9b07c6401fd7d424a442f247937aa3c4c9 /src/long_mode/mod.rs
parent96a83895ae7b99efe35c45066e4f35b4c441e359 (diff)
display opt: mem size labels and minor segment reporting changes
for mem size labels: add one new "BUG" entry at the start of the array so `mem_size` does not need to be adjusted before being used to look up a string from the `MEM_SIZE_STRINGS` array. it's hard to measure the direct benefit of this, but it shrinks codegen size by a bit and simplfies a bit of assembly.... for segment reporting changes: stos/scas/lods do not actually need special segment override logic. instead, set their use of `es` when decoded, if appropriate. this is potentially ambiguous; in non-64bit modes the sequence `26aa` would decode as `stos` with explicit `es` prefix. this is now identical to simply decoding `aa`, which now also reports that there is an explicit `es` prefix even though there is no prefix on tne instruction. on the other hand, the prefix-reported segment now more accurately describes the memory selector through which memory accesses will happen. seems ok?
Diffstat (limited to 'src/long_mode/mod.rs')
-rw-r--r--src/long_mode/mod.rs17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 9bc9f0b..f58976a 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -4380,21 +4380,6 @@ impl Instruction {
/// prefixes.
pub fn segment_override_for_op(&self, op: u8) -> Option<Segment> {
match self.opcode {
- Opcode::STOS |
- Opcode::SCAS => {
- if op == 0 {
- Some(Segment::ES)
- } else {
- None
- }
- }
- Opcode::LODS => {
- if op == 1 {
- Some(self.prefixes.segment)
- } else {
- None
- }
- }
Opcode::MOVS => {
if op == 0 {
Some(Segment::ES)
@@ -9002,6 +8987,7 @@ fn read_operands<
}
OperandCase::Yb_AL => {
instruction.regs[0] = RegSpec::al();
+ instruction.prefixes.segment = Segment::ES;
if instruction.prefixes.address_size() {
instruction.regs[1] = RegSpec::edi();
} else {
@@ -9028,6 +9014,7 @@ fn read_operands<
let bank = bank_from_prefixes_64(SizeCode::vqp, instruction.prefixes);
instruction.regs[0].num = 0;
instruction.regs[0].bank = bank;
+ instruction.prefixes.segment = Segment::ES;
if instruction.prefixes.address_size() {
instruction.regs[1] = RegSpec::edi();
} else {