~cypheon/xos

xos/genassym.c -rw-r--r-- 694 bytes
567db604 — Johann Rudloff Implement scanning and allocation of physical memory. 7 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <sys/proc.h>

#define offsetof(type, member) __builtin_offsetof(type, member)
#define ASSYM(name, value) char name##v[value + 0x100];

ASSYM(PROC_PCB, offsetof(struct proc, pcb))
ASSYM(PROC_PD, offsetof(struct proc, pd))

ASSYM(PCB_EAX, offsetof(struct pcb, eax))
ASSYM(PCB_EBX, offsetof(struct pcb, ebx))
ASSYM(PCB_ECX, offsetof(struct pcb, ecx))
ASSYM(PCB_EDX, offsetof(struct pcb, edx))

ASSYM(PCB_ESP, offsetof(struct pcb, esp))
ASSYM(PCB_EBP, offsetof(struct pcb, ebp))
ASSYM(PCB_ESI, offsetof(struct pcb, esi))
ASSYM(PCB_EDI, offsetof(struct pcb, edi))
ASSYM(PCB_EIP, offsetof(struct pcb, eip))
ASSYM(PCB_EFL, offsetof(struct pcb, efl))
ASSYM(PCB_CR3, offsetof(struct pcb, cr3))