[*] Binary protection state of watchDog
Full RELRO Canary found NX disabled No PIE No RPATH No RUNPATH No Symbols
[*] Function printf tear down of watchDog
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/watchDog @ 0x402f5c */
| #include <stdint.h>
|
; (fcn) main () | int32_t main () {
0x00402f5c lui gp, 2 |
0x00402f60 addiu gp, gp, 0x72b4 |
0x00402f64 addu gp, gp, t9 | gp += t9;
0x00402f68 addiu sp, sp, -0x88 |
0x00402f6c sw ra, 0x84(sp) | *(var_84h) = ra;
0x00402f70 sw s4, 0x80(sp) | *(var_80h) = s4;
0x00402f74 sw s3, 0x7c(sp) | *(var_7ch) = s3;
0x00402f78 sw s2, 0x78(sp) | *(var_78h) = s2;
0x00402f7c sw s1, 0x74(sp) | *(var_74h) = s1;
0x00402f80 sw s0, 0x70(sp) | *(var_70h) = s0;
0x00402f84 slti a0, a0, 2 | a0 = (a0 < 2) ? 1 : 0;
0x00402f88 lw s3, -0x7d2c(gp) | s3 = *((gp - 8011));
0x00402f8c sw gp, 0x10(sp) | *(var_10h) = gp;
0x00402f90 lw t8, (s3) | t8 = *(s3);
0x00402f94 sw t8, 0x6c(sp) | *(var_6ch) = t8;
0x00402f98 lw t9, -0x7e90(gp) | t9 = sym.imp.strcmp;
| if (a0 == 0) {
0x00402f9c bnez a0, 0x402fcc |
0x00402fa0 lw a0, 4(a1) | a0 = *((a1 + 1));
0x00402fa4 lw a1, -0x7fc4(gp) | a1 = *((gp - 8177));
| /* esilref: '-h' */
0x00402fa8 addiu a1, a1, -0x1e18 | a1 += -0x1e18;
0x00402fac jalr t9 | t9 ();
0x00402fb0 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == 0) {
0x00402fb4 bnez v0, 0x402fcc |
0x00402fb8 lw t9, -0x7f8c(gp) | t9 = *(gp);
0x00402fbc jalr t9 | t9 ();
0x00402fc0 nop |
0x00402fc4 lw gp, 0x10(sp) | gp = *(var_10h);
0x00402fc8 b 0x4031d0 |
| }
| } else {
0x00402fcc lw t9, -0x7d34(gp) | t9 = sym.imp.daemon;
0x00402fd0 addiu a0, zero, 1 | a0 = 1;
0x00402fd4 addiu a1, zero, 1 | a1 = 1;
0x00402fd8 jalr t9 | t9 ();
0x00402fdc lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 < 0) {
0x00402fe0 bgez v0, 0x402ff0 |
0x00402fe4 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
| /* str.daemon_failed */
0x00402fe8 addiu a0, a0, -0x1e14 | a0 += -0x1e14;
0x00402fec b 0x4031f4 | goto label_4;
| }
0x00402ff0 lw s1, -0x7f88(gp) | s1 = *(gp);
0x00402ff4 addiu a0, zero, 0xf | a0 = 0xf;
0x00402ff8 lw t9, -0x7ecc(gp) | t9 = sym.imp.signal;
0x00402ffc addiu s0, zero, -1 | s0 = -1;
| /* aav.0x00404a90 */
0x00403000 addiu a1, s1, 0x4a90 | a1 = s1 + 0x4a90;
0x00403004 jalr t9 | t9 ();
0x00403008 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == s0) {
0x0040300c beq v0, s0, 0x4031ec | goto label_5;
| }
0x00403010 lw t9, -0x7ecc(gp) | t9 = sym.imp.signal;
0x00403014 addiu a0, zero, 2 | a0 = 2;
| /* aav.0x00404a90 */
0x00403018 addiu a1, s1, 0x4a90 | a1 = s1 + 0x4a90;
0x0040301c jalr t9 | t9 ();
0x00403020 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == s0) {
0x00403024 beq v0, s0, 0x4031ec | goto label_5;
| }
0x00403028 lw t9, -0x7ecc(gp) | t9 = sym.imp.signal;
0x0040302c addiu a0, zero, 0xd | a0 = 0xd;
| /* aav.0x00404a90 */
0x00403030 addiu a1, s1, 0x4a90 | a1 = s1 + 0x4a90;
0x00403034 jalr t9 | t9 ();
0x00403038 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 != s0) {
0x0040303c bne v0, s0, 0x40320c | goto label_6;
| }
0x00403040 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x00403044 b 0x4031f0 | goto label_7;
| label_0:
0x00403048 lw t9, -0x7d94(gp) | t9 = sym.imp.fcntl;
0x0040304c addiu t8, zero, 1 | t8 = 1;
0x00403050 sh t8, 0x20(sp) | *(var_20h) = t8;
0x00403054 move a0, s0 | a0 = s0;
0x00403058 sw zero, 0x24(sp) | *(var_24h) = 0;
0x0040305c addiu a1, zero, 6 | a1 = 6;
0x00403060 sh zero, 0x22(sp) | *(var_22h) = 0;
0x00403064 addiu a2, sp, 0x20 | a2 = sp + 0x20;
0x00403068 sw zero, 0x28(sp) | *(var_28h) = 0;
0x0040306c jalr t9 | t9 ();
0x00403070 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 < 0) {
0x00403074 bltz v0, 0x403248 | goto label_8;
| }
0x00403078 lw t9, -0x7dc8(gp) | t9 = sym.imp.getpid;
0x0040307c addiu s1, sp, 0x44 | s1 = sp + 0x44;
0x00403080 jalr t9 | t9 ();
0x00403084 move a0, s1 | a0 = s1;
0x00403088 lw gp, 0x10(sp) | gp = *(var_10h);
0x0040308c move a3, v0 | a3 = v0;
0x00403090 addiu a1, zero, 0x28 | a1 = 0x28;
0x00403094 lw a2, -0x7fc4(gp) | a2 = *((gp - 8177));
0x00403098 lw t9, -0x7d9c(gp) | t9 = sym.imp.snprintf
| /* str._ld_n */
0x0040309c addiu a2, a2, -0x1db8 | a2 += -0x1db8;
0x004030a0 jalr t9 | t9 ();
0x004030a4 move a0, s0 | a0 = s0;
0x004030a8 lw gp, 0x10(sp) | gp = *(var_10h);
0x004030ac lw t9, -0x7e50(gp) | t9 = sym.imp.ftruncate;
0x004030b0 move a1, zero | a1 = 0;
0x004030b4 jalr t9 | t9 ();
0x004030b8 lw gp, 0x10(sp) | gp = *(var_10h);
0x004030bc lw t9, -0x7d80(gp) | t9 = sym.imp.strlen;
0x004030c0 move a0, s1 | a0 = s1;
0x004030c4 jalr t9 | t9 ();
0x004030c8 move a0, s0 | a0 = s0;
0x004030cc lw gp, 0x10(sp) | gp = *(var_10h);
0x004030d0 move a1, s1 | a1 = s1;
0x004030d4 lw t9, -0x7df8(gp) | t9 = sym.imp.write;
0x004030d8 move a2, v0 | a2 = v0;
0x004030dc jalr t9 | t9 ();
0x004030e0 lw gp, 0x10(sp) | gp = *(var_10h);
0x004030e4 lw t9, -0x7e24(gp) | t9 = sym.imp.operator_new_unsigned_int_;
0x004030e8 addiu a0, zero, 0x10 | a0 = 0x10;
0x004030ec jalr t9 | t9 ();
0x004030f0 lw gp, 0x10(sp) | gp = *(var_10h);
0x004030f4 move a0, v0 | a0 = v0;
0x004030f8 lw t9, -0x7f84(gp) | t9 = *(gp);
0x004030fc move s0, v0 | s0 = v0;
0x00403100 jalr t9 | t9 ();
0x00403104 lw gp, 0x10(sp) | gp = *(var_10h);
| if (s0 == 0) {
0x00403108 beqz s0, 0x403204 | goto label_1;
| }
0x0040310c lw t9, -0x7f80(gp) | t9 = *(gp);
0x00403110 move a0, s0 | a0 = s0;
0x00403114 jalr t9 | t9 ();
0x00403118 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 != 0) {
0x0040311c bnez v0, 0x403354 | goto label_9;
| }
0x00403120 lw s4, -0x7fc0(gp) | s4 = *((gp - 8176));
0x00403124 lb t8, 0x5ab8(s4) | t8 = *((s4 + 23224));
0x00403128 lw s2, -0x7fc0(gp) | s2 = *((gp - 8176));
| if (t8 == 0) {
0x0040312c beqz t8, 0x4032e0 | goto label_10;
| }
| label_2:
0x00403130 lw t9, -0x7e78(gp) | t9 = *(gp);
0x00403134 addiu a0, s2, 0x2590 | a0 = s2 + 0x2590;
0x00403138 addiu s1, sp, 0x1c | s1 = sp + 0x1c;
0x0040313c jalr t9 | t9 ();
0x00403140 move a0, s1 | a0 = s1;
0x00403144 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403148 lw t9, -0x7e70(gp) | t9 = *(gp);
0x0040314c addiu a1, s2, 0x2590 | a1 = s2 + 0x2590;
0x00403150 jalr t9 | t9 ();
0x00403154 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403158 lw a0, 0x1c(sp) | a0 = *(var_1ch);
0x0040315c lw a1, -0x7fc4(gp) | a1 = *((gp - 8177));
0x00403160 lw t9, -0x7e90(gp) | t9 = sym.imp.strcmp;
| /* esilref: 'mfg' */
0x00403164 addiu a1, a1, -0x1d98 | a1 += -0x1d98;
0x00403168 jalr t9 | t9 ();
0x0040316c move a0, s1 | a0 = s1;
0x00403170 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403174 move s2, v0 | s2 = v0;
0x00403178 lw t9, -0x7db4(gp) | t9 = *(gp);
0x0040317c move s1, zero | s1 = 0;
0x00403180 jalr t9 | t9 ();
0x00403184 move a0, s0 | a0 = s0;
0x00403188 lw gp, 0x10(sp) | gp = *(var_10h);
0x0040318c lw t9, -0x7f7c(gp) | t9 = *(gp);
0x00403190 sltu a1, zero, s2 | a1 = (0 < s2) ? 1 : 0;
0x00403194 jalr t9 | t9 ();
0x00403198 lw gp, 0x10(sp) | gp = *(var_10h);
0x0040319c lw t9, -0x7fbc(gp) | t9 = *(gp);
0x004031a0 move a0, s0 | a0 = s0;
0x004031a4 jalr t9 | t9 ();
0x004031a8 lw gp, 0x10(sp) | gp = *(var_10h);
| label_3:
0x004031ac lw t9, -0x7f78(gp) | t9 = *(gp);
0x004031b0 move a0, s0 | a0 = s0;
0x004031b4 jalr t9 | t9 ();
0x004031b8 lw gp, 0x10(sp) | gp = *(var_10h);
0x004031bc lw t9, -0x7d54(gp) | t9 = sym.imp.operator_delete_void_;
0x004031c0 move a0, s0 | a0 = s0;
0x004031c4 jalr t9 | t9 ();
0x004031c8 move v0, s1 | v0 = s1;
0x004031cc lw gp, 0x10(sp) | gp = *(var_10h);
| }
| do {
0x004031d0 lw v1, 0x6c(sp) | v1 = *(var_6ch);
0x004031d4 lw t8, (s3) | t8 = *(s3);
0x004031d8 lw ra, 0x84(sp) | ra = *(var_84h);
| if (v1 == t8) {
0x004031dc beq v1, t8, 0x403378 | goto label_11;
| }
0x004031e0 lw t9, -0x7dec(gp) | t9 = sym.imp.__stack_chk_fail;
0x004031e4 jalr t9 | t9 ();
0x004031e8 nop |
| label_5:
0x004031ec lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
| /* str.signal_failed */
| label_7:
0x004031f0 addiu a0, a0, -0x1d7c | a0 += -0x1d7c;
| label_4:
0x004031f4 lw t9, -0x7e48(gp) | t9 = sym.imp.perror;
0x004031f8 jalr t9 | t9 ();
0x004031fc nop |
0x00403200 lw gp, 0x10(sp) | gp = *(var_10h);
| label_1:
0x00403204 addiu v0, zero, -1 | v0 = -1;
0x00403208 b 0x4031d0 |
| } while (1);
| label_6:
0x0040320c lw s1, -0x7fc4(gp) | s1 = *((gp - 8177));
0x00403210 addiu a1, zero, 0x102 | a1 = 0x102;
0x00403214 lw t9, -0x7d30(gp) | t9 = sym.imp.open;
0x00403218 addiu a2, zero, 0x1a4 | a2 = 0x1a4;
| /* str._var_run_watchdog.pid */
0x0040321c addiu a0, s1, -0x1dd0 | a0 = s1 + -0x1dd0;
0x00403220 jalr t9 | t9 ();
0x00403224 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403228 move s0, v0 | s0 = v0;
| if (v0 >= 0) {
0x0040322c bgez v0, 0x403048 | goto label_0;
| }
0x00403230 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x00403234 lw t9, -0x7e48(gp) | t9 = sym.imp.perror;
| /* str.open */
0x00403238 addiu a0, a0, -0x1e04 | a0 += -0x1e04;
0x0040323c jalr t9 | t9 ();
0x00403240 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403244 b 0x403284 | goto label_12;
| label_8:
0x00403248 lw t9, -0x7d24(gp) | t9 = sym.imp.__errno_location;
0x0040324c jalr t9 | t9 ();
0x00403250 nop |
0x00403254 lw t8, (v0) | t8 = *(v0);
0x00403258 addiu v0, zero, 0xd | v0 = 0xd;
0x0040325c lw gp, 0x10(sp) | gp = *(var_10h);
| if (t8 != v0) {
0x00403260 beq t8, v0, 0x403270 |
0x00403264 addiu v0, zero, 0xb | v0 = 0xb;
| /* str._var_run_watchdog.pid */
0x00403268 addiu a1, s1, -0x1dd0 | a1 = s1 + -0x1dd0;
| if (t8 != v0) {
0x0040326c bne t8, v0, 0x4032a4 | goto label_13;
| }
| }
0x00403270 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x00403274 lw t9, -0x7ec0(gp) | t9 = sym.imp.puts;
| /* str.Program_already_exists. */
0x00403278 addiu a0, a0, -0x1dfc | a0 += -0x1dfc;
0x0040327c jalr t9 | t9 ();
0x00403280 lw gp, 0x10(sp) | gp = *(var_10h);
| do {
| label_12:
0x00403284 lw t8, -0x7df0(gp) | t8 = *((gp - 8060));
0x00403288 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x0040328c lw t9, -0x7e2c(gp) | t9 = sym.imp.fputs;
0x00403290 lw a1, (t8) | a1 = *(t8);
| /* str.create_pidfile_failed_n */
0x00403294 addiu a0, a0, -0x1db0 | a0 += -0x1db0;
0x00403298 jalr t9 | t9 ();
0x0040329c lw gp, 0x10(sp) | gp = *(var_10h);
0x004032a0 b 0x403204 | goto label_1;
| label_13:
0x004032a4 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x004032a8 lw t9, -0x7eb4(gp) | t9 = sym.imp.printf
| /* str.Unable_to_lock__s_n */
0x004032ac addiu a0, a0, -0x1de4 | a0 += -0x1de4;
0x004032b0 jalr t9 | t9 ();
0x004032b4 lw gp, 0x10(sp) | gp = *(var_10h);
0x004032b8 b 0x403284 |
| } while (1);
| label_10:
0x004032e0 lw t9, -0x7d44(gp) | t9 = sym.imp.__cxa_guard_acquire;
0x004032e4 addiu a0, s4, 0x5ab8 | a0 = s4 + 0x5ab8;
0x004032e8 jalr t9 | t9 ();
0x004032ec lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == 0) {
0x004032f0 beqz v0, 0x403130 | goto label_2;
| }
0x004032f4 lw t8, -0x7dbc(gp) | t8 = *((gp - 8047));
0x004032f8 addiu s1, s2, 0x2590 | s1 = s2 + 0x2590;
0x004032fc lw t9, -0x7de8(gp) | t9 = sym.imp.__cxa_guard_release;
0x00403300 addiu a0, s4, 0x5ab8 | a0 = s4 + 0x5ab8;
0x00403304 addiu t8, t8, 8 | t8 += 8;
0x00403308 sw t8, 0x2590(s2) | *((s2 + 2404)) = t8;
0x0040330c lw t8, -0x7e94(gp) | t8 = *((gp - 8101));
0x00403310 sb zero, 0x31e4(s1) | *((s1 + 12772)) = 0;
0x00403314 addiu t8, t8, 0xc | t8 += 0xc;
0x00403318 sw t8, 0x31d8(s1) | *((s1 + 3190)) = t8;
0x0040331c sw t8, 0x31dc(s1) | *((s1 + 3191)) = t8;
0x00403320 sw t8, 0x31e0(s1) | *((s1 + 3192)) = t8;
0x00403324 sw zero, 0x31e8(s1) | *((s1 + 3194)) = 0;
0x00403328 sw zero, 0x31ec(s1) | *((s1 + 3195)) = 0;
0x0040332c sw zero, 0x31f0(s1) | *((s1 + 3196)) = 0;
0x00403330 jalr t9 | t9 ();
0x00403334 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403338 lw t9, -0x7d8c(gp) | t9 = sym.imp.__cxa_atexit;
0x0040333c lw a0, -0x7d0c(gp) | a0 = *((gp - 8003));
0x00403340 lw a2, -0x7f90(gp) | a2 = *((gp - 8164));
0x00403344 move a1, s1 | a1 = s1;
0x00403348 jalr t9 | t9 ();
0x0040334c lw gp, 0x10(sp) | gp = *(var_10h);
0x00403350 b 0x403130 | goto label_2;
| label_9:
0x00403354 lw t8, -0x7df0(gp) | t8 = *((gp - 8060));
0x00403358 addiu s1, zero, -1 | s1 = -1;
0x0040335c lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x00403360 lw t9, -0x7e2c(gp) | t9 = sym.imp.fputs;
0x00403364 lw a1, (t8) | a1 = *(t8);
| /* str.Watchdog_init_error_n */
0x00403368 addiu a0, a0, -0x1d94 | a0 += -0x1d94;
0x0040336c jalr t9 | t9 ();
0x00403370 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403374 b 0x4031ac | goto label_3;
| label_11:
0x00403378 lw s4, 0x80(sp) | s4 = *(var_80h);
0x0040337c lw s3, 0x7c(sp) | s3 = *(var_7ch);
0x00403380 lw s2, 0x78(sp) | s2 = *(var_78h);
0x00403384 lw s1, 0x74(sp) | s1 = *(var_74h);
0x00403388 lw s0, 0x70(sp) | s0 = *(var_70h);
0x0040338c addiu sp, sp, 0x88 |
0x00403390 jr ra | return v0;
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/watchDog @ 0x4080bc */
| #include <stdint.h>
|
; (fcn) method.CommonBehavior.sendCmd_char_const__unsigned_int__unsigned_int__unsigned_int_ () | void method_CommonBehavior_sendCmd_char_const_unsigned_int_unsigned_int_unsigned_int_ () {
| /* CommonBehavior::sendCmd(char const*, unsigned int, unsigned int, unsigned int) */
0x004080bc lui gp, 2 |
0x004080c0 addiu gp, gp, 0x2154 |
0x004080c4 addu gp, gp, t9 | gp += t9;
0x004080c8 addiu sp, sp, -0xd8 |
0x004080cc sw ra, 0xd4(sp) | *(var_d4h) = ra;
0x004080d0 sw s2, 0xd0(sp) | *(var_d0h) = s2;
0x004080d4 sw s1, 0xcc(sp) | *(var_cch) = s1;
0x004080d8 sw s0, 0xc8(sp) | *(var_c8h) = s0;
0x004080dc addiu s1, sp, 0x20 | s1 = sp + 0x20;
0x004080e0 lw t8, -0x7d2c(gp) | t8 = *((gp - 8011));
0x004080e4 move a0, s1 | a0 = s1;
0x004080e8 lw t9, -0x7db0(gp) | t9 = *(gp);
0x004080ec lw v0, (t8) | v0 = *(t8);
0x004080f0 move s2, t8 | s2 = t8;
0x004080f4 sw gp, 0x18(sp) | *(var_18h) = gp;
0x004080f8 sw v0, 0xc4(sp) | *(var_c4h) = v0;
0x004080fc addiu v0, zero, -1 | v0 = -1;
0x00408100 sw v0, 0x24(sp) | *(var_24h) = v0;
0x00408104 addiu v0, zero, 0x1e | v0 = 0x1e;
0x00408108 sw v0, 0x28(sp) | *(var_28h) = v0;
0x0040810c lw v0, -0x7f70(gp) | v0 = *(gp);
0x00408110 sw a2, 0x2c(sp) | *(var_2ch) = a2;
0x00408114 addiu a2, sp, 0x2c | a2 = sp + 0x2c;
0x00408118 addiu v0, v0, 8 | v0 += 8;
0x0040811c sw v0, 0x20(sp) | *(var_20h) = v0;
0x00408120 lw v0, 0xe8(sp) | v0 = *(arg_e8h);
0x00408124 sw a3, 0x30(sp) | *(var_30h) = a3;
0x00408128 addiu a3, zero, 0xc | a3 = 0xc;
0x0040812c sw v0, 0x34(sp) | *(var_34h) = v0;
0x00408130 addiu v0, sp, 0x38 | v0 = sp + 0x38;
0x00408134 sw v0, 0x10(sp) | *(var_10h) = v0;
0x00408138 addiu v0, zero, 0x8c | v0 = 0x8c;
0x0040813c sw v0, 0x14(sp) | *(var_14h) = v0;
0x00408140 jalr t9 | t9 ();
0x00408144 lw gp, 0x18(sp) | gp = *(var_18h);
0x00408148 move s0, v0 | s0 = v0;
| if (v0 < 0) {
0x0040814c bgez v0, 0x408174 |
0x00408150 lw t8, -0x7df0(gp) | t8 = *((gp - 8060));
0x00408154 move a2, v0 | a2 = v0;
0x00408158 lw a1, -0x7fc4(gp) | a1 = *((gp - 8177));
0x0040815c lw a0, (t8) | a0 = *(t8);
0x00408160 lw t9, -0x7e54(gp) | t9 = sym.imp.fprintf
| /* str.OOPS___sendCmd_return__d_n */
0x00408164 addiu a1, a1, -0x1860 | a1 += -0x1860;
0x00408168 jalr t9 | t9 ();
0x0040816c lw gp, 0x18(sp) | gp = *(var_18h);
0x00408170 b 0x4081b8 |
| } else {
0x00408174 lw a2, 0x38(sp) | a2 = *(var_38h);
0x00408178 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
| if (a2 != 0) {
0x0040817c beqz a2, 0x4081a4 |
0x00408180 lw t8, -0x7df0(gp) | t8 = *((gp - 8060));
0x00408184 lw a1, -0x7fc4(gp) | a1 = *((gp - 8177));
0x00408188 lw a0, (t8) | a0 = *(t8);
0x0040818c lw t9, -0x7e54(gp) | t9 = sym.imp.fprintf
| /* str.OOPS___sendCmd_result__d_n */
0x00408190 addiu a1, a1, -0x1844 | a1 += -0x1844;
0x00408194 jalr t9 | t9 ();
0x00408198 lw gp, 0x18(sp) | gp = *(var_18h);
0x0040819c addiu s0, zero, -1 | s0 = -1;
0x004081a0 b 0x4081b8 |
| } else {
0x004081a4 lw a1, 0x3c(sp) | a1 = *(var_3ch);
0x004081a8 lw t9, -0x7eb4(gp) | t9 = sym.imp.printf
| /* str.sendCmd_:__d_n */
0x004081ac addiu a0, a0, -0x1828 | a0 += -0x1828;
0x004081b0 jalr t9 | t9 ();
0x004081b4 lw gp, 0x18(sp) | gp = *(var_18h);
| }
| }
0x004081b8 lw t9, -0x7f6c(gp) | t9 = *(gp);
0x004081bc move a0, s1 | a0 = s1;
0x004081c0 jalr t9 | t9 ();
0x004081c4 move v0, s0 | v0 = s0;
0x004081c8 lw v1, 0xc4(sp) | v1 = *(var_c4h);
0x004081cc lw t8, (s2) | t8 = *(s2);
0x004081d0 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v1 != t8) {
0x004081d4 beq v1, t8, 0x408208 |
0x004081d8 lw t9, -0x7dec(gp) | t9 = sym.imp.__stack_chk_fail;
0x004081dc jalr t9 | t9 ();
0x004081e0 nop |
0x004081e4 lw gp, 0x18(sp) | gp = *(var_18h);
0x004081e8 move s0, a0 | s0 = a0;
0x004081ec lw t9, -0x7f6c(gp) | t9 = *(gp);
0x004081f0 move a0, s1 | a0 = s1;
0x004081f4 jalr t9 | t9 ();
0x004081f8 lw gp, 0x18(sp) | gp = *(var_18h);
0x004081fc lw t9, -0x7dcc(gp) | t9 = sym.imp._Unwind_Resume;
0x00408200 move a0, s0 | a0 = s0;
0x00408204 jalr t9 | t9 ();
| }
0x00408208 lw ra, 0xd4(sp) | ra = *(var_d4h);
0x0040820c lw s2, 0xd0(sp) | s2 = *(var_d0h);
0x00408210 lw s1, 0xcc(sp) | s1 = *(var_cch);
0x00408214 lw s0, 0xc8(sp) | s0 = *(var_c8h);
0x00408218 addiu sp, sp, 0xd8 |
0x0040821c jr ra | return v1;
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/watchDog @ 0x403b0c */
| #include <stdint.h>
|
; (fcn) method.Watchdog.help__ () | void method_Watchdog_help_ () {
| /* Watchdog::help() */
0x00403b0c lui gp, 2 |
0x00403b10 addiu gp, gp, 0x6704 |
0x00403b14 addu gp, gp, t9 | gp += t9;
0x00403b18 addiu sp, sp, -0x218 |
0x00403b1c sw ra, 0x214(sp) | *(var_214h) = ra;
0x00403b20 sw s3, 0x210(sp) | *(var_210h) = s3;
0x00403b24 sw s2, 0x20c(sp) | *(var_20ch) = s2;
0x00403b28 sw s1, 0x208(sp) | *(var_208h) = s1;
0x00403b2c sw s0, 0x204(sp) | *(var_204h) = s0;
0x00403b30 addiu s0, sp, 0x1c | s0 = sp + 0x1c;
0x00403b34 lw s1, -0x7d2c(gp) | s1 = *((gp - 8011));
0x00403b38 move a0, s0 | a0 = s0;
0x00403b3c lw a1, -0x7fc0(gp) | a1 = *((gp - 8176));
0x00403b40 addiu a2, zero, 0x1e0 | a2 = 0x1e0;
0x00403b44 lw t8, (s1) | t8 = *(s1);
0x00403b48 lw t9, -0x7d40(gp) | t9 = sym.imp.memcpy;
0x00403b4c addiu a1, a1, 0x2010 | a1 += 0x2010;
0x00403b50 sw gp, 0x10(sp) | *(var_10h) = gp;
0x00403b54 sw t8, 0x1fc(sp) | *(var_1fch) = t8;
0x00403b58 jalr t9 | t9 ();
0x00403b5c nop |
0x00403b60 addiu v1, zero, 0x3c | v1 = 0x3c;
0x00403b64 lw gp, 0x10(sp) | gp = *(var_10h);
| label_0:
0x00403b68 addiu t8, sp, 0x24 | t8 = sp + 0x24;
0x00403b6c addiu v0, zero, 1 | v0 = 1;
0x00403b70 move a0, zero | a0 = 0;
| do {
0x00403b74 sltu a1, v0, v1 | a1 = (v0 < v1) ? 1 : 0;
| if (a1 == 0) {
0x00403b78 beqz a1, 0x403bbc | goto label_1;
| }
0x00403b7c nop |
0x00403b80 lw a1, -8(t8) | a1 = *((t8 - 2));
0x00403b84 lw a2, (t8) | a2 = *(t8);
0x00403b88 slt a3, a2, a1 | a3 = (a2 < a1) ? 1 : 0;
| if (a3 != 0) {
0x00403b8c beqz a3, 0x403bb0 |
0x00403b90 nop |
0x00403b94 lw a0, -4(t8) | a0 = *((t8 - 1));
0x00403b98 sw a2, -8(t8) | *((t8 - 8)) = a2;
0x00403b9c lw a2, 4(t8) | a2 = *((t8 + 1));
0x00403ba0 sw a1, (t8) | *(t8) = a1;
0x00403ba4 sw a0, 4(t8) | *((t8 + 4)) = a0;
0x00403ba8 move a0, v0 | a0 = v0;
0x00403bac sw a2, -4(t8) | *((t8 - 4)) = a2;
| }
0x00403bb0 addiu v0, v0, 1 | v0++;
0x00403bb4 addiu t8, t8, 8 | t8 += 8;
0x00403bb8 b 0x403b74 |
| } while (1);
| label_1:
0x00403bbc move v1, a0 | v1 = a0;
| if (a0 != 0) {
0x00403bc0 bnez a0, 0x403b68 | goto label_0;
| }
0x00403bc4 lw a0, -0x7fc4(gp) | a0 = *((gp - 8177));
0x00403bc8 addiu s2, sp, 0x1fc | s2 = sp + 0x1fc;
0x00403bcc lw t9, -0x7ec0(gp) | t9 = sym.imp.puts;
| /* str.List_of_commands_: */
0x00403bd0 addiu a0, a0, -0x2464 | a0 += -0x2464;
0x00403bd4 jalr t9 | t9 ();
0x00403bd8 lw gp, 0x10(sp) | gp = *(var_10h);
0x00403bdc lw s3, -0x7fc4(gp) | s3 = *((gp - 8177));
| /* str._t_5d____s_n */
0x00403be0 addiu s3, s3, -0x2450 | s3 += -0x2450;
| do {
0x00403be4 lw t9, -0x7eb4(gp) | t9 = sym.imp.printf
0x00403be8 move a0, s3 | a0 = s3;
0x00403bec lw a1, (s0) | a1 = *(s0);
0x00403bf0 addiu s0, s0, 8 | s0 += 8;
0x00403bf4 lw a2, -4(s0) | a2 = *((s0 - 1));
0x00403bf8 jalr t9 | t9 ();
0x00403bfc lw gp, 0x10(sp) | gp = *(var_10h);
0x00403c00 bne s0, s2, 0x403be4 |
| } while (s0 != s2);
0x00403c04 lw v1, 0x1fc(sp) | v1 = *(var_1fch);
0x00403c08 move v0, zero | v0 = 0;
0x00403c0c lw t8, (s1) | t8 = *(s1);
0x00403c10 lw ra, 0x214(sp) | ra = *(var_214h);
| if (v1 != t8) {
0x00403c14 beq v1, t8, 0x403c24 |
0x00403c18 lw t9, -0x7dec(gp) | t9 = sym.imp.__stack_chk_fail;
0x00403c1c jalr t9 | t9 ();
0x00403c20 nop |
| }
0x00403c24 lw s3, 0x210(sp) | s3 = *(var_210h);
0x00403c28 lw s2, 0x20c(sp) | s2 = *(var_20ch);
0x00403c2c lw s1, 0x208(sp) | s1 = *(var_208h);
0x00403c30 lw s0, 0x204(sp) | s0 = *(var_204h);
0x00403c34 addiu sp, sp, 0x218 |
0x00403c38 jr ra | return v1;
| }
[*] Function printf used 7 times watchDog