Skip to content

Commit

Permalink
Several tiny syntactical and style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Nov 17, 2023
1 parent d52c934 commit e323d19
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions handwritten/hexagon_il_c/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* \brief Sends the IL op at \p start to the position \p newloc.
*
* Note: THis is a copy of the same function implemented by Qualcomm in QEMU.
* See: https://github.com/quic/qemu/blob/d48125de38f48a61d6423ef6a01156d6dff9ee2c/target/hexagon/decode.c#L224-L244
* See: https://gitlab.com/qemu-project/qemu/-/blob/master/target/hexagon/decode.c :: decode_send_insn_to
*
* \param ops The IL ops list.
* \param start Index of the op to move.
Expand Down Expand Up @@ -39,7 +39,7 @@ static void hex_send_insn_to_i(RzVector /* HexILOp* */ *ops, ut8 start, ut8 newl
* and stores the result in \p p->il_ops
*
* The shuffle algorithm implemented here is a copy of Qualcomm's implementation in QEMU:
* https://github.com/quic/qemu/blob/d48125de38f48a61d6423ef6a01156d6dff9ee2c/target/hexagon/decode.c#L423-L543
* https://gitlab.com/qemu-project/qemu/-/blob/master/target/hexagon/decode.c :: decode_shuffle_for_execution
*
* Though some changes were made:
* * Endloops are not handled here (they are pushed to the ops list afterwards).
Expand All @@ -61,9 +61,7 @@ RZ_IPI bool hex_shuffle_insns(RZ_INOUT HexPkt *p) {
}
RzVector *ops = p->il_ops;

//
// Do the shuffle
//
bool changed = false;
int i;
bool flag; /* flag means we've seen a non-memory instruction */
Expand Down Expand Up @@ -108,16 +106,16 @@ RZ_IPI bool hex_shuffle_insns(RZ_INOUT HexPkt *p) {
flag = true;
}
}

if (changed) {
continue;
}
/* Compares go first, may be reordered with regard to each other */

/* Comparisons go first, may be reordered with regard to each other */
for (flag = false, i = 0; i < last_insn + 1; i++) {
op = rz_vector_index_ptr(ops, i);
if ((op->attr & HEX_IL_INSN_ATTR_WPRED) &&
(op->attr & HEX_IL_INSN_ATTR_MEM_WRITE)) {
/* This should be a compare (not a store conditional) */
/* This should be a comparison (not a store conditional) */
if (flag) {
hex_send_insn_to_i(ops, i, 0);
changed = true;
Expand Down Expand Up @@ -251,7 +249,7 @@ static bool set_pkt_il_ops(RZ_INOUT HexPkt *p) {
}
return true;
not_impl:
RZ_LOG_INFO("Hexagon instruction %" PFMT32d " not implemented.\n", pos->bin.insn->identifier);
RZ_LOG_WARN("Hexagon instruction %" PFMT32d " not implemented.\n", pos->bin.insn->identifier);
return false;
}

Expand Down Expand Up @@ -300,7 +298,7 @@ RZ_IPI RzILOpEffect *hex_get_il_op(const ut32 addr, const bool get_pkt_op) {
static bool might_has_jumped = false;
HexState *state = hexagon_get_state();
if (!state) {
RZ_LOG_WARN("Could not get hexagon state!\n");
RZ_LOG_WARN("Failed to get hexagon plugin state data!\n");
return NULL;
}
HexPkt *p = hex_get_pkt(state, addr);
Expand Down Expand Up @@ -739,8 +737,6 @@ RZ_IPI RZ_OWN RzILOpEffect *hex_cancel_slot(RZ_BORROW HexPkt *pkt, ut8 slot) {
RZ_LOG_WARN("Slot %d does not exist!", slot);
}
pkt->il_op_stats.slot_cancelled |= (1 << slot);
// TODO Does this really need to be tracked in the VM?
// return SETG("slot_cancelled", LOGOR(VARG("slot_cancelled"), SHIFTL0(U8(1), U8(slot))));
return EMPTY();
}

Expand Down

0 comments on commit e323d19

Please sign in to comment.