From 02188d2a161248aa89ae9fddd347b61e56d00766 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 28 Jan 2022 01:47:05 +0100 Subject: Started trying to add missing instructions. --- utils/tl/span.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'utils/tl/span.c') diff --git a/utils/tl/span.c b/utils/tl/span.c index 85f27621..8ceaf631 100644 --- a/utils/tl/span.c +++ b/utils/tl/span.c @@ -771,6 +771,7 @@ Optab* oplook(Prog *p) { int a1, a2, a3, r; + int oa1, oa2, oa3; char *c1, *c3; Optab *o, *e; Optab *otab; @@ -808,6 +809,9 @@ oplook(Prog *p) a2 = C_NONE; if(p->reg != NREG) a2 = C_REG; + + oa1 = a1; oa2 = a2; oa3 = a3; + r = p->as; o = orange[r].start; if(o == 0) { @@ -834,7 +838,7 @@ oplook(Prog *p) return o; } diag("illegal combination %A %d %d %d", - p->as, a1, a2, a3); + p->as, oa1, oa2, oa3); prasm(p); if(o == 0) o = otab; -- cgit v1.2.3 From 691df57aba2063cba34cc3bcf0cea90a54e83e76 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Sun, 2 Apr 2023 18:24:44 +0200 Subject: Enabled assembly of constant strings into the text segment. --- utils/tl/asm.c | 22 ++++++++++++++++------ utils/tl/l.h | 2 ++ utils/tl/span.c | 2 ++ utils/tl/thumb.c | 6 +++--- 4 files changed, 23 insertions(+), 9 deletions(-) (limited to 'utils/tl/span.c') diff --git a/utils/tl/asm.c b/utils/tl/asm.c index 66a7f0c6..ec0f63a8 100644 --- a/utils/tl/asm.c +++ b/utils/tl/asm.c @@ -63,17 +63,15 @@ asmb(void) asmout(p, o); pc += o->size; } - while(pc-INITTEXT < textsize) { - cput(0); - pc++; + + /* output strings in text segment */ + while (pc < INITRODAT) { + cput(0); pc++; } - if(debug['a']) - Bprint(&bso, "\n"); Bflush(&bso); cflush(); - /* output strings in text segment */ etext = INITTEXT + textsize; for(t = pc; t < etext; t += sizeof(buf)-100) { if(etext-t > sizeof(buf)-100) @@ -82,6 +80,18 @@ asmb(void) datblk(t, etext-t, 1); } + pc = t; + + while(pc-INITTEXT < textsize) { + cput(0); + pc++; + } + + if(debug['a']) + Bprint(&bso, "\n"); + Bflush(&bso); + cflush(); + curtext = P; switch(HEADTYPE) { case 0: diff --git a/utils/tl/l.h b/utils/tl/l.h index f2e6ad02..3e84ff66 100644 --- a/utils/tl/l.h +++ b/utils/tl/l.h @@ -90,6 +90,7 @@ struct Sym uchar fnptr; // used as fn ptr Use* use; Sym* link; + long base; }; #define SIGNINTERN (1729*325*1729) @@ -248,6 +249,7 @@ EXTERN union EXTERN long HEADR; /* length of header */ EXTERN int HEADTYPE; /* type of header */ EXTERN long INITDAT; /* data location */ +EXTERN long INITRODAT; /* read-only data location */ EXTERN long INITRND; /* data round above text location */ EXTERN long INITTEXT; /* text location */ EXTERN char* INITENTRY; /* entry point */ diff --git a/utils/tl/span.c b/utils/tl/span.c index 8ceaf631..6d5a0443 100644 --- a/utils/tl/span.c +++ b/utils/tl/span.c @@ -350,6 +350,7 @@ span(void) * add strings to text segment */ c = rnd(c, 8); + INITRODAT = c; for(i=0; ilink) { if(s->type != SSTRING) @@ -358,6 +359,7 @@ span(void) while(v & 3) v++; s->value = c; + s->base = -INITDAT; // compensate for assumptions in thumb.c c += v; } } diff --git a/utils/tl/thumb.c b/utils/tl/thumb.c index ff089918..d3324ebf 100644 --- a/utils/tl/thumb.c +++ b/utils/tl/thumb.c @@ -181,7 +181,7 @@ thumbaclass(Adr *a, Prog *p) a->sym->name, TNAME); a->sym->type = SDATA; } - instoffset = a->sym->value + a->offset + INITDAT; + instoffset = a->sym->value + a->offset + INITDAT + a->sym->base; return C_LEXT; /* INITDAT unknown at this stage */ // return immacon(instoffset, p, C_SEXT, C_LEXT); case D_AUTO: @@ -213,7 +213,7 @@ thumbaclass(Adr *a, Prog *p) s->name, TNAME); s->type = SDATA; } - instoffset = s->value + a->offset + INITDAT; + instoffset = s->value + a->offset + INITDAT + s->base; if(s->type == STEXT || s->type == SLEAF){ instoffset = s->value + a->offset; #ifdef CALLEEBX @@ -262,7 +262,7 @@ thumbaclass(Adr *a, Prog *p) #endif return C_LCON; } - instoffset = s->value + a->offset + INITDAT; + instoffset = s->value + a->offset + INITDAT + s->base; return C_LCON; /* INITDAT unknown at this stage */ // return immcon(instoffset, p); case D_AUTO: -- cgit v1.2.3