e2k: Fix decoding of ALES2/5.

This commit is contained in:
Denis Drakhnia 2021-01-17 13:10:39 +02:00 committed by Denis Drakhnia
parent 562df00e27
commit 5aa3d47668
2 changed files with 11 additions and 6 deletions

View File

@ -47,12 +47,12 @@ static size_t unpack_bundle(CPUE2KState *env, DisasContext *ctx)
}
if (GET_BIT(hs, 25)) {
bundle->ales_present[5] = ALES_ALLOCATED;
bundle->ales_present[5] = ALES_PRESENT;
bundle->ales[5] = 0x01c0;
}
if (GET_BIT(hs, 22)) {
bundle->ales_present[2] = ALES_ALLOCATED;
bundle->ales_present[2] = ALES_PRESENT;
bundle->ales[2] = 0x01c0;
}
@ -76,8 +76,8 @@ static size_t unpack_bundle(CPUE2KState *env, DisasContext *ctx)
/* Adjust `ALES_PRESENT[{5,2}]' as proposed above now that we know that
they are allocated. */
bundle->ales_present[5] |= ALES_PRESENT;
bundle->ales_present[2] |= ALES_PRESENT;
bundle->ales_present[5] |= ALES_ALLOCATED;
bundle->ales_present[2] |= ALES_ALLOCATED;
pos += 4;
}

View File

@ -6,7 +6,7 @@
#include "alops.inc"
static int16_t alops_map[4][128][6] = { { { -1 } } };
static int16_t alops_map[4][128][6];
typedef struct {
TCGv_i32 tag;
@ -27,6 +27,7 @@ typedef struct {
typedef struct {
DisasContext *ctx;
int chan;
AlesFlag ales_present;
int aaincr_len;
union {
uint32_t als;
@ -2937,7 +2938,9 @@ static inline void gen_alopf2_dx(Instr *instr,
static Alop find_op(Instr *instr)
{
int16_t index = alops_map[instr->opc2][instr->opc1][instr->chan];
/* ALES2/5 may be allocated but must not be used */
int opc2 = instr->ales_present & ALES_PRESENT ? instr->opc2 : 0;
int16_t index = alops_map[opc2][instr->opc1][instr->chan];
while (index != -1) {
bool is_match = false;
AlopDesc *desc = &alops[index];
@ -4546,6 +4549,7 @@ static void chan_execute(DisasContext *ctx, int chan)
instr.chan = chan;
instr.als = ctx->bundle.als[chan];
instr.ales = ctx->bundle.ales[chan];
instr.ales_present = ctx->bundle.ales_present[chan];
chan_check_preds(ctx, chan, l0);
@ -4757,6 +4761,7 @@ void e2k_alc_init(DisasContext *ctx)
{
int i, j;
memset(alops_map, -1, sizeof(alops_map));
// TODO: symmetric alops table
/* Most alops are symmetric and can be stored in a half table. */
for (i = 0; i < ARRAY_SIZE(alops); i++) {