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

Add option to specify initial value for saved registers #150

Open
tge-was-taken opened this issue Oct 3, 2021 · 0 comments
Open

Add option to specify initial value for saved registers #150

tge-was-taken opened this issue Oct 3, 2021 · 0 comments

Comments

@tge-was-taken
Copy link

Add option to specify initial value for saved registers, such as $gp, in order to resolve data accesses through these registers.

Example assembly

glabel fun_2442c8
lw $v1, -0x5750($gp)
lw $v0, 0xa48($v1)
slt $v0, $v0, $a0
jr $ra
sltiu $v0, $v0, 0x1
nop 

mips-to-c output

s32 fun_2442c8(s32 arg0) {
    return (saved_reg_gp->unk-5750->unkA48 < arg0) == 0;
}

If I were to specify the value of $gp as 0x554170, then I'd expect the output to look like this:

s32 fun_2442c8(s32 arg0) {
    return (0x54EA20->unkA48 < arg0) == 0;
}

Ideally, I'd able to declare a variable in the context and bind to the address (with eg a pragma or macro), so the decompiler could use its name and typeinfo to improve the legibility of the code.

Perhaps specifying the value of $gp could be done through a pragma or macro in the context as well.

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