Home | History | Annotate | Download | only in x86_64
      1 /*
      2  * On i386, pt_regs and user_regs_struct are the same,
      3  * but on 64 bit x86, user_regs_struct has six more fields:
      4  * fs_base, gs_base, ds, es, fs, gs.
      5  * PTRACE_GETREGS fills them too, so struct pt_regs would overflow.
      6  */
      7 struct i386_user_regs_struct {
      8 	uint32_t ebx;
      9 	uint32_t ecx;
     10 	uint32_t edx;
     11 	uint32_t esi;
     12 	uint32_t edi;
     13 	uint32_t ebp;
     14 	uint32_t eax;
     15 	uint32_t xds;
     16 	uint32_t xes;
     17 	uint32_t xfs;
     18 	uint32_t xgs;
     19 	uint32_t orig_eax;
     20 	uint32_t eip;
     21 	uint32_t xcs;
     22 	uint32_t eflags;
     23 	uint32_t esp;
     24 	uint32_t xss;
     25 };
     26 static union {
     27 	struct user_regs_struct      x86_64_r;
     28 	struct i386_user_regs_struct i386_r;
     29 } x86_regs_union;
     30 #define x86_64_regs x86_regs_union.x86_64_r
     31 #define i386_regs   x86_regs_union.i386_r
     32 
     33 uint32_t *const i386_esp_ptr = &i386_regs.esp;
     34 uint64_t *const x86_64_rsp_ptr = (uint64_t *) &x86_64_regs.rsp;
     35 static struct iovec x86_io = {
     36 	.iov_base = &x86_regs_union
     37 };
     38 
     39 #define ARCH_REGS_FOR_GETREGSET x86_regs_union
     40 #define ARCH_IOVEC_FOR_GETREGSET x86_io
     41 #define ARCH_PC_REG (x86_io.iov_len == sizeof(i386_regs) ? i386_regs.eip : x86_64_regs.rip)
     42