7 #if defined(__ARM_FEATURE_SVE)
8 #define ITYR_AARCH64_FLOAT_CLOBBERS \
9 "p0" , "p1" , "p2" , "p3" , "p4" , "p5" , "p6" , "p7" , \
10 "p8" , "p9" , "p10", "p11", "p12", "p13", "p14", "p15", \
11 "z0" , "z1" , "z2" , "z3" , "z4" , "z5" , "z6" , "z7" , \
12 "z8" , "z9" , "z10", "z11", "z12", "z13", "z14", "z15", \
13 "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", \
14 "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
16 #define ITYR_AARCH64_FLOAT_CLOBBERS \
17 "v0" , "v1" , "v2" , "v3" , "v4" , "v5" , "v6" , "v7" , \
18 "v8" , "v9" , "v10", "v11", "v12", "v13", "v14", "v15", \
19 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", \
20 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
23 #if defined(__FUJITSU)
28 #define ITYR_AARCH64_SAVE_R19 "stp x0, x19, [sp, #-16]!\n\t"
29 #define ITYR_AARCH64_RESTORE_R19 "ldp x0, x19, [sp], #16\n\t"
30 #define ITYR_AARCH64_CLOBBER_R19
32 #define ITYR_AARCH64_SAVE_R19
33 #define ITYR_AARCH64_RESTORE_R19
34 #define ITYR_AARCH64_CLOBBER_R19 "x19",
38 #define ITYR_AARCH64_ORIG_SP_REG "x20"
49 using save_context_fn_t = void (*)(
context_frame*,
void*,
void*);
50 using call_on_stack_fn_t = void (*)(
void*,
void*,
void*,
void*);
51 using jump_to_stack_fn_t = void (*)(
void*,
void*,
void*,
void*);
58 void* saved_ptr =
nullptr) {
59 register void* parent_cf_x9
asm(
"x9") =
reinterpret_cast<void*
>(parent_cf);
60 register void* fn_x10
asm(
"x10") =
reinterpret_cast<void*
>(fn);
61 register void* arg0_x1
asm(
"x1") = arg0;
62 register void* arg1_x2
asm(
"x2") = arg1;
63 register void* saved_ptr_x11
asm(
"x11") = saved_ptr;
67 "stp %4, %0, [sp, #-16]!\n\t"
70 "stp x29, x30, [sp, #-16]!\n\t"
81 :
"+r"(parent_cf_x9),
"+r"(fn_x10),
"+r"(arg0_x1),
"+r"(arg1_x2),
"+r"(saved_ptr_x11)
83 :
"x0",
"x3",
"x4",
"x5",
"x6",
"x7",
84 "x8",
"x12",
"x13",
"x14",
"x15",
86 "x24",
"x25",
"x26",
"x27",
"x28",
"x29",
"x30",
95 "ldp x29, x30, [sp], #16\n\t"
106 call_on_stack_fn_t fn,
111 uintptr_t sp =
reinterpret_cast<uintptr_t
>(stack_buf) + stack_size - 1;
112 sp &= 0xFFFFFFFFFFFFFFF0;
114 register void* sp_x9
asm(
"x9") =
reinterpret_cast<void*
>(sp);
115 register void* fn_x10
asm(
"x10") =
reinterpret_cast<void*
>(fn);
116 register void* arg0_x0
asm(
"x0") = arg0;
117 register void* arg1_x1
asm(
"x1") = arg1;
118 register void* arg2_x2
asm(
"x2") = arg2;
119 register void* arg3_x3
asm(
"x3") = arg3;
125 :
"+r"(sp_x9),
"+r"(fn_x10),
126 "+r"(arg0_x0),
"+r"(arg1_x1),
"+r"(arg2_x2),
"+r"(arg3_x3)
128 :
"x4",
"x5",
"x6",
"x7",
129 "x8",
"x11",
"x12",
"x13",
"x14",
"x15",
138 jump_to_stack_fn_t fn,
143 uintptr_t sp =
reinterpret_cast<uintptr_t
>(stack_ptr) & 0xFFFFFFFFFFFFFFF0;
145 register void* arg0_x0
asm(
"x0") = arg0;
146 register void* arg1_x1
asm(
"x1") = arg1;
147 register void* arg2_x2
asm(
"x2") = arg2;
148 register void* arg3_x3
asm(
"x3") = arg3;
154 "r"(arg0_x0),
"r"(arg1_x1),
"r"(arg2_x2),
"r"(arg3_x3)
#define ITYR_AARCH64_FLOAT_CLOBBERS
Definition: aarch64.hpp:16
#define ITYR_AARCH64_ORIG_SP_REG
Definition: aarch64.hpp:38
#define ITYR_AARCH64_RESTORE_R19
Definition: aarch64.hpp:33
#define ITYR_AARCH64_SAVE_R19
Definition: aarch64.hpp:32
#define ITYR_AARCH64_CLOBBER_R19
Definition: aarch64.hpp:34
Definition: aarch64.hpp:47
static void call_on_stack(void *stack_buf, size_t stack_size, call_on_stack_fn_t fn, void *arg0, void *arg1, void *arg2, void *arg3)
Definition: aarch64.hpp:104
static void resume(context_frame *cf)
Definition: aarch64.hpp:92
static void jump_to_stack(void *stack_ptr, jump_to_stack_fn_t fn, void *arg0, void *arg1, void *arg2, void *arg3)
Definition: aarch64.hpp:137
static void clear_parent_frame(context_frame *cf)
Definition: aarch64.hpp:160
static void save_context_with_call(context_frame *parent_cf, save_context_fn_t fn, void *arg0, void *arg1, void *saved_ptr=nullptr)
Definition: aarch64.hpp:54
Definition: aarch64.hpp:5
Definition: aarch64.hpp:40
void * saved_ptr
Definition: aarch64.hpp:43
void * lr
Definition: aarch64.hpp:42
void * fp
Definition: aarch64.hpp:41
context_frame_aarch64 * parent_frame
Definition: aarch64.hpp:44