diff options
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/5l/asm.c | 17 | ||||
| -rw-r--r-- | utils/libmach/executable.c | 22 |
2 files changed, 22 insertions, 17 deletions
diff --git a/utils/5l/asm.c b/utils/5l/asm.c index 53d51c45..d693eea6 100644 --- a/utils/5l/asm.c +++ b/utils/5l/asm.c @@ -902,13 +902,15 @@ PP = p; r = o->param; o1 = olr(instoffset, r, p->to.reg, p->scond); - o2 = oprrr(ASLL, p->scond); - o3 = oprrr(ASRA, p->scond); r = p->to.reg; if(p->as == AMOVB) { + o2 = oprrr(ASLL, p->scond & ~C_PBIT); + o3 = oprrr(ASRA, p->scond & ~C_PBIT); o2 |= (24<<7)|(r)|(r<<12); o3 |= (24<<7)|(r)|(r<<12); } else { + o2 = oprrr(ASLL, p->scond); + o3 = oprrr(ASRA, p->scond); o2 |= (16<<7)|(r)|(r<<12); if(p->as == AMOVHU) o3 = oprrr(ASRL, p->scond); @@ -1195,15 +1197,18 @@ PP = p; o1 |= 1<<22; break; - case 60: /* movb R(R),R -> ldrsb indexed */ + case 60: /* movb R(R),R -> ldrb indexed */ if(p->from.reg == NREG) { diag("byte MOV from shifter operand"); goto mov; } if(p->from.offset&(~0xf)) - diag("bad shift in LDRSB"); - o1 = olhrr(p->from.offset, p->from.reg, p->to.reg, p->scond); - o1 ^= (1<<5)|(1<<6); + diag("bad shift in LDRB"); + o1 = olr(p->from.offset, p->from.reg, p->to.reg, p->scond); + if(p->as == AMOVB) { + o1 |= 1<<22; /* B */ + o1 ^= 1<<25; /* instruction with Rm */ + } break; case 61: /* movw/b/bu R,R<<[IR](R) -> str indexed */ 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; } |
