2005-05-05 17:15:23 -06:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <signal.h>
|
2006-03-27 02:14:30 -07:00
|
|
|
#include <sys/poll.h>
|
2007-05-06 15:51:48 -06:00
|
|
|
#include <sys/mman.h>
|
2007-10-16 02:27:14 -06:00
|
|
|
#include <sys/user.h>
|
2005-05-05 17:15:23 -06:00
|
|
|
#define __FRAME_OFFSETS
|
|
|
|
#include <asm/ptrace.h>
|
2005-05-20 14:59:07 -06:00
|
|
|
#include <asm/types.h>
|
2005-05-05 17:15:23 -06:00
|
|
|
|
|
|
|
#define DEFINE(sym, val) \
|
|
|
|
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
|
|
|
|
|
2005-09-28 15:27:23 -06:00
|
|
|
#define DEFINE_LONGS(sym, val) \
|
|
|
|
asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
|
|
|
|
|
2005-05-05 17:15:23 -06:00
|
|
|
#define OFFSET(sym, str, mem) \
|
|
|
|
DEFINE(sym, offsetof(struct str, mem));
|
|
|
|
|
|
|
|
void foo(void)
|
|
|
|
{
|
2005-09-28 15:27:23 -06:00
|
|
|
OFFSET(HOST_SC_CR2, sigcontext, cr2);
|
|
|
|
OFFSET(HOST_SC_ERR, sigcontext, err);
|
|
|
|
OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
|
2005-05-05 17:15:23 -06:00
|
|
|
|
2006-02-07 13:58:43 -07:00
|
|
|
DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
|
2005-09-28 15:27:23 -06:00
|
|
|
DEFINE_LONGS(HOST_RBX, RBX);
|
|
|
|
DEFINE_LONGS(HOST_RCX, RCX);
|
|
|
|
DEFINE_LONGS(HOST_RDI, RDI);
|
|
|
|
DEFINE_LONGS(HOST_RSI, RSI);
|
|
|
|
DEFINE_LONGS(HOST_RDX, RDX);
|
|
|
|
DEFINE_LONGS(HOST_RBP, RBP);
|
|
|
|
DEFINE_LONGS(HOST_RAX, RAX);
|
|
|
|
DEFINE_LONGS(HOST_R8, R8);
|
|
|
|
DEFINE_LONGS(HOST_R9, R9);
|
|
|
|
DEFINE_LONGS(HOST_R10, R10);
|
|
|
|
DEFINE_LONGS(HOST_R11, R11);
|
|
|
|
DEFINE_LONGS(HOST_R12, R12);
|
|
|
|
DEFINE_LONGS(HOST_R13, R13);
|
|
|
|
DEFINE_LONGS(HOST_R14, R14);
|
|
|
|
DEFINE_LONGS(HOST_R15, R15);
|
|
|
|
DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX);
|
|
|
|
DEFINE_LONGS(HOST_CS, CS);
|
|
|
|
DEFINE_LONGS(HOST_SS, SS);
|
|
|
|
DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
|
2005-05-05 17:15:23 -06:00
|
|
|
#if 0
|
2005-09-28 15:27:23 -06:00
|
|
|
DEFINE_LONGS(HOST_FS, FS);
|
|
|
|
DEFINE_LONGS(HOST_GS, GS);
|
|
|
|
DEFINE_LONGS(HOST_DS, DS);
|
|
|
|
DEFINE_LONGS(HOST_ES, ES);
|
2005-05-05 17:15:23 -06:00
|
|
|
#endif
|
|
|
|
|
2005-09-28 15:27:23 -06:00
|
|
|
DEFINE_LONGS(HOST_IP, RIP);
|
|
|
|
DEFINE_LONGS(HOST_SP, RSP);
|
|
|
|
DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
|
2006-03-27 02:14:30 -07:00
|
|
|
|
|
|
|
/* XXX Duplicated between i386 and x86_64 */
|
|
|
|
DEFINE(UM_POLLIN, POLLIN);
|
|
|
|
DEFINE(UM_POLLPRI, POLLPRI);
|
|
|
|
DEFINE(UM_POLLOUT, POLLOUT);
|
2007-05-06 15:51:48 -06:00
|
|
|
|
|
|
|
DEFINE(UM_PROT_READ, PROT_READ);
|
|
|
|
DEFINE(UM_PROT_WRITE, PROT_WRITE);
|
|
|
|
DEFINE(UM_PROT_EXEC, PROT_EXEC);
|
2005-05-05 17:15:23 -06:00
|
|
|
}
|