From owner-svn-soc-all@FreeBSD.ORG Fri Aug 3 18:12:52 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2DD2B1065670 for ; Fri, 3 Aug 2012 18:12:50 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 03 Aug 2012 18:12:50 +0000 Date: Fri, 03 Aug 2012 18:12:50 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120803181250.2DD2B1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r240050 - soc2012/syuu/bhyve-bios/lib/libbiosemul X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2012 18:12:52 -0000 Author: syuu Date: Fri Aug 3 18:12:49 2012 New Revision: 240050 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240050 Log: fix incorrect drive number, fix incorrect 'vm_set_register' to 'vm_get_register' Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c Fri Aug 3 17:04:41 2012 (r240049) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c Fri Aug 3 18:12:49 2012 (r240050) @@ -109,7 +109,7 @@ static struct vm86_init_args kargs; #endif -#define HDISK_CYL 130 +#define HDISK_CYL 2610 #define HDISK_HEAD 255 #define HDISK_TRACK 63 #define HDISK_FILE "/home/syuu/test.img" @@ -121,16 +121,16 @@ ivec = (u_int32_t *)lomem_addr; debugf = stderr; -#if 0 - debug_set(0); /* debug any D_TRAPS without intnum */ + debug_set(0xfffffff); +#if 0 /* Call init functions */ if (raw_kbd) console_init(); init_io_port_handlers(); #endif bios_init(); - init_hdisk(3, HDISK_CYL, HDISK_HEAD, HDISK_TRACK, HDISK_FILE, NULL); + init_hdisk(2, HDISK_CYL, HDISK_HEAD, HDISK_TRACK, HDISK_FILE, NULL); #if 0 cpu_init(); kbd_init(); @@ -830,67 +830,83 @@ int error = 0; if ((orig->r.gs.r_rx != modified->r.gs.r_rx) && + printf("%s gs:%lx\n", __func__, modified->r.gs.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_GS, modified->r.gs.r_rx)) != 0) goto done; if ((orig->r.fs.r_rx != modified->r.fs.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_FS, &modified->r.fs.r_rx)) != 0) + printf("%s fs:%lx\n", __func__, modified->r.fs.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_FS, modified->r.fs.r_rx)) != 0) goto done; if ((orig->r.es.r_rx != modified->r.es.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_ES, &modified->r.es.r_rx)) != 0) + printf("%s es:%lx\n", __func__, modified->r.es.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_ES, modified->r.es.r_rx)) != 0) goto done; if ((orig->r.ds.r_rx != modified->r.ds.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_DS, &modified->r.es.r_rx)) != 0) + printf("%s ds:%lx\n", __func__, modified->r.ds.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_DS, modified->r.es.r_rx)) != 0) goto done; if ((orig->r.edi.r_rx != modified->r.edi.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RDI, &modified->r.edi.r_rx)) != 0) + printf("%s edi:%lx\n", __func__, modified->r.edi.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RDI, modified->r.edi.r_rx)) != 0) goto done; if ((orig->r.esi.r_rx != modified->r.esi.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RSI, &modified->r.esi.r_rx)) != 0) + printf("%s esi:%lx\n", __func__, modified->r.esi.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RSI, modified->r.esi.r_rx)) != 0) goto done; if ((orig->r.ebp.r_rx != modified->r.ebp.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RBP, &modified->r.ebp.r_rx)) != 0) + printf("%s ebp:%lx\n", __func__, modified->r.ebp.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RBP, modified->r.ebp.r_rx)) != 0) goto done; if ((orig->r.ebx.r_rx != modified->r.ebx.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RBX, &modified->r.ebx.r_rx)) != 0) + printf("%s ebx:%lx\n", __func__, modified->r.ebx.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RBX, modified->r.ebx.r_rx)) != 0) goto done; if ((orig->r.edx.r_rx != modified->r.edx.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RDX, &modified->r.edx.r_rx)) != 0) + printf("%s edx:%lx\n", __func__, modified->r.edx.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RDX, modified->r.edx.r_rx)) != 0) goto done; if ((orig->r.ecx.r_rx != modified->r.ecx.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RCX, &modified->r.ecx.r_rx)) != 0) + printf("%s ecx:%lx\n", __func__, modified->r.ecx.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RCX, modified->r.ecx.r_rx)) != 0) goto done; if ((orig->r.eax.r_rx != modified->r.eax.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RAX, &modified->r.eax.r_rx)) != 0) + printf("%s eax:%lx\n", __func__, modified->r.eax.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RAX, modified->r.eax.r_rx)) != 0) goto done; if ((orig->r.eip.r_rx != modified->r.eip.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &modified->r.eip.r_rx)) != 0) + printf("%s eip:%lx\n", __func__, modified->r.eip.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, modified->r.eip.r_rx)) != 0) goto done; if ((orig->r.cs.r_rx != modified->r.cs.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_CS, &modified->r.cs.r_rx)) != 0) + printf("%s cs:%lx\n", __func__, modified->r.cs.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_CS, modified->r.cs.r_rx)) != 0) goto done; if ((orig->r.efl.r_rx != modified->r.efl.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, &modified->r.efl.r_rx)) != 0) + printf("%s eflags:%lx\n", __func__, modified->r.efl.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, modified->r.efl.r_rx)) != 0) goto done; if ((orig->r.esp.r_rx != modified->r.esp.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RSP, &modified->r.esp.r_rx)) != 0) + printf("%s esp:%lx\n", __func__, modified->r.esp.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RSP, modified->r.esp.r_rx)) != 0) goto done; if ((orig->r.ss.r_rx != modified->r.ss.r_rx) && - (error = vm_get_register(ctx, vcpu, VM_REG_GUEST_SS, &modified->r.ss.r_rx)) != 0) + printf("%s ss:%lx\n", __func__, modified->r.ss.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_SS, modified->r.ss.r_rx)) != 0) goto done; done: @@ -907,23 +923,38 @@ get_all_regs(ctx, vcpu, &orig); modified = orig; - printf("%s RAX=%lx EAX=%x AX=%x AH=%x AL=%x\n", + printf("%s orig RAX=%lx EAX=%x AX=%x AL=%x AH=%x\n", __func__, orig.r.eax.r_rx, orig.r.eax.r_dw.r_ex, orig.r.eax.r_w.r_x, orig.r.eax.r_b.r_l, orig.r.eax.r_b.r_h); - printf("%s RBX=%lx EBX=%x BX=%x BH=%x BL=%x\n", + printf("%s orig RBX=%lx EBX=%x BX=%x BL=%x BH=%x\n", __func__, orig.r.ebx.r_rx, orig.r.ebx.r_dw.r_ex, orig.r.ebx.r_w.r_x, orig.r.ebx.r_b.r_l, orig.r.ebx.r_b.r_h); + printf("%s modified RAX=%lx EAX=%x AX=%x AL=%x AH=%x\n", + __func__, + modified.r.eax.r_rx, + modified.r.eax.r_dw.r_ex, + modified.r.eax.r_w.r_x, + modified.r.eax.r_b.r_l, + modified.r.eax.r_b.r_h); + printf("%s modified RBX=%lx EBX=%x BX=%x BL=%x BH=%x\n", + __func__, + modified.r.ebx.r_rx, + modified.r.ebx.r_dw.r_ex, + modified.r.ebx.r_w.r_x, + modified.r.ebx.r_b.r_l, + modified.r.ebx.r_b.r_h); switch (intno) { case 0x13: + printf("call int13\n"); int13(&modified); break; default: Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c Fri Aug 3 17:04:41 2012 (r240049) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c Fri Aug 3 18:12:49 2012 (r240050) @@ -88,15 +88,19 @@ { va_list args; +#if 0 if (flags & (debug_flags & ~0xff)) { if ((debug_flags & 0xff) == 0 && (flags & (D_ITRAPS | D_TRAPS)) && !debug_isset(flags & 0xff)) return; +#endif va_start (args, fmt); vfprintf (debugf, fmt, args); va_end (args); +#if 0 } +#endif } /* Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Fri Aug 3 17:04:41 2012 (r240049) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Fri Aug 3 18:12:49 2012 (r240050) @@ -595,6 +595,8 @@ R_FLAGS &= ~PSL_C; + printf("%s:%d AH:%x AL:%x FLAGS:%x\n", __func__, __LINE__, R_AH, R_AL, R_FLAGS); + drive = R_DL; if (R_AX != 0x01) { @@ -621,6 +623,8 @@ sectors = R_AL; side = R_DH; R_AL = 0; /* Start out with nothing read */ + fprintf(stderr, "%s read addr:%x sectors:%d side:%d drive:%x\n", + __func__, (R_ES << 4) + R_BX, sectors, side, drive); if (drive & 0x80) { cyl = R_CH | ((R_CL & 0xc0) << 2); @@ -639,6 +643,8 @@ start = cyl * di->sectors * di->sides + side * di->sectors + sector; + fprintf(stderr, "%s cyl:%d sector:%d di->sectors:%d di->sides:%d\n", + __func__, cyl, sector, di->sectors, di->sides); if (start >= disize(di)) { debug(D_DISK, "Read past end of disk\n"); @@ -668,6 +674,8 @@ if ((did = diread(di, REGS, start, addr, sectors)) >= 0) R_AL = did; + + fprintf(stderr, "%s did:%d\n", __func__, did); #if 0 callint(0x0d); callint(0x76);