Exemple #1
0
static int avrdis (char *out, ut64 addr, cut8 *buf, int len) {
	formattingOptions opt = { 0 };
	disassembledInstruction dins;
	assembledInstruction ins;
	AVR_Long_Instruction = 0;
	AVR_Long_Address = 0;
	ins.address = addr;
	ins.opcode = (buf[1]<<8) | buf[0] |
		(buf[2]<<16) | (buf[3]<<24);
	if (disassembleInstruction (&dins, ins)) {
		strcpy (out, "invalid");
		return -1;
	}
	if (AVR_Long_Instruction) {
		ins.address = addr;
		ins.opcode = 
			(buf[3]<<8) | (buf[2]);
		/*
			(buf[3]<<24) | (buf[2]<<16) | \
			(buf[1]<<8) | (buf[0]);
		*/
		if (disassembleInstruction (&dins, ins)) {
			strcpy (out, "invalid");
			return -1;
		}
		printDisassembledInstruction (out, dins, opt);
		return 4;
	}
	printDisassembledInstruction (out, dins, opt);
	//printf ("0x%08"PFMT64x" %s\n", addr, out);
	return 2;
}
Exemple #2
0
int avrdis (char *out, ut64 addr, cut8 *buf, int len) {
	formattingOptions opt = { 0 };
	disassembledInstruction dins;
	assembledInstruction ins;
	ins.address = addr;
	ins.opcode = (buf[1]<<8) | buf[0];
	if (disassembleInstruction (&dins, ins)) {
		fprintf (stderr, "FAIL\n");
		return -1;
	}
	printDisassembledInstruction (out, dins, opt);
	//printf ("0x%08"PFMT64x" %s\n", addr, out);
	return 2;
}