Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jul 2012 10:38:35 +0000
From:      syuu@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r239890 - in soc2012/syuu/bhyve-bios: lib/libbiosemul usr.sbin/bhyve
Message-ID:  <20120729103835.A5514106566B@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: syuu
Date: Sun Jul 29 10:38:35 2012
New Revision: 239890
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239890

Log:
  libbiosemul SEGV fixes

Modified:
  soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile
  soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c
  soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c
  soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h
  soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h
  soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c
  soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h
  soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile
  soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c
  soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile	Sun Jul 29 10:38:35 2012	(r239890)
@@ -14,7 +14,7 @@
 FONTHDRS=	font8x8.h font8x14.h font8x16.h
 CLEANFILES=	${FONTFILES} ${FONTHDRS}
 
-CFLAGS+=	-DNO_X
+CFLAGS+=	-DNO_X -g
 
 cp437-8x8.pcf.gz: cp437-8x8.pcf.gz.uu
 	uudecode ${.CURDIR}/cp437-8x8.pcf.gz.uu

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c	Sun Jul 29 10:38:35 2012	(r239890)
@@ -38,33 +38,33 @@
 #include "mouse.h"
 #include "com.h"
 
-#define	BIOS_copyright         0xfe000
-#define	BIOS_reset             0xfe05b
-#define	BIOS_nmi               0xfe2c3
-#define	BIOS_hdisk_table       0xfe401
-#define	BIOS_boot              0xfe6f2
-#define	BIOS_comm_table        0xfe729
-#define	BIOS_comm_io           0xfe739
-#define	BIOS_keyboard_io       0xfe82e
-#define	BIOS_keyboard_isr      0xfe987
-#define	BIOS_fdisk_io          0xfec59
-#define	BIOS_fdisk_isr         0xfef57
-#define	BIOS_disk_parms        0xfefc7
-#define	BIOS_printer_io        0xfefd2
-#define	BIOS_video_io          0xff065
-#define	BIOS_video_parms       0xff0a4
-#define	BIOS_mem_size          0xff841
-#define	BIOS_equipment         0xff84d
-#define	BIOS_cassette_io       0xff859
-#define	BIOS_video_font        0xffa6e
-#define	BIOS_time_of_day       0xffe6e
-#define	BIOS_timer_int         0xffea5
-#define	BIOS_vector            0xffef3
-#define	BIOS_dummy_iret        0xfff53
-#define	BIOS_print_screen      0xfff54
-#define	BIOS_hard_reset        0xffff0
-#define	BIOS_date_stamp        0xffff5
-#define	BIOS_hardware_id       0xffffe
+#define	BIOS_copyright         (lomem_addr + 0xfe000)
+#define	BIOS_reset             (lomem_addr + 0xfe05b)
+#define	BIOS_nmi               (lomem_addr + 0xfe2c3)
+#define	BIOS_hdisk_table       (lomem_addr + 0xfe401)
+#define	BIOS_boot              (lomem_addr + 0xfe6f2)
+#define	BIOS_comm_table        (lomem_addr + 0xfe729)
+#define	BIOS_comm_io           (lomem_addr + 0xfe739)
+#define	BIOS_keyboard_io       (lomem_addr + 0xfe82e)
+#define	BIOS_keyboard_isr      (lomem_addr + 0xfe987)
+#define	BIOS_fdisk_io          (lomem_addr + 0xfec59)
+#define	BIOS_fdisk_isr         (lomem_addr + 0xfef57)
+#define	BIOS_disk_parms        (lomem_addr + 0xfefc7)
+#define	BIOS_printer_io        (lomem_addr + 0xfefd2)
+#define	BIOS_video_io          (lomem_addr + 0xff065)
+#define	BIOS_video_parms       (lomem_addr + 0xff0a4)
+#define	BIOS_mem_size          (lomem_addr + 0xff841)
+#define	BIOS_equipment         (lomem_addr + 0xff84d)
+#define	BIOS_cassette_io       (lomem_addr + 0xff859)
+#define	BIOS_video_font        (lomem_addr + 0xffa6e)
+#define	BIOS_time_of_day       (lomem_addr + 0xffe6e)
+#define	BIOS_timer_int         (lomem_addr + 0xffea5)
+#define	BIOS_vector            (lomem_addr + 0xffef3)
+#define	BIOS_dummy_iret        (lomem_addr + 0xfff53)
+#define	BIOS_print_screen      (lomem_addr + 0xfff54)
+#define	BIOS_hard_reset        (lomem_addr + 0xffff0)
+#define	BIOS_date_stamp        (lomem_addr + 0xffff5)
+#define	BIOS_hardware_id       (lomem_addr + 0xffffe)
 
 static u_char disk_params[] = {
     0xdf, 2, 0x25, 2, 0x0f, 0x1b, 0xff, 0x54, 0xf6, 0x0f, 8,
@@ -166,7 +166,9 @@
 void
 bios_init(void)
 {
+#if 0
     int i, j, k;
+#endif
     u_char *jtab;
 #if 0
     struct timeval tv;
@@ -198,7 +200,7 @@
     *(u_short *)BIOS_mem_size = 0xffcd;
     *(u_short *)BIOS_equipment = 0xffcd;
     *(u_short *)BIOS_vector = 0xffcd;
-    *(u_char *)0xffff2 = 0xcf;			/* IRET */
+    *(u_char *)(lomem_addr + 0xffff2) = 0xcf;			/* IRET */
 
     memcpy((u_char *)BIOS_disk_parms, disk_params, sizeof(disk_params));
     memcpy((u_char *)BIOS_comm_table, comm_table, sizeof(comm_table));
@@ -217,6 +219,7 @@
 
     *(u_char *)BIOS_hardware_id = 0xfc;           /* Identify as a PC/AT */
 
+#if 0
     /*
      * Interrupt revectors F000:0000 - F000:03ff
      */
@@ -241,6 +244,7 @@
 	    ++j;
 	}
     }
