diff options
Diffstat (limited to 'sys/dev/microcode/aic7xxx/aicasm_symbol.c')
-rw-r--r-- | sys/dev/microcode/aic7xxx/aicasm_symbol.c | 77 |
1 files changed, 54 insertions, 23 deletions
diff --git a/sys/dev/microcode/aic7xxx/aicasm_symbol.c b/sys/dev/microcode/aic7xxx/aicasm_symbol.c index 2ebd01b4bd1..7b4ba330f65 100644 --- a/sys/dev/microcode/aic7xxx/aicasm_symbol.c +++ b/sys/dev/microcode/aic7xxx/aicasm_symbol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aicasm_symbol.c,v 1.4 2002/06/28 00:34:55 smurph Exp $ */ +/* $OpenBSD: aicasm_symbol.c,v 1.5 2002/06/30 18:25:58 smurph Exp $ */ /* * Aic7xxx SCSI host adapter firmware asssembler symbol table implementation * @@ -11,31 +11,40 @@ * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the - * GNU Public License ("GPL"). + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. * - * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_symbol.c,v 1.14 2001/07/18 21:03:32 gibbs Exp $ + * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_symbol.c,v 1.17 2002/06/06 16:07:18 gibbs Exp $ */ #include <sys/types.h> #include <db.h> #include <fcntl.h> +#include <regex.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -317,12 +326,15 @@ symtable_dump(ofile) symlist_t constants; symlist_t download_constants; symlist_t aliases; + symlist_t exported_labels; + u_int i; SLIST_INIT(®isters); SLIST_INIT(&masks); SLIST_INIT(&constants); SLIST_INIT(&download_constants); SLIST_INIT(&aliases); + SLIST_INIT(&exported_labels); if (symtable != NULL) { DBT key; @@ -344,10 +356,8 @@ symtable_dump(ofile) symlist_add(&masks, cursym, SYMLIST_SORT); break; case CONST: - if (cursym->info.cinfo->define == FALSE) { - symlist_add(&constants, cursym, + symlist_add(&constants, cursym, SYMLIST_INSERT_HEAD); - } break; case DOWNLOAD_CONST: symlist_add(&download_constants, cursym, @@ -357,6 +367,12 @@ symtable_dump(ofile) symlist_add(&aliases, cursym, SYMLIST_INSERT_HEAD); break; + case LABEL: + if (cursym->info.linfo->exported == 0) + break; + symlist_add(&exported_labels, cursym, + SYMLIST_INSERT_HEAD); + break; default: break; } @@ -395,14 +411,14 @@ symtable_dump(ofile) /* Output what we have */ fprintf(ofile, -"/* - * DO NOT EDIT - This file is automatically generated - * from the following source files: - * -%s */\n", versions); +"/*\n" +" * DO NOT EDIT - This file is automatically generated\n" +" * from the following source files:\n" +" *\n" +"%s */\n", versions); while (registers.slh_first != NULL) { symbol_node_t *curnode; - u_int8_t value; + u_int value; char *tab_str; char *tab_str2; @@ -472,5 +488,20 @@ symtable_dump(ofile) curnode->symbol->info.cinfo->value); free(curnode); } + fprintf(ofile, "#define\tDOWNLOAD_CONST_COUNT\t0x%02x\n", i); + + fprintf(ofile, "\n\n/* Exported Labels */\n"); + + while (exported_labels.slh_first != NULL) { + symbol_node_t *curnode; + + curnode = exported_labels.slh_first; + SLIST_REMOVE_HEAD(&exported_labels, links); + fprintf(ofile, "#define\tLABEL_%-8s\t0x%02x\n", + curnode->symbol->name, + curnode->symbol->info.linfo->address); + free(curnode); + } } } + |