Question

I have my own ARM asm (32-bit ARM/NEON). From this asm code I call some functions that are implemented in C. Something like this:

        ARM

NormCorrS0_S0_S0_ PROC
        ...
        BL     ConvolveC4  <-- implemented in C/C++
        ...

1) if ARM-asm is aware that ConvolveC4 is Thumb2, what does it need to do to call it and switch to Thumb2?

2) if ARM-asm isn't aware about what ConvolveC4 is, then obviously ARM asm stays as is, but I'd need to add some kind of veneer on ConvolveC4 side to ensure that ARM state switches properly.

Was it helpful?

Solution

you have to use BX or BLX or depending on the arm pop (ldm). Depending on your linker you can leave it like this and the linker will add a ConvolveC4_from_arm for example which basically sets the link register to the return address after the bl, but the trampoline switches modes.

The other approach is unless you are calling functions in the same source and you know the mode of, then always use blx or bx.

the gnu tools, binutils, can take care of some of this for you if you declare the labels/functions properly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top