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
  • It is not possible to link a 64-bit library with a 32-bit application.

    In ARMv8, interworking between 64-bit execution state (AArch64) and 32-bit execution state (AArch32) happens only at boundaries between exception levels (that is, privilege levels). So you can execute a 32-bit application -- linked with 32-bit libraries -- at the lowest execution level (EL0) within the context of a 64-bit operating system at the kernel execution level (EL1). By the way, the converse is not true -- you cannot run 64-bit applications under a 32-bit operating system.

    So when creating your application you have to choose: 32-bit or 64-bit. This does also mean that if you want your operating system to support both 32-bit and 64-bit then you must have both 32-bit and 64-bit libraries.

    As I understand it, this is the same for other major architectures that support both 32-bit and 64-bit operation, though I could be wrong.

    It also depends on whether your hardware supports both AArch32 and AArch64 at all exception levels. The Cortex processors from ARM do, but not all ARMv8-A processors support all the combinations. See section D1.20 of the "ARM Architecture Reference Manual, ARMv8, for ARMv8-A architecture profile" manual for more details.

    If the hardware supports AArch32 and AArch64 at all exception levels then the RMR_ELx register (where x is the highest implemented exception level, typically x=3) might be used to switch the execution state at the highest exception level by resetting the processor. But that assumes you have access to the highest exception level. (EL3 is 2 levels above where the OS kernel executes, for example).

Reply
  • It is not possible to link a 64-bit library with a 32-bit application.

    In ARMv8, interworking between 64-bit execution state (AArch64) and 32-bit execution state (AArch32) happens only at boundaries between exception levels (that is, privilege levels). So you can execute a 32-bit application -- linked with 32-bit libraries -- at the lowest execution level (EL0) within the context of a 64-bit operating system at the kernel execution level (EL1). By the way, the converse is not true -- you cannot run 64-bit applications under a 32-bit operating system.

    So when creating your application you have to choose: 32-bit or 64-bit. This does also mean that if you want your operating system to support both 32-bit and 64-bit then you must have both 32-bit and 64-bit libraries.

    As I understand it, this is the same for other major architectures that support both 32-bit and 64-bit operation, though I could be wrong.

    It also depends on whether your hardware supports both AArch32 and AArch64 at all exception levels. The Cortex processors from ARM do, but not all ARMv8-A processors support all the combinations. See section D1.20 of the "ARM Architecture Reference Manual, ARMv8, for ARMv8-A architecture profile" manual for more details.

    If the hardware supports AArch32 and AArch64 at all exception levels then the RMR_ELx register (where x is the highest implemented exception level, typically x=3) might be used to switch the execution state at the highest exception level by resetting the processor. But that assumes you have access to the highest exception level. (EL3 is 2 levels above where the OS kernel executes, for example).

Children