comparison packages/hal/powerpc/arch/current/src/hal_mk_defs.c @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children 6ed91473a1cd
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 //==========================================================================
2 //
3 // hal_mk_defs.c
4 //
5 // HAL (architecture) "make defs" program
6 //
7 //==========================================================================
8 //####COPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 // The contents of this file are subject to the Red Hat eCos Public License
12 // Version 1.1 (the "License"); you may not use this file except in
13 // compliance with the License. You may obtain a copy of the License at
14 // http://www.redhat.com/
15 //
16 // Software distributed under the License is distributed on an "AS IS"
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18 // License for the specific language governing rights and limitations under
19 // the License.
20 //
21 // The Original Code is eCos - Embedded Configurable Operating System,
22 // released September 30, 1998.
23 //
24 // The Initial Developer of the Original Code is Red Hat.
25 // Portions created by Red Hat are
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
27 // All Rights Reserved.
28 // -------------------------------------------
29 //
30 //####COPYRIGHTEND####
31 //==========================================================================
32 //#####DESCRIPTIONBEGIN####
33 //
34 // Author(s): gthomas
35 // Contributors: gthomas, jskov
36 // Date: 2000-02-21
37 // Purpose: PowerPC architecture dependent definition generator
38 // Description: This file contains code that can be compiled by the target
39 // compiler and used to generate machine specific definitions
40 // suitable for use in assembly code.
41 //
42 //####DESCRIPTIONEND####
43 //
44 //==========================================================================
45
46 #include <pkgconf/hal.h>
47
48 #include <cyg/hal/hal_arch.h> // HAL header
49 #include <cyg/hal/hal_intr.h> // HAL header
50 #ifdef CYGPKG_KERNEL
51 # include <pkgconf/kernel.h>
52 # include <cyg/kernel/instrmnt.h>
53 #endif
54
55 /*
56 * This program is used to generate definitions needed by
57 * assembly language modules.
58 *
59 * This technique was first used in the OSF Mach kernel code:
60 * generate asm statements containing #defines,
61 * compile this file to assembler, and then extract the
62 * #defines from the assembly-language output.
63 */
64
65 #define DEFINE(sym, val) \
66 asm volatile("\n\t.equ\t" #sym ",%0" : : "i" (val))
67
68 int
69 main(void)
70 {
71 // setjmp/longjmp buffer
72 DEFINE(CYGARC_JMPBUF_SP, offsetof(hal_jmp_buf_t, sp));
73 DEFINE(CYGARC_JMPBUF_R2, offsetof(hal_jmp_buf_t, r2));
74 DEFINE(CYGARC_JMPBUF_R13, offsetof(hal_jmp_buf_t, r13));
75 DEFINE(CYGARC_JMPBUF_R14, offsetof(hal_jmp_buf_t, r14));
76 DEFINE(CYGARC_JMPBUF_R15, offsetof(hal_jmp_buf_t, r15));
77 DEFINE(CYGARC_JMPBUF_R16, offsetof(hal_jmp_buf_t, r16));
78 DEFINE(CYGARC_JMPBUF_R17, offsetof(hal_jmp_buf_t, r17));
79 DEFINE(CYGARC_JMPBUF_R18, offsetof(hal_jmp_buf_t, r18));
80 DEFINE(CYGARC_JMPBUF_R19, offsetof(hal_jmp_buf_t, r19));
81 DEFINE(CYGARC_JMPBUF_R20, offsetof(hal_jmp_buf_t, r20));
82 DEFINE(CYGARC_JMPBUF_R21, offsetof(hal_jmp_buf_t, r21));
83 DEFINE(CYGARC_JMPBUF_R22, offsetof(hal_jmp_buf_t, r22));
84 DEFINE(CYGARC_JMPBUF_R23, offsetof(hal_jmp_buf_t, r23));
85 DEFINE(CYGARC_JMPBUF_R24, offsetof(hal_jmp_buf_t, r24));
86 DEFINE(CYGARC_JMPBUF_R25, offsetof(hal_jmp_buf_t, r25));
87 DEFINE(CYGARC_JMPBUF_R26, offsetof(hal_jmp_buf_t, r26));
88 DEFINE(CYGARC_JMPBUF_R27, offsetof(hal_jmp_buf_t, r27));
89 DEFINE(CYGARC_JMPBUF_R28, offsetof(hal_jmp_buf_t, r28));
90 DEFINE(CYGARC_JMPBUF_R29, offsetof(hal_jmp_buf_t, r29));
91 DEFINE(CYGARC_JMPBUF_R30, offsetof(hal_jmp_buf_t, r30));
92 DEFINE(CYGARC_JMPBUF_R31, offsetof(hal_jmp_buf_t, r31));
93 DEFINE(CYGARC_JMPBUF_LR, offsetof(hal_jmp_buf_t, lr));
94 DEFINE(CYGARC_JMPBUF_CR, offsetof(hal_jmp_buf_t, cr));
95
96 // Exception/interrupt/context save buffer
97 #ifdef CYGDBG_HAL_POWERPC_FRAME_WALLS
98 DEFINE(CYGARC_PPCREG_WALL_HEAD, offsetof(HAL_SavedRegisters, wall_head));
99 DEFINE(CYGARC_PPCREG_WALL_TAIL, offsetof(HAL_SavedRegisters, wall_tail));
100 #endif
101 DEFINE(CYGARC_PPCREG_REGS, offsetof(HAL_SavedRegisters, d[0]));
102 DEFINE(CYGARC_PPCREG_CR, offsetof(HAL_SavedRegisters, cr));
103 DEFINE(CYGARC_PPCREG_XER, offsetof(HAL_SavedRegisters, xer));
104 DEFINE(CYGARC_PPCREG_LR, offsetof(HAL_SavedRegisters, lr));
105 DEFINE(CYGARC_PPCREG_CTR, offsetof(HAL_SavedRegisters, ctr));
106 DEFINE(CYGARC_PPCREG_MSR, offsetof(HAL_SavedRegisters, msr));
107 DEFINE(CYGARC_PPCREG_PC, offsetof(HAL_SavedRegisters, pc));
108 DEFINE(CYGARC_PPC_CONTEXT_SIZE, offsetof(HAL_SavedRegisters, context_size));
109 // Below only saved on exceptions/interrupts
110 DEFINE(CYGARC_PPCREG_VECTOR, offsetof(HAL_SavedRegisters, vector));
111 DEFINE(CYGARC_PPC_EXCEPTION_SIZE, sizeof(HAL_SavedRegisters));
112
113 DEFINE(CYGARC_PPC_STACK_FRAME_SIZE, CYGARC_PPC_STACK_FRAME_SIZE);
114 DEFINE(CYGARC_PPC_EXCEPTION_DECREMENT, sizeof(HAL_SavedRegisters));
115
116 // Some other exception related definitions
117 DEFINE(CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_ISR_COUNT);
118 DEFINE(CYGNUM_HAL_VECTOR_INTERRUPT, CYGNUM_HAL_VECTOR_INTERRUPT);
119 DEFINE(CYGNUM_HAL_VECTOR_DECREMENTER, CYGNUM_HAL_VECTOR_DECREMENTER);
120 DEFINE(CYGNUM_HAL_VSR_MAX, CYGNUM_HAL_VSR_MAX);
121 DEFINE(CYGNUM_HAL_VSR_COUNT, CYGNUM_HAL_VSR_COUNT);
122
123 // Variant definitions - want these to be included instead.
124 #ifdef CYGPKG_HAL_POWERPC_MPC8xx
125 DEFINE(CYGNUM_HAL_VECTOR_NMI, CYGNUM_HAL_VECTOR_NMI);
126 #endif
127 }
128
129 //--------------------------------------------------------------------------
130 // EOF hal_mk_defs.c