avast / retdec

RetDec is a retargetable machine-code decompiler based on LLVM.
https://retdec.com/
MIT License
8.05k stars 953 forks source link

Rewrite x86 FPU analysis #160

Open PeterMatula opened 6 years ago

PeterMatula commented 6 years ago

Our x86 FPU analysis is not very robust. We should rewrite it in order to make the x86 FPU stack reconstruction more reliable.

PeterMatula commented 6 years ago

Test program that should work with all compilers, optimizations, etc:

#include <stdio.h>
#include <math.h>

double deg2rad(double deg)
{
    double result = atan(1.0);
    return (4.0 * result * deg / 180.0);
}

int main(int argc,char *argv[])
{
    printf("%.12f\n", deg2rad(45.0));
    return 0;
}
PeterMatula commented 6 years ago

Problems with the current x86 FPU analysis:

Some info on how IDA deals with this: https://www.hex-rays.com/products/decompiler/manual/fpu.shtml http://www.hexblog.com/?p=42

That simplex method looks like a good idea for this kind of analysis.

PeterMatula commented 6 years ago

This issue might get solved as part of a bachelor thesis - see milestone.