From: ceriel Date: Thu, 18 Feb 1988 10:22:14 +0000 (+0000) Subject: Initial revision X-Git-Tag: release-5-5~3600 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3ccbd9cdc7c1e84e1cb394a37570181d0b23c902;p=ack.git Initial revision --- diff --git a/mach/arm/.distr b/mach/arm/.distr new file mode 100644 index 000000000..815da01cc --- /dev/null +++ b/mach/arm/.distr @@ -0,0 +1,6 @@ +Action +as +cv +libcc +libem +ncg diff --git a/mach/arm/Action b/mach/arm/Action new file mode 100644 index 000000000..1ddbe79a5 --- /dev/null +++ b/mach/arm/Action @@ -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 index 000000000..3ba15958e --- /dev/null +++ b/mach/arm/cv/.distr @@ -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 index 000000000..60df44d3d --- /dev/null +++ b/mach/arm/cv/Makefile @@ -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 index 000000000..be8a56ced --- /dev/null +++ b/mach/arm/cv/arm.h @@ -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 index 000000000..88a711574 --- /dev/null +++ b/mach/arm/cv/cv.c @@ -0,0 +1,96 @@ +#include +#include +#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