Chapter 8. Porting to A64

This chapter is not intended to act as an exhaustive guide to writing portable code for all systems, however, this should cover the main areas that application engineers should know for code porting on ARM specific machines. There are some significant differences that you should be aware of when moving code to the A64 instruction set in AArch64 from A32 and T32 instruction sets:

For many applications, porting code from older versions of the ARM Architecture, or other processor architectures, to A64 means simply recompiling the source code. However, there are a number of areas where C code is not fully portable.

The similarity between A64 and A32/T32 is illustrated in the following example. The three sequences below show a simple C function and the output code in first T32 and then A64. The correspondence between the two is very easy to see.

                             //C code
                             int foo(int val)
                             {
                               int newval = bar(val);
                               return val + newval;
                             }

           //T32                                     //A64
          foo:                                      foo:
          sub sp, sp, #8                            sub sp, sp #16
          strd r4, r14, [sp]                        stp x19, x30, [sp]
          mov r4, r0                                mov w19, w0
          bl bar                                    bl bar
          add r0, r0, r4                            add w0, w0, w19
          ldrd r4, r14, [sp]                        ldp x19, x30, [sp]
          add sp, sp, #8                            add sp, sp, #16
          bx lr                                     ret

The general-purpose functionality provided by A64 has evolved from that found in A32 and T32, so porting code between the two is fairly straightforward. Translating A32 assembly code to A64 is also generally straightforward. Most instructions map easily between these instruction sets and many sequences become simpler in A64.

Copyright © 2015 ARM. All rights reserved.ARM DEN0024A
Non-ConfidentialID050815