Replies: 20 comments
-
There is an attribute for The callfixups are for things like compiler generated functions that have side effects the decompiler needs to know about that it can't see. An example is ghidra/Ghidra/Processors/x86/data/languages/x86win.cspec Lines 155 to 157 in c6cb8a0 |
Beta Was this translation helpful? Give feedback.
-
I'm sorry but I don't understand: is it the attribute I'm working on an ARM32 binary so I don't know if it works for x86. |
Beta Was this translation helpful? Give feedback.
-
Oh wow, I didn't even notice. I will confirm later but I think it is backwards. I think I have always gotten the behavior you are looking for where the return pointer came before the this pointer. The name is accurate so setting it to false should do what you're looking for. |
Beta Was this translation helpful? Give feedback.
-
Hi, not working |
Beta Was this translation helpful? Give feedback.
-
You can't have both |
Beta Was this translation helpful? Give feedback.
-
thx,i will try. and i maked a rep for test this: |
Beta Was this translation helpful? Give feedback.
-
this label seems not a right label or node title ? |
Beta Was this translation helpful? Give feedback.
-
The attribute you're looking for is
|
Beta Was this translation helpful? Give feedback.
-
To be honest I'm not sure this attribute would allow the decompiler to replace x86 multiplication and division with 64-bit /* / % and so on and so forth for these math symbols. As I understand it, removing the implementation of mul and div is just one step, it's more about combining the two high and low 32-bit integers of the passed formal parameter into a single 64-bit one, so ideally there should be a lot less upper level code to see calls to decompile mul and div. Also, it would be great if you could make a unit test handy, thanks. |
Beta Was this translation helpful? Give feedback.
-
Sorry, but I now don't understand what it is you're attempting. I thought/understood that you were looking for the correct mechanism to place a pointer before the If you're specifically asking how to replace function calls the compiler uses for mathematical operations, I'd also like to see an example please @astrelsky. |
Beta Was this translation helpful? Give feedback.
-
Sorry there is no As for the callfixup for replacing function calls with mathematical operations, it's pretty simple. This one was for arm so you'll need to change the register names and adjust the stack if applicable. NOTE: it's an xml file but GitHub doesn't like that. Just add it in the |
Beta Was this translation helpful? Give feedback.
-
I am doing test this logic: |
Beta Was this translation helpful? Give feedback.
-
Not working, could you please test it? Thx
https://github.com/ddkwork/asm/blob/master/bigNumber%2FbigNumber_test.go#L12-L36 |
Beta Was this translation helpful? Give feedback.
-
This is the expected unit test data for this behavior func Test_bigNumber(t *testing.T) {
data := []byte{0x9, 0x99, 0x8a, 0x7b, 0xfe, 0x46, 0xc2, 0xf0}
b := bigNumber(data)
mylog.Struct(b)
assert.Equal(t, uint64(0xCD2F21A91272EE20), b.QuadPart())
assert.Equal(t, mylog.Check2(hex.DecodeString("CD2F21A91272EE20")), b.Bytes())
} https://github.com/ddkwork/asm/blob/master/demo%2Fdemo_test.go#L11-L17 It is a validation of x86 inline assembly, which gets its data from the results of c code inline asm inputs and outputs, asm is here, thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi, I didn't understand you correctly the other day, are you saying that this can be achieved by modifying the registers? I can't select the callfixup I just added in the function signature edit window because it's not in the list. <callfixup name="__sdivsi3">
<target name="__sdivsi3"/>
<pcode>
<body> eax = eax s/ ecx; </body>
</pcode>
</callfixup>
<callfixup name="__mul">
<target name="__mul"/>
<pcode>
<body> eax = eax s* ecx; </body>
</pcode>
</callfixup> |
Beta Was this translation helpful? Give feedback.
-
Did you add it to the program in |
Beta Was this translation helpful? Give feedback.
-
I think the x86 registers need to be uppercase. You might need to have each extension in its own file too. |
Beta Was this translation helpful? Give feedback.
-
The arithmetic should be this logic, I don't know how to populate this correctly :) Eax*ecx. return uint64(eax)<<32|edx / |
Beta Was this translation helpful? Give feedback.
-
If you are working with something written in go, you should be using the golang compiler specification. |
Beta Was this translation helpful? Give feedback.
-
As indicated here
Indeed in some
C++
binaries that I'm reversing the__thiscall
erroneously set the first argument as a pointer to the class instance but in reality should use the second parameter for that and uses the first for the return value.Is there any way of describing a call fixup for this case? moreover, what
switch8_r0
and similar that I see forARM32
are used for? I didn't find any information.Beta Was this translation helpful? Give feedback.
All reactions