Deleted Added
full compact
aicasm_symbol.h (92770) aicasm_symbol.h (95376)
1/*
2 * Aic7xxx SCSI host adapter firmware asssembler symbol table definitions
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
1/*
2 * Aic7xxx SCSI host adapter firmware asssembler symbol table definitions
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 * substantially similar to the "NO WARRANTY" disclaimer below
15 * ("Disclaimer") and any redistribution must be conditioned upon
16 * including a substantially similar Disclaimer requirement for further
17 * binary redistribution.
18 * 3. Neither the names of the above-listed copyright holders nor the names
19 * of any contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
15 *
16 * Alternatively, this software may be distributed under the terms of the
21 *
22 * Alternatively, this software may be distributed under the terms of the
17 * GNU Public License ("GPL").
23 * GNU General Public License ("GPL") version 2 as published by the Free
24 * Software Foundation.
18 *
25 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * NO WARRANTY
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGES.
30 *
38 *
31 * $Id: //depot/src/aic7xxx/aicasm/aicasm_symbol.h#4 $
39 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_symbol.h#10 $
32 *
40 *
33 * $FreeBSD: head/sys/dev/aic7xxx/aicasm/aicasm_symbol.h 92770 2002-03-20 08:56:31Z alfred $
41 * $FreeBSD: head/sys/dev/aic7xxx/aicasm/aicasm_symbol.h 95376 2002-04-24 16:24:43Z gibbs $
34 */
35
36#ifdef __linux__
37#include "../queue.h"
38#else
39#include <sys/queue.h>
40#endif
41
42typedef enum {
43 UNINITIALIZED,
44 REGISTER,
45 ALIAS,
46 SCBLOC,
47 SRAMLOC,
48 MASK,
49 BIT,
50 CONST,
51 DOWNLOAD_CONST,
52 LABEL,
42 */
43
44#ifdef __linux__
45#include "../queue.h"
46#else
47#include <sys/queue.h>
48#endif
49
50typedef enum {
51 UNINITIALIZED,
52 REGISTER,
53 ALIAS,
54 SCBLOC,
55 SRAMLOC,
56 MASK,
57 BIT,
58 CONST,
59 DOWNLOAD_CONST,
60 LABEL,
53 CONDITIONAL
54}symtype;
61 CONDITIONAL,
62 MACRO
63} symtype;
55
56typedef enum {
57 RO = 0x01,
58 WO = 0x02,
59 RW = 0x03
60}amode_t;
61
62struct reg_info {
64
65typedef enum {
66 RO = 0x01,
67 WO = 0x02,
68 RW = 0x03
69}amode_t;
70
71struct reg_info {
63 u_int8_t address;
72 u_int address;
64 int size;
65 amode_t mode;
66 u_int8_t valid_bitmask;
73 int size;
74 amode_t mode;
75 u_int8_t valid_bitmask;
76 u_int8_t modes;
67 int typecheck_masks;
68};
69
70typedef SLIST_HEAD(symlist, symbol_node) symlist_t;
71
72struct mask_info {
73 symlist_t symrefs;
74 u_int8_t mask;
75};
76
77struct const_info {
77 int typecheck_masks;
78};
79
80typedef SLIST_HEAD(symlist, symbol_node) symlist_t;
81
82struct mask_info {
83 symlist_t symrefs;
84 u_int8_t mask;
85};
86
87struct const_info {
78 u_int8_t value;
79 int define;
88 u_int value;
89 int define;
80};
81
82struct alias_info {
83 struct symbol *parent;
84};
85
86struct label_info {
87 int address;
90};
91
92struct alias_info {
93 struct symbol *parent;
94};
95
96struct label_info {
97 int address;
98 int exported;
88};
89
90struct cond_info {
91 int func_num;
92};
93
99};
100
101struct cond_info {
102 int func_num;
103};
104
105struct macro_arg {
106 STAILQ_ENTRY(macro_arg) links;
107 regex_t arg_regex;
108 char *replacement_text;
109};
110STAILQ_HEAD(macro_arg_list, macro_arg) args;
111
112struct macro_info {
113 struct macro_arg_list args;
114 int narg;
115 const char* body;
116};
117
94typedef struct expression_info {
95 symlist_t referenced_syms;
96 int value;
97} expression_t;
98
99typedef struct symbol {
100 char *name;
101 symtype type;
102 union {
118typedef struct expression_info {
119 symlist_t referenced_syms;
120 int value;
121} expression_t;
122
123typedef struct symbol {
124 char *name;
125 symtype type;
126 union {
103 struct reg_info *rinfo;
104 struct mask_info *minfo;
127 struct reg_info *rinfo;
128 struct mask_info *minfo;
105 struct const_info *cinfo;
106 struct alias_info *ainfo;
107 struct label_info *linfo;
129 struct const_info *cinfo;
130 struct alias_info *ainfo;
131 struct label_info *linfo;
108 struct cond_info *condinfo;
132 struct cond_info *condinfo;
133 struct macro_info *macroinfo;
109 }info;
110} symbol_t;
111
112typedef struct symbol_ref {
113 symbol_t *symbol;
114 int offset;
115} symbol_ref_t;
116

--- 31 unchanged lines hidden (view full) ---

148 patch_info_t patches[2];
149 int func_num;
150} scope_t;
151
152TAILQ_HEAD(cs_tailq, critical_section);
153SLIST_HEAD(scope_list, scope);
154TAILQ_HEAD(scope_tailq, scope);
155
134 }info;
135} symbol_t;
136
137typedef struct symbol_ref {
138 symbol_t *symbol;
139 int offset;
140} symbol_ref_t;
141

--- 31 unchanged lines hidden (view full) ---

173 patch_info_t patches[2];
174 int func_num;
175} scope_t;
176
177TAILQ_HEAD(cs_tailq, critical_section);
178SLIST_HEAD(scope_list, scope);
179TAILQ_HEAD(scope_tailq, scope);
180
156void symbol_delete(symbol_t *symbol);
181void symbol_delete __P((symbol_t *symbol));
157
182
158void symtable_open(void);
183void symtable_open __P((void));
159
184
160void symtable_close(void);
185void symtable_close __P((void));
161
162symbol_t *
186
187symbol_t *
163 symtable_get(char *name);
188 symtable_get __P((char *name));
164
165symbol_node_t *
189
190symbol_node_t *
166 symlist_search(symlist_t *symlist, char *symname);
191 symlist_search __P((symlist_t *symlist, char *symname));
167
168void
192
193void
169 symlist_add(symlist_t *symlist, symbol_t *symbol, int how);
194 symlist_add __P((symlist_t *symlist, symbol_t *symbol, int how));
170#define SYMLIST_INSERT_HEAD 0x00
171#define SYMLIST_SORT 0x01
172
195#define SYMLIST_INSERT_HEAD 0x00
196#define SYMLIST_SORT 0x01
197
173void symlist_free(symlist_t *symlist);
198void symlist_free __P((symlist_t *symlist));
174
199
175void symlist_merge(symlist_t *symlist_dest, symlist_t *symlist_src1,
176 symlist_t *symlist_src2);
177void symtable_dump(FILE *ofile);
200void symlist_merge __P((symlist_t *symlist_dest, symlist_t *symlist_src1,
201 symlist_t *symlist_src2));
202void symtable_dump __P((FILE *ofile));