aboutsummaryrefslogtreecommitdiff
path: root/src/libmach/elfcore.h
blob: f1e953fbef91237c7c92474c942456b24ac8259d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* Copyright (c) 2002, 2003 William Josephson */

enum {
	CoremapMagic	= 0xba5eba11,
	CoremapMax	= 128,
};
#undef MAXCOMLEN
#define MAXCOMLEN 16
#define PRSTATUS_VERSION	1	/* Current version of prstatus_t */
#define PRPSINFO_VERSION	1	/* Current version of prpsinfo_t */
#define PRARGSZ			80	/* Maximum argument bytes saved */


typedef struct Coremap Coremap;
typedef struct CoremapItem CoremapItem;
typedef struct CoremapHeader CoremapHeader;
typedef struct ElfNote ElfNote;
typedef struct Reg386 Reg386;
typedef struct PrStatus386 PrStatus386;
typedef struct PrPsinfo PrPsinfo;

struct CoremapHeader {
	u32int	magic;
	u32int	counter;
	u32int	maxelem;
};

struct CoremapItem {
	u32int	address;
	u32int	size;
};

struct Coremap {
	CoremapHeader	header;
	CoremapItem	map[CoremapMax];
};

struct ElfNote {
	u32int	namesz;
	u32int	descsz;
	u32int	type;
	char	*name;
	uchar	*desc;
	u32int	offset;	/* in-memory only */
};

enum
{
	NotePrStatus = 1,
	NotePrFpreg = 2,
	NotePrPsinfo = 3,
	NotePrTaskstruct = 4,
	NotePrAuxv = 6,
	NotePrXfpreg = 0x46e62b7f,	/* according to gdb */
};
#if 0
struct Reg386
{
	u32int	fs;
	u32int	es;
	u32int	ds;
	u32int	edi;
	u32int	esi;
	u32int	ebp;
	u32int	isp;
	u32int	ebx;
	u32int	edx;
	u32int	ecx;
	u32int	eax;
	u32int	trapno;
	u32int	err;
	u32int	eip;
	u32int	cs;
	u32int	eflags;
	u32int	esp;
	u32int	ss;
	u32int	gs;
};
#endif

struct Reg386
{
	u32int	ebx;
	u32int	ecx;
	u32int	edx;
	u32int	esi;
	u32int	edi;
	u32int	ebp;
	u32int	eax;
	u32int	ds;
	u32int	es;
	u32int	fs;
	u32int	gs;
	u32int	origeax;
	u32int	eip;
	u32int	cs;
	u32int	eflags;
	u32int	esp;
	u32int	ss;
};

#if 0
struct PrStatus386
{
    u32int		version;	/* Version number of struct (1) */
    u32int		statussz;	/* sizeof(prstatus_t) (1) */
    u32int		gregsetsz;	/* sizeof(gregset_t) (1) */
    u32int		fpregsetsz;	/* sizeof(fpregset_t) (1) */
    int			osreldate;	/* Kernel version (1) */
    int			cursig;	/* Current signal (1) */
    pid_t		pid;		/* Process ID (1) */
    Reg386		reg;		/* General purpose registers (1) */
};
#endif

struct PrPsinfo
{
    int		version;		/* Version number of struct (1) */
    u32int	psinfosz;		/* sizeof(prpsinfo_t) (1) */
    char	fname[MAXCOMLEN+1];	/* Command name, null terminated (1) */
    char	psargs[PRARGSZ+1];	/* Arguments, null terminated (1) */
};

struct PrStatus386
{
	u32int	signo;
	u32int	code;
	u32int	errno;
	u32int	cursig;
	u32int	sigpend;
	u32int	sighold;
	u32int	pid;
	u32int	ppid;
	u32int	pgrp;
	u32int	sid;
	u32int	utime[2];
	u32int	stime[2];
	u32int	cutime[2];
	u32int	cstime[2];
	Reg386	reg;
	u32int	fpvalid;
};