Skip to content

Commit e68629c

Browse files
committed
Update ppc750cl (subi{,s,c} mnemonics, capstone-style CR bits)
1 parent bb9ff4b commit e68629c

File tree

4 files changed

+5
-48
lines changed

4 files changed

+5
-48
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ memmap2 = "0.9.0"
3939
notify = "6.1.1"
4040
object = { version = "0.32.1", features = ["read_core", "std", "elf"], default-features = false }
4141
png = "0.17.10"
42-
ppc750cl = { git = "https://github.com/terorie/ppc750cl", rev = "9ae36eef34aa6d74e00972c7671f547a2acfd0aa" }
42+
ppc750cl = { git = "https://github.com/encounter/ppc750cl", rev = "4a2bbbc6f84dcb76255ab6f3595a8d4a0ce96618" }
4343
rabbitizer = "1.7.10"
4444
rfd = { version = "0.12.0" } #, default-features = false, features = ['xdg-portal']
4545
ron = "0.8.1"

src/obj/mod.rs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct ObjSection {
3838
pub match_percent: f32,
3939
}
4040

41-
#[derive(Debug, Clone)]
41+
#[derive(Debug, Clone, Eq, PartialEq)]
4242
pub enum ObjInsArg {
4343
PpcArg(ppc750cl::Argument),
4444
MipsArg(String),
@@ -48,39 +48,6 @@ pub enum ObjInsArg {
4848
BranchOffset(i32),
4949
}
5050

51-
// TODO derive PartialEq on ppc750cl::Argument so this isn't necessary
52-
impl PartialEq for ObjInsArg {
53-
fn eq(&self, other: &Self) -> bool {
54-
match (self, other) {
55-
(ObjInsArg::PpcArg(a), ObjInsArg::PpcArg(b)) => {
56-
use ppc750cl::Argument;
57-
match (a, b) {
58-
(Argument::GPR(a), Argument::GPR(b)) => a == b,
59-
(Argument::FPR(a), Argument::FPR(b)) => a == b,
60-
(Argument::SR(a), Argument::SR(b)) => a == b,
61-
(Argument::SPR(a), Argument::SPR(b)) => a == b,
62-
(Argument::CRField(a), Argument::CRField(b)) => a == b,
63-
(Argument::CRBit(a), Argument::CRBit(b)) => a == b,
64-
(Argument::GQR(a), Argument::GQR(b)) => a == b,
65-
(Argument::Uimm(a), Argument::Uimm(b)) => a == b,
66-
(Argument::Simm(a), Argument::Simm(b)) => a == b,
67-
(Argument::Offset(a), Argument::Offset(b)) => a == b,
68-
(Argument::BranchDest(a), Argument::BranchDest(b)) => a == b,
69-
(Argument::Bit(a), Argument::Bit(b)) => a == b,
70-
(Argument::OpaqueU(a), Argument::OpaqueU(b)) => a == b,
71-
(_, _) => false,
72-
}
73-
}
74-
(ObjInsArg::MipsArg(a), ObjInsArg::MipsArg(b)) => a == b,
75-
(ObjInsArg::MipsArgWithBase(a), ObjInsArg::MipsArgWithBase(b)) => a == b,
76-
(ObjInsArg::Reloc, ObjInsArg::Reloc) => true,
77-
(ObjInsArg::RelocWithBase, ObjInsArg::RelocWithBase) => true,
78-
(ObjInsArg::BranchOffset(a), ObjInsArg::BranchOffset(b)) => a == b,
79-
(_, _) => false,
80-
}
81-
}
82-
}
83-
8451
#[derive(Debug, Copy, Clone)]
8552
pub struct ObjInsArgDiff {
8653
/// Incrementing index for coloring

src/obj/ppc.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::BTreeMap;
22

33
use anyhow::Result;
4-
use ppc750cl::{disasm_iter, Argument, Ins, SimplifiedIns};
4+
use ppc750cl::{disasm_iter, Argument, SimplifiedIns};
55

66
use crate::obj::{ObjIns, ObjInsArg, ObjReloc, ObjRelocKind};
77

@@ -89,18 +89,8 @@ pub fn process_code(
8989
op: ins.op as u8,
9090
branch_dest: None,
9191
line,
92-
orig: Some(format!("{}", basic_form(ins))),
92+
orig: Some(format!("{}", SimplifiedIns::basic_form(ins))),
9393
});
9494
}
9595
Ok((ops, insts))
9696
}
97-
98-
// TODO make public in ppc750cl
99-
fn basic_form(ins: Ins) -> SimplifiedIns {
100-
SimplifiedIns {
101-
mnemonic: ins.op.mnemonic(),
102-
suffix: ins.suffix(),
103-
args: ins.fields().iter().flat_map(|field| field.argument()).collect(),
104-
ins,
105-
}
106-
}

0 commit comments

Comments
 (0)