[status report #1] BHyVe BIOS emulation to boot legacy systems
Takuya ASADA
syuu at dokukino.com
Wed May 30 00:48:06 UTC 2012
* project summary
The project goal is to support BIOS emulation on BHyVe, enabling boot
from disk image.
I going to focus booting FreeBSD/amd64 from disk image on this GSoC,
but final goal is to make BHyVe able to support more guest OSes.
* preparation to develop BHyVe
Before try to join BHyVe development, I read the source code and think
what BHyVe doing on FreeBSD host system, and made presentations about
it, discussed in some small conferences.
Here're slides(Unfortunately, it's in Japanese):
- http://www.slideshare.net/AsadaTakuya/bhyve
- http://www.slideshare.net/syuu1228/bhyve-12636280
- http://www.slideshare.net/syuu1228/bhyve-internals-13082679
Result of this activity, I could get some members who have interest to
play with BHyVe, we probably going to held small Hackathon in next
month.
* trap VMCALL instruction
test code worked fine.
## patch for guest kernel ##
--- /usr/src-bhyve/sys/amd64/amd64/locore.S 2012-01-03 12:27:06.000000000 +0900
+++ /home/syuu/9.0-bhyve/sys/amd64/amd64/locore.S 2012-05-30
09:05:33.000000000 +0900
@@ -77,7 +77,9 @@
xorl %ebp, %ebp
call hammer_time /* set up cpu for unix operation */
- movq %rax,%rsp /* set up kstack for mi_startup() */
+
+ .byte 0xf,0x1,0xc1
+
call mi_startup /* autoconfiguration, mountroot etc */
0: hlt
jmp 0b
## patch for host ##
Index: usr.sbin/bhyve/fbsdrun.c
===================================================================
--- usr.sbin/bhyve/fbsdrun.c (revision 236685)
+++ usr.sbin/bhyve/fbsdrun.c (working copy)
@@ -429,6 +429,15 @@
return (VMEXIT_CONTINUE);
}
+static int
+vmexit_vmcall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
+{
+ printf("VMCALL handled\n");
+ exit(1);
+
+ return (VMEXIT_RESTART);
+}
+
static void
sigalrm(int sig)
{
@@ -469,7 +478,8 @@
[VM_EXITCODE_RDMSR] = vmexit_rdmsr,
[VM_EXITCODE_WRMSR] = vmexit_wrmsr,
[VM_EXITCODE_MTRAP] = vmexit_mtrap,
- [VM_EXITCODE_PAGING] = vmexit_paging
+ [VM_EXITCODE_PAGING] = vmexit_paging,
+ [VM_EXITCODE_VMCALL] = vmexit_vmcall,
};
static void
Index: sys/amd64/include/vmm.h
===================================================================
--- sys/amd64/include/vmm.h (revision 236685)
+++ sys/amd64/include/vmm.h (working copy)
@@ -228,6 +228,7 @@
VM_EXITCODE_MTRAP,
VM_EXITCODE_PAUSE,
VM_EXITCODE_PAGING,
+ VM_EXITCODE_VMCALL,
VM_EXITCODE_MAX
};
Index: sys/amd64/vmm/intel/vmx.c
===================================================================
--- sys/amd64/vmm/intel/vmx.c (revision 236685)
+++ sys/amd64/vmm/intel/vmx.c (working copy)
@@ -1189,6 +1189,9 @@
vmexit->exitcode = VM_EXITCODE_PAGING;
vmexit->u.paging.cr3 = vmcs_guest_cr3();
break;
+ case EXIT_REASON_VMCALL:
+ vmexit->exitcode = VM_EXITCODE_VMCALL;
+ break;
default:
break;
}
More information about the soc-status
mailing list