[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Calling x86 code from 64-bit code



[Reposting - the news gateway seems to be read-only]

Hi folks,

I am not sure this issue has been discussed before: is it possible - and
how - to call 32-bit x86 native code from a 64-bit function ?

Some folks could have the need to link (mostyl proprietary) 32-bit code
on opteron systems, from 64-bit bytecode.

I imagine that function prototypes will have to be compatible, but the
most annoying problem will be link and pointers.

ldd accepts to link x86 and x86-64 bytecode with a warning ; but I'm not
sure this is really sane (and of course the code is not valid after
link) - how to handle this?

Is there a way to create 32-bit compatible address space inside 64-bit
code? (shared memory ?)

Something like:

typedef uint32 ptr32;
extern ptr32 bar(ptr32 address, int32 foobar);

ptr32 addr32 = FooAllocate(sizeof(myStructure));
void* addr64 = FooGet64Ptr(addr32);
.. do something inside addr64

ptr32 result = bar(addr32, 42);
void* result64 = FooCopyFrom32bitAddrSpace(result32);
.. do something with result64

Any thoughts?




Reply to: