Skip to content

Commit

Permalink
Reverse renaming of k, since it is indeed the location in the packet …
Browse files Browse the repository at this point in the history
…and not the slot.
  • Loading branch information
Rot127 committed Sep 15, 2023
1 parent b6d9a4e commit 408de4c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions librz/asm/arch/hexagon/hexagon_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@ void hex_set_hic_text(RZ_INOUT HexInsnContainer *hic) {
*
* \param hi The instruction.
* \param pkt The packet the instruction belongs to.
* \param slot The index of the instruction within the packet.
* \param k The index of the instruction within the packet.
*/
static void hex_set_pkt_info(const RzAsm *rz_asm, RZ_INOUT HexInsnContainer *hic, const HexPkt *pkt, const ut8 slot, const bool update_text) {
static void hex_set_pkt_info(const RzAsm *rz_asm, RZ_INOUT HexInsnContainer *hic, const HexPkt *pkt, const ut8 k, const bool update_text) {
rz_return_if_fail(hic && pkt);
bool is_first = (slot == 0);
bool is_first = (k == 0);
HexPktInfo *hi_pi = &hic->pkt_info;
HexState *state = hexagon_get_state();
bool sdk_form = rz_config_get_b(state->cfg, "plugins.hexagon.sdk");
Expand Down Expand Up @@ -633,24 +633,24 @@ RZ_API HexInsnContainer *hexagon_alloc_instr_container() {
* \param state The state to operate on.
* \param new_hic The instruction container to copy.
* \param pkt The packet in which will hold the instruction container.
* \param slot The index of the instruction container in the packet.
* \param k The index of the instruction container in the packet.
* \return HexInsnContainer* Pointer to the copied instruction container on the heap.
*/
static HexInsnContainer *hex_add_to_pkt(HexState *state, const HexInsnContainer *new_hic, RZ_INOUT HexPkt *pkt, const ut8 slot) {
if (slot > 3) {
RZ_LOG_FATAL("Instruction could not be set! A packet can only hold four instructions but slot=%d.", slot);
static HexInsnContainer *hex_add_to_pkt(HexState *state, const HexInsnContainer *new_hic, RZ_INOUT HexPkt *pkt, const ut8 k) {
if (k > 3) {
RZ_LOG_FATAL("Instruction could not be set! A packet can only hold four instructions but k=%d.", k);
}
HexInsnContainer *hic = hexagon_alloc_instr_container();
hex_copy_insn_container(hic, new_hic);
rz_list_insert(pkt->bin, slot, hic);
rz_list_insert(pkt->bin, k, hic);

if (slot == 0) {
if (k == 0) {
pkt->pkt_addr = hic->addr;
}
pkt->last_instr_present |= is_last_instr(hic->parse_bits);
ut32 p_l = rz_list_length(pkt->bin);
hex_set_pkt_info(&state->rz_asm, hic, pkt, slot, false);
if (slot == 0 && p_l > 1) {
hex_set_pkt_info(&state->rz_asm, hic, pkt, k, false);
if (k == 0 && p_l > 1) {
// Update the instruction which was previously the first one.
hex_set_pkt_info(&state->rz_asm, rz_list_get_n(pkt->bin, 1), pkt, 1, true);
}
Expand Down

0 comments on commit 408de4c

Please sign in to comment.