X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=sim%2Fh8300%2Fcompile.c;h=0d307577ae332b753205f5b8ac11d8646985356c;hb=b86015eaa50eb4b44a7055a5114262e94040213a;hp=462240ce1453591ca41b5c1690189fdcb1483969;hpb=454d05118bc21bb4966c0cb13d3bfc526c26e3b8;p=binutils-gdb.git diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 462240ce145..0d307577ae3 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -1018,7 +1018,7 @@ decode (SIM_DESC sd, int addr, unsigned char *data, decoded_inst *dst) p->literal = 0; if (OP_KIND (q->how) == O_JSR || OP_KIND (q->how) == O_JMP) - if (lvalue (sd, p->type, p->reg, &p->type)) + if (lvalue (sd, p->type, p->reg, (unsigned int *)&p->type)) goto end; } else if ((x & MODE) == ABS) @@ -1050,7 +1050,7 @@ decode (SIM_DESC sd, int addr, unsigned char *data, decoded_inst *dst) p->literal = cst[opnum]; if (OP_KIND (q->how) == O_JSR || OP_KIND (q->how) == O_JMP) - if (lvalue (sd, p->type, p->reg, &p->type)) + if (lvalue (sd, p->type, p->reg, (unsigned int *)&p->type)) goto end; } else if ((x & MODE) == PCREL) @@ -1891,7 +1891,7 @@ case O (name, SB): \ goto end; \ if (fetch (sd, &code->src, &tmp)) \ goto end; \ - m = 1 << tmp; \ + m = 1 << (tmp & 7); \ op; \ if (s) \ if (store (sd, &code->dst,ea)) \ @@ -2037,7 +2037,10 @@ sim_resume (SIM_DESC sd, int step, int siggnal) code->op3.literal = 0; if (OP_KIND (code->src.type) == OP_INDEXB) - code->dst.type = X (OP_REG, SB); + { + code->dst.type = X (OP_REG, SB); + code->dst.reg = code->op3.reg + 8; + } else code->dst.type = X (OP_REG, SW); } @@ -2566,7 +2569,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) { if (h8300smode) h8_set_exr (sd, (trace << 7) | intMask); - res = h8_get_exr (sd); + rd = h8_get_exr (sd); } else goto illegal; @@ -3886,13 +3889,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfff0; - else - ea = SEXTSHORT (ea); - + ea = SEXTSHORT (ea); res = SEXTSHORT (ea * SEXTSHORT (rd)); n = res & 0x8000; @@ -3907,11 +3904,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - res = ea * rd; n = res & 0x80000000; @@ -3925,11 +3917,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - /* Compute upper 32 bits of the 64-bit result. */ res = (((long long) ea) * ((long long) rd)) >> 32; @@ -3985,13 +3972,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - else - ea = SEXTCHAR (ea); - + ea = SEXTCHAR (ea); res = ea * SEXTCHAR (rd); n = res & 0x8000; @@ -4006,13 +3987,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfff0; - else - ea = SEXTSHORT (ea); - + ea = SEXTSHORT (ea); res = ea * SEXTSHORT (rd & 0xffff); n = res & 0x80000000; @@ -4103,11 +4078,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - if (ea) { res = SEXTSHORT (rd) / SEXTSHORT (ea); @@ -4129,11 +4099,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - if (ea) { res = rd / ea; @@ -4205,13 +4170,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) goto end; rd = SEXTSHORT (rd); - - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - else - ea = SEXTCHAR (ea); + ea = SEXTCHAR (ea); if (ea) { @@ -4236,12 +4195,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) fetch (sd, &code->dst, &rd)) goto end; - /* FIXME: is this the right place to be doing sign extend? */ - if (OP_KIND (code->src.type) == OP_IMM && - (ea & 8) != 0) - ea |= 0xfffffff0; - else - ea = SEXTSHORT (ea); + ea = SEXTSHORT (ea); if (ea) { @@ -5052,7 +5006,7 @@ sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) if (abfd != NULL) prog_bfd = abfd; else - prog_bfd = bfd_openr (prog, "coff-h8300"); + prog_bfd = bfd_openr (prog, NULL); if (prog_bfd != NULL) { /* Set the cpu type. We ignore failure from bfd_check_format @@ -5096,6 +5050,7 @@ sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) calloc (sizeof (char), memory_size)); h8_set_cache_idx_buf (sd, (unsigned short *) calloc (sizeof (short), memory_size)); + sd->memory_size = memory_size; h8_set_eightbit_buf (sd, (unsigned char *) calloc (sizeof (char), 256)); /* `msize' must be a power of two. */