From 50df28867847aba6578d19b16989d2bc2d64c3ea Mon Sep 17 00:00:00 2001 From: billow Date: Sun, 28 Apr 2024 09:13:53 +0800 Subject: [PATCH] [skip ci] PIC: NOP Watchdog Timer and SLEEP --- librz/arch/isa/pic/pic18_il.inc | 24 +++++++++++++----------- librz/arch/isa/pic/pic_midrange_il.inc | 8 ++------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/librz/arch/isa/pic/pic18_il.inc b/librz/arch/isa/pic/pic18_il.inc index e7fd0a1fd21..c77056d25ab 100644 --- a/librz/arch/isa/pic/pic18_il.inc +++ b/librz/arch/isa/pic/pic18_il.inc @@ -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)); @@ -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); diff --git a/librz/arch/isa/pic/pic_midrange_il.inc b/librz/arch/isa/pic/pic_midrange_il.inc index 822c9259b9d..edd00f4a97b 100644 --- a/librz/arch/isa/pic/pic_midrange_il.inc +++ b/librz/arch/isa/pic/pic_midrange_il.inc @@ -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);