]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/hal/powerpc/arch/v2_0/src/hal_mk_defs.c
Initial revision
[karo-tx-redboot.git] / packages / hal / powerpc / arch / v2_0 / src / hal_mk_defs.c
1 //==========================================================================
2 //
3 //      hal_mk_defs.c
4 //
5 //      HAL (architecture) "make defs" program
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 // Copyright (C) 2002 Gary Thomas
13 //
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
17 //
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21 // for more details.
22 //
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 //
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
33 //
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
36 //
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
43 //
44 // Author(s):    gthomas
45 // Contributors: gthomas, jskov
46 // Date:         2000-02-21
47 // Purpose:      PowerPC architecture dependent definition generator
48 // Description:  This file contains code that can be compiled by the target
49 //               compiler and used to generate machine specific definitions
50 //               suitable for use in assembly code.
51 //
52 //####DESCRIPTIONEND####
53 //
54 //==========================================================================
55
56 #include <pkgconf/hal.h>
57 #include CYGHWR_MEMORY_LAYOUT_H     
58
59 #include <cyg/hal/hal_arch.h>           // HAL header
60 #include <cyg/hal/hal_intr.h>           // HAL header
61 #ifdef CYGPKG_KERNEL
62 # include <pkgconf/kernel.h>
63 # include <cyg/kernel/instrmnt.h>
64 #endif
65
66 /*
67  * This program is used to generate definitions needed by
68  * assembly language modules.
69  *
70  * This technique was first used in the OSF Mach kernel code:
71  * generate asm statements containing #defines,
72  * compile this file to assembler, and then extract the
73  * #defines from the assembly-language output.
74  */
75
76 #define DEFINE(sym, val) \
77         asm volatile("\n\t.equ\t" #sym ",%0" : : "i" (val))
78
79 int
80 main(void)
81 {
82     // setjmp/longjmp buffer
83     DEFINE(CYGARC_JMPBUF_SP, offsetof(hal_jmp_buf_t, sp));
84     DEFINE(CYGARC_JMPBUF_R2, offsetof(hal_jmp_buf_t, r2));
85     DEFINE(CYGARC_JMPBUF_R13, offsetof(hal_jmp_buf_t, r13));
86     DEFINE(CYGARC_JMPBUF_R14, offsetof(hal_jmp_buf_t, r14));
87     DEFINE(CYGARC_JMPBUF_R15, offsetof(hal_jmp_buf_t, r15));
88     DEFINE(CYGARC_JMPBUF_R16, offsetof(hal_jmp_buf_t, r16));
89     DEFINE(CYGARC_JMPBUF_R17, offsetof(hal_jmp_buf_t, r17));
90     DEFINE(CYGARC_JMPBUF_R18, offsetof(hal_jmp_buf_t, r18));
91     DEFINE(CYGARC_JMPBUF_R19, offsetof(hal_jmp_buf_t, r19));
92     DEFINE(CYGARC_JMPBUF_R20, offsetof(hal_jmp_buf_t, r20));
93     DEFINE(CYGARC_JMPBUF_R21, offsetof(hal_jmp_buf_t, r21));
94     DEFINE(CYGARC_JMPBUF_R22, offsetof(hal_jmp_buf_t, r22));
95     DEFINE(CYGARC_JMPBUF_R23, offsetof(hal_jmp_buf_t, r23));
96     DEFINE(CYGARC_JMPBUF_R24, offsetof(hal_jmp_buf_t, r24));
97     DEFINE(CYGARC_JMPBUF_R25, offsetof(hal_jmp_buf_t, r25));
98     DEFINE(CYGARC_JMPBUF_R26, offsetof(hal_jmp_buf_t, r26));
99     DEFINE(CYGARC_JMPBUF_R27, offsetof(hal_jmp_buf_t, r27));
100     DEFINE(CYGARC_JMPBUF_R28, offsetof(hal_jmp_buf_t, r28));
101     DEFINE(CYGARC_JMPBUF_R29, offsetof(hal_jmp_buf_t, r29));
102     DEFINE(CYGARC_JMPBUF_R30, offsetof(hal_jmp_buf_t, r30));
103     DEFINE(CYGARC_JMPBUF_R31, offsetof(hal_jmp_buf_t, r31));
104     DEFINE(CYGARC_JMPBUF_LR, offsetof(hal_jmp_buf_t, lr));
105     DEFINE(CYGARC_JMPBUF_CR, offsetof(hal_jmp_buf_t, cr));
106 #ifdef CYGHWR_HAL_POWERPC_FPU
107     DEFINE(CYGARC_JMPBUF_F14, offsetof(hal_jmp_buf_t, f14));
108     DEFINE(CYGARC_JMPBUF_F15, offsetof(hal_jmp_buf_t, f15));
109     DEFINE(CYGARC_JMPBUF_F16, offsetof(hal_jmp_buf_t, f16));
110     DEFINE(CYGARC_JMPBUF_F17, offsetof(hal_jmp_buf_t, f17));
111     DEFINE(CYGARC_JMPBUF_F18, offsetof(hal_jmp_buf_t, f18));
112     DEFINE(CYGARC_JMPBUF_F19, offsetof(hal_jmp_buf_t, f19));
113     DEFINE(CYGARC_JMPBUF_F20, offsetof(hal_jmp_buf_t, f20));
114     DEFINE(CYGARC_JMPBUF_F21, offsetof(hal_jmp_buf_t, f21));
115     DEFINE(CYGARC_JMPBUF_F22, offsetof(hal_jmp_buf_t, f22));
116     DEFINE(CYGARC_JMPBUF_F23, offsetof(hal_jmp_buf_t, f23));
117     DEFINE(CYGARC_JMPBUF_F24, offsetof(hal_jmp_buf_t, f24));
118     DEFINE(CYGARC_JMPBUF_F25, offsetof(hal_jmp_buf_t, f25));
119     DEFINE(CYGARC_JMPBUF_F26, offsetof(hal_jmp_buf_t, f26));
120     DEFINE(CYGARC_JMPBUF_F27, offsetof(hal_jmp_buf_t, f27));
121     DEFINE(CYGARC_JMPBUF_F28, offsetof(hal_jmp_buf_t, f28));
122     DEFINE(CYGARC_JMPBUF_F29, offsetof(hal_jmp_buf_t, f29));
123     DEFINE(CYGARC_JMPBUF_F30, offsetof(hal_jmp_buf_t, f30));
124     DEFINE(CYGARC_JMPBUF_F31, offsetof(hal_jmp_buf_t, f31));
125 #endif
126
127     // Exception/interrupt/context save buffer
128 #ifdef CYGDBG_HAL_POWERPC_FRAME_WALLS
129     DEFINE(CYGARC_PPCREG_WALL_HEAD, offsetof(HAL_SavedRegisters, wall_head));
130     DEFINE(CYGARC_PPCREG_WALL_TAIL, offsetof(HAL_SavedRegisters, wall_tail));
131 #endif
132     DEFINE(CYGARC_PPCREG_REGS, offsetof(HAL_SavedRegisters, d[0]));
133 #ifdef CYGHWR_HAL_POWERPC_FPU
134     DEFINE(CYGARC_PPCREG_FREGS, offsetof(HAL_SavedRegisters, f[0]));
135 #endif
136     DEFINE(CYGARC_PPCREG_CR, offsetof(HAL_SavedRegisters, cr));
137     DEFINE(CYGARC_PPCREG_XER, offsetof(HAL_SavedRegisters, xer));
138     DEFINE(CYGARC_PPCREG_LR, offsetof(HAL_SavedRegisters, lr));
139     DEFINE(CYGARC_PPCREG_CTR, offsetof(HAL_SavedRegisters, ctr));
140     DEFINE(CYGARC_PPCREG_MSR, offsetof(HAL_SavedRegisters, msr));
141     DEFINE(CYGARC_PPCREG_PC, offsetof(HAL_SavedRegisters, pc));
142     DEFINE(CYGARC_PPC_CONTEXT_SIZE, offsetof(HAL_SavedRegisters, context_size));
143     // Below only saved on exceptions/interrupts
144     DEFINE(CYGARC_PPCREG_VECTOR, offsetof(HAL_SavedRegisters, vector));
145     DEFINE(CYGARC_PPC_EXCEPTION_SIZE, sizeof(HAL_SavedRegisters));
146
147     DEFINE(CYGARC_PPC_STACK_FRAME_SIZE, CYGARC_PPC_STACK_FRAME_SIZE);
148     DEFINE(CYGARC_PPC_EXCEPTION_DECREMENT, sizeof(HAL_SavedRegisters));
149
150     // Some other exception related definitions
151     DEFINE(CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_ISR_COUNT);
152     DEFINE(CYGNUM_HAL_VECTOR_INTERRUPT, CYGNUM_HAL_VECTOR_INTERRUPT);
153     DEFINE(CYGNUM_HAL_VECTOR_DECREMENTER, CYGNUM_HAL_VECTOR_DECREMENTER);
154     DEFINE(CYGNUM_HAL_VSR_MAX, CYGNUM_HAL_VSR_MAX);
155     DEFINE(CYGNUM_HAL_VSR_COUNT, CYGNUM_HAL_VSR_COUNT);
156
157     // Variant definitions - want these to be included instead.
158 #ifdef CYGARC_VARIANT_DEFS
159     CYGARC_VARIANT_DEFS
160 #endif
161 #ifdef CYGARC_PLATFORM_DEFS
162     CYGARC_PLATFORM_DEFS
163 #endif
164
165     // Memory layout values (since these aren't "asm"-safe)
166 #ifdef CYGMEM_REGION_rom    
167     DEFINE(CYGMEM_REGION_rom, CYGMEM_REGION_rom);
168 #endif
169 #ifdef CYGMEM_REGION_ram    
170     DEFINE(CYGMEM_REGION_ram, CYGMEM_REGION_ram);
171 #endif
172     return 0;
173 }
174
175 //--------------------------------------------------------------------------
176 // EOF hal_mk_defs.c