Initial revision
authorceriel <none@none>
Thu, 18 Feb 1988 10:22:14 +0000 (10:22 +0000)
committerceriel <none@none>
Thu, 18 Feb 1988 10:22:14 +0000 (10:22 +0000)
mach/arm/.distr [new file with mode: 0644]
mach/arm/Action [new file with mode: 0644]
mach/arm/cv/.distr [new file with mode: 0644]
mach/arm/cv/Makefile [new file with mode: 0644]
mach/arm/cv/arm.h [new file with mode: 0644]
mach/arm/cv/cv.c [new file with mode: 0644]

diff --git a/mach/arm/.distr b/mach/arm/.distr
new file mode 100644 (file)
index 0000000..815da01
--- /dev/null
@@ -0,0 +1,6 @@
+Action
+as
+cv
+libcc
+libem
+ncg
diff --git a/mach/arm/Action b/mach/arm/Action
new file mode 100644 (file)
index 0000000..1ddbe79
--- /dev/null
@@ -0,0 +1,12 @@
+name "ARM assembler"
+dir as
+end
+name "ARM backend"
+dir ncg
+end
+name "ARM C libraries"
+dir libcc
+end
+name "ARM EM library"
+dir libem
+end
diff --git a/mach/arm/cv/.distr b/mach/arm/cv/.distr
new file mode 100644 (file)
index 0000000..3ba1595
--- /dev/null
@@ -0,0 +1,3 @@
+Makefile
+arm.h
+cv.c
diff --git a/mach/arm/cv/Makefile b/mach/arm/cv/Makefile
new file mode 100644 (file)
index 0000000..60df44d
--- /dev/null
@@ -0,0 +1,22 @@
+EMHOME=../../..
+OBJLIB=$(EMHOME)/modules/lib/libobject.a
+
+head:  cv
+
+cv:    conv.c
+       $(CC) -I$(EMHOME)/h -o cv cv.c $(OBJLIB)
+
+install:       head
+       @echo Nothing is installed
+
+cmp:   head
+       @echo Nothing is compared
+
+clean:
+       rm -f *.o
+
+pr:
+       @pr `pwd`/Makefile `pwd`/cv.c
+
+opr:
+       make pr | opr
diff --git a/mach/arm/cv/arm.h b/mach/arm/cv/arm.h
new file mode 100644 (file)
index 0000000..be8a56c
--- /dev/null
@@ -0,0 +1,34 @@
+#define MAXCHUNK        5
+#define NSECT          4
+
+
+struct entry{
+        char chunkid[8];
+        long offset;
+        long size;
+};
+
+struct armhead{
+        long chunkfileid;
+        long maxchunks;
+        long numchunks;
+        struct entry entries[MAXCHUNK];
+};
+
+struct chunkhead{
+        long objtype;
+        long versionid;
+        long narea;
+        long nsymb;
+        long entrya;
+        long entryo;
+};
+
+struct areadec{
+        long name;
+        long atal;
+        long size;
+        long nrel;
+        long base;
+};
+
diff --git a/mach/arm/cv/cv.c b/mach/arm/cv/cv.c
new file mode 100644 (file)
index 0000000..88a7115
--- /dev/null
@@ -0,0 +1,96 @@
+#include <stdio.h>
+#include <out.h>
+#include "arm.h"
+struct outhead ohead;
+struct outsect sect[NSECT];
+struct armhead ahead;
+struct chunkhead chead;
+struct areadec area[NSECT];
+int fd;
+
+
+main (argc,argv)
+int argc;
+char *argv[];
+{
+        if (argc != 3)   fatal ("usage: dl ackobj armobj\n");
+        if (! rd_open (*++argv))
+                fatal ("can't open \n");
+       if ((fd = open(*++argv, 1)) <0)
+                fatal ("can't open \n");
+        else    {
+                convert ();
+                }
+}
+
+convert ()
+{
+        int i,areasize=0;
+       char buf[4];
+       int cnt;
+
+        rd_ohead(&ohead);
+        if (ohead.oh_flags & HF_LINK) {
+                fatal("unresolved references\n");
+        }
+        ahead.chunkfileid = 0xC3CBC6C5;
+        ahead.maxchunks = MAXCHUNK;
+        ahead.numchunks = MAXCHUNK;
+       strncpy(ahead.entries[0].chunkid , "OBJ_HEAD", 8);
+       strncpy(ahead.entries[1].chunkid , "OBJ_AREA", 8);
+       strncpy(ahead.entries[2].chunkid , "OBJ_IDFN", 8);
+       strncpy(ahead.entries[3].chunkid , "OBJ_SYMT", 8);
+       strncpy(ahead.entries[4].chunkid , "OBJ_STRT", 8);
+       ahead.entries[0].offset = sizeof(struct armhead);
+       ahead.entries[0].size = sizeof(struct chunkhead) + ohead.oh_nsect *
+                                       sizeof(struct areadec);
+       ahead.entries[1].offset = ahead.entries[0].offset+ahead.entries[0].size;
+        chead.objtype = 0xC5E2D080;
+        chead.versionid = 110;
+        chead.narea = ohead.oh_nsect;
+        chead.nsymb = ohead.oh_nname;
+        chead.entrya = 0;
+        chead.entryo = 0;
+       lseek(fd, ahead.entries[1].offset, 0);
+        rd_sect(sect, ohead.oh_nsect);
+        for (i = 0; i < ohead.oh_nsect; i++) {
+                area[i].name=0;
+                area[i].atal=2|1<<7|(i=0?(1<<8):0);
+                area[i].size=sect[i].os_size;
+                area[i].nrel=0;
+                area[i].base=sect[i].os_base;
+               rd_outsect(i);
+               cnt = sect[i].os_flen;
+               areasize += cnt;
+               if (cnt!=sect[i].os_size)
+                       area[i].atal |= 1<<11;
+                       if (cnt & 3)
+                               fatal("alignment error\n");     
+                       while (cnt){
+                               rd_emit(buf, (long)4);
+                               write(fd, buf, 4);
+                               cnt -= 4;
+                       }
+        }
+       ahead.entries[1].size = areasize;
+       lseek(fd, 0, 0);
+       write(fd, &ahead, sizeof(struct armhead));
+       write(fd, &chead, sizeof(struct chunkhead));
+       for(i=1; i<NSECT; i++)
+               write(fd, &area[i], sizeof(struct areadec));
+       close(fd);
+}
+
+fatal(s)
+char *s;
+{
+        printf (s);
+        exit (-1);
+}
+
+rd_fatal(s)
+char *s;
+{
+        printf (s);
+        exit (-1);
+}