Added grind support
authorceriel <none@none>
Fri, 1 Nov 1991 11:53:42 +0000 (11:53 +0000)
committerceriel <none@none>
Fri, 1 Nov 1991 11:53:42 +0000 (11:53 +0000)
22 files changed:
mach/m68020/ce/EM_table
mach/vax4/ce/EM_table
util/ceg/EM_parser/common/C_instr2.c
util/ceg/ce_back/as_back/.distr
util/ceg/ce_back/as_back/dbsym.c [new file with mode: 0644]
util/ceg/ce_back/as_back/proto.make
util/ceg/ce_back/obj_back/.distr
util/ceg/ce_back/obj_back/extnd.c
util/ceg/ce_back/obj_back/header.h
util/ceg/ce_back/obj_back/output.c
util/ceg/ce_back/obj_back/proto.make
util/ceg/ce_back/obj_back/symtable.c
util/ceg/ce_back/proto.make
util/ceg/defaults/message/C_cst.c
util/ceg/defaults/message/C_dlb.c
util/ceg/defaults/message/C_dnam.c
util/ceg/defaults/message/C_ilb.c
util/ceg/defaults/message/C_mes_begin.c
util/ceg/defaults/message/C_mes_end.c
util/ceg/defaults/message/C_pnam.c
util/ceg/defaults/message/C_scon.c
util/ceg/defaults/not_impl/not_impl_table

index e5d8c74..099cbe3 100644 (file)
@@ -881,3 +881,5 @@ C_prolog            ==>     .
 C_jump                 ==>     "bra $1".
 
 C_locals               ==>     "link a6, #-$1".
+
+C_db_sline             ==>     "jsr (___u_LiB)".
index 1c2194c..d7972b1 100644 (file)
@@ -777,3 +777,5 @@ C_locals
   $1 == 4       ==>             "clrq -(sp)".
   $1 == 8       ==>             "clrq -(sp)".
   default      ==>             "subl2 ~$1, sp".
+
+C_db_sline     ==>             "calls ~0, ___u_LiB".
index bd85a54..19281bd 100644 (file)
@@ -145,7 +145,7 @@ t_C_info C_info[] = {
                               { "str", 0, 0, 0}}
                     }, *C_instr_info;
 
