This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to do the ARM state change between 64-bit and 32-bit?

Hi,

The latest 64-bit architecture can on both AArch64 and AArch32 state.

Can someone tell me how to utilize this feature so that I can seamlessly integrate algorithms (which are optimized with 32-bit and 64-bit instructions) with applications which are build for 32-bit and 64-bit modes.

Here is the specifics of situation which I am facing right now.

I want to link an ARM shared library which is optimized with 64-bit instructions with my application which is built in 32 bit mode.

At the time of linking I am getting the following error.  "skipping incompatible xxxx.so file".

My build environment is android and unfortunately I don't have the option to build my application in 64-bit mode.

Appreciate your help with inputs.

Thanks, Prasad

Parents
  • Execution state (AArch32/AArch64) can change on when you take or return from an exception, and there is a change of Exception level (EL).  There also restrictions on how you can mix 32-bit and 64-bit levels.  Below is a slide we use is training to illustrate this:

    mixing_AArch32_and_AArch64.png

    What this means is that you could host a mix of 32-bit and 64-bit applications under the same 64-bit kernel.  But you can't, for example, dynamically link a 32-bit app against a 64-bit shared library (or vice verse).

Reply
  • Execution state (AArch32/AArch64) can change on when you take or return from an exception, and there is a change of Exception level (EL).  There also restrictions on how you can mix 32-bit and 64-bit levels.  Below is a slide we use is training to illustrate this:

    mixing_AArch32_and_AArch64.png

    What this means is that you could host a mix of 32-bit and 64-bit applications under the same 64-bit kernel.  But you can't, for example, dynamically link a 32-bit app against a 64-bit shared library (or vice verse).

Children
  • Assuming my OS has a syscall to switch from AARCH32 to AARCH64, it should be possible to mix 32-bit and 64-bit code. But which major OS and toolchain would implement this? Usually it's easier to compile the app as 64-bit if there is a 64-bit library to be used. Besides memory footprint concerns, is there really anything that prevents switching to 64-bit ?

    Actually, there might be a few use cases where somebody wants to run a 3rd party 32-bit library with 64-bit code. There this switch-syscall could come handy. And in your case you'd build a 64-bit wrapper application then that runs most of the actual app as 32-bit code. Just for the 64-bit library you'd use a trampoline via the 64-bit wrapper to call the 64-bit library then.