On the x86 / x86_64 platform, you cannot do this. I mean, maybe you could if you wrote custom assembly shells for every 32-bit function that you wanted to call. But this is the only way that this is possible. And even if you were ready to do this work, Iโm not sure that it will work.
The reason for this is that the calling conventions are completely different. The x864_64 platform has much more registers for playback, and 64-bit ABI (Application Binary Interface, basically, how parameters are passed, how the stack frame is set, and the like), standards for all operating systems use these additional registers to pass parameters, etc. .
This makes the ABI of 32-bit and 64-bit x86 / x86_64 systems completely incompatible. You will need to write a translation layer. And perhaps the 32-bit version of ABI allows 32-bit code to play with the processor, so that 64-bit code is not allowed to play, and this will make your work even harder, since you will need to restore what was possibly changed before returning to 64-bit code.
And that doesnโt even talk about this pointer problem. How to pass a pointer to a data structure that is on a 64-bit address up to 32-bit code?
source share