The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
Main Page
Data Structures
Files
File List
Globals
jmp.h
Go to the documentation of this file.
1
36
#pragma once
37
38
#ifdef OS_LINUX
39
#if defined(__x86_64__)
40
42
typedef
struct
__exec_context_t
{
43
// This is the space for general purpose registers
44
unsigned
long
long
rax;
45
unsigned
long
long
rdx;
46
unsigned
long
long
rcx;
47
unsigned
long
long
rbx;
48
unsigned
long
long
rsp;
49
unsigned
long
long
rbp;
50
unsigned
long
long
rsi;
51
unsigned
long
long
rdi;
52
unsigned
long
long
r8;
53
unsigned
long
long
r9;
54
unsigned
long
long
r10;
55
unsigned
long
long
r11;
56
unsigned
long
long
r12;
57
unsigned
long
long
r13;
58
unsigned
long
long
r14;
59
unsigned
long
long
r15;
60
unsigned
long
long
rip;
61
unsigned
long
long
flags;
62
63
// Space for FPU registers
64
unsigned
char
fpu[512] __attribute__((aligned(16)));
// fxsave wants 16-byte aligned memory
65
}
exec_context_t
;
66
91
#define set_jmp(env) ({\
92
int _set_ret;\
93
__asm__ __volatile__ ("pushq %rdi"); \
94
_set_ret = _set_jmp(env); \
95
__asm__ __volatile__ ("add $8, %rsp"); \
96
_set_ret;\
97
})
98
109
#define long_jmp(env, val) _long_jmp(env, val)
110
134
long
long
_set_jmp
(
exec_context_t
*env);
135
136
137
159
__attribute__((__noreturn__))
160
void
_long_jmp
(
exec_context_t
*env,
long
long
val);
161
162
163
184
extern
void
context_create
(
exec_context_t
*creat,
void
(*fn)(
void
*),
void
*args,
void
*stack,
size_t
stack_size);
185
186
187
// As mentioned, using direct calls to _set_jmp or _long_jmp is not safe.
188
// Here we poison their explicit usage, forcing the code base to rely
189
// on wrapper macros.
190
// on wrapper macros.
191
#pragma GCC poison _set_jmp _long_jmp
192
193
194
#endif
/* defined(__x86_64__) */
195
#endif
/* OS_LINUX */
context_create
void context_create(exec_context_t *creat, void(*fn)(void *), void *args, void *stack, size_t stack_size)
_set_jmp
long long _set_jmp(exec_context_t *env)
exec_context_t
struct __exec_context_t exec_context_t
This structure describes the CPU context of a User-Level Thread.
_long_jmp
void _long_jmp(exec_context_t *env, long long val)
__exec_context_t
This structure describes the CPU context of a User-Level Thread.
Definition:
jmp.h:42
src
arch
x86
jmp.h
Generated by
1.8.11