Skip to content

Commit

Permalink
[skip ci] PIC: NOP Watchdog Timer and SLEEP
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Apr 28, 2024
1 parent d1735f7 commit 50df288
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
24 changes: 13 additions & 11 deletions librz/arch/isa/pic/pic18_il.inc
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,19 @@ static RzILOpEffect *pic18_il(Pic18ILContext *ctx) {
case PIC18_OPCODE_CALL: return op_call(ctx);
case PIC18_OPCODE_CLRF: return SEQ2(SETG(RF, U8(0)), SETG("z", IL_TRUE));
case PIC18_OPCODE_CLRWDT:
return SEQ4(
SETG("wdt", U8(0)),
SETG("wdt_prescaler_count", IL_FALSE),
SETG("to", IL_TRUE),
SETG("pd", IL_TRUE));
return NOP();
// return SEQ4(
// SETG("wdt", U8(0)),
// SETG("wdtps", IL_FALSE),
// SETG("to", IL_TRUE),
// SETG("pd", IL_TRUE));
case PIC18_OPCODE_SLEEP:
return NOP();
// return SEQ4(
// SETG("wdt", U8(0)),
// SETG("wdtps", IL_FALSE),
// SETG("to", IL_TRUE),
// SETG("pd", IL_FALSE));
case PIC18_OPCODE_COMF: return set_dest_status(ctx, complement_1(VRF));
case PIC18_OPCODE_CPFSEQ: return op_skip_if(ctx, EQ(VRW, VRF));
case PIC18_OPCODE_CPFSGT: return op_skip_if(ctx, SGT(VRW, VRF));
Expand Down Expand Up @@ -373,12 +381,6 @@ static RzILOpEffect *pic18_il(Pic18ILContext *ctx) {
set_dest_status(ctx, LOGOR(SHIFTR0(VARLP("_x"), U8(7)), BOOL_TO_BV(VRC, 8))));
case PIC18_OPCODE_SETF:
return SETG(RF, U8(0xff));
case PIC18_OPCODE_SLEEP:
return SEQ4(
SETG("wdt", U8(0)),
SETG("wdt_prescaler_count", IL_FALSE),
SETG("to", IL_TRUE),
SETG("pd", IL_FALSE));
case PIC18_OPCODE_SUBFWB: return op_sub(ctx, NULL, VRW, VRF, VRC);
case PIC18_OPCODE_SUBLW: return op_sub(ctx, RW, U8(K), VRW, NULL);
case PIC18_OPCODE_SUBWF: return op_sub(ctx, NULL, VRF, VRW, NULL);
Expand Down
8 changes: 2 additions & 6 deletions librz/arch/isa/pic/pic_midrange_il.inc
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,8 @@ static RzILOpPure *bit_get(RzILOpPure *v, ut32 b) {
return NON_ZERO(LOGAND(v, U8(1 << b)));
}

static RzILOpEffect *regbit_set(const char *reg, ut32 b, bool x) {
return SETG(reg, bit_set(VARG(reg), b, x));
}
static RzILOpEffect *regbit_set1(const char *reg, ut32 b, RzILOpBool *x) {
return SETG(reg, bit_set1(VARG(reg), b, x));
}
#define regbit_set(reg, b, x) SETG(reg, bit_set(VARG(reg), b, x))
#define regbit_set1(reg, b, x) SETG(reg, bit_set1(VARG(reg), b, x))

IL_LIFTER_IMPL(BCF) {
return regbit_set(pic_midrange_regname(F), B, 0);
Expand Down

0 comments on commit 50df288

Please sign in to comment.