Example #1
0
void kvm_cpu__show_code(struct kvm_cpu *vcpu)
{
	if (ioctl(vcpu->vcpu_fd, KVM_GET_REGS, &vcpu->regs) < 0)
		die("KVM_GET_REGS failed");

	/* FIXME: Dump/disassemble some code...! */

	dprintf(debug_fd, "\n Stack:\n");
	dprintf(debug_fd,   " ------\n");
	/* Only works in real mode: */
	kvm__dump_mem(vcpu->kvm, vcpu->regs.gpr[1], 32, debug_fd);
}
Example #2
0
void kvm_cpu__show_code(struct kvm_cpu *vcpu)
{
	struct kvm_one_reg reg;
	u32 data;
	int debug_fd = kvm_cpu__get_debug_fd();

	reg.addr = (u64)(unsigned long)&data;

	dprintf(debug_fd, "\n*pc:\n");
	reg.id = ARM_CORE_REG(usr_regs.ARM_pc);
	if (ioctl(vcpu->vcpu_fd, KVM_GET_ONE_REG, &reg) < 0)
		die("KVM_GET_ONE_REG failed (show_code @ PC)");

	kvm__dump_mem(vcpu->kvm, data, 32, debug_fd);

	dprintf(debug_fd, "\n*lr (svc):\n");
	reg.id = ARM_CORE_REG(svc_regs[1]);
	if (ioctl(vcpu->vcpu_fd, KVM_GET_ONE_REG, &reg) < 0)
		die("KVM_GET_ONE_REG failed (show_code @ LR_svc)");
	data &= ~0x1;

	kvm__dump_mem(vcpu->kvm, data, 32, debug_fd);
}