mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
tms320: trying to implement insn qualifiers for c55x
This commit is contained in:
parent
e070707308
commit
9d0bb6b0b0
@ -937,13 +937,31 @@ void decode_qualifiers(tms320_dasm_t * dasm)
|
||||
|
||||
case 0x9c:
|
||||
// 1001 1100 - <insn>.LR
|
||||
set_field_value(dasm, q_lr, 1);
|
||||
break;
|
||||
case 0x9d:
|
||||
// 1001 1101 - <insn>.CR
|
||||
set_field_value(dasm, q_cr, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static insn_item_t * finalize(tms320_dasm_t * dasm)
|
||||
{
|
||||
// remove odd spaces
|
||||
|
||||
substitute(dasm->syntax, " ", "%s", " ");
|
||||
|
||||
// add some qualifiers
|
||||
|
||||
if (field_value(dasm, q_lr))
|
||||
replace(dasm->syntax, " ", ".LR ");
|
||||
if (field_value(dasm, q_cr))
|
||||
replace(dasm->syntax, " ", ".CR ");
|
||||
|
||||
return dasm->insn;
|
||||
}
|
||||
|
||||
insn_item_t * decode_insn(tms320_dasm_t * dasm)
|
||||
{
|
||||
dasm->length = dasm->head->size;
|
||||
@ -965,11 +983,8 @@ insn_item_t * decode_insn(tms320_dasm_t * dasm)
|
||||
decode_registers(dasm);
|
||||
decode_addressing_modes(dasm);
|
||||
|
||||
// cleanup rudiments
|
||||
return finalize(dasm);
|
||||
|
||||
substitute(dasm->syntax, " ", "%s", " "); // spaces
|
||||
|
||||
return dasm->insn;
|
||||
}
|
||||
|
||||
insn_item_t * decode_insn_head(tms320_dasm_t * dasm)
|
||||
@ -1042,6 +1057,18 @@ static void init_dasm(tms320_dasm_t * dasm, const ut8 * stream, int len)
|
||||
dasm->insn = NULL;
|
||||
}
|
||||
|
||||
static int full_insn_size(tms320_dasm_t * dasm)
|
||||
{
|
||||
int qualifier_size = 0;
|
||||
|
||||
if (field_value(dasm, q_cr))
|
||||
qualifier_size = 1;
|
||||
if (field_value(dasm, q_lr))
|
||||
qualifier_size = 1;
|
||||
|
||||
return dasm->length + qualifier_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* TMS320 disassembly engine public interface
|
||||
*/
|
||||
@ -1065,7 +1092,7 @@ int tms320_dasm(tms320_dasm_t * dasm, const ut8 * stream, int len)
|
||||
if (dasm->status & TMS320_S_INVAL)
|
||||
strcpy(dasm->syntax, "invalid"), dasm->length = 1;
|
||||
|
||||
return dasm->length;
|
||||
return full_insn_size(dasm);
|
||||
}
|
||||
|
||||
static insn_head_t c55x_list[] = {
|
||||
|
@ -195,6 +195,11 @@ typedef struct {
|
||||
|
||||
def_field (Ymem_mmm, 3);
|
||||
def_field (Ymem_reg, 3);
|
||||
|
||||
// qualifiers
|
||||
|
||||
def_field (q_lr, 1)
|
||||
def_field (q_cr, 1)
|
||||
} f;
|
||||
|
||||
RHashTable * map;
|
||||
|
Loading…
Reference in New Issue
Block a user