Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed May 16, 2024
1 parent 7d6f23b commit 8ea03a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
4 changes: 3 additions & 1 deletion librz/arch/isa/pic/pic18.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#include "pic18.h"

// PIC18CXXX instruction set
/**
* \file PIC18CXXX instruction set
*/

// instruction classification according to the argument types

Expand Down
6 changes: 1 addition & 5 deletions librz/arch/isa/pic/pic_midrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ static const char *PicMidrangeFsrOps[] = { "++FSR%d", "--FSR%d", "FSR%d++",
* \brief Decode a Pic Midrange instruction to it's corresponding opcode enum.
* */
PicMidrangeOpcode pic_midrange_get_opcode(ut16 instr) {
if (instr & (1 << 14)) {
return PIC_MIDRANGE_OPCODE_INVALID;
}

switch (instr >> 11) { // 3 first MSB bits
case 0x4: return PIC_MIDRANGE_OPCODE_CALL;
case 0x5: return PIC_MIDRANGE_OPCODE_GOTO;
Expand Down Expand Up @@ -336,7 +332,7 @@ bool pic16_disasm_op(Pic16Op *op, ut64 addr, const ut8 *b, ut64 l) {
return false;
}

op->instr = rz_read_le16(b);
op->instr = rz_read_le16(b) & 0x3fff;
PicMidrangeOpcode opcode = pic_midrange_get_opcode(op->instr);
if (opcode == PIC_MIDRANGE_OPCODE_INVALID) {
return false;
Expand Down
7 changes: 0 additions & 7 deletions librz/arch/isa/pic/pic_midrange_il.inc
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ static RzILOpEffect *set_register_i(ut16 i, RzILOpPure *x);
#define PC (ctx->x->addr)
#define VPC (U16(PC))

static const char *PIC16_FSR[] = {
"fsr0l",
"fsr0h",
"fsr1l",
"fsr1h",
};

static RzILOpPure *val_fsrn(ut8 n) {
rz_return_val_if_fail(n <= 1, NULL);
return APPEND(register_i(2 * n + FSR0L + 1), register_i(2 * n + FSR0L));
Expand Down
4 changes: 2 additions & 2 deletions librz/arch/p/analysis/analysis_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ static int pic_archinfo(RzAnalysis *analysis, RzAnalysisInfoType query) {
switch (query) {
case RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE: return 2;
case RZ_ANALYSIS_ARCHINFO_MAX_OP_SIZE: return 2;
case RZ_ANALYSIS_ARCHINFO_TEXT_ALIGN: return 2;
case RZ_ANALYSIS_ARCHINFO_DATA_ALIGN: return 2;
case RZ_ANALYSIS_ARCHINFO_TEXT_ALIGN: return 1;
case RZ_ANALYSIS_ARCHINFO_DATA_ALIGN: return 1;
case RZ_ANALYSIS_ARCHINFO_CAN_USE_POINTERS: return 1;
default: return -1;
}
Expand Down
4 changes: 4 additions & 0 deletions test/db/analysis/pic
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pc = 0x0000
stkptr = 0x00
_sram = 0x00000000
_stack = 0x00000000
tosl = 0x00
tosh = 0x00
tris = 0x00
_bank = 0x00
=============== pic18
pc = 0x00000000
bsr = 0x00
Expand Down

0 comments on commit 8ea03a8

Please sign in to comment.