forked from ariadne/libucontext
Merge pull request #32 from rlcamp/master
Adjusted location within ucontext of saved/restored FP regs for compatarm_linker_fix
commit
b1b4fe9665
|
@ -9,7 +9,7 @@
|
||||||
#define SP_OFFSET 432
|
#define SP_OFFSET 432
|
||||||
#define PC_OFFSET 440
|
#define PC_OFFSET 440
|
||||||
#define PSTATE_OFFSET 448
|
#define PSTATE_OFFSET 448
|
||||||
#define D8_OFFSET 456
|
#define FPSIMD_CONTEXT_OFFSET 464
|
||||||
|
|
||||||
#ifndef FPSIMD_MAGIC
|
#ifndef FPSIMD_MAGIC
|
||||||
# define FPSIMD_MAGIC 0x46508001
|
# define FPSIMD_MAGIC 0x46508001
|
||||||
|
|
|
@ -50,10 +50,11 @@ PROC_NAME(libucontext_getcontext):
|
||||||
/* save pstate */
|
/* save pstate */
|
||||||
str xzr, [x0, #PSTATE_OFFSET]
|
str xzr, [x0, #PSTATE_OFFSET]
|
||||||
|
|
||||||
stp d8, d9, [x0, #D8_OFFSET + 0]
|
add x2, x0, #FPSIMD_CONTEXT_OFFSET
|
||||||
stp d10, d11, [x0, #D8_OFFSET + 16]
|
stp q8, q9, [x2, #144]
|
||||||
stp d12, d13, [x0, #D8_OFFSET + 32]
|
stp q10, q11, [x2, #176]
|
||||||
stp d14, d15, [x0, #D8_OFFSET + 48]
|
stp q12, q13, [x2, #208]
|
||||||
|
stp q14, q15, [x2, #240]
|
||||||
|
|
||||||
mov x0, #0
|
mov x0, #0
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -14,8 +14,7 @@ typedef struct sigcontext {
|
||||||
unsigned long fault_address;
|
unsigned long fault_address;
|
||||||
unsigned long regs[31];
|
unsigned long regs[31];
|
||||||
unsigned long sp, pc, pstate;
|
unsigned long sp, pc, pstate;
|
||||||
unsigned long d8_through_d15[8];
|
long double __reserved[256];
|
||||||
long double __reserved[252];
|
|
||||||
} libucontext_mcontext_t;
|
} libucontext_mcontext_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -33,10 +33,11 @@ PROC_NAME(libucontext_setcontext):
|
||||||
ldr x2, [x0, #SP_OFFSET]
|
ldr x2, [x0, #SP_OFFSET]
|
||||||
mov sp, x2
|
mov sp, x2
|
||||||
|
|
||||||
ldp d8, d9, [x0, #D8_OFFSET + 0]
|
add x2, x0, #FPSIMD_CONTEXT_OFFSET
|
||||||
ldp d10, d11, [x0, #D8_OFFSET + 16]
|
ldp q8, q9, [x2, #144]
|
||||||
ldp d12, d13, [x0, #D8_OFFSET + 32]
|
ldp q10, q11, [x2, #176]
|
||||||
ldp d14, d15, [x0, #D8_OFFSET + 48]
|
ldp q12, q13, [x2, #208]
|
||||||
|
ldp q14, q15, [x2, #240]
|
||||||
|
|
||||||
/* save current program counter in link register */
|
/* save current program counter in link register */
|
||||||
ldr x16, [x0, #PC_OFFSET]
|
ldr x16, [x0, #PC_OFFSET]
|
||||||
|
|
|
@ -49,10 +49,11 @@ PROC_NAME(libucontext_swapcontext):
|
||||||
/* save pstate */
|
/* save pstate */
|
||||||
str xzr, [x0, #PSTATE_OFFSET]
|
str xzr, [x0, #PSTATE_OFFSET]
|
||||||
|
|
||||||
stp d8, d9, [x0, #D8_OFFSET + 0]
|
add x2, x0, #FPSIMD_CONTEXT_OFFSET
|
||||||
stp d10, d11, [x0, #D8_OFFSET + 16]
|
stp q8, q9, [x2, #144]
|
||||||
stp d12, d13, [x0, #D8_OFFSET + 32]
|
stp q10, q11, [x2, #176]
|
||||||
stp d14, d15, [x0, #D8_OFFSET + 48]
|
stp q12, q13, [x2, #208]
|
||||||
|
stp q14, q15, [x2, #240]
|
||||||
|
|
||||||
/* context to swap to is in x1 so... we move to x0 and call setcontext */
|
/* context to swap to is in x1 so... we move to x0 and call setcontext */
|
||||||
/* store our link register in x28 */
|
/* store our link register in x28 */
|
||||||
|
|
Loading…
Reference in New Issue