Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Aug 2013 05:07:18 +0900
From:      Takuya ASADA <syuu@dokukino.com>
To:        Peter Grehan <grehan@freebsd.org>,  "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>
Subject:   Standalone binary loader for BHyVe
Message-ID:  <CALG4x-XsorM_Uy0dcBUbS_ApbuGTYByGy07JzjtWJh3148G_6g@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I implemented standalone binary loader for BHyVe.
This allows to load custom program on guest memory area, and run it from
specified entry point address.
I wrote this for test code of BHyVe suspend/resume project(Yoneji Iori's
work), but it might be useful for some other purposes.

This is a patch:
http://people.freebsd.org/~syuu/bhyve_standalone_guest.diff

Most of the code is borrowed from userboot, but userboot looks like only
for FreeBSD kernel, so I copied those code to bhyveload instead of
modifying userboot APIs.

Here's a example of usage:
 echo "main:" > test.S
 echo "inb \$0x50, %al" >> test.S
 as -o test.o test.S
 objcopy -I elf64-x86-64-freebsd -O binary test.o test.bin
 sudo bhyveload -m 256 -S test.bin:0x7c00 test
 sudo bhyve -m 256 -e test
 # bhyve says "Unhandled inb 0x0050", because there's no inb 0x50 handler.

Another example of usage:
 svn co svn://svn.freebsd.org/base/user/syuu/bhyve_standalone_guest_test1
 cd bhyve_standalone_guest_test1
 make
 make run
 # because test1 is COM1 test program, bhyve continues to show asterisk on
the console.



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