xref: /dflybsd-src/lib/libc/x86_64/sys/asmcontext.c (revision 38c3a22e15fcec0d0f58d0632d67112826ed3615)
1b2b3ffcdSSimon Schubert #define _KERNEL_STRUCTURES
2b2b3ffcdSSimon Schubert #include <sys/types.h>
3*38c3a22eSSascha Wildner #include <sys/signal.h>
4b2b3ffcdSSimon Schubert #include <sys/ucontext.h>
5b2b3ffcdSSimon Schubert #include <sys/assym.h>
663261abbSMatthew Dillon #include <machine/frame.h>
763261abbSMatthew Dillon #include <machine/tss.h>
863261abbSMatthew Dillon #include <machine/segments.h>
9b2b3ffcdSSimon Schubert #include <stddef.h>
10b2b3ffcdSSimon Schubert 
11b2b3ffcdSSimon Schubert ASSYM(UC_SIGMASK, offsetof(ucontext_t, uc_sigmask));
1263261abbSMatthew Dillon ASSYM(UC_LINK, offsetof(ucontext_t, uc_link));
13b2b3ffcdSSimon Schubert ASSYM(UC_MCONTEXT, offsetof(ucontext_t, uc_mcontext));
14b2b3ffcdSSimon Schubert ASSYM(SIG_BLOCK, SIG_BLOCK);
15b2b3ffcdSSimon Schubert #ifdef __x86_64__
1663261abbSMatthew Dillon ASSYM(KUCSEL, GSEL(GUCODE_SEL, SEL_UPL));
1763261abbSMatthew Dillon ASSYM(KUDSEL, GSEL(GUDATA_SEL, SEL_UPL));
18b2b3ffcdSSimon Schubert ASSYM(MC_ONSTACK, offsetof(mcontext_t, mc_onstack));
19b2b3ffcdSSimon Schubert ASSYM(MC_RDI, offsetof(mcontext_t, mc_rdi));
20b2b3ffcdSSimon Schubert ASSYM(MC_RSI, offsetof(mcontext_t, mc_rsi));
21b2b3ffcdSSimon Schubert ASSYM(MC_RDX, offsetof(mcontext_t, mc_rdx));
22b2b3ffcdSSimon Schubert ASSYM(MC_RCX, offsetof(mcontext_t, mc_rcx));
23b2b3ffcdSSimon Schubert ASSYM(MC_R8, offsetof(mcontext_t, mc_r8));
24b2b3ffcdSSimon Schubert ASSYM(MC_R9, offsetof(mcontext_t, mc_r9));
25b2b3ffcdSSimon Schubert ASSYM(MC_RAX, offsetof(mcontext_t, mc_rax));
26b2b3ffcdSSimon Schubert ASSYM(MC_RBX, offsetof(mcontext_t, mc_rbx));
27b2b3ffcdSSimon Schubert ASSYM(MC_RBP, offsetof(mcontext_t, mc_rbp));
28b2b3ffcdSSimon Schubert ASSYM(MC_R10, offsetof(mcontext_t, mc_r10));
29b2b3ffcdSSimon Schubert ASSYM(MC_R11, offsetof(mcontext_t, mc_r11));
30b2b3ffcdSSimon Schubert ASSYM(MC_R12, offsetof(mcontext_t, mc_r12));
31b2b3ffcdSSimon Schubert ASSYM(MC_R13, offsetof(mcontext_t, mc_r13));
32b2b3ffcdSSimon Schubert ASSYM(MC_R14, offsetof(mcontext_t, mc_r14));
33b2b3ffcdSSimon Schubert ASSYM(MC_R15, offsetof(mcontext_t, mc_r15));
34b2b3ffcdSSimon Schubert ASSYM(MC_RIP, offsetof(mcontext_t, mc_rip));
35b2b3ffcdSSimon Schubert ASSYM(MC_CS, offsetof(mcontext_t, mc_cs));
36b2b3ffcdSSimon Schubert ASSYM(MC_RFLAGS, offsetof(mcontext_t, mc_rflags));
37b2b3ffcdSSimon Schubert ASSYM(MC_RSP, offsetof(mcontext_t, mc_rsp));
38b2b3ffcdSSimon Schubert ASSYM(MC_SS, offsetof(mcontext_t, mc_ss));
3963261abbSMatthew Dillon ASSYM(_MC_FPOWNED_NONE, _MC_FPOWNED_NONE);
4063261abbSMatthew Dillon ASSYM(_MC_FPFMT_NODEV, _MC_FPFMT_NODEV);
41b2b3ffcdSSimon Schubert #endif
42b2b3ffcdSSimon Schubert ASSYM(MC_LEN, offsetof(mcontext_t, mc_len));
43b2b3ffcdSSimon Schubert ASSYM(MC_FPFORMAT, offsetof(mcontext_t, mc_fpformat));
44b2b3ffcdSSimon Schubert ASSYM(MC_OWNEDFP, offsetof(mcontext_t, mc_ownedfp));
45b2b3ffcdSSimon Schubert ASSYM(SIZEOF_MCONTEXT_T, sizeof(mcontext_t));
46