Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions context/switch-arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ FSIZE(switch_frame)
FNAME(create_frame)
" stp x1, x2, [x0, #-16]!\n"
" mov x16, lr\n" // Save LR so can use same STP slot
#if defined(__aarch64__) && defined(__APPLE__) // darwin syntax
" adrp lr, action_entry@PAGE\n"
" add lr, lr, action_entry@PAGEOFF\n"
#else
" ldr lr, =action_entry\n"
#endif
Comment on lines +108 to +113
Copy link
Collaborator

@Araneidae Araneidae Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's anything specific to Apple about this two part syntax. If possible I think I'd like to see this unconditionally using the new syntax.

It does occur to me that we shouldn't need to be using a linker relocation here at all: action_entry is nearby at a constant offset, so I'd expect something like

 adr lr, action_entry

to work on both targets (it looks like ADR is the appropriate instruction here).

@AlexanderWells-diamond, do we have CI runners for Linux and OSX ARM64 for cothread?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently do not have Linux ARM64, nor any MacOS CI as part of our default set.

In theory, as per this blog post, we can simply add ubuntu-24.04-arm and macos-latest to the test matrix to get full coverage of Arm64 platforms. However, a quick test shows failures on both platforms.

I'll do a little digging into why these are failing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the corresponding instruction in switch-arm.c also ought to be ADR, but I guess that's out of scope for this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's currently no drop-in way to make either Linux or MacOS Arm64 work.

Both have the issue that they will need changes to the epics-base container to support ARM.

MacOS additionally needs a complete overhaul of how the CI works; we currently use the epics-base container to provide us an EPICS environment for various tests. We cannot use this on MacOS, the Github runners do not let us run containers inside them. So we need to either stop doing all the EPICS-specific tests there, or set up the environment ourselves in the CI scripts.

" stp x19, x20, [x0, #-16]!\n"
" stp x21, x22, [x0, #-16]!\n"
" stp x23, x24, [x0, #-16]!\n"
Expand Down
Loading