cpu/native: Support native64
Board on ARM
#20739
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution Description.
This PR adds support for the
native64
board on arm64/aarch641-m32
and-m64
flags on ARM (?) (hencegcc-multilib
is unavailable on ARM),-mXX
flags are omitted when they would matchgetconf LONG_BIT
Testing procedure (GNU/Linux)
Compile and run on an ARM 64-bit CPU.
Footnotes
Why? E.g., with 64-bit ARM support, you can use the native board on Apple Silicon Macs in a Linux-based virtualized environment (i.e., multipass (or qemu directly), Docker, Virtualization.framework or Hypervisor.framework), without having to resort to emulating a 32-bit ARM or x86 CPU. ↩
For anyone else also wondering how the PC can be set on ARM 64-bit, v8, while preserving all general-purpose registers: You don't. On ARMv8,
PC
cannot be written to anymore, and branch instructions (and friends) either require a static address (which isn't available to us (stored in_native_saved_eip
) or a register containing the destination address. If you look at the glibc implementation ofsetcontext
(which lets you set the instruction pointer) in glibc'ssetcontext.S
, you'll noticex16
is used as the register for thebr
instruction. This PR adopts the same technique. ↩