20 const char *
const key;
26 #define CPU_CONST_NONE 0
27 #define CPU_CONST_PARAM 1
28 #define CPU_CONST_REG 2
52 #define CPU_MODEL_DECL(model, pc, consts) \
58 #define MASK(bits) ((bits) == 32 ? 0xffffffff : (~((~((ut32)0)) << (bits))))
59 #define CPU_PC_MASK(cpu) MASK((cpu)->pc)
60 #define CPU_PC_SIZE(cpu) ((((cpu)->pc) >> 3) + ((((cpu)->pc) & 0x07) ? 1 : 0))
62 #define INST_HANDLER(OPCODE_NAME) static void _inst__##OPCODE_NAME(RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu)
63 #define INST_DECL(OP, M, SL, C, SZ, T) \
64 { #OP, (M), (SL), _inst__##OP, (C), (SZ), RZ_ANALYSIS_OP_TYPE_##T }
66 { "unknown", 0, 0, (void *)0, 2, 1, RZ_ANALYSIS_OP_TYPE_UNK }
68 #define INST_CALL(OPCODE_NAME) _inst__##OPCODE_NAME(analysis, op, buf, len, fail, cpu)
69 #define INST_INVALID \
74 #define INST_ASSERT(x) \
81 #define ESIL_A(e, ...) rz_strbuf_appendf(&op->esil, e, ##__VA_ARGS__)
83 #define STR_BEGINS(in, s) rz_str_ncasecmp(in, s, strlen(s))
132 .
model =
"ATmega640",
141 { .model =
"ATmega1280", .pc = 16, .inherit =
"ATmega640" },
142 { .model =
"ATmega1281", .pc = 16, .inherit =
"ATmega640" },
143 { .model =
"ATmega2560", .pc = 17, .inherit =
"ATmega640" },
144 { .model =
"ATmega2561", .pc = 17, .inherit =
"ATmega640" },
145 { .model =
"ATmega88", .pc = 8, .inherit =
"ATmega8" },
166 if (
cpu->inherit && !
cpu->inherit_cpu_p) {
168 if (!
cpu->inherit_cpu_p) {
169 RZ_LOG_ERROR(
"Cannot inherit from unknown CPU model '%s'.\n",
cpu->inherit);
191 return c ?
MASK(
c->size * 8) &
c->value : 0;
197 for (clist =
cpu->consts; *clist; clist++) {
198 for (citem = *clist; citem->
key; citem++) {
204 if (
cpu->inherit_cpu_p) {
224 for (clist =
cpu->consts; *clist; clist++) {
225 for (citem = *clist; citem && citem->
key; citem++) {
231 if (
cpu->inherit_cpu_p) {
255 if (prepostdec < 0) {
256 ESIL_A(
"1,%c,-,%c,=,", ireg, ireg);
268 ESIL_A(
"16,ramp%c,<<,+,", ireg ? ireg :
'd');
273 ESIL_A(
"%s[1],", st ?
"=" :
"");
275 if (ireg && prepostdec > 0) {
276 ESIL_A(
"1,%c,+,%c,=,", ireg, ireg);
305 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
306 const ut32 r = (
buf[0] & 0xf) | ((
buf[1] & 2) << 3);
312 ESIL_A(
"0x80,r%d,&,!,!,nf,:=",
d);
320 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
321 const ut32 r = (
buf[0] & 0xf) | ((
buf[1] & 2) << 3);
327 ESIL_A(
"0x80,r%d,&,!,!,nf,:=,",
d);
334 const ut32 d = ((
buf[0] & 0x30) >> 3) + 24;
335 const ut32 k = (
buf[0] & 0x0f) | ((
buf[0] >> 2) & 0x30);
337 ESIL_A(
"8,%d,8,r%d,<<,r%d,|,+,DUP,r%d,=,>>,r%d,=,",
k,
d + 1,
d,
d,
d + 1);
339 ESIL_A(
"DUP,!,7,r%d,>>,&,vf,:=,",
d + 1);
340 ESIL_A(
"r%d,0x80,&,!,!,nf,:=,",
d + 1);
341 ESIL_A(
"8,r%d,<<,r%d,|,!,zf,:=,",
d + 1,
d);
342 ESIL_A(
"7,r%d,>>,!,&,cf,:=,",
d + 1);
351 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
352 const ut32 r = (
buf[0] & 0xf) | ((
buf[1] & 2) << 3);
353 ESIL_A(
"r%d,r%d,&=,$z,zf,:=,r%d,0x80,&,!,!,nf,:=,0,vf,:=,nf,sf,:=,",
r,
d,
d);
361 const ut32 d = ((
buf[0] >> 4) & 0xf) + 16;
362 const ut32 k = ((
buf[1] & 0x0f) << 4) | (
buf[0] & 0x0f);
363 ESIL_A(
"%d,r%d,&=,$z,zf,:=,r%d,0x80,&,!,!,nf,:=,0,vf,:=,nf,sf,:=,",
k,
d,
d);
370 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
371 ESIL_A(
"r%d,0x1,&,cf,:=,0x1,r%d,>>,r%d,0x80,&,|,",
d,
d,
d);
374 ESIL_A(
"r%d,0x80,&,!,!,nf,:=,",
d);
392 int s = (
buf[0] >> 4) & 0x7;
393 ESIL_A(
"0xff,%d,1,<<,^,sreg,&=,",
s);
400 int d = ((
buf[1] & 0x01) << 4) | ((
buf[0] >> 4) & 0xf);
401 int b =
buf[0] & 0x7;
402 ESIL_A(
"r%d,%d,1,<<,0xff,^,&,",
d,
b);
420 int s =
buf[0] & 0x7;
421 ut64 jump =
op->addr + ((((
buf[1] & 0x03) << 6) | ((
buf[0] & 0xf8) >> 2)) | (
buf[1] & 0x2 ? ~((
int)0x7f) : 0)) + 2;
446 int s = (
buf[0] >> 4) & 0x7;
454 ESIL_A(
"r%d,%d,1,<<,&,!,!,tf,=,",
455 ((
buf[1] & 1) << 4) | ((
buf[0] >> 4) & 0xf),
463 ut64 jump = (
buf[2] << 1) | (
buf[3] << 9) | (
buf[1] & 0x01) << 23 | (
buf[0] & 0x01) << 17 | (
buf[0] & 0xf0) << 14;
474 int a = (
buf[0] >> 3) & 0x1f;
475 int b =
buf[0] & 0x07;
493 int r = ((
buf[0] >> 4) & 0x0f) | ((
buf[1] & 1) << 4);
495 ESIL_A(
"r%d,0xff,-,r%d,=,$z,zf,:=,0,cf,:=,0,vf,:=,r%d,0x80,&,!,!,nf,:=,vf,nf,^,sf,:=",
r,
r,
r);
503 const ut32 r = (
buf[0] & 0x0f) | ((
buf[1] << 3) & 0x10);
504 const ut32 d = ((
buf[0] >> 4) & 0x0f) | ((
buf[1] << 4) & 0x10);
505 ESIL_A(
"r%d,r%d,-,0x80,&,!,!,nf,:=,",
r,
d);
518 const ut32 r = (
buf[0] & 0x0f) | ((
buf[1] << 3) & 0x10);
519 const ut32 d = ((
buf[0] >> 4) & 0x0f) | ((
buf[1] << 4) & 0x10);
521 ESIL_A(
"cf,r%d,+,DUP,r%d,-,0x80,&,!,!,nf,:=,",
r,
d);
534 const ut32 d = ((
buf[0] >> 4) & 0xf) + 16;
535 const ut32 k = (
buf[0] & 0xf) | ((
buf[1] & 0xf) << 4);
536 ESIL_A(
"%d,r%d,-,0x80,&,!,!,nf,:=,",
k,
d);
549 int r = (
buf[0] & 0xf) | ((
buf[1] & 0x2) << 3);
550 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
559 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
563 ESIL_A(
"r%d,0x80,&,!,!,nf,:=,",
d);
569 int round = (
buf[0] >> 4);
574 ESIL_A(
"1,z,16,eind,<<,+,<<,pc,=,");
592 int d = ((
buf[1] & 0xfe) == 0x90)
593 ? ((
buf[1] & 1) << 4) | ((
buf[0] >> 4) & 0xf)
595 ESIL_A(
"16,rampz,<<,z,+,_prog,+,[1],");
597 if ((
buf[1] & 0xfe) == 0x90 && (
buf[0] & 0xf) == 0x7) {
598 ESIL_A(
"16,1,z,+,DUP,z,=,>>,1,&,rampz,+=,");
607 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
608 const ut32 r = (
buf[0] & 0xf) | ((
buf[1] & 2) << 3);
609 ESIL_A(
"r%d,r%d,^=,$z,zf,:=,0,vf,:=,r%d,0x80,&,!,!,nf,:=,nf,sf,:=",
r,
d,
d);
617 const ut32 d = ((
buf[0] >> 4) & 0x7) + 16;
621 ESIL_A(
"0xffff,1,r%d,r%d,*,<<,&,DUP,r0,=,>>,r1,=,",
r,
d);
622 ESIL_A(
"8,r1,<<,r0,|,DUP,0x8000,&,!,!,cf,:=,");
630 const ut32 d = ((
buf[0] >> 4) & 0x7) + 16;
634 ESIL_A(
"r%d,DUP,0x80,&,?{,0xff00,|,},",
d);
635 ESIL_A(
"r%d,DUP,0x80,&,?{,0xff00,|,},",
r);
636 ESIL_A(
"*,<<,DUP,r0,=,>>,r1,=,");
638 ESIL_A(
"8,r1,<<,r0,|,DUP,0x8000,&,!,!,cf,:=,");
646 const ut32 d = ((
buf[0] >> 4) & 0x7) + 16;
650 ESIL_A(
"r%d,DUP,0x80,&,?{,0xff00,|,},",
d);
651 ESIL_A(
"r%d,*,<<,DUP,r0,=,>>,r1,=,",
r);
653 ESIL_A(
"8,r1,<<,r0,|,DUP,0x8000,&,!,!,cf,:=,");
675 int r = ((
buf[0] >> 4) & 0x0f) | ((
buf[1] & 0x01) << 4);
676 int a = (
buf[0] & 0x0f) | ((
buf[1] & 0x6) << 3);
686 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
690 ESIL_A(
"r%d,0x80,&,!,!,nf,:=,",
d);
699 ut64 jump = (
buf[2] << 1) | (
buf[3] << 9) | (
buf[1] & 0x01) << 23 | (
buf[0] & 0x01) << 17 | (
buf[0] & 0xf0) << 14;
707 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
720 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
733 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
753 (
buf[0] & 0xf) == 0xe
755 : (
buf[0] & 0xf) == 0xd
761 ESIL_A(
"r%d,=,", ((
buf[1] & 1) << 4) | ((
buf[0] >> 4) & 0xf));
777 buf[0] & 0x8 ?
'y' :
'z',
787 ESIL_A(
"r%d,=,", ((
buf[1] & 1) << 4) | ((
buf[0] >> 4) & 0xf));
794 int k = (
buf[0] & 0xf) + ((
buf[1] & 0xf) << 4);
795 int d = ((
buf[0] >> 4) & 0xf) + 16;
803 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
804 int k = (
buf[3] << 8) |
buf[2];
815 int r = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
816 int k = (
buf[3] << 8) |
buf[2];
834 (ins & 0xfe0f) == 0x9005
843 : ((
buf[0] >> 4) & 0xf)
844 | ((
buf[1] & 0x1) << 4));
851 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
864 const ut32 d = ((
buf[1] << 4) & 0x10) | ((
buf[0] >> 4) & 0x0f);
865 const ut32 r = ((
buf[1] << 3) & 0x10) | (
buf[0] & 0x0f);
873 const ut32 d = (
buf[0] & 0xf0) >> 3;
874 const ut32 r = (
buf[0] & 0x0f) << 1;
875 ESIL_A(
"r%d,r%d,=,r%d,r%d,=,",
r,
d,
r + 1,
d + 1);
882 const ut32 d = ((
buf[1] << 4) & 0x10) | ((
buf[0] >> 4) & 0x0f);
883 const ut32 r = ((
buf[1] << 3) & 0x10) | (
buf[0] & 0x0f);
885 ESIL_A(
"8,r%d,r%d,*,DUP,r0,=,>>,r1,=,",
r,
d);
886 ESIL_A(
"8,r1,<<,r0,|,DUP,0x8000,&,!,!,cf,:=,");
894 const ut32 d = (
buf[0] >> 4 & 0x0f) + 16;
895 const ut32 r = (
buf[0] & 0x0f) + 16;
898 ESIL_A(
"r%d,DUP,0x80,&,?{,0xff00,|,},",
d);
899 ESIL_A(
"r%d,DUP,0x80,&,?{,0xff00,|,},",
r);
900 ESIL_A(
"*,DUP,r0,=,>>,r1,=,");
902 ESIL_A(
"8,r1,<<,r0,|,DUP,0x8000,&,!,!,cf,:=,");
910 const ut32 d = (
buf[0] >> 4 & 0x07) + 16;
911 const ut32 r = (
buf[0] & 0x07) + 16;
914 ESIL_A(
"r%d,DUP,0x80,&,?{,0xff00,|,},",
d);
915 ESIL_A(
"r%d,*,DUP,r0,=,>>,r1,=,",
r);
917 ESIL_A(
"8,r1,<<,r0,|,DUP,0x8000,&,!,!,cf,:=,");
925 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
926 ESIL_A(
"r%d,0x00,-,0xff,&,",
d);
927 ESIL_A(
"DUP,r%d,0xff,^,|,0x08,&,!,!,hf,=,",
d);
928 ESIL_A(
"DUP,0x80,-,!,vf,=,");
929 ESIL_A(
"DUP,0x80,&,!,!,nf,=,");
944 int d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
945 int r = (
buf[0] & 0xf) | ((
buf[1] & 2) << 3);
958 const ut32 d = ((
buf[0] >> 4) & 0xf) + 16;
959 const ut32 k = (
buf[0] & 0xf) | ((
buf[1] & 0xf) << 4);
962 ESIL_A(
"r%d,0x80,&,!,!,nf,:=,",
d);
971 int r = ((
buf[0] >> 4) & 0x0f) | ((
buf[1] & 0x01) << 4);
972 int a = (
buf[0] & 0x0f) | ((
buf[1] & 0x6) << 3);
982 int d = ((
buf[1] & 0x1) << 4) | ((
buf[0] >> 4) & 0xf);
991 int r = ((
buf[1] & 0x1) << 4) | ((
buf[0] >> 4) & 0xf);
1001 ut64 jump =
op->addr + ((((((
buf[1] & 0xf) << 8) |
buf[0]) << 1) | (((
buf[1] & 0x8) ? ~((
int)0x1fff) : 0))) + 2);
1026 st32 loc = (((((
buf[1] & 0xf) << 9) | (
buf[0] << 1))) | (
buf[1] & 0x8 ? ~(0x1fff) : 0)) + 2;
1032 const ut32 d = ((
buf[0] >> 4) & 0x0f) | ((
buf[1] << 4) & 0x10);
1035 ESIL_A(
"1,r%d,>>,7,cf,<<,|,r%d,=,cf,:=,",
d,
d);
1037 ESIL_A(
"nf,cf,^,vf,:=,");
1045 const ut32 r = (
buf[0] & 0x0f) | ((
buf[1] & 0x2) << 3);
1046 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x1) << 4);
1053 ESIL_A(
"0x80,r%d,&,!,!,nf,:=,",
d);
1061 const ut32 d = ((
buf[0] >> 4) & 0xf) + 16;
1062 const ut32 k = ((
buf[1] & 0xf) << 4) | (
buf[0] & 0xf);
1069 ESIL_A(
"0x80,r%d,&,!,!,nf,:=,",
d);
1077 const ut32 d = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 1) << 4);
1078 const ut32 r = (
buf[0] & 0xf) | ((
buf[1] & 2) << 3);
1085 ESIL_A(
"0x80,r%d,&,!,!,nf,:=,",
d);
1093 const ut32 d = ((
buf[0] >> 4) & 0xf) + 16;
1094 const ut32 k = ((
buf[1] & 0xf) << 4) | (
buf[0] & 0xf);
1101 ESIL_A(
"0x80,r%d,&,!,!,nf,:=,",
d);
1109 int a = (
buf[0] >> 3) & 0x1f;
1110 int b =
buf[0] & 0x07;
1129 int a = (
buf[0] >> 3) & 0x1f;
1130 int b =
buf[0] & 0x07;
1147 int d = ((
buf[0] & 0x30) >> 3) + 24;
1148 int k = (
buf[0] & 0xf) | ((
buf[0] >> 2) & 0x30);
1150 ESIL_A(
"8,%d,8,r%d,<<,r%d,|,-,DUP,r%d,=,>>,r%d,=,",
k,
d + 1,
d,
d,
d + 1);
1152 ESIL_A(
"DUP,!,7,r%d,>>,&,cf,:=,",
d + 1);
1153 ESIL_A(
"r%d,0x80,&,!,!,nf,:=,",
d + 1);
1154 ESIL_A(
"7,r%d,>>,!,&,vf,:=,",
d + 1);
1163 int b =
buf[0] & 0x7;
1164 int r = ((
buf[0] >> 4) & 0xf) | ((
buf[1] & 0x01) << 4);
1183 ESIL_A(
"0x7c,spmcsr,&=,");
1186 switch (spmcsr & 0x7f) {
1190 ESIL_A(
"16,rampz,<<,z,+,");
1191 ESIL_A(
"SPM_PAGE_ERASE,");
1197 ESIL_A(
"SPM_PAGE_FILL,");
1201 ESIL_A(
"16,rampz,<<,z,+,");
1202 ESIL_A(
"SPM_PAGE_WRITE,");
1218 ESIL_A(
"r%d,", ((
buf[1] & 1) << 4) | ((
buf[0] >> 4) & 0xf));
1224 (
buf[0] & 0xf) == 0xe
1226 : (
buf[0] & 0xf) == 0xd
1241 ESIL_A(
"r%d,", ((
buf[1] & 1) << 4) | ((
buf[0] >> 4) & 0xf));
1245 buf[0] & 0x8 ?
'y' :
'z',
1254 | ((
buf[1] & 0xc) << 1) | (
buf[0] & 0x7)
1263 int d = ((
buf[1] & 0x1) << 4) | ((
buf[0] >> 4) & 0xf);
1264 ESIL_A(
"4,r%d,>>,0x0f,&,",
d);
1265 ESIL_A(
"4,r%d,<<,0xf0,&,",
d);
1273 INST_DECL(eicall, 0xffff, 0x9519, 0, 2, UCALL),
1274 INST_DECL(eijmp, 0xffff, 0x9419, 0, 2, UJMP),
1275 INST_DECL(icall, 0xffff, 0x9509, 0, 2, UCALL),
1276 INST_DECL(ijmp, 0xffff, 0x9409, 0, 2, UJMP),
1283 INST_DECL(bclr, 0xff8f, 0x9488, 1, 2, MOV),
1284 INST_DECL(bset, 0xff8f, 0x9408, 1, 2, MOV),
1292 INST_DECL(cbi, 0xff00, 0x9800, 1, 2, IO),
1293 INST_DECL(sbi, 0xff00, 0x9a00, 1, 2, IO),
1294 INST_DECL(movw, 0xff00, 0x0100, 1, 2, MOV),
1297 INST_DECL(com, 0xfe0f, 0x9400, 1, 2, NOT),
1314 INST_DECL(pop, 0xfe0f, 0x900f, 2, 2, POP),
1315 INST_DECL(push, 0xfe0f, 0x920f, 0, 2, PUSH),
1323 INST_DECL(bld, 0xfe08, 0xf800, 1, 2, MOV),
1324 INST_DECL(bst, 0xfe08, 0xfa00, 1, 2, MOV),
1325 INST_DECL(sbix, 0xff00, 0x9900, 2, 2, CJMP),
1326 INST_DECL(sbix, 0xff00, 0x9b00, 2, 2, CJMP),
1327 INST_DECL(sbrx, 0xfe08, 0xfc00, 2, 2, CJMP),
1328 INST_DECL(sbrx, 0xfe08, 0xfe00, 2, 2, CJMP),
1336 INST_DECL(brbx, 0xfc00, 0xf000, 0, 2, CJMP),
1337 INST_DECL(brbx, 0xfc00, 0xf400, 0, 2, CJMP),
1340 INST_DECL(cpse, 0xfc00, 0x1000, 0, 2, CJMP),
1353 INST_DECL(rcall, 0xf000, 0xd000, 0, 2, CALL),
1374 for (opcode_desc =
opcodes; opcode_desc->
handler; opcode_desc++) {
1375 if ((ins & opcode_desc->
mask) == opcode_desc->
selector) {
1385 }
else if (opcode_desc->
cycles <= 0) {
1391 if (t && strlen(t) > 1) {
1414 if (round < 0 || round > 15) {
1424 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
1425 "r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"r14",
"r15"
1427 for (
size_t i = 0;
i <
sizeof(
regs);
i++) {
1444 ut32 key_lo = key_orig_lo;
1445 ut32 key_hi = key_orig_hi;
1451 ut32 round_key_lo, round_key_hi;
1452 rz_des_pc2(&round_key_lo, &round_key_hi, key_lo, key_hi);
1457 rz_des_round(&buf_lo, &buf_hi, &round_key_lo, &round_key_hi);
1467 key_lo |= key_orig_hi & 0x01010101;
1468 key_hi |= key_orig_lo & 0x01010101;
1474 for (
size_t i = 0;
i <
sizeof(
regs);
i++) {
1507 for (
i = 0;
i < (1ULL << page_size_bits);
i++) {
1546 addr &= (
MASK(page_size_bits) ^ 1);
1560 ut64 addr, page_size_bits, tmp_page;
1583 if (!(t =
malloc(1 << page_size_bits))) {
1584 RZ_LOG_ERROR(
"Cannot alloc a buffer for copying the temporary page.\n");
1604 if (!strcmp(
name,
"pc")) {
1606 }
else if (!strcmp(
name,
"pcl")) {
1610 }
else if (!strcmp(
name,
"pch")) {
static const char * arg(RzAnalysis *a, csh *handle, cs_insn *insn, char *buf, int n)
static RzILOpEffect * mov(cs_insn *insn, bool is_thumb)
static RzILOpEffect * mul(cs_insn *insn, bool is_thumb)
static ut32 neg(ArmOp *op)
static void __generic_push(RzAnalysisOp *op, int sz)
#define INST_CALL(OPCODE_NAME)
RZ_IPI int rz_avr_esil_fini(RzAnalysisEsil *esil)
static RzStrBuf * __generic_io_dest(ut8 port, int write, CPU_MODEL *cpu)
static int esil_avr_hook_reg_write(RzAnalysisEsil *esil, const char *name, ut64 *val)
static int __esil_pop_argument(RzAnalysisEsil *esil, ut64 *v)
static bool avr_custom_des(RzAnalysisEsil *esil)
CPU_CONST cpu_memsize_m640_m1280m_m1281_m2560_m2561[]
CPU_CONST cpu_memsize_common[]
static bool avr_custom_spm_page_write(RzAnalysisEsil *esil)
CPU_CONST cpu_reg_common[]
static CPU_MODEL * get_cpu_model(char *model)
static CPU_MODEL * __get_cpu_model_recursive(char *model)
static bool avr_custom_spm_page_erase(RzAnalysisEsil *esil)
RZ_IPI void rz_avr_esil_opcode(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len)
static CPU_CONST * const_by_value(CPU_MODEL *cpu, int type, ut32 v)
CPU_CONST cpu_pagesize_7_bits[]
CPU_CONST cpu_pagesize_5_bits[]
static ut32 const_get_value(CPU_CONST *c)
RZ_IPI int rz_avr_esil_init(RzAnalysisEsil *esil)
static void __generic_ld_st(RzAnalysisOp *op, char *mem, char ireg, int use_ramp, int prepostdec, int offset, int st)
void(* inst_handler_t)(RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu)
#define INST_HANDLER(OPCODE_NAME)
static OPCODE_DESC * avr_op_analyze(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, CPU_MODEL *cpu)
CPU_CONST cpu_memsize_xmega128a4u[]
static void __generic_pop(RzAnalysisOp *op, int sz)
struct _cpu_model_tag CPU_MODEL
static CPU_CONST * const_by_name(CPU_MODEL *cpu, int type, char *c)
#define INST_DECL(OP, M, SL, C, SZ, T)
static bool avr_custom_spm_page_fill(RzAnalysisEsil *esil)
struct _opcodes_tag_ OPCODE_DESC
struct _cpu_const_tag CPU_CONST
static bool rjmp(RzBuffer *b, ut64 addr)
const lzma_allocator const uint8_t * in
const lzma_allocator const uint8_t size_t uint8_t * out
RZ_API void rz_des_permute_key(ut32 *keylo, ut32 *keyhi)
Apply PC-1.
RZ_API void rz_des_pc2(RZ_OUT ut32 *keylo, RZ_OUT ut32 *keyhi, RZ_IN ut32 deslo, RZ_IN ut32 deshi)
PC-2 permutation of a key.
RZ_API void rz_des_permute_block1(ut32 *blocklo, ut32 *blockhi)
last permutation of the block
RZ_API void rz_des_shift_key(int i, bool decrypt, RZ_INOUT ut32 *deskeylo, RZ_INOUT ut32 *deskeyhi)
Apply the respective shift to the key for a given round.
RZ_API void rz_des_round(RZ_OUT ut32 *buflo, RZ_OUT ut32 *bufhi, RZ_IN ut32 *roundkeylo, RZ_IN ut32 *roundkeyhi)
Apply the cipher function (f)
RZ_API void rz_des_permute_key_inv(ut32 *keylo, ut32 *keyhi)
Inverse of rz_des_permute_key (PC-1)
RZ_API void rz_des_permute_block0(ut32 *blocklo, ut32 *blockhi)
first permutation of the input block
RZ_API int rz_analysis_esil_get_parm(RzAnalysisEsil *esil, const char *str, ut64 *num)
RZ_API int rz_analysis_esil_mem_write(RzAnalysisEsil *esil, ut64 addr, const ut8 *buf, int len)
RZ_API int rz_analysis_esil_reg_read(RzAnalysisEsil *esil, const char *regname, ut64 *num, int *size)
RZ_API bool rz_analysis_esil_set_op(RzAnalysisEsil *esil, const char *op, RzAnalysisEsilOpCb code, ut32 push, ut32 pop, ut32 type)
RZ_API int rz_analysis_esil_reg_write(RzAnalysisEsil *esil, const char *dst, ut64 num)
RZ_API char * rz_analysis_esil_pop(RzAnalysisEsil *esil)
RZ_API int rz_analysis_esil_mem_read(RzAnalysisEsil *esil, ut64 addr, ut8 *buf, int len)
static const char *const reg_names[]
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * malloc(size_t size)
@ RZ_ANALYSIS_ESIL_OP_TYPE_CUSTOM
static ut32 rz_read_at_le32(const void *src, size_t offset)
static void rz_write_at_le32(void *dest, ut32 val, size_t offset)
#define RZ_LOG_DEBUG(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API int rz_str_casecmp(const char *dst, const char *orig)
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
RZ_API const char * rz_strbuf_setf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API void rz_strbuf_free(RzStrBuf *sb)
struct _cpu_model_tag * inherit_cpu_p
RzAnalysisEsilHookRegWriteCB hook_reg_write
RzAnalysisEsilCallbacks cb
ut64(WINAPI *w32_GetEnabledXStateFeatures)()