xref: /haiku/src/system/kernel/arch/arm64/asm_offsets.cpp (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
1 /*
2  * Copyright 2022 Haiku, Inc. All Rights Reserved.
3  * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 // This file is used to get C structure offsets into assembly code.
8 // The build system assembles the file and processes the output to create
9 // a header file with macro definitions, that can be included from assembly
10 // code.
11 
12 
13 #include <computed_asm_macros.h>
14 
15 #include <arch_cpu.h>
16 #include <cpu.h>
17 #include <ksignal.h>
18 #include <ksyscalls.h>
19 #include <thread_types.h>
20 
21 
22 #define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value)
23 
24 #define DEFINE_OFFSET_MACRO(prefix, structure, member) \
25 	DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member));
26 
27 #define DEFINE_SIZEOF_MACRO(prefix, structure) \
28 	DEFINE_MACRO(prefix##_sizeof, sizeof(struct structure));
29 
30 
31 void
32 dummy()
33 {
34 	DEFINE_SIZEOF_MACRO(IFRAME, iframe);
35 	DEFINE_OFFSET_MACRO(IFRAME, iframe, elr);
36 	DEFINE_OFFSET_MACRO(IFRAME, iframe, spsr);
37 	DEFINE_OFFSET_MACRO(IFRAME, iframe, x);
38 	DEFINE_OFFSET_MACRO(IFRAME, iframe, lr);
39 	DEFINE_OFFSET_MACRO(IFRAME, iframe, sp);
40 	DEFINE_OFFSET_MACRO(IFRAME, iframe, fp);
41 	DEFINE_OFFSET_MACRO(IFRAME, iframe, esr);
42 	DEFINE_OFFSET_MACRO(IFRAME, iframe, far);
43 
44 	DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler);
45 	DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler_stack_pointer);
46 }
47