aboutsummaryrefslogtreecommitdiff
path: root/src/real_mode/behavior.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2026-05-25 17:32:57 +0000
committeriximeow <me@iximeow.net>2026-05-25 18:00:30 +0000
commitf2a2a09688421f2c532ab6f02527bf68f095407a (patch)
treee7b5c3c5302c4c1a4ef89c1a5852b50059850986 /src/real_mode/behavior.rs
parent94f39674e0aee55ff6f6bb59f7d7c4873d2d1a6c (diff)
j*cxz/pusha/popa alternate size forms
these all existed since forever but the library did not distinguish them and did not provide prefix information for users to tell which had been decoded.
Diffstat (limited to 'src/real_mode/behavior.rs')
-rw-r--r--src/real_mode/behavior.rs38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/real_mode/behavior.rs b/src/real_mode/behavior.rs
index cc7f705..8941ee5 100644
--- a/src/real_mode/behavior.rs
+++ b/src/real_mode/behavior.rs
@@ -140,22 +140,6 @@ impl Instruction {
.set_operand(1, Access::Read)
.set_operand(2, Access::Read);
}
- } else if self.opcode == Opcode::PUSHA {
- if self.prefixes.operand_size() {
- behavior = behavior
- .set_implicit_ops(PUSHAD_IDX);
- } else {
- behavior = behavior
- .set_implicit_ops(PUSHA_IDX);
- }
- } else if self.opcode == Opcode::POPA {
- if self.prefixes.operand_size() {
- behavior = behavior
- .set_implicit_ops(POPAD_IDX);
- } else {
- behavior = behavior
- .set_implicit_ops(POPA_IDX);
- }
} else if self.opcode == Opcode::DIV || self.opcode == Opcode::IDIV {
let op_width = if self.operands[0] == OperandSpec::RegMMM {
self.regs[1].width()
@@ -257,8 +241,7 @@ impl Instruction {
}
} else if self.opcode() == Opcode::LOOPNZ
|| self.opcode() == Opcode::LOOPZ
- || self.opcode() == Opcode::LOOP
- || self.opcode() == Opcode::JCXZ {
+ || self.opcode() == Opcode::LOOP {
if !self.prefixes.operand_size() {
behavior = behavior
.set_implicit_ops(RW_CX_IDX);
@@ -3808,7 +3791,7 @@ fn behavior_table_size_is_right() {
}
/// this table MUST line up with Opcode declaration order in `mod.rs`.
-static TABLE: [BehaviorDigest; 1425] = [
+static TABLE: [BehaviorDigest; 1428] = [
/* ADD => */ GENERAL_RW_R_FLAGWRITE,
/* OR => */ GENERAL_RW_R_FLAGWRITE,
/* ADC => */ GENERAL_RW_R_FLAGRW,
@@ -5424,14 +5407,14 @@ static TABLE: [BehaviorDigest; 1425] = [
/* JCXZ => */ BehaviorDigest::empty()
.set_pl_any()
.set_operand(0, Access::Read)
- .set_nontrivial(true),
+ .set_implicit_ops(RW_CX_IDX),
/* PUSHA => */ BehaviorDigest::empty()
.set_pl_any()
- .set_nontrivial(true),
+ .set_implicit_ops(PUSHA_IDX),
/* POPA => */ BehaviorDigest::empty()
.set_pl_any()
- .set_nontrivial(true),
+ .set_implicit_ops(POPA_IDX),
/* BOUND => */ BehaviorDigest::empty()
.set_pl_any()
.set_operand(0, Access::Read)
@@ -6170,4 +6153,15 @@ static TABLE: [BehaviorDigest; 1425] = [
.set_pl0()
.set_flags_access(Access::Write)
.set_complex(true),
+
+ /* PUSHAD => */ BehaviorDigest::empty()
+ .set_pl_any()
+ .set_implicit_ops(PUSHAD_IDX),
+ /* POPAD => */ BehaviorDigest::empty()
+ .set_pl_any()
+ .set_implicit_ops(POPAD_IDX),
+ /* JECXZ => */ BehaviorDigest::empty()
+ .set_pl_any()
+ .set_operand(0, Access::Read)
+ .set_implicit_ops(RW_ECX_IDX),
];