mirror of
https://github.com/rizinorg/rizin.git
synced 2026-10-12 02:21:57 +00:00
Fix another edge case of Hexagon IL lifting. (#5645)
If a packet was pushed out of the cache, it can be decoded as invalid, although it is valid. Then it is marked as such according to some heuristic. But the get_pkt_op parameter was not set in this case, which further down let the plugin return an EMPTY() effect.
This commit is contained in:
@@ -1316,7 +1316,6 @@ RZ_API void hexagon_reverse_opcode(HexReversedOpcode *rz_reverse, const ut64 add
|
||||
if (p->last_instr_present && addr_at_io_map_border) {
|
||||
make_packet_valid(state, p);
|
||||
}
|
||||
rz_reverse->pkt_fully_decoded = p->is_valid;
|
||||
}
|
||||
|
||||
copy_asm_ana_ops(state, rz_reverse, hic);
|
||||
|
||||
@@ -347,7 +347,7 @@ static inline bool pkt_at_addr_is_emu_ready(const HexPkt *pkt, const ut32 addr)
|
||||
* If false, the behavior is as documented above.
|
||||
* \return RzILOpEffect* Sequence of operations to emulate the packet.
|
||||
*/
|
||||
RZ_IPI RZ_OWN RzILOpEffect *hex_get_il_op(const ut32 addr, const bool get_pkt_op, RZ_NONNULL HexState *state) {
|
||||
RZ_IPI RZ_OWN RzILOpEffect *hex_get_il_op(const ut32 addr, bool get_pkt_op, RZ_NONNULL HexState *state) {
|
||||
rz_return_val_if_fail(state, NULL);
|
||||
HexPkt *p = hex_get_pkt(state, addr);
|
||||
if (!p) {
|
||||
@@ -365,6 +365,7 @@ RZ_IPI RZ_OWN RzILOpEffect *hex_get_il_op(const ut32 addr, const bool get_pkt_op
|
||||
// Assume that the instruction at the address the VM was initialized is the first instruction.
|
||||
// Also make it valid if a jump let to this packet.
|
||||
p->is_valid = true;
|
||||
get_pkt_op = true;
|
||||
hic->pkt_info.first_insn = true;
|
||||
state->just_init = false;
|
||||
state->might_have_jumped = false;
|
||||
|
||||
@@ -56,7 +56,7 @@ static const ut64 hex_ctr_immut_masks[32] = {
|
||||
};
|
||||
|
||||
RZ_IPI bool hex_shuffle_insns(RZ_INOUT HexPkt *p);
|
||||
RZ_IPI RZ_OWN RzILOpEffect *hex_get_il_op(const ut32 addr, const bool get_pkt_op, RZ_NONNULL HexState *state);
|
||||
RZ_IPI RZ_OWN RzILOpEffect *hex_get_il_op(const ut32 addr, bool get_pkt_op, RZ_NONNULL HexState *state);
|
||||
RZ_IPI RZ_OWN RzILOpPure *hex_get_rf_property_val(const HexRegFieldProperty property, const HexRegField field);
|
||||
RZ_IPI RZ_OWN RzILOpEffect *hex_get_npc(const HexPkt *pkt);
|
||||
RZ_IPI RZ_OWN RzILOpEffect *hex_il_op_jump_flag_init(HexInsnPktBundle *bundle);
|
||||
|
||||
@@ -31,6 +31,10 @@ RZ_API int hexagon_v6_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, cons
|
||||
// Disassemble as many instructions as possible from the buffer.
|
||||
HexReversedOpcode rev = { .action = HEXAGON_ANALYSIS, .ana_op = op, .asm_op = NULL, .state = NULL, .pkt_fully_decoded = false, .bytes_buf = buf, .bytes_buf_len = len };
|
||||
hexagon_reverse_opcode(&rev, addr, NULL, analysis);
|
||||
HexPkt *p = hex_get_pkt(rev.state, addr);
|
||||
if (p) {
|
||||
rev.pkt_fully_decoded = p->is_valid;
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_IL) {
|
||||
op->il_op = hex_get_il_op(addr, rev.pkt_fully_decoded, rev.state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user