+#endif
 
     /*
      * Misc variables from F000:0400 - F000:0fff

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c	Sun Jul 29 10:38:35 2012	(r239890)
@@ -55,6 +55,8 @@
 #if 0
 #include <machine/vm86.h>
 #endif
+#include <machine/vmm.h>
+#include <vmmapi.h>
 
 #include "doscmd.h"
 #include "tty.h"
@@ -107,20 +109,21 @@
 static struct vm86_init_args kargs;
 #endif
 
-#define HDISK_CYL 0
-#define HDISK_HEAD 0
-#define HDISK_TRACK 0
-#define HDISK_FILE "diskdev"
+#define HDISK_CYL 130
+#define HDISK_HEAD 255
+#define HDISK_TRACK 63
+#define HDISK_FILE "/home/syuu/test.img"
 
 /* lobotomise */
 void biosemul_init(char *lomem)
 {
     lomem_addr = lomem;
+    ivec = (u_int32_t *)lomem_addr;
     debugf = stderr;
 
-    debug_set(0);		/* debug any D_TRAPS without intnum */
-	
 #if 0
+    debug_set(0);		/* debug any D_TRAPS without intnum */
+
     /* Call init functions */
     if (raw_kbd)
 	console_init();
@@ -138,8 +141,6 @@
     video_bios_init();
     disk_bios_init();
     cmos_init();
-#endif
-#if 0
     timer_init();
     /* iomap_init(); */
 
@@ -766,3 +767,170 @@
     debug(D_PORT,"mapped I/O port: port=%#x count=%d\n", port, count);
 }
 #endif
+
+int
+get_all_regs(struct vmctx *ctx, int vcpu, regcontext_t *regs)
+{
+	int error = 0;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_GS, &regs->r.gs.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_FS, &regs->r.fs.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_ES, &regs->r.es.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_DS, &regs->r.es.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RDI, &regs->r.edi.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RSI, &regs->r.esi.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RBP, &regs->r.ebp.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RBX, &regs->r.ebx.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RDX, &regs->r.edx.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RCX, &regs->r.ecx.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RAX, &regs->r.eax.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &regs->r.eip.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_CS, &regs->r.cs.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, &regs->r.efl.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RSP, &regs->r.esp.r_rx)) != 0)
+		goto done;
+
+	if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_SS, &regs->r.ss.r_rx)) != 0)
+		goto done;
+done:
+	return (error);
+}
+
+int
+set_modified_regs(struct vmctx *ctx, int vcpu, regcontext_t *orig, regcontext_t *modified)
+{
+	int error = 0;
+
+	if ((orig->r.gs.r_rx != 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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		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)
+		goto done;
+done:
+	
+	return (error);
+}
+
+extern void int13(regcontext_t *REGS);
+
+int
+biosemul_call(struct vmctx *ctx, int vcpu, int intno)
+{
+	int ret = 0;
+	regcontext_t orig, modified;
+
+	get_all_regs(ctx, vcpu, &orig);
+	modified = orig;
+	printf("%s RAX=%lx EAX=%x AX=%x AH=%x AL=%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",
+		__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);
+
+	switch (intno) {
+	case 0x13:
+		int13(&modified);
+		break;
+	default:
+		ret = -1;
+	}
+	set_modified_regs(ctx, vcpu, &orig, &modified);
+
+	return (ret);
+}
+

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h	Sun Jul 29 10:38:35 2012	(r239890)
@@ -0,0 +1,11 @@
+
+#ifndef _BIOSEMUL_H_
+#define	_BIOSEMUL_H_
+
+#include <machine/vmm.h>
+#include <vmmapi.h>
+
+void biosemul_init(char *lomem);
+int biosemul_call(struct vmctx *ctx, int vcpu, int intno);
+#endif
+

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h	Sun Jul 29 10:38:35 2012	(r239890)
@@ -88,7 +88,7 @@
 #define IntState vconnect_area.int_state
 
 /* bios.c */
-#define	BIOSDATA	((u_char *)(0x400 + lomem_addr))
+#define	BIOSDATA	((u_char *)(lomem_addr + 0x400))
 extern u_int32_t	rom_config;
 extern int nfloppies;
 extern int ndisks;

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c	Sun Jul 29 10:38:35 2012	(r239890)
@@ -94,8 +94,8 @@
     int		changed:1;		/* Set if we change format */
 };
 