-#define N_INSTR        269
+#define N_INSTR        270
 
 struct { char *name; int class, segment;}
                EM_instr[ N_INSTR ] = {
@@ -220,6 +220,7 @@ struct { char *name; int class, segment;}
                                { "C_cuf", NO_ARGS, SEGTXT},
                                { "C_cui", NO_ARGS, SEGTXT},
                                { "C_cuu", NO_ARGS, SEGTXT},
+                               { "C_db_sline", NO_ARGS, SEGTXT},
                                { "C_dch", NO_ARGS, SEGTXT},
                                { "C_dec", NO_ARGS, SEGTXT},
                                { "C_dee", EXTERNAL, SEGTXT},
index 65edd25..fbc0bdb 100644 (file)
@@ -27,3 +27,4 @@ symboldef.c
 text1.c
 text2.c
 text4.c
+dbsym.c
diff --git a/util/ceg/ce_back/as_back/dbsym.c b/util/ceg/ce_back/as_back/dbsym.c
new file mode 100644 (file)
index 0000000..c18448d
--- /dev/null
@@ -0,0 +1,26 @@
+#include "header.h"
+
+#ifndef OWN_SYMB
+B_symbstr(s, len, type, add, val, added)
+char *s, *val;
+arith added;
+{
+       if (! s) s = "";
+       fprint(codefile, ".symb \"%s\", %s+%ld, 0x%x, %d\n", s, val, (long) added, type, add);
+}
+
+B_symbcst(s, len, type, add, val)
+char *s;
+arith val;
+{
+       if (! s) s = "";
+       fprint(codefile, ".symb \"%s\", %ld, 0x%x, %d\n", s, val, type, add);
+}
+
+B_symd(s, len, type, add)
+char *s;
+{
+       if (! s) s = "";
+       fprint(codefile, ".symd \"%s\", 0x%x, %d\n", s, type, add);
+}
+#endif
index 265b0c0..31b4ce7 100644 (file)
@@ -17,7 +17,7 @@ all:  bottom.$(SUF) con1.$(SUF) con2.$(SUF) con4.$(SUF) end_back.$(SUF) \
        reloc2.$(SUF) reloc4.$(SUF) bss.$(SUF) rom1.$(SUF) rom2.$(SUF) \
        rom4.$(SUF) set_global.$(SUF) set_local.$(SUF) switchseg.$(SUF) \
        symboldef.$(SUF) do_open.$(SUF) do_close.$(SUF) text1.$(SUF) \
-       text2.$(SUF) text4.$(SUF)
+       text2.$(SUF) text4.$(SUF) dbsym.$(SUF)
 
 bottom.$(SUF) : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/bottom.c
        $(CC) $(CFLAGS) -c $(SOURCE)/bottom.c
@@ -93,3 +93,6 @@ switchseg.$(SUF) : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/switchseg.c
 
 symboldef.$(SUF) : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/symboldef.c
        $(CC) $(CFLAGS) -c $(SOURCE)/symboldef.c
+
+dbsym.$(SUF) : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/dbsym.c
+       $(CC) $(CFLAGS) -c $(SOURCE)/dbsym.c
index 4d503dc..cd700c6 100644 (file)
@@ -33,3 +33,4 @@ symtable.c
 text2.c
 text4.c
 common.c
+dbsym.c
index 221fb08..2fda33b 100644 (file)
@@ -77,9 +77,9 @@ char *s;
 
 
 char *extnd_dlb( g)
-arith g;
+label g;
 {
-       string_lengte = mysprint( DLB_FMT, (arith)g);
+       string_lengte = mysprint( DLB_FMT, (long)g);
         index_symbol_table = find_sym( string, STORE_STRING);
        return( symbol_table[ index_symbol_table].on_foff + string_area);
 }
@@ -88,7 +88,7 @@ arith g;
 char *extnd_ilb( l, prcno)
 arith l;
 {
-       string_lengte = mysprint( ILB_FMT, prcno, (arith) l);
+       string_lengte = mysprint( ILB_FMT, prcno, (long) l);
         index_symbol_table = find_sym( string, STORE_STRING);
        return( symbol_table[ index_symbol_table].on_foff + string_area);
 }
index a633794..f48ca3f 100644 (file)
@@ -3,5 +3,6 @@
 #define SYMBOL_DEFINITION      1
 #define REFERENCE              2
 #define STORE_STRING           3
+#define FORCE_DEF              4
 
 #define conv_seg( s)   ( ( s == SEGROM) ? SEGCON : s)
index 57a5810..0bf5947 100644 (file)
@@ -17,7 +17,7 @@ output_back()
 {
        struct outhead header;
        struct outsect sect;
-        long   ntext = text - text_area, 
+        long   ntext = text - text_area, 
                ndata = data - data_area,
                nchar;
 
@@ -94,12 +94,13 @@ reduce_name_table()
         * After that, the string table is reduced.
         */
 
-#define S_NEEDED       0x8000
-#define removable(nm)  (!(nm.on_type & S_NEEDED) && *(nm.on_foff+string_area) == GENLAB)
+#define S_NEEDED S_MOD
+#define removable(nm)  (!(nm->on_type & (S_NEEDED|S_STB)) && *(nm->on_foff+string_area) == GENLAB)
 
        register int *diff_index =
                (int *) Malloc((unsigned)(nname + 1) * sizeof(int));
        register struct outrelo *rp = reloc_info;
+       register struct outname *np;
        register int i;
        char *new_str;
        register char *p, *q;
@@ -113,22 +114,31 @@ reduce_name_table()
                rp++;
        }
 
-       for (i = 0; i < nname; i++) {
+       for (i = 0, np = symbol_table; i < nname; i++, np++) {
                diff_index[i] = diff_index[i-1];
-               if (removable(symbol_table[i])) {
+               if (removable(np)) {
                        diff_index[i]++;
                }
+               if ((np->on_type & S_TYP) == S_CRS) {
+                       struct outname *n = &symbol_table[(int) np->on_valu];
+                       if (! (n->on_type & S_COM)) {
+                               np->on_type &= ~S_TYP;
+                               np->on_type |= (n->on_type & S_TYP);
+                               np->on_valu = n->on_valu;
+                       }
+               }
        }
 
        rp = reloc_info;
        for (i = 0; i < nrelo; i++) {
+               symbol_table[rp->or_nami].on_type &= ~S_NEEDED;
                rp->or_nami -= diff_index[rp->or_nami];
                rp++;
        }
-       for (i = 0; i < nname; i++) {
-               register struct outname *np = &symbol_table[i];
-
-               np->on_type &= ~S_NEEDED;
+       for (i = 0, np = symbol_table; i < nname; i++, np++) {
+               if ((np->on_type & S_TYP) == S_CRS) {
+                       np->on_valu -= diff_index[(int) np->on_valu];
+               }
                if (diff_index[i] && diff_index[i] == diff_index[i-1]) {
                        symbol_table[i - diff_index[i]] = *np;
                }
@@ -138,14 +148,20 @@ reduce_name_table()
        free((char *)(diff_index-1));
 
        new_str = q = Malloc((unsigned)(string - string_area));
-       for (i = 0; i < nname; i++) {
-               p = symbol_table[i].on_foff + string_area;
-               symbol_table[i].on_foff = q - new_str;
+       for (i = 0, np = symbol_table; i < nname; i++, np++) {
+               p = np->on_foff + string_area;
+               np->on_foff = q - new_str;
                while (*q++ = *p) p++;
        }
        free(string_area);
        string_area = new_str;
        string = q;
+       for (i = 0, np = symbol_table; i < nname; i++, np++) {
+               if ((np->on_type & S_TYP) == S_CRS) {
+                       /* replace by reference to string */
+                       np->on_valu = symbol_table[(int) np->on_valu].on_foff;
+               }
+       }
 }
 
 wr_fatal()
@@ -159,11 +175,14 @@ static
 convert_outname( header)
 struct outhead *header;
 {
-    int i;
-
-       for ( i=0; i < nname; i++) {
-               symbol_table[ i].on_foff += OFF_CHAR( *header);
-    }
+       int i;
+       register struct outname *np;
+       register long l = OFF_CHAR(*header);
+
+       for (i = 0, np = symbol_table; i < nname; i++, np++) {
+               np->on_foff += l;
+               if ((np->on_type & S_TYP) == S_CRS) {
+                       np->on_valu += l;
+               }
+       }
 }
-
-
index 3939874..4f004c2 100644 (file)
@@ -17,7 +17,8 @@ all:  data.$(SUF) con2.$(SUF) con4.$(SUF) relocation.$(SUF) end_back.$(SUF) \
        reloc1.$(SUF) reloc2.$(SUF) reloc4.$(SUF) rom2.$(SUF) rom4.$(SUF) \
        set_global.$(SUF) set_local.$(SUF) switchseg.$(SUF) symboldef.$(SUF) \
        text2.$(SUF) text4.$(SUF) do_open.$(SUF) do_close.$(SUF) memory.$(SUF) \
-       label.$(SUF) misc.$(SUF) extnd.$(SUF) symtable.$(SUF) common.$(SUF)
+       label.$(SUF) misc.$(SUF) extnd.$(SUF) symtable.$(SUF) common.$(SUF) \
+       dbsym.$(SUF)
 
 data.$(SUF) : data.h back.h header.h $(SOURCE)/data.c
        $(CC) $(CFLAGS) -c $(SOURCE)/data.c
@@ -106,3 +107,5 @@ label.$(SUF) : data.h back.h $(SRC_DIR)/mach.h $(SOURCE)/label.c
 common.$(SUF) : data.h back.h $(SRC_DIR)/mach.h $(SOURCE)/common.c
        $(CC) $(CFLAGS) -c $(SOURCE)/common.c
 
+dbsym.$(SUF) : data.h back.h $(SRC_DIR)/mach.h $(SOURCE)/dbsym.c
+       $(CC) $(CFLAGS) -c $(SOURCE)/dbsym.c
index db324a9..8733392 100644 (file)
@@ -45,7 +45,8 @@ int isdef;
        register struct Hashitem *ip;
        register int h;
 
-       if ( index_symbol_table != -1 ) {
+       if (isdef != FORCE_DEF) {
+           if ( index_symbol_table != -1 )     {
                s = symbol_table + index_symbol_table;
                if ( sym == s->on_foff + string_area)  {
                        if ( (s->on_valu == -2) && ( isdef == REFERENCE)) {
@@ -54,10 +55,10 @@ int isdef;
                        }
                        return( index_symbol_table);
                }
-       }
+           }
 
-       h = Hash(sym);
-       for ( ip = Hashtab[h] + Hashitems ; ip != Hashitems; 
+           h = Hash(sym);
+           for ( ip = Hashtab[h] + Hashitems ; ip != Hashitems; 
                                          ip = (ip->hs_next) + Hashitems) {
                register char *p = sym, *q;
 
@@ -70,26 +71,30 @@ int isdef;
                        }
                        return ip->hs_nami;
                }
+           }
        }
        
        if ( nname >= size_symbol)  
                mem_symbol_hash();
 
        s = symbol_table + nname;
-       ip = Hashitems + nname + 1;  /* skip the first entry */
 
-       if (isdef == REFERENCE)  {
+       if (isdef != FORCE_DEF) {
+           ip = Hashitems + nname + 1;  /* skip the first entry */
+
+           if (isdef == REFERENCE)  {
                s->on_type = S_EXT; 
                s->on_valu = -1;
-       }
-       if (isdef == STORE_STRING) {
+           }
+           if (isdef == STORE_STRING) {
                s->on_type = S_UND;
                s->on_valu = -2; 
-       }
+           }
 
-       ip->hs_nami = nname;
-       ip->hs_next = Hashtab[h];
-       Hashtab[h] = ip - Hashitems;
+           ip->hs_nami = nname;
+           ip->hs_next = Hashtab[h];
+           Hashtab[h] = ip - Hashitems;
+       }
 
        if ( sym == string) 
                string += string_lengte;
index 54423a3..25ff80c 100644 (file)
@@ -11,14 +11,14 @@ ASLIST = back.h bottom.c bss.c con1.c con2.c con4.c \
                do_close.c do_open.c end_back.c gen1.c gen2.c gen4.c header.h \
                init_back.c reloc1.c reloc2.c reloc4.c rom1.c rom2.c rom4.c \
                set_global.c set_local.c switchseg.c symboldef.c text1.c \
-               text2.c text4.c
+               text2.c text4.c dbsym.c
 
 OBJLIST = back.h con2.c con4.c data.c data.h do_close.c do_open.c \
                end_back.c extnd.c gen1.c gen2.c gen4.c hash.h header.h \
                init_back.c label.c memory.c misc.c output.c \
                reloc1.c reloc2.c reloc4.c relocation.c rom2.c rom4.c \
                set_global.c set_local.c switchseg.c symboldef.c symtable.c \
-               text2.c text4.c common.c
+               text2.c text4.c common.c dbsym.c
 
 all:
 
index ca7682e..0118528 100644 (file)
@@ -1,7 +1,26 @@
 #define CODE_EXPANDER
 #include <em.h>
+#include <stb.h>
+#include <em_mes.h>
+
+extern int __db_mes, __db_cst, __db_len, __db_type, __db_add;
+extern char *__db_str;
 
 C_cst( l)
 arith l;
 {
+       if (__db_mes) {
+               if (! __db_cst) __db_type = l;
+               else if (__db_cst == 1) {
+                       if (__db_mes == ms_std) {
+                               if (__db_type == N_SLINE) {
+                                       C_db_sline();
+                               }
+                               B_symd(__db_str, __db_len, __db_type, (int) l);
+                       }
+                       else __db_add = l;
+               }
+               else B_symbcst(__db_str, __db_len, __db_type, __db_add, l);
+               __db_cst++;
+       }
 }
index 49746d8..a6da60a 100644 (file)
@@ -1,8 +1,15 @@
 #define CODE_EXPANDER
 #include <em.h>
+#include "back.h"
+
+extern int __db_mes, __db_len, __db_type, __db_add;
+extern char *__db_str;
 
 C_dlb( l, val)
 label l;
-char *val;
+arith val;
 {
+       if (__db_mes) {
+               B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_dlb(l), val);
+       }
 }
index c673ad6..5a9cac4 100644 (file)
@@ -1,8 +1,15 @@
 #define CODE_EXPANDER
 #include <em.h>
+#include "back.h"
+
+extern int __db_mes, __db_len, __db_type, __db_add;
+extern char *__db_str;
 
 C_dnam( str, val)
 char *str;
 arith val;
 {
+       if (__db_mes) {
+               B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_dnam(str), val);
+       }
 }
index 8d431ae..091feb6 100644 (file)
@@ -1,7 +1,16 @@
 #define CODE_EXPANDER
 #include <em.h>
+#include "back.h"
+
+extern int __db_mes, __db_len, __db_type, __db_add;
+extern char *__db_str;
+
+extern int B_procno;
 
 C_ilb( l)
 label l;
 {
+       if (__db_mes) {
+               B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_ilb(l, B_procno), (arith) 0);
+       }
 }
index 773391b..dedcbf8 100644 (file)
@@ -1,7 +1,16 @@
 #define CODE_EXPANDER
 #include <em.h>
+#include <em_mes.h>
+
+int __db_mes;
+char *__db_str = 0;
+int __db_len = 0;
+int __db_cst = 0;
+int __db_type;
+int __db_add;
 
 C_mes_begin( ms)
 int ms;
 {
+       __db_mes = (ms == ms_stb || ms == ms_std) ? ms : 0;
 }
index 542124a..cf303b7 100644 (file)
@@ -1,6 +1,15 @@
 #define CODE_EXPANDER
 #include <em.h>
 
+extern int __db_mes;
+extern int __db_cst;
+extern char *__db_str;
+
 C_mes_end()
 {
+       if (__db_mes) {
+               __db_mes = 0;
+               __db_cst = 0;
+               __db_str = 0;
+       }
 }
index af5b853..117f3c2 100644 (file)
@@ -1,7 +1,14 @@
 #define CODE_EXPANDER
 #include <em.h>
+#include "back.h"
+
+extern int __db_mes, __db_len, __db_type, __db_add;
+extern char *__db_str;
 
 C_pnam( str)
 char *str;
 {
+       if (__db_mes) {
+               B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_name(str), (arith) 0);
+       }
 }
index 6d89bcd..612cc47 100644 (file)
@@ -1,8 +1,16 @@
 #define CODE_EXPANDER
 #include <em.h>
 
+extern int __db_mes;
+extern char *__db_str;
+extern int __db_len;
+
 C_scon( str, siz)
 char *str;
 arith siz;
 {
+       if (__db_mes) {
+               __db_str = str;
+               __db_len = siz;
+       }
 }
index d492375..7c0c9c4 100644 (file)
@@ -268,3 +268,4 @@ C_bss_fcon  ==>     not_implemented( "C_bss_fcon").
 C_hol_fcon     ==>     not_implemented( "C_hol_fcon").
 C_con_fcon     ==>     not_implemented( "C_con_fcon").
 C_exc  ==>     not_implemented( "C_exc").
+C_db_sline     ==>     .