1 // SPDX-License-Identifier: GPL-2.0 1 2 #include <sys/ucontext.h> 3 #define __FRAME_OFFSETS 4 #include <asm/ptrace.h> 5 #include <sysdep/ptrace.h> 6 #include <sysdep/mcontext.h> 7 8 void get_regs_from_mc(struct uml_pt_regs *regs 9 { 10 #ifdef __i386__ 11 #define COPY2(X,Y) regs->gp[X] = mc->gregs[REG 12 #define COPY(X) regs->gp[X] = mc->gregs[REG_## 13 #define COPY_SEG(X) regs->gp[X] = mc->gregs[RE 14 #define COPY_SEG_CPL3(X) regs->gp[X] = (mc->gr 15 COPY_SEG(GS); COPY_SEG(FS); COPY_SEG(E 16 COPY(EDI); COPY(ESI); COPY(EBP); 17 COPY2(UESP, ESP); /* sic */ 18 COPY(EBX); COPY(EDX); COPY(ECX); COPY( 19 COPY(EIP); COPY_SEG_CPL3(CS); COPY(EFL 20 #else 21 #define COPY2(X,Y) regs->gp[X/sizeof(unsigned 22 #define COPY(X) regs->gp[X/sizeof(unsigned lon 23 COPY(R8); COPY(R9); COPY(R10); COPY(R1 24 COPY(R12); COPY(R13); COPY(R14); COPY( 25 COPY(RDI); COPY(RSI); COPY(RBP); COPY( 26 COPY(RDX); COPY(RAX); COPY(RCX); COPY( 27 COPY(RIP); 28 COPY2(EFLAGS, EFL); 29 COPY2(CS, CSGSFS); 30 regs->gp[CS / sizeof(unsigned long)] & 31 regs->gp[CS / sizeof(unsigned long)] | 32 #endif 33 } 34
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.