The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
asm_defines.c
Go to the documentation of this file.
1 
38 #ifdef ASM_DEFINES
39 
40 
41 #include <scheduler/process.h>
42 #include <arch/x86/jmp.h>
43 
52 #define DEFINE(sym, val) __asm__ __volatile__("\n-> " #sym " %0 \n" : : "i" (val))
53 
59 #define OFFSETOF(s, m) DEFINE(offsetof_##s##_##m, offsetof(s, m));
60 
65 #define SIZEOF(s) DEFINE(sizeof_##s, sizeof(s));
66 
78 void foo(void)
79 {
80  // We need the offset of the LP State to make a context switch in ECS
81  SIZEOF(struct lp_struct);
82  OFFSETOF(struct lp_struct, context);
83 
84  // Size and offsets of a context are used when creating/saving/restoring contexts in jmp.S
85  SIZEOF(exec_context_t);
86  OFFSETOF(exec_context_t, rax);
87  OFFSETOF(exec_context_t, rdx);
88  OFFSETOF(exec_context_t, rcx);
89  OFFSETOF(exec_context_t, rbx);
90  OFFSETOF(exec_context_t, rsp);
91  OFFSETOF(exec_context_t, rbp);
92  OFFSETOF(exec_context_t, rsi);
93  OFFSETOF(exec_context_t, rdi);
94  OFFSETOF(exec_context_t, r8);
95  OFFSETOF(exec_context_t, r9);
96  OFFSETOF(exec_context_t, r10);
97  OFFSETOF(exec_context_t, r11);
98  OFFSETOF(exec_context_t, r12);
99  OFFSETOF(exec_context_t, r13);
100  OFFSETOF(exec_context_t, r14);
101  OFFSETOF(exec_context_t, r15);
102  OFFSETOF(exec_context_t, rip);
103  OFFSETOF(exec_context_t, flags);
104  OFFSETOF(exec_context_t, fpu);
105 }
106 
107 #endif /* ASM_DEFINES */
LP control blocks.
x86 ULT support header
This structure describes the CPU context of a User-Level Thread.
Definition: jmp.h:42