summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-28 09:13:24 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-28 09:13:24 +0200
commita63d034fdab18dd14ee34bc438f4c6cf72a839d7 (patch)
tree726d265ee0820b226443d8624e3d10a22ba93ede
parentf84498ff447cc4bf891999e782ef90bfbc9577bd (diff)
MHR-21: Fix ordering of cmp* instructions of PPCasm.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--Examples/ExamplePowerPC.S1
-rw-r--r--Sources/ppcasm.cc6
2 files changed, 4 insertions, 3 deletions
diff --git a/Examples/ExamplePowerPC.S b/Examples/ExamplePowerPC.S
index 9615fe8..b9de796 100644
--- a/Examples/ExamplePowerPC.S
+++ b/Examples/ExamplePowerPC.S
@@ -4,4 +4,5 @@ b 0x1000
mflr r21
mtlr r21
li r3, 0
+cmpw r10, r11
stw r7, r5+36
diff --git a/Sources/ppcasm.cc b/Sources/ppcasm.cc
index 9d12922..3260662 100644
--- a/Sources/ppcasm.cc
+++ b/Sources/ppcasm.cc
@@ -909,15 +909,15 @@ bool CompilerKit::EncoderPowerPC::WriteLine(std::string &line,
}
if (opcodeName.find("cmp") != std::string::npos) {
- char rightReg = 0;
+ char rightReg = 0x0;
- for (size_t i = 0; i != found_registers_index[0]; i++) {
+ for (size_t i = 0; i != found_registers_index[1]; i++) {
rightReg += 0x08;
}
kBytes.emplace_back(0x00);
kBytes.emplace_back(rightReg);
- kBytes.emplace_back(found_registers_index[1]);
+ kBytes.emplace_back(found_registers_index[0]);
kBytes.emplace_back(0x7c);
}