Re: [PATCH] Cygwin: exceptions: Fix AArch64 non-incyg signal handling

Jon Turney <[email protected]> Mon, 3 Aug 2026 17:01:49 +0100
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
On 03/07/2026 10:25, Máte Dimand wrote:
[...]
> 
> I will take your suggestion into consideration, however 
> RtlRestoreContext will still need to be used in some form, we can't 
> avoid clobbering any other way. We also cannot forget about the other 
> registers that still need to be backed up somewhere.
> 
>> (It might also be worthwhile looking at the aarch64 implementation of 
>> RtlRestoreContext - since it must know how to restore all registers 
>> without clobbering any of them - which is exactly what we want to do 
>> in sigdelayed?) 
> 
> I looked at its internals, and it uses NtContinue to restore them, which 
> is a syscall (svc 0x43), so unfortunately it most likely does something 
> we can't do in user-mode.
Ah, right.  I was imagining we could do something like pop lr and pc off 
the stack, but that doesn't exist in aarch64.

Looking at the instruction set reference, it seems like the only way to 
set pc is either (i) via a branch instruction (in which case we need a 
scratch register, as you mentioned previously, or (ii) via an eret 
(which we need to be in EL1 to do).

So, yeah, RtlRestoreContext is our only solution.