diff options
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/ic/cgen.c | 20 | ||||
| -rw-r--r-- | utils/ic/reg.c | 2 | ||||
| -rw-r--r-- | utils/il/pass.c | 2 | ||||
| -rw-r--r-- | utils/libmach/executable.c | 22 |
4 files changed, 30 insertions, 16 deletions
diff --git a/utils/ic/cgen.c b/utils/ic/cgen.c index a8bf5ea1..7afe3290 100644 --- a/utils/ic/cgen.c +++ b/utils/ic/cgen.c @@ -179,11 +179,21 @@ cgen(Node *n, Node *nn) cgen(r, &nod1); gopcode(o, &nod1, Z, &nod); } else { - regalloc(&nod, r, nn); - cgen(r, &nod); - regalloc(&nod1, l, Z); - cgen(l, &nod1); - gopcode(o, &nod, &nod1, &nod); + if(typev[n->type->etype] && + (o == OLSHR || o == OASHL || o == OASHR)){ + /* vlong shifts: result has type of l, not type of r */ + regalloc(&nod1, r, Z); + cgen(r, &nod1); + regalloc(&nod, l, nn); + cgen(l, &nod); + gopcode(o, &nod1, Z, &nod); + }else{ + regalloc(&nod, r, nn); + cgen(r, &nod); + regalloc(&nod1, l, Z); + cgen(l, &nod1); + gopcode(o, &nod, &nod1, &nod); + } } gopcode(OAS, &nod, Z, nn); regfree(&nod); diff --git a/utils/ic/reg.c b/utils/ic/reg.c index 50df739a..66ab68fe 100644 --- a/utils/ic/reg.c +++ b/utils/ic/reg.c @@ -536,6 +536,8 @@ addmove(Reg *r, int bn, int rn, int f) p1->as = AMOVBU; if(v->etype == TUSHORT) p1->as = AMOVHU; + if(thechar == 'j' && v->etype == TUINT) + p1->as = AMOVWU; } if(debug['R']) print("%P\t.a%P\n", p, p1); diff --git a/utils/il/pass.c b/utils/il/pass.c index 8d3b435b..69aec247 100644 --- a/utils/il/pass.c +++ b/utils/il/pass.c @@ -68,6 +68,8 @@ dodata(void) orig += v; s->type = SDATA1; } + while(orig & 7) + orig++; orig1 = orig; /* diff --git a/utils/libmach/executable.c b/utils/libmach/executable.c index 2734cf44..ce12ca83 100644 --- a/utils/libmach/executable.c +++ b/utils/libmach/executable.c @@ -17,7 +17,7 @@ typedef struct { uvlong hdr[1]; } exechdr64; Ehdr elfhdr32; /* elf.h */ - struct mipsexec mips; /* bootexec.h */ + struct mipsexec mips32; /* bootexec.h */ struct mips4kexec mips4k; /* bootexec.h */ struct sparcexec sparc; /* bootexec.h */ struct nextexec next; /* bootexec.h */ @@ -451,22 +451,22 @@ mipsboot(int fd, Fhdr *fp, ExecHdr *hp) { USED(fd); fp->type = FMIPSB; - switch(hp->e.mips.amagic) { + switch(hp->e.mips32.amagic) { default: case 0407: /* some kind of mips */ - settext(fp, (u32int)hp->e.mips.mentry, (u32int)hp->e.mips.text_start, - hp->e.mips.tsize, sizeof(struct mipsexec)+4); - setdata(fp, (u32int)hp->e.mips.data_start, hp->e.mips.dsize, - fp->txtoff+hp->e.mips.tsize, hp->e.mips.bsize); + settext(fp, (u32int)hp->e.mips32.mentry, (u32int)hp->e.mips32.text_start, + hp->e.mips32.tsize, sizeof(struct mipsexec)+4); + setdata(fp, (u32int)hp->e.mips32.data_start, hp->e.mips32.dsize, + fp->txtoff+hp->e.mips32.tsize, hp->e.mips32.bsize); break; case 0413: /* some kind of mips */ - settext(fp, (u32int)hp->e.mips.mentry, (u32int)hp->e.mips.text_start, - hp->e.mips.tsize, 0); - setdata(fp, (u32int)hp->e.mips.data_start, hp->e.mips.dsize, - hp->e.mips.tsize, hp->e.mips.bsize); + settext(fp, (u32int)hp->e.mips32.mentry, (u32int)hp->e.mips32.text_start, + hp->e.mips32.tsize, 0); + setdata(fp, (u32int)hp->e.mips32.data_start, hp->e.mips32.dsize, + hp->e.mips32.tsize, hp->e.mips32.bsize); break; } - setsym(fp, hp->e.mips.nsyms, 0, hp->e.mips.pcsize, hp->e.mips.symptr); + setsym(fp, hp->e.mips32.nsyms, 0, hp->e.mips32.pcsize, hp->e.mips32.symptr); fp->hdrsz = 0; /* header stripped */ return 1; } |
