diff --git a/arch/aarch64/defs.h b/arch/aarch64/defs.h index ee9fc7f..1282f56 100644 --- a/arch/aarch64/defs.h +++ b/arch/aarch64/defs.h @@ -9,6 +9,7 @@ #define SP_OFFSET 432 #define PC_OFFSET 440 #define PSTATE_OFFSET 448 +#define D8_OFFSET 456 #ifndef FPSIMD_MAGIC # define FPSIMD_MAGIC 0x46508001 diff --git a/arch/aarch64/getcontext.S b/arch/aarch64/getcontext.S index 1098706..a4a8bfa 100644 --- a/arch/aarch64/getcontext.S +++ b/arch/aarch64/getcontext.S @@ -50,7 +50,10 @@ PROC_NAME(libucontext_getcontext): /* save pstate */ str xzr, [x0, #PSTATE_OFFSET] - /* TODO: SIMD / FPRs */ + stp d8, d9, [x0, #D8_OFFSET + 0] + stp d10, d11, [x0, #D8_OFFSET + 16] + stp d12, d13, [x0, #D8_OFFSET + 32] + stp d14, d15, [x0, #D8_OFFSET + 48] mov x0, #0 ret diff --git a/arch/aarch64/include/libucontext/bits.h b/arch/aarch64/include/libucontext/bits.h index e249448..0bc0563 100644 --- a/arch/aarch64/include/libucontext/bits.h +++ b/arch/aarch64/include/libucontext/bits.h @@ -14,7 +14,8 @@ typedef struct sigcontext { unsigned long fault_address; unsigned long regs[31]; unsigned long sp, pc, pstate; - long double __reserved[256]; + unsigned long d8_through_d15[8]; + long double __reserved[252]; } libucontext_mcontext_t; typedef struct { diff --git a/arch/aarch64/setcontext.S b/arch/aarch64/setcontext.S index 3d455a5..cbe1ddc 100644 --- a/arch/aarch64/setcontext.S +++ b/arch/aarch64/setcontext.S @@ -33,7 +33,10 @@ PROC_NAME(libucontext_setcontext): ldr x2, [x0, #SP_OFFSET] mov sp, x2 - /* TODO: SIMD / FPRs */ + ldp d8, d9, [x0, #D8_OFFSET + 0] + ldp d10, d11, [x0, #D8_OFFSET + 16] + ldp d12, d13, [x0, #D8_OFFSET + 32] + ldp d14, d15, [x0, #D8_OFFSET + 48] /* save current program counter in link register */ ldr x16, [x0, #PC_OFFSET] diff --git a/arch/aarch64/swapcontext.S b/arch/aarch64/swapcontext.S index fddfa41..e90f7f1 100644 --- a/arch/aarch64/swapcontext.S +++ b/arch/aarch64/swapcontext.S @@ -49,6 +49,11 @@ PROC_NAME(libucontext_swapcontext): /* save pstate */ str xzr, [x0, #PSTATE_OFFSET] + stp d8, d9, [x0, #D8_OFFSET + 0] + stp d10, d11, [x0, #D8_OFFSET + 16] + stp d12, d13, [x0, #D8_OFFSET + 32] + stp d14, d15, [x0, #D8_OFFSET + 48] + /* context to swap to is in x1 so... we move to x0 and call setcontext */ /* store our link register in x28 */ mov x28, x30