Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting AddrSpace by Address space ID #1

Open
befoulad opened this issue Oct 4, 2023 · 0 comments
Open

Getting AddrSpace by Address space ID #1

befoulad opened this issue Oct 4, 2023 · 0 comments

Comments

@befoulad
Copy link

befoulad commented Oct 4, 2023

Hi,

Suppose that we are translating a single ARM instruction (push {r7, lr}) using the following code in a pcode emulator:

let mut decompiler = Decompiler::builder().arm(ArmVersion::Arm8, Endian::LittleEndian, rmMode::Thumb).build();
let code = Vec::from([0x80,0xb5]);
let(_, insts) = decompiler.disassemble(&code, 0x1000);
let (_, pcodes) = decompiler.translate(&code, 0x1000);
println!("{:?}", insts);
for pcode in pcodes {
    let opcode = pcode.opcode;
    println!("  opcode: {:?} ", opcode);
    if let Opcode::Store = opcode {
        println!("      {:?}", pcode.vars)
    }
}

The highlighted input varnode in the program output is supposed to be an address space ID:

[Instruction { address: 4096, mnemonic: "push", body: "{ r7, lr }" }]
opcode: Copy
opcode: IntSub
opcode: Store
[VarnodeData { space: AddrSpace { name: "const", ty: Constant }, offset: 94449029331728, size: 8 }, VarnodeData { space: AddrSpace { name: "const", ty: Constant }, offset: 94449029331728, size: 8 }, VarnodeData { space: AddrSpace { name: "const", ty: Constant }, offset: 94449029331728, size: 8 }]
opcode: IntSub
opcode: Store
[VarnodeData { space: AddrSpace { name: "const", ty: Constant }, offset: 94449029331728, size: 8 }, VarnodeData { space: AddrSpace { name: "const", ty: Constant }, offset: 94449029331728, size: 8 }, VarnodeData { space: AddrSpace { name: "const", ty: Constant }, offset: 94449029331728, size: 8 }]
opcode: Copy

Is there a way to get the actual AddrSpace asscoiated with this address space ID (94449029331728)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant