Sync up with SDM 2.1:

o  Add nop/hint formats F16, I18, M48 and X5,
o  Add format M47 for ptc.e,
o  Add hint instruction,
o  Fix decoding of cmp8xchg16.
This commit is contained in:
marcel 2006-06-24 01:19:52 +00:00
parent 5688b2b9fa
commit f5d673ba84
5 changed files with 77 additions and 20 deletions

View File

@ -203,15 +203,16 @@ enum asm_fmt {
ASM_FMT_F1, ASM_FMT_F2, ASM_FMT_F3, ASM_FMT_F4,
ASM_FMT_F5, ASM_FMT_F6, ASM_FMT_F7, ASM_FMT_F8,
ASM_FMT_F9, ASM_FMT_F10, ASM_FMT_F11, ASM_FMT_F12,
ASM_FMT_F13, ASM_FMT_F14, ASM_FMT_F15,
ASM_FMT_F13, ASM_FMT_F14, ASM_FMT_F15, ASM_FMT_F16,
ASM_FMT_I = 0x0400,
ASM_FMT_I1, ASM_FMT_I2, ASM_FMT_I3, ASM_FMT_I4,
ASM_FMT_I5, ASM_FMT_I6, ASM_FMT_I7, ASM_FMT_I8,
ASM_FMT_I9, ASM_FMT_I10, ASM_FMT_I11, ASM_FMT_I12,
ASM_FMT_I13, ASM_FMT_I14, ASM_FMT_I15, ASM_FMT_I16,
ASM_FMT_I17, ASM_FMT_I19, ASM_FMT_I20, ASM_FMT_I21,
ASM_FMT_I22, ASM_FMT_I23, ASM_FMT_I24, ASM_FMT_I25,
ASM_FMT_I26, ASM_FMT_I27, ASM_FMT_I28, ASM_FMT_I29,
ASM_FMT_I17, ASM_FMT_I18, ASM_FMT_I19, ASM_FMT_I20,
ASM_FMT_I21, ASM_FMT_I22, ASM_FMT_I23, ASM_FMT_I24,
ASM_FMT_I25, ASM_FMT_I26, ASM_FMT_I27, ASM_FMT_I28,
ASM_FMT_I29,
ASM_FMT_M = 0x0500,
ASM_FMT_M1, ASM_FMT_M2, ASM_FMT_M3, ASM_FMT_M4,
ASM_FMT_M5, ASM_FMT_M6, ASM_FMT_M7, ASM_FMT_M8,
@ -224,9 +225,10 @@ enum asm_fmt {
ASM_FMT_M33, ASM_FMT_M34, ASM_FMT_M35, ASM_FMT_M36,
ASM_FMT_M37, ASM_FMT_M38, ASM_FMT_M39, ASM_FMT_M40,
ASM_FMT_M41, ASM_FMT_M42, ASM_FMT_M43, ASM_FMT_M44,
ASM_FMT_M45, ASM_FMT_M46,
ASM_FMT_M45, ASM_FMT_M46, ASM_FMT_M47, ASM_FMT_M48,
ASM_FMT_X = 0x0600,
ASM_FMT_X1, ASM_FMT_X2, ASM_FMT_X3, ASM_FMT_X4
ASM_FMT_X1, ASM_FMT_X2, ASM_FMT_X3, ASM_FMT_X4,
ASM_FMT_X5
};
/* Instruction opcodes. */
@ -251,6 +253,7 @@ enum asm_op {
ASM_OP_FSETC, ASM_OP_FSWAP, ASM_OP_FSXT, ASM_OP_FWB, ASM_OP_FXOR,
ASM_OP_GETF,
ASM_OP_INVALA, ASM_OP_ITC, ASM_OP_ITR,
ASM_OP_HINT,
ASM_OP_LD1, ASM_OP_LD16, ASM_OP_LD2, ASM_OP_LD4, ASM_OP_LD8,
ASM_OP_LDF, ASM_OP_LDF8, ASM_OP_LDFD, ASM_OP_LDFE, ASM_OP_LDFP8,
ASM_OP_LDFPD, ASM_OP_LDFPS, ASM_OP_LDFS, ASM_OP_LFETCH, ASM_OP_LOADRS,

View File

@ -591,6 +591,9 @@ asm_decodeB(uint64_t ip, struct asm_bundle *b, int slot)
case 0x0:
op = ASM_OP_NOP_B, fmt = ASM_FMT_B9;
break;
case 0x1:
op = ASM_OP_HINT_B, fmt = ASM_FMT_B9;
break;
case 0x10:
op = ASM_OP_BRP_, fmt = ASM_FMT_B7;
break;
@ -655,7 +658,10 @@ asm_decodeF(uint64_t ip, struct asm_bundle *b, int slot)
op = ASM_OP_BREAK_F, fmt = ASM_FMT_F15;
break;
case 0x1:
op = ASM_OP_NOP_F, fmt = ASM_FMT_F15;
if (FIELD(bits, 26, 1) == 0) /* y */
op = ASM_OP_NOP_F, fmt = ASM_FMT_F16;
else
op = ASM_OP_HINT_F, fmt = ASM_FMT_F16;
break;
case 0x4:
op = ASM_OP_FSETC, fmt = ASM_FMT_F12;
@ -906,7 +912,10 @@ asm_decodeI(uint64_t ip, struct asm_bundle *b, int slot)
op = ASM_OP_BREAK_I, fmt = ASM_FMT_I19;
break;
case 0x1:
op = ASM_OP_NOP_I, fmt = ASM_FMT_I19;
if (FIELD(bits, 26, 1) == 0) /* y */
op = ASM_OP_NOP_I, fmt = ASM_FMT_I18;
else
op = ASM_OP_HINT_I, fmt = ASM_FMT_I18;
break;
case 0xA:
op = ASM_OP_MOV_I, fmt = ASM_FMT_I27;
@ -1282,7 +1291,10 @@ asm_decodeM(uint64_t ip, struct asm_bundle *b, int slot)
op = ASM_OP_BREAK_M, fmt = ASM_FMT_M37;
break;
case 0x1:
op = ASM_OP_NOP_M, fmt = ASM_FMT_M37;
if (FIELD(bits, 26, 1) == 0) /* y */
op = ASM_OP_NOP_M, fmt = ASM_FMT_M48;
else
op = ASM_OP_HINT_M, fmt = ASM_FMT_M48;
break;
case 0x4: case 0x14: case 0x24: case 0x34:
op = ASM_OP_SUM, fmt = ASM_FMT_M44;
@ -1482,7 +1494,7 @@ asm_decodeM(uint64_t ip, struct asm_bundle *b, int slot)
op = ASM_OP_PROBE_W_FAULT, fmt = ASM_FMT_M40;
break;
case 0x34:
op = ASM_OP_PTC_E, fmt = ASM_FMT_M28;
op = ASM_OP_PTC_E, fmt = ASM_FMT_M47;
break;
case 0x38:
op = ASM_OP_PROBE_R, fmt = ASM_FMT_M38;
@ -2439,7 +2451,10 @@ asm_decodeX(uint64_t ip, struct asm_bundle *b, int slot)
op = ASM_OP_BREAK_X, fmt = ASM_FMT_X1;
break;
case 0x1:
op = ASM_OP_NOP_X, fmt = ASM_FMT_X1;
if (FIELD(bits, 26, 1) == 0) /* y */
op = ASM_OP_NOP_X, fmt = ASM_FMT_X5;
else
op = ASM_OP_HINT_X, fmt = ASM_FMT_X5;
break;
}
}

View File

@ -817,6 +817,26 @@ asm_normalize(struct asm_inst *i, enum asm_op op)
asm_cmpltr_add(i, ASM_CC_GETF, ASM_CT_SIG);
op = ASM_OP_GETF;
break;
case ASM_OP_HINT_B:
asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_B);
op = ASM_OP_HINT;
break;
case ASM_OP_HINT_F:
asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_F);
op = ASM_OP_HINT;
break;
case ASM_OP_HINT_I:
asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_I);
op = ASM_OP_HINT;
break;
case ASM_OP_HINT_M:
asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_M);
op = ASM_OP_HINT;
break;
case ASM_OP_HINT_X:
asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_X);
op = ASM_OP_HINT;
break;
case ASM_OP_INVALA_:
asm_cmpltr_add(i, ASM_CC_INVALA, ASM_CT_NONE);
op = ASM_OP_INVALA;
@ -2058,6 +2078,9 @@ asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits,
case ASM_FMT_F15: /* 0 dst */
u_imm(i, 1, bits, 6, 20);
break;
case ASM_FMT_F16: /* 0 dst */
u_imm(i, 1, bits, 6, 20);
break;
case ASM_FMT_I1:
operand(i, 1, ASM_OPER_GREG, bits, 6, 7);
operand(i, 2, ASM_OPER_GREG, bits, 13, 7);
@ -2161,6 +2184,9 @@ asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits,
operand(i, 3, ASM_OPER_GREG, bits, 20, 7);
i->i_srcidx++;
break;
case ASM_FMT_I18:
u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0);
break;
case ASM_FMT_I19:
u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0);
break;
@ -2314,8 +2340,7 @@ asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits,
s_immf(i, 2, bits, FRAG(13,7), FRAG(27,1), FRAG(36,1), 0);
i->i_srcidx--;
break;
case ASM_FMT_M16: {
int oper;
case ASM_FMT_M16:
asm_hint(i, ASM_CC_LDHINT);
operand(i, 1, ASM_OPER_GREG, bits, 6, 7);
operand(i, 2, ASM_OPER_MEM, bits, 20, 7);
@ -2323,15 +2348,15 @@ asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits,
if (i->i_op == ASM_OP_CMP8XCHG16) {
op_type(i, 4, ASM_OPER_AREG);
op_value(i, 4, AR_CSD);
oper = 5;
} else
oper = 4;
if (FIELD(bits, 30, 6) < 8) {
op_type(i, oper, ASM_OPER_AREG);
op_value(i, oper, AR_CCV);
op_type(i, 5, ASM_OPER_AREG);
op_value(i, 5, AR_CCV);
} else {
if (FIELD(bits, 30, 6) < 8) {
op_type(i, 4, ASM_OPER_AREG);
op_value(i, 4, AR_CCV);
}
}
break;
}
case ASM_FMT_M17:
asm_hint(i, ASM_CC_LDHINT);
operand(i, 1, ASM_OPER_GREG, bits, 6, 7);
@ -2478,6 +2503,12 @@ asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits,
operand(i, 1, ASM_OPER_GREG, bits, 6, 7);
operand(i, 2, ASM_OPER_GREG, bits, 20, 7);
break;
case ASM_FMT_M47:
operand(i, 1, ASM_OPER_GREG, bits, 20, 7);
break;
case ASM_FMT_M48:
u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0);
break;
case ASM_FMT_X1:
KASSERT(slot == 2, ("foo"));
u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0);
@ -2510,6 +2541,11 @@ asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits,
i->i_oper[2].o_value <<= 4;
i->i_oper[2].o_type = ASM_OPER_DISP;
break;
case ASM_FMT_X5:
KASSERT(slot == 2, ("foo"));
u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0);
combine(&i->i_oper[1].o_value, 21, b->b_inst[1].i_bits, 41, 0);
break;
default:
KASSERT(fmt == ASM_FMT_NONE, ("foo"));
return (0);

View File

@ -51,6 +51,7 @@ static const char *asm_mnemonics[] = {
"fpms", "fpnma", "fprcpa", "fprsqrta", "frcpa", "frsqrta", "fselect",
"fsetc", "fswap", "fsxt", "fwb", "fxor",
"getf",
"hint",
"invala", "itc", "itr",
"ld1", "ld16", "ld2", "ld4", "ld8", "ldf", "ldf8", "ldfd", "ldfe",
"ldfp8", "ldfpd", "ldfps", "ldfs", "lfetch", "loadrs",

View File

@ -122,6 +122,8 @@
ASM_OP_FSWAP_, ASM_OP_FSWAP_NL, ASM_OP_FSWAP_NR, \
ASM_OP_FSXT_L, ASM_OP_FSXT_R, \
ASM_OP_GETF_D, ASM_OP_GETF_EXP, ASM_OP_GETF_S, ASM_OP_GETF_SIG, \
ASM_OP_HINT_B, ASM_OP_HINT_F, ASM_OP_HINT_I, ASM_OP_HINT_M, \
ASM_OP_HINT_X, \
ASM_OP_INVALA_, ASM_OP_INVALA_E, \
ASM_OP_ITC_D, ASM_OP_ITC_I, \
ASM_OP_ITR_D, ASM_OP_ITR_I, \