Update ppc750cl (subi{,s,c} mnemonics, capstone-style CR bits)

This commit is contained in:
Luke Street 2023-10-06 01:22:07 -04:00
parent bb9ff4b928
commit e68629c339
4 changed files with 5 additions and 48 deletions

2
Cargo.lock generated
View File

@ -2799,7 +2799,7 @@ checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b"
[[package]]
name = "ppc750cl"
version = "0.2.0"
source = "git+https://github.com/terorie/ppc750cl?rev=9ae36eef34aa6d74e00972c7671f547a2acfd0aa#9ae36eef34aa6d74e00972c7671f547a2acfd0aa"
source = "git+https://github.com/encounter/ppc750cl?rev=4a2bbbc6f84dcb76255ab6f3595a8d4a0ce96618#4a2bbbc6f84dcb76255ab6f3595a8d4a0ce96618"
dependencies = [
"num-traits",
"serde",

View File

@ -39,7 +39,7 @@ memmap2 = "0.9.0"
notify = "6.1.1"
object = { version = "0.32.1", features = ["read_core", "std", "elf"], default-features = false }
png = "0.17.10"
ppc750cl = { git = "https://github.com/terorie/ppc750cl", rev = "9ae36eef34aa6d74e00972c7671f547a2acfd0aa" }
ppc750cl = { git = "https://github.com/encounter/ppc750cl", rev = "4a2bbbc6f84dcb76255ab6f3595a8d4a0ce96618" }
rabbitizer = "1.7.10"
rfd = { version = "0.12.0" } #, default-features = false, features = ['xdg-portal']
ron = "0.8.1"

View File

@ -38,7 +38,7 @@ pub struct ObjSection {
pub match_percent: f32,
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ObjInsArg {
PpcArg(ppc750cl::Argument),
MipsArg(String),
@ -48,39 +48,6 @@ pub enum ObjInsArg {
BranchOffset(i32),
}
// TODO derive PartialEq on ppc750cl::Argument so this isn't necessary
impl PartialEq for ObjInsArg {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(ObjInsArg::PpcArg(a), ObjInsArg::PpcArg(b)) => {
use ppc750cl::Argument;
match (a, b) {
(Argument::GPR(a), Argument::GPR(b)) => a == b,
(Argument::FPR(a), Argument::FPR(b)) => a == b,
(Argument::SR(a), Argument::SR(b)) => a == b,
(Argument::SPR(a), Argument::SPR(b)) => a == b,
(Argument::CRField(a), Argument::CRField(b)) => a == b,
(Argument::CRBit(a), Argument::CRBit(b)) => a == b,
(Argument::GQR(a), Argument::GQR(b)) => a == b,
(Argument::Uimm(a), Argument::Uimm(b)) => a == b,
(Argument::Simm(a), Argument::Simm(b)) => a == b,
(Argument::Offset(a), Argument::Offset(b)) => a == b,
(Argument::BranchDest(a), Argument::BranchDest(b)) => a == b,
(Argument::Bit(a), Argument::Bit(b)) => a == b,
(Argument::OpaqueU(a), Argument::OpaqueU(b)) => a == b,
(_, _) => false,
}
}
(ObjInsArg::MipsArg(a), ObjInsArg::MipsArg(b)) => a == b,
(ObjInsArg::MipsArgWithBase(a), ObjInsArg::MipsArgWithBase(b)) => a == b,
(ObjInsArg::Reloc, ObjInsArg::Reloc) => true,
(ObjInsArg::RelocWithBase, ObjInsArg::RelocWithBase) => true,
(ObjInsArg::BranchOffset(a), ObjInsArg::BranchOffset(b)) => a == b,
(_, _) => false,
}
}
}
#[derive(Debug, Copy, Clone)]
pub struct ObjInsArgDiff {
/// Incrementing index for coloring

View File

@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use anyhow::Result;
use ppc750cl::{disasm_iter, Argument, Ins, SimplifiedIns};
use ppc750cl::{disasm_iter, Argument, SimplifiedIns};
use crate::obj::{ObjIns, ObjInsArg, ObjReloc, ObjRelocKind};
@ -89,18 +89,8 @@ pub fn process_code(
op: ins.op as u8,
branch_dest: None,
line,
orig: Some(format!("{}", basic_form(ins))),
orig: Some(format!("{}", SimplifiedIns::basic_form(ins))),
});
}
Ok((ops, insts))
}
// TODO make public in ppc750cl
fn basic_form(ins: Ins) -> SimplifiedIns {
SimplifiedIns {
mnemonic: ins.op.mnemonic(),
suffix: ins.suffix(),
args: ins.fields().iter().flat_map(|field| field.argument()).collect(),
ins,
}
}