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
|
typedef struct Macho Macho;
typedef struct MachoCmd MachoCmd;
enum
{
MachoCpuVax = 1,
MachoCpu68000 = 6,
MachoCpu386 = 7,
MachoCpuMips = 8,
MachoCpu98000 = 10,
MachoCpuHppa = 11,
MachoCpuArm = 12,
MachoCpu88000 = 13,
MachoCpuSparc = 14,
MachoCpu860 = 15,
MachoCpuAlpha = 16,
MachoCpuPower = 18,
MachoCmdSegment = 1,
MachoCmdSymtab = 2,
MachoCmdSymseg = 3,
MachoCmdThread = 4,
MachoFileObject = 1,
MachoFileExecutable = 2,
MachoFileFvmlib = 3,
MachoFileCore = 4,
MachoFilePreload = 5,
};
struct MachoCmd
{
int type;
ulong off;
ulong size;
struct {
char name[16+1];
ulong vmaddr;
ulong vmsize;
ulong fileoff;
ulong filesz;
ulong maxprot;
ulong initprot;
ulong nsect;
ulong flags;
} seg;
struct {
ulong symoff;
ulong nsyms;
ulong stroff;
ulong strsize;
} sym;
};
struct Macho
{
int fd;
uint cputype;
uint subcputype;
ulong filetype;
ulong flags;
MachoCmd *cmd;
uint ncmd;
u32int (*e4)(uchar*);
int (*coreregs)(Macho*, uchar**);
};
Macho *machoopen(char*);
Macho *machoinit(int);
void machoclose(Macho*);
int coreregsmachopower(Macho*, uchar**);
|