-#define	hd_status	(*(u_char *)0x474)
-#define	fd_status	(*(u_char *)0x441)
+#define	hd_status	(*(u_char *)(lomem_addr + 0x474))
+#define	fd_status	(*(u_char *)(lomem_addr + 0x441))
 
 static __inline int
 disize(struct diskinfo *di)

Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h
==============================================================================
--- soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h	Sun Jul 29 10:38:35 2012	(r239890)
@@ -36,17 +36,24 @@
 /* standard register representation */
 typedef union 
 {
-    u_int32_t	r_ex;
+    u_int64_t r_rx;
+    struct
+    {
+        u_int32_t r_ex;
+	u_int32_t :32;
+    } r_dw;
     struct 
     {
 	u_short	r_x;
 	u_short	:16;
+	u_int32_t :32;
     } r_w;
     struct
     {
 	u_char	r_l;
 	u_char	r_h;
 	u_short :16;
+	u_int32_t :32;
     } r_b;
 } reg86_t;
 
@@ -91,46 +98,46 @@
 */
 
 /* register shorthands */
-#define R_ESP		(REGS->r.esp.r_ex)
+#define R_ESP		(REGS->r.esp.r_dw.r_ex)
 #define R_SP		(REGS->r.esp.r_w.r_x)
-#define R_EBP		(REGS->r.ebp.r_ex)
+#define R_EBP		(REGS->r.ebp.r_dw.r_ex)
 #define R_BP		(REGS->r.ebp.r_w.r_x)
-#define R_ISP		(REGS->r.isp.r_ex)
-#define R_EIP		(REGS->r.eip.r_ex)
+#define R_ISP		(REGS->r.isp.r_dw.r_ex)
+#define R_EIP		(REGS->r.eip.r_dw.r_ex)
 #define R_IP		(REGS->r.eip.r_w.r_x)
-#define R_EFLAGS	(REGS->r.efl.r_ex)
+#define R_EFLAGS	(REGS->r.efl.r_dw.r_ex)
 #define R_FLAGS		(REGS->r.efl.r_w.r_x)
-#define R_EES		(REGS->r.es.r_ex)
+#define R_EES		(REGS->r.es.r_dw.r_ex)
 #define R_ES		(REGS->r.es.r_w.r_x)
-#define R_EDS		(REGS->r.ds.r_ex)
+#define R_EDS		(REGS->r.ds.r_dw.r_ex)
 #define R_DS		(REGS->r.ds.r_w.r_x)
-#define R_ECS		(REGS->r.cs.r_ex)
+#define R_ECS		(REGS->r.cs.r_dw.r_ex)
 #define R_CS		(REGS->r.cs.r_w.r_x)
-#define R_ESS		(REGS->r.ss.r_ex)
+#define R_ESS		(REGS->r.ss.r_dw.r_ex)
 #define R_SS		(REGS->r.ss.r_w.r_x)
-#define R_EDI		(REGS->r.edi.r_ex)
+#define R_EDI		(REGS->r.edi.r_dw.r_ex)
 #define R_DI		(REGS->r.edi.r_w.r_x)
-#define R_ESI		(REGS->r.esi.r_ex)
+#define R_ESI		(REGS->r.esi.r_dw.r_ex)
 #define R_SI		(REGS->r.esi.r_w.r_x)
