1*8ca0f03dSX512 /*
2*8ca0f03dSX512 * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3*8ca0f03dSX512 * Distributed under the terms of the MIT License.
4*8ca0f03dSX512 */
5*8ca0f03dSX512
6*8ca0f03dSX512 // This file is used to get C structure offsets into assembly code.
7*8ca0f03dSX512 // The build system assembles the file and processes the output to create
8*8ca0f03dSX512 // a header file with macro definitions, that can be included from assembly
9*8ca0f03dSX512 // code.
10*8ca0f03dSX512
11*8ca0f03dSX512
12*8ca0f03dSX512 #include <computed_asm_macros.h>
13*8ca0f03dSX512
14*8ca0f03dSX512 #include <arch_cpu.h>
15*8ca0f03dSX512 #include <cpu.h>
16*8ca0f03dSX512 #include <ksignal.h>
17*8ca0f03dSX512 #include <ksyscalls.h>
18*8ca0f03dSX512 #include <thread_types.h>
19*8ca0f03dSX512
20*8ca0f03dSX512
21*8ca0f03dSX512 #define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value)
22*8ca0f03dSX512
23*8ca0f03dSX512 #define DEFINE_OFFSET_MACRO(prefix, structure, member) \
24*8ca0f03dSX512 DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member));
25*8ca0f03dSX512
26*8ca0f03dSX512 #define DEFINE_SIZEOF_MACRO(prefix, structure) \
27*8ca0f03dSX512 DEFINE_MACRO(prefix##_sizeof, sizeof(struct structure));
28*8ca0f03dSX512
29*8ca0f03dSX512
30*8ca0f03dSX512 void
dummy()31*8ca0f03dSX512 dummy()
32*8ca0f03dSX512 {
33*8ca0f03dSX512 // struct Thread
34*8ca0f03dSX512 DEFINE_OFFSET_MACRO(THREAD, Thread, arch_info);
35*8ca0f03dSX512
36*8ca0f03dSX512 // struct arch_thread
37*8ca0f03dSX512 DEFINE_OFFSET_MACRO(ARCH_THREAD, arch_thread, context);
38*8ca0f03dSX512 DEFINE_OFFSET_MACRO(ARCH_THREAD, arch_thread, fpuContext);
39*8ca0f03dSX512
40*8ca0f03dSX512 DEFINE_OFFSET_MACRO(ARCH_CONTEXT, arch_context, sp);
41*8ca0f03dSX512
42*8ca0f03dSX512 DEFINE_OFFSET_MACRO(ARCH_STACK, arch_stack, thread);
43*8ca0f03dSX512
44*8ca0f03dSX512 DEFINE_SIZEOF_MACRO(IFRAME, iframe);
45*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, status);
46*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, cause);
47*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, tval);
48*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, ra);
49*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, sp);
50*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, tp);
51*8ca0f03dSX512 DEFINE_OFFSET_MACRO(IFRAME, iframe, epc);
52*8ca0f03dSX512 }
53