Esempio n. 1
0
static void _disassembleMode(struct CLIDebugger* debugger, struct CLIDebugVector* dv, enum ExecutionMode mode) {
	struct ARMCore* cpu = debugger->d.core->cpu;
	uint32_t address;
	int size;
	int wordSize;

	if (mode == MODE_ARM) {
		wordSize = WORD_SIZE_ARM;
	} else {
		wordSize = WORD_SIZE_THUMB;
	}

	if (!dv || dv->type != CLIDV_INT_TYPE) {
		address = cpu->gprs[ARM_PC] - wordSize;
	} else {
		address = dv->intValue;
		dv = dv->next;
	}

	if (!dv || dv->type != CLIDV_INT_TYPE) {
		size = 1;
	} else {
		size = dv->intValue;
		dv = dv->next; // TODO: Check for excess args
	}

	int i;
	for (i = 0; i < size; ++i) {
		address += _printLine(debugger, address, mode);
	}
}
Esempio n. 2
0
static void _printStatus(struct CLIDebuggerSystem* debugger) {
	struct CLIDebuggerBackend* be = debugger->p->backend;
	struct LR35902Core* cpu = debugger->p->d.core->cpu;
	be->printf(be, "A: %02X F: %02X (AF: %04X)\n", cpu->a, cpu->f.packed, cpu->af);
	be->printf(be, "B: %02X C: %02X (BC: %04X)\n", cpu->b, cpu->c, cpu->bc);
	be->printf(be, "D: %02X E: %02X (DE: %04X)\n", cpu->d, cpu->e, cpu->de);
	be->printf(be, "H: %02X L: %02X (HL: %04X)\n", cpu->h, cpu->l, cpu->hl);
	be->printf(be, "PC: %04X SP: %04X\n", cpu->pc, cpu->sp);
	_printFlags(be, cpu->f);
	_printLine(debugger->p, cpu->pc, -1);
}
Esempio n. 3
0
static void _printStatus(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
	UNUSED(dv);
	int r;
	for (r = 0; r < 4; ++r) {
		printf("%08X %08X %08X %08X\n",
		    debugger->d.cpu->gprs[r << 2],
		    debugger->d.cpu->gprs[(r << 2) + 1],
		    debugger->d.cpu->gprs[(r << 2) + 2],
		    debugger->d.cpu->gprs[(r << 2) + 3]);
	}
	_printPSR(debugger->d.cpu->cpsr);
	int instructionLength;
	enum ExecutionMode mode = debugger->d.cpu->cpsr.t;
	if (mode == MODE_ARM) {
		instructionLength = WORD_SIZE_ARM;
	} else {
		instructionLength = WORD_SIZE_THUMB;
	}
	_printLine(debugger, debugger->d.cpu->gprs[ARM_PC] - instructionLength, mode);
}
Esempio n. 4
0
static void _printStatus(struct CLIDebuggerSystem* debugger) {
	struct CLIDebuggerBackend* be = debugger->p->backend;
	struct ARMCore* cpu = debugger->p->d.core->cpu;
	int r;
	for (r = 0; r < 4; ++r) {
		be->printf(be, "%08X %08X %08X %08X\n",
		    cpu->gprs[r << 2],
		    cpu->gprs[(r << 2) + 1],
		    cpu->gprs[(r << 2) + 2],
		    cpu->gprs[(r << 2) + 3]);
	}
	_printPSR(be, cpu->cpsr);
	int instructionLength;
	enum ExecutionMode mode = cpu->cpsr.t;
	if (mode == MODE_ARM) {
		instructionLength = WORD_SIZE_ARM;
	} else {
		instructionLength = WORD_SIZE_THUMB;
	}
	_printLine(debugger->p, cpu->gprs[ARM_PC] - instructionLength, mode);
}
Esempio n. 5
0
static void _disassemble(struct CLIDebuggerSystem* debugger, struct CLIDebugVector* dv) {
	struct LR35902Core* cpu = debugger->p->d.core->cpu;

	uint16_t address;
	size_t size;
	if (!dv || dv->type != CLIDV_INT_TYPE) {
		address = cpu->pc;
	} else {
		address = dv->intValue;
		dv = dv->next;
	}

	if (!dv || dv->type != CLIDV_INT_TYPE) {
		size = 1;
	} else {
		size = dv->intValue;
		dv = dv->next; // TODO: Check for excess args
	}

	size_t i;
	for (i = 0; i < size; ++i) {
		address = _printLine(debugger->p, address, -1);
	}
}