Re: Calling x86 code from 64-bit code
Xavier Roche <rocheml@httrack.com> writes:
> Goswin von Brederlow wrote:
> > The easiest would be to allocate the program completly in the 32 bit
> > address space. Converting pointers is then just a matter of extending
> > them.
>
> Isn't it possible to allocate 32-bit space inside 64-bit one?
> Besides, I am absolutely unaware of the calling conventions between
> 32 and 64-bit bytecode ; here's the idiotic test I did:
>
> // compiled in 32-bit using gcc -shared ..
> void foo()
> printf("foo!\n");
> }
>
> // compiled in 64-bit with -lfoo
> extern void foo(void);
> int main() {
> foo();
> }
>
> Of course ldd was horrified but did link anyway, and the program
> just.. crashed when calling foo()
>
> I imagine I should have used something like:
> extern __magicGccKeyword32 void foo(void);
>
> And more magic when linking.
>
> Any references to start with? The gcc manual is really not very
> helpful - is the only way to learn x86-64 and write the function
> calls by hand, playing with asm {} things ?
No clue, sorry.
I guess the calling convention are too different. You would need
special 32bit function call magic.
MfG
Goswin
Reply to: