cpu/{arm|thumb}(chore): change how branch disassembly happens

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-11 23:03:44 +05:30
parent 0062ad424b
commit 78c1150412
10 changed files with 39 additions and 34 deletions

View File

@@ -1,7 +1,6 @@
#include "cpu/arm/instruction.hh"
#include "util/bits.hh"
#include <format>
#include <string>
namespace matar::arm {
std::string
@@ -13,9 +12,11 @@ Instruction::disassemble() {
[condition](BranchAndExchange& data) {
return std::format("BX{} R{:d}", condition, data.rn);
},
[condition](Branch& data) {
return std::format(
"B{}{} 0x{:06X}", (data.link ? "L" : ""), condition, data.offset);
[condition](Branch& data) {
return std::format("B{}{} {:#06x}",
(data.link ? "L" : ""),
condition,
static_cast<int32_t>(data.offset + 2 * INSTRUCTION_SIZE));
},
[condition](Multiply& data) {
if (data.acc) {