[Context] RFR: Add support for ARM aarch64 architecture
Hi,
I hope this is the right place to post this.
The following patch adds support for ARMs aarch64 architecture on Linux
(there is existing iOS support for aarch64).
I have run the context regression test on this on an aarch64 board running
Ubuntu 14.04 with gcc 4.9.1 and it passes all OK.
Could someone please review this patch and if OK push it?
Many thanks,
Ed.
--- CUT HERE ---
commit bd34672217ff3bcee185f9c7383179342ec2fe9b
Author: Edward Nevill
thx for the patches - I've updated branch develop. Could you verify that the code is running on your arm64 system (if it is working I'll merge to master).
Hi Oliver,
Thanks for looking at this so quickly. The develop branch does not build
because when I build <abi> is set to 'sysv' not 'aapcs'. I have patched it
as in the patch below by just changing <abi>aapcs to <abi>sysv in
build/Jamfile.v2. I have not changed the name of the .S files so they are
now somewhat inappropriately named *_aapcs_*.
There was also a problem with jump_fcontext in that it was restoring the FP
context from x0, not from SP. Interestingly I based my patch on the
existing iOS code which also has this bug. I have not fixed it in the iOS
code as I have no way of testing anything on iOS.
Built and testing on arm64, ubuntu 14.04, gcc 4.9.1.
Thanks for your help with this,
Ed.
--- CUT HERE ---
commit d19baee73f90de01375af69a9f8621799c649964
Author: Edward Nevill
thx for the patches - I've updated branch develop. Could you verify that the code is running on your arm64 system (if it is working I'll merge to master).
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
2015-02-23 18:44 GMT+01:00 Edward Nevill
The develop branch does not build because when I build <abi> is set to 'sysv' not 'aapcs'.
the problem that boost.build does not evaluate os.paltform to ARM the reason is that tools/build/src/engine/jam.h tests for __arm__ which is not set in the case of the 64bit ARM architecture. I'll post a patch.
There was also a problem with jump_fcontext in that it was restoring the FP context from x0, not from SP. Interestingly I based my patch on the existing iOS code which also has this bug. I have not fixed it in the iOS code as I have no way of testing anything on iOS.
strange - I got the information that it is working on iOS (I don't own Apple systems).
On Tue, 2015-02-24 at 08:16 +0100, Oliver Kowalke wrote:
2015-02-23 18:44 GMT+01:00 Edward Nevill
: the problem that boost.build does not evaluate os.paltform to ARM the reason is that tools/build/src/engine/jam.h tests for __arm__ which is not set in the case of the 64bit ARM architecture. I'll post a patch.
OK, Thx.
There was also a problem with jump_fcontext in that it was restoring the FP context from x0, not from SP. Interestingly I based my patch on the existing iOS code which also has this bug. I have not fixed it in the iOS code as I have no way of testing anything on iOS.
strange - I got the information that it is working on iOS (I don't own Apple systems).
I think it is broken. It may be that it is just never exercised with the 'save floating point registers' option. Here is what it does #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) ; test if fpu env should be preserved cmp w3, #0 b.eq 1f ; save d8 - d15 stp d8, d9, [x0, #0x00] stp d10, d11, [x0, #0x10] stp d12, d13, [x0, #0x20] stp d14, d15, [x0, #0x30] 1: #endif ; save x19-x30 stp x19, x20, [sp, #0x40] stp x21, x22, [sp, #0x50] stp x23, x24, [sp, #0x60] stp x25, x26, [sp, #0x70] stp x27, x28, [sp, #0x80] Note that in the case of the integer registers it is saving them to [sp, #XXX] whereas in the case of the fp registers it is to [x0, #XXX]. On entry to jump_context x0 contains a pointer to an fcontext_t (ie a pointer to a single longword which is to receive the new fcontext_t). Writing to [x0, #NNN] is just writing off the end of this into whatever data happens to be there. It may be that this works on iOS because the code is never compiled due to the conditionalisation. All the best, Ed.
2015-02-24 10:24 GMT+01:00 Edward Nevill
On Tue, 2015-02-24 at 08:16 +0100, Oliver Kowalke wrote:
2015-02-23 18:44 GMT+01:00 Edward Nevill
: the problem that boost.build does not evaluate os.paltform to ARM the reason is that tools/build/src/engine/jam.h tests for __arm__ which is not set in the case of the 64bit ARM architecture. I'll post a patch. OK, Thx.
the patch was merged into boost.build - could you fetch the new version (file src/engine/jam.h https://github.com/boostorg/build/pull/58/files#diff-c88fe8afebc632d0bef2bd5...) and check if boost.context (please fetch) builds and runs as expected?
On Wed, 2015-02-25 at 10:27 +0100, Oliver Kowalke wrote:
the patch was merged into boost.build - could you fetch the new version (file src/engine/jam.h https://github.com/boostorg/build/pull/58/files#diff-c88fe8afebc632d0bef2bd5...) and check if boost.context (please fetch) builds and runs as expected?
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Oliver,
I have pulled the jam.h patch and pulled the latest boost.context (develop branch), however it fails to build with the following error.
gcc.compile.asm ../../../bin.v2/libs/context/build/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/asm/jump_arm64_aapcs_elf_gas.o
../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S: Assembler messages:
../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S:86: Error: operand 1 should be a floating-point register -- `stp fp,lr,[sp,#0x90]'
../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S:89: Error: operand 1 should be an integer register -- `str lr,[sp,#0xa0]'
../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S:116: Error: operand 1 should be a floating-point register -- `ldp fp,lr,[sp,#0x90]'
The assembler does not recognise the names 'fp', or 'lr'. Instead you must use x29, or x30. I thought I had done this already in my original patch. Apologies if I made a mistake.
Patch below:-
With this patch it now reports
gcc.compile.asm ../../../bin.v2/libs/context/build/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/asm/jump_arm64_aapcs_elf_gas.o
gcc.archive ../../../bin.v2/libs/context/build/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/libboost_context.a
gcc.link ../../../bin.v2/libs/context/test/test_context.test/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/test_context
testing.capture-output ../../../bin.v2/libs/context/test/test_context.test/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/test_context.run
**passed** ../../../bin.v2/libs/context/test/test_context.test/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/test_context.test
...updated 6 targets...
All the best,
Ed.
--- CUT HERE ---
commit f5905ba4672c78fc5b250e990a9103beb226baeb
Author: Edward Nevill
2015-02-25 12:48 GMT+01:00 Edward Nevill
gcc.compile.asm ../../../bin.v2/libs/context/build/gcc-4.9.1/debug/address-model-64/architecture-arm/link-static/threading-multi/asm/jump_arm64_aapcs_elf_gas.o ../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S: Assembler messages: ../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S:86: Error: operand 1 should be a floating-point register -- `stp fp,lr,[sp,#0x90]' ../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S:89: Error: operand 1 should be an integer register -- `str lr,[sp,#0xa0]' ../../../libs/context/src/asm/jump_arm64_aapcs_elf_gas.S:116: Error: operand 1 should be a floating-point register -- `ldp fp,lr,[sp,#0x90]'
The assembler does not recognise the names 'fp', or 'lr'. Instead you must use x29, or x30. I thought I had done this already in my original patch. Apologies if I made a mistake.
I've renamed the code - I assumed that the alias names for register LR and FP are still valid on 64 bit (too be consistent to the other implementations) :^(
participants (2)
-
Edward Nevill
-
Oliver Kowalke