xref: /haiku/src/system/kernel/arch/m68k/asm_offsets.cpp (revision 22440f4105cafc95cc1d49f9bc65bb395c527d86)
1 /*
2  * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
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
9 // code.
10 
11 
12 #include <computed_asm_macros.h>
13 
14 #include <arch_cpu.h>
15 #include <ksyscalls.h>
16 #include <thread_types.h>
17 
18 
19 #define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value)
20 
21 #define DEFINE_OFFSET_MACRO(prefix, structure, member) \
22     DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member));
23 
24 #define DEFINE_SIZEOF_MACRO(prefix, structure) \
25     DEFINE_MACRO(prefix##_sizeof, sizeof(struct structure));
26 
27 
28 void
29 dummy()
30 {
31 	// struct Thread
32 	DEFINE_OFFSET_MACRO(THREAD, Thread, kernel_time);
33 	DEFINE_OFFSET_MACRO(THREAD, Thread, user_time);
34 	DEFINE_OFFSET_MACRO(THREAD, Thread, last_time);
35 	DEFINE_OFFSET_MACRO(THREAD, Thread, in_kernel);
36 	DEFINE_OFFSET_MACRO(THREAD, Thread, flags);
37 	DEFINE_OFFSET_MACRO(THREAD, Thread, kernel_stack_top);
38 	DEFINE_OFFSET_MACRO(THREAD, Thread, fault_handler);
39 
40 	// struct iframe
41 	DEFINE_OFFSET_MACRO(IFRAME, iframe, fp);
42 	DEFINE_OFFSET_MACRO(IFRAME, iframe, fpc);
43 	DEFINE_OFFSET_MACRO(IFRAME, iframe, fpu);
44 	DEFINE_OFFSET_MACRO(IFRAME, iframe, d);
45 	DEFINE_OFFSET_MACRO(IFRAME, iframe, a);
46 	DEFINE_OFFSET_MACRO(IFRAME, iframe, cpu);
47 #if 0
48 	// struct iframe
49 	DEFINE_OFFSET_MACRO(IFRAME, iframe, cs);
50 	DEFINE_OFFSET_MACRO(IFRAME, iframe, eax);
51 	DEFINE_OFFSET_MACRO(IFRAME, iframe, edx);
52 	DEFINE_OFFSET_MACRO(IFRAME, iframe, orig_eax);
53 	DEFINE_OFFSET_MACRO(IFRAME, iframe, vector);
54 	DEFINE_OFFSET_MACRO(IFRAME, iframe, eip);
55 	DEFINE_OFFSET_MACRO(IFRAME, iframe, flags);
56 	DEFINE_OFFSET_MACRO(IFRAME, iframe, user_esp);
57 #endif
58 
59 	DEFINE_SIZEOF_MACRO(FPU_STATE, mc680x0_fpu_state);
60 	DEFINE_SIZEOF_MACRO(FPU_DATA_REG, mc680x0_fp_data_reg);
61 
62 	// struct syscall_info
63 	DEFINE_SIZEOF_MACRO(SYSCALL_INFO, syscall_info);
64 	DEFINE_OFFSET_MACRO(SYSCALL_INFO, syscall_info, function);
65 	DEFINE_OFFSET_MACRO(SYSCALL_INFO, syscall_info, parameter_size);
66 }
67