2 * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
6 // This file is used to get C structure offsets into assembly code.
7 // The build system assembles the file and processes the output to create
8 // a header file with macro definitions, that can be included from assembly
12 #include <computed_asm_macros.h>
17 #include <ksyscalls.h>
18 #include <thread_types.h>
21 #define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value)
23 #define DEFINE_OFFSET_MACRO(prefix, structure, member) \
24 DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member));
26 #define DEFINE_SIZEOF_MACRO(prefix, structure) \
27 DEFINE_MACRO(prefix##_sizeof, sizeof(struct structure));
34 DEFINE_OFFSET_MACRO(CPU_ENT
, cpu_ent
, fault_handler
);
35 DEFINE_OFFSET_MACRO(CPU_ENT
, cpu_ent
, fault_handler_stack_pointer
);
38 DEFINE_OFFSET_MACRO(TEAM
, Team
, commpage_address
);
41 DEFINE_OFFSET_MACRO(THREAD
, Thread
, team
);
42 DEFINE_OFFSET_MACRO(THREAD
, Thread
, time_lock
);
43 DEFINE_OFFSET_MACRO(THREAD
, Thread
, kernel_time
);
44 DEFINE_OFFSET_MACRO(THREAD
, Thread
, user_time
);
45 DEFINE_OFFSET_MACRO(THREAD
, Thread
, last_time
);
46 DEFINE_OFFSET_MACRO(THREAD
, Thread
, in_kernel
);
47 DEFINE_OFFSET_MACRO(THREAD
, Thread
, flags
);
48 DEFINE_OFFSET_MACRO(THREAD
, Thread
, kernel_stack_top
);
49 DEFINE_OFFSET_MACRO(THREAD
, Thread
, fault_handler
);
53 DEFINE_OFFSET_MACRO(ARCH_THREAD
, arch_thread
, syscall_rsp
);
54 DEFINE_OFFSET_MACRO(ARCH_THREAD
, arch_thread
, user_rsp
);
55 DEFINE_OFFSET_MACRO(ARCH_THREAD
, arch_thread
, current_stack
);
59 DEFINE_SIZEOF_MACRO(IFRAME
, iframe
);
60 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, cs
);
61 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, ax
);
62 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, dx
);
63 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, di
);
64 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, si
);
65 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, vector
);
66 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, ip
);
67 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, flags
);
68 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, user_sp
);
70 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, r8
);
71 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, r9
);
72 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, r10
);
73 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, fpu
);
75 DEFINE_OFFSET_MACRO(IFRAME
, iframe
, orig_eax
);
78 // struct syscall_info
79 DEFINE_SIZEOF_MACRO(SYSCALL_INFO
, syscall_info
);
80 DEFINE_OFFSET_MACRO(SYSCALL_INFO
, syscall_info
, function
);
81 DEFINE_OFFSET_MACRO(SYSCALL_INFO
, syscall_info
, parameter_size
);
83 // struct signal_frame_data
84 DEFINE_SIZEOF_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
);
85 DEFINE_OFFSET_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
, info
);
86 DEFINE_OFFSET_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
, context
);
87 DEFINE_OFFSET_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
, user_data
);
88 DEFINE_OFFSET_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
, handler
);
89 DEFINE_OFFSET_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
, siginfo_handler
);
90 DEFINE_OFFSET_MACRO(SIGNAL_FRAME_DATA
, signal_frame_data
, commpage_address
);
93 DEFINE_OFFSET_MACRO(UCONTEXT_T
, __ucontext_t
, uc_mcontext
);
96 DEFINE_SIZEOF_MACRO(VREGS
, vregs
);
99 DEFINE_OFFSET_MACRO(SIGINFO_T
, __siginfo_t
, si_signo
);