7 #if defined(__AVX512F__)
8 #define ITYR_X86_64_FLOAT_REGS \
9 "%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , "%xmm4" , "%xmm5" , "%xmm6" , "%xmm7" , \
10 "%xmm8" , "%xmm9" , "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15", \
11 "%xmm16", "%xmm17", "%xmm18", "%xmm19", "%xmm20", "%xmm21", "%xmm22", "%xmm23", \
12 "%xmm24", "%xmm25", "%xmm26", "%xmm27", "%xmm28", "%xmm29", "%xmm30", "%xmm31"
14 #define ITYR_X86_64_FLOAT_REGS \
15 "%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , "%xmm4" , "%xmm5" , "%xmm6" , "%xmm7" , \
16 "%xmm8" , "%xmm9" , "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15"
29 using save_context_fn_t = void (*)(
context_frame*,
void*,
void*);
30 using call_on_stack_fn_t = void (*)(
void*,
void*,
void*,
void*);
31 using jump_to_stack_fn_t = void (*)(
void*,
void*,
void*,
void*);
38 void* saved_ptr =
nullptr) {
39 register void* parent_cf_r8
asm(
"r8") =
reinterpret_cast<void*
>(parent_cf);
40 register void* fn_r9
asm(
"r9") =
reinterpret_cast<void*
>(fn);
41 register void* saved_ptr_r10
asm(
"r10") =
reinterpret_cast<void*
>(saved_ptr);
46 "mov %%rsp, %%rax\n\t"
47 "and $0xFFFFFFFFFFFFFFF0, %%rsp\n\t"
56 "lea -16(%%rsp), %%rax\n\t"
59 "lea 1f(%%rip), %%rax\n\t"
62 "mov %%rsp, %%rdi\n\t"
78 :
"+r"(parent_cf_r8),
"+r"(fn_r9),
79 "+S"(arg0),
"+d"(arg1),
"+r"(saved_ptr_r10)
81 :
"%rax",
"%rbx",
"%rcx",
"%rdi",
82 "%r11",
"%r12",
"%r13",
"%r14",
"%r15",
101 call_on_stack_fn_t fn,
106 uintptr_t sp =
reinterpret_cast<uintptr_t
>(stack_buf) + stack_size - 1;
107 sp &= 0xFFFFFFFFFFFFFFF0;
109 register void* sp_r8
asm(
"r8") =
reinterpret_cast<void*
>(sp);
110 register void* fn_r9
asm(
"r9") =
reinterpret_cast<void*
>(fn);
112 "mov %%rsp, %%rax\n\t"
115 "sub $0x8, %%rsp\n\t"
119 :
"+r"(sp_r8),
"+r"(fn_r9),
120 "+D"(arg0),
"+S"(arg1),
"+d"(arg2),
"+c"(arg3)
123 "%r10",
"%r11",
"%r12",
"%r13",
"%r14",
"%r15",
130 jump_to_stack_fn_t fn,
135 uintptr_t sp =
reinterpret_cast<uintptr_t
>(stack_ptr) & 0xFFFFFFFFFFFFFFF0;
142 "D"(arg0),
"S"(arg1),
"d"(arg2),
"c"(arg3)
Definition: x86_64.hpp:27
static void jump_to_stack(void *stack_ptr, jump_to_stack_fn_t fn, void *arg0, void *arg1, void *arg2, void *arg3)
Definition: x86_64.hpp:129
static void resume(context_frame *cf)
Definition: x86_64.hpp:88
static void clear_parent_frame(context_frame *cf)
Definition: x86_64.hpp:148
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: x86_64.hpp:99
static void save_context_with_call(context_frame *parent_cf, save_context_fn_t fn, void *arg0, void *arg1, void *saved_ptr=nullptr)
Definition: x86_64.hpp:34
Definition: aarch64.hpp:5
Definition: x86_64.hpp:19
void * rip
Definition: x86_64.hpp:20
void * rsp
Definition: x86_64.hpp:21
context_frame_x86_64 * parent_frame
Definition: x86_64.hpp:24
void * rbp
Definition: x86_64.hpp:22
void * saved_ptr
Definition: x86_64.hpp:23
#define ITYR_X86_64_FLOAT_REGS
Definition: x86_64.hpp:14