-#define R_EBX		(REGS->r.ebx.r_ex)
+#define R_EBX		(REGS->r.ebx.r_dw.r_ex)
 #define R_BX		(REGS->r.ebx.r_w.r_x)
 #define R_BL		(REGS->r.ebx.r_b.r_l)
 #define R_BH		(REGS->r.ebx.r_b.r_h)
-#define R_EDX		(REGS->r.edx.r_ex)
+#define R_EDX		(REGS->r.edx.r_dw.r_ex)
 #define R_DX		(REGS->r.edx.r_w.r_x)
 #define R_DL		(REGS->r.edx.r_b.r_l)
 #define R_DH		(REGS->r.edx.r_b.r_h)
-#define R_ECX		(REGS->r.ecx.r_ex)
+#define R_ECX		(REGS->r.ecx.r_dw.r_ex)
 #define R_CX		(REGS->r.ecx.r_w.r_x)
 #define R_CL		(REGS->r.ecx.r_b.r_l)
 #define R_CH		(REGS->r.ecx.r_b.r_h)
-#define R_EAX		(REGS->r.eax.r_ex)
+#define R_EAX		(REGS->r.eax.r_dw.r_ex)
 #define R_AX		(REGS->r.eax.r_w.r_x)
 #define R_AL		(REGS->r.eax.r_b.r_l)
 #define R_AH		(REGS->r.eax.r_b.r_h)
-#define R_EGS		(REGS->r.gs.r_ex)
+#define R_EGS		(REGS->r.gs.r_dw.r_ex)
 #define R_GS		(REGS->r.gs.r_w.r_x)
-#define R_EFS		(REGS->r.fs.r_ex)
+#define R_EFS		(REGS->r.fs.r_dw.r_ex)
 #define R_FS		(REGS->r.fs.r_w.r_x)
 
 #endif

Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile
==============================================================================
--- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile	Sun Jul 29 10:38:35 2012	(r239890)
@@ -8,7 +8,8 @@
 SRCS+=  instruction_emul.c mevent.c
 SRCS+=	pci_emul.c pci_hostbridge.c pci_passthru.c pci_virtio_block.c
 SRCS+=	pci_virtio_net.c pci_uart.c pit_8254.c post.c rtc.c uart.c xmsr.c
-SRCS+=  bios_call.c bios_int10.c bios_int13.c bios_int16.c bios_int18.c
+#SRCS+=  bios_call.c bios_int10.c bios_int13.c bios_int16.c bios_int18.c
+SRCS+=  bios_call.c bios_int10.c bios_int16.c bios_int18.c
 
 NO_MAN=
 
@@ -17,6 +18,6 @@
 
 WARNS?=	2
 
-CFLAGS+= -I${.CURDIR}/../../sys
+CFLAGS+= -I${.CURDIR}/../../sys -g
 
 .include <bsd.prog.mk>

Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c
==============================================================================
--- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c	Sun Jul 29 10:38:35 2012	(r239890)
@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <assert.h>
 
+#include <biosemul.h>
+
 #include "bios_call.h"
 
 SET_DECLARE(bios_call_set, struct bios_call);

Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c
==============================================================================
--- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c	Sun Jul 29 09:23:32 2012	(r239889)
+++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c	Sun Jul 29 10:38:35 2012	(r239890)
@@ -47,6 +47,8 @@
 #include <machine/vmm.h>
 #include <vmmapi.h>
 
+#include <biosemul.h>
+
 #include "fbsdrun.h"
 #include "inout.h"
 #include "dbgport.h"
@@ -443,11 +445,19 @@
 			vmexit->rip);
 		return (VMEXIT_ABORT);
 	}
-		
-	if (emulate_bios_call(ctx, *pvcpu, intno) != 0) {
-		fprintf(stderr, "Failed to emulate INT %x at 0x%lx\n", 
-			intno, vmexit->rip);
-		return (VMEXIT_ABORT);
+	if (intno == 0x13) {
+		if (biosemul_call(ctx, *pvcpu, intno) != 0) {
+			fprintf(stderr, "Failed to emulate INT %x at 0x%lx\n", 
+				intno, vmexit->rip);
+			return (VMEXIT_ABORT);
+		}
+	} else
+	 {
+		if (emulate_bios_call(ctx, *pvcpu, intno) != 0) {
+			fprintf(stderr, "Failed to emulate INT %x at 0x%lx\n", 
+				intno, vmexit->rip);
+			return (VMEXIT_ABORT);
+		}
 	}
 		
 	return (VMEXIT_CONTINUE);
@@ -675,6 +685,7 @@
 	if (bios_mode != 0) {
 		vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1);
 		init_bios_call();
+		biosemul_init(lomem_addr);
 	}
 
 	init_inout();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120729103835.A5514106566B>