2011-09-23 12:00:45 +04:00
|
|
|
#ifndef CR_TYPES_H_
|
|
|
|
#define CR_TYPES_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "bitops.h"
|
2011-11-18 16:09:01 +04:00
|
|
|
#include "atomic.h"
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2011-11-07 16:29:36 +04:00
|
|
|
/* prctl */
|
|
|
|
#define ARCH_SET_GS 0x1001
|
|
|
|
#define ARCH_SET_FS 0x1002
|
|
|
|
#define ARCH_GET_FS 0x1003
|
|
|
|
#define ARCH_GET_GS 0x1004
|
|
|
|
|
2011-11-07 17:44:00 +04:00
|
|
|
#define FS_TLS 0
|
|
|
|
#define GS_TLS 1
|
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
/* some constants for ptrace */
|
2011-11-20 10:31:16 +04:00
|
|
|
#ifndef PTRACE_SEIZE
|
|
|
|
# define PTRACE_SEIZE 0x4206
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PTRACE_INTERRUPT
|
|
|
|
# define PTRACE_INTERRUPT 0x4207
|
|
|
|
#endif
|
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
#define PTRACE_LISTEN 0x4208
|
|
|
|
|
|
|
|
#define PTRACE_SEIZE_DEVEL 0x80000000
|
|
|
|
|
|
|
|
#define PTRACE_EVENT_FORK 1
|
|
|
|
#define PTRACE_EVENT_VFORK 2
|
|
|
|
#define PTRACE_EVENT_CLONE 3
|
|
|
|
#define PTRACE_EVENT_EXEC 4
|
|
|
|
#define PTRACE_EVENT_VFORK_DONE 5
|
|
|
|
#define PTRACE_EVENT_EXIT 6
|
|
|
|
#define PTRACE_EVENT_STOP 7
|
|
|
|
|
|
|
|
#define PTRACE_O_TRACESYSGOOD 0x00000001
|
|
|
|
#define PTRACE_O_TRACEFORK 0x00000002
|
|
|
|
#define PTRACE_O_TRACEVFORK 0x00000004
|
|
|
|
#define PTRACE_O_TRACECLONE 0x00000008
|
|
|
|
#define PTRACE_O_TRACEEXEC 0x00000010
|
|
|
|
#define PTRACE_O_TRACEVFORKDONE 0x00000020
|
|
|
|
#define PTRACE_O_TRACEEXIT 0x00000040
|
|
|
|
|
2011-11-08 17:53:47 +04:00
|
|
|
/* prctl.h */
|
2011-11-21 16:47:36 +04:00
|
|
|
#define PR_SET_NAME 15
|
|
|
|
#define PR_GET_NAME 16
|
2011-11-08 17:53:47 +04:00
|
|
|
|
2011-11-21 16:47:36 +04:00
|
|
|
#define PR_SET_MM 35
|
2011-11-21 12:54:14 +04:00
|
|
|
# define PR_SET_MM_START_CODE 1
|
|
|
|
# define PR_SET_MM_END_CODE 2
|
|
|
|
# define PR_SET_MM_START_DATA 3
|
|
|
|
# define PR_SET_MM_END_DATA 4
|
|
|
|
# define PR_SET_MM_START_STACK 5
|
|
|
|
# define PR_SET_MM_START_BRK 6
|
|
|
|
# define PR_SET_MM_BRK 7
|
|
|
|
|
2011-11-21 16:47:36 +04:00
|
|
|
#define PR_SETUP_VDSO_AT 36
|
2011-11-08 17:53:47 +04:00
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
/* fcntl */
|
|
|
|
#ifndef F_LINUX_SPECIFIC_BASE
|
|
|
|
#define F_LINUX_SPECIFIC_BASE 1024
|
|
|
|
#endif
|
|
|
|
#ifndef F_SETPIPE_SZ
|
|
|
|
# define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
|
|
|
|
#endif
|
|
|
|
#ifndef F_GETPIPE_SZ
|
|
|
|
# define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CLONE_CHILD_USEPID 0x02000000
|
|
|
|
#define CLONE_VFORK 0x00004000
|
|
|
|
|
2011-11-29 15:12:25 +03:00
|
|
|
#define SIGMAX 32
|
|
|
|
|
2011-12-02 16:46:00 +04:00
|
|
|
#define ERESTARTSYS 512
|
|
|
|
#define ERESTARTNOINTR 513
|
|
|
|
#define ERESTARTNOHAND 514
|
|
|
|
#define ERESTART_RESTARTBLOCK 516
|
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
typedef uint64_t u64;
|
|
|
|
typedef int64_t s64;
|
|
|
|
typedef unsigned int u32;
|
|
|
|
typedef signed int s32;
|
|
|
|
typedef unsigned short u16;
|
|
|
|
typedef signed short s16;
|
|
|
|
typedef unsigned char u8;
|
|
|
|
typedef signed char s8;
|
|
|
|
|
|
|
|
#define MAJOR(dev) ((dev)>>8)
|
|
|
|
|
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
|
2011-11-07 14:47:04 +04:00
|
|
|
typedef struct {
|
|
|
|
unsigned int entry_number;
|
|
|
|
unsigned int base_addr;
|
|
|
|
unsigned int limit;
|
|
|
|
unsigned int seg_32bit:1;
|
|
|
|
unsigned int contents:2;
|
|
|
|
unsigned int read_exec_only:1;
|
|
|
|
unsigned int limit_in_pages:1;
|
|
|
|
unsigned int seg_not_present:1;
|
|
|
|
unsigned int useable:1;
|
|
|
|
unsigned int lm:1;
|
|
|
|
} user_desc_t;
|
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
typedef struct {
|
|
|
|
unsigned long r15;
|
|
|
|
unsigned long r14;
|
|
|
|
unsigned long r13;
|
|
|
|
unsigned long r12;
|
|
|
|
unsigned long bp;
|
|
|
|
unsigned long bx;
|
|
|
|
unsigned long r11;
|
|
|
|
unsigned long r10;
|
|
|
|
unsigned long r9;
|
|
|
|
unsigned long r8;
|
|
|
|
unsigned long ax;
|
|
|
|
unsigned long cx;
|
|
|
|
unsigned long dx;
|
|
|
|
unsigned long si;
|
|
|
|
unsigned long di;
|
|
|
|
unsigned long orig_ax;
|
|
|
|
unsigned long ip;
|
|
|
|
unsigned long cs;
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned long sp;
|
|
|
|
unsigned long ss;
|
|
|
|
unsigned long fs_base;
|
|
|
|
unsigned long gs_base;
|
|
|
|
unsigned long ds;
|
|
|
|
unsigned long es;
|
|
|
|
unsigned long fs;
|
|
|
|
unsigned long gs;
|
|
|
|
} user_regs_struct_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned short cwd;
|
|
|
|
unsigned short swd;
|
|
|
|
unsigned short twd; /* Note this is not the same as
|
|
|
|
the 32bit/x87/FSAVE twd */
|
|
|
|
unsigned short fop;
|
|
|
|
u64 rip;
|
|
|
|
u64 rdp;
|
|
|
|
u32 mxcsr;
|
|
|
|
u32 mxcsr_mask;
|
|
|
|
u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
|
|
|
|
u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
|
|
|
|
u32 padding[24];
|
|
|
|
} user_fpregs_struct_t;
|
|
|
|
|
|
|
|
#else /* CONFIG_X86_64 */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned long bx;
|
|
|
|
unsigned long cx;
|
|
|
|
unsigned long dx;
|
|
|
|
unsigned long si;
|
|
|
|
unsigned long di;
|
|
|
|
unsigned long bp;
|
|
|
|
unsigned long ax;
|
|
|
|
unsigned long ds;
|
|
|
|
unsigned long es;
|
|
|
|
unsigned long fs;
|
|
|
|
unsigned long gs;
|
|
|
|
unsigned long orig_ax;
|
|
|
|
unsigned long ip;
|
|
|
|
unsigned long cs;
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned long sp;
|
|
|
|
unsigned long ss;
|
|
|
|
} user_regs_struct_t;
|
|
|
|
|
|
|
|
#endif /* CONFIG_X86_64 */
|
|
|
|
|
|
|
|
#ifndef PAGE_SIZE
|
|
|
|
# define PAGE_SIZE 4096
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CR_TYPES_H_ */
|