From owner-freebsd-virtualization@FreeBSD.ORG Sun Aug 4 20:07:59 2013 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3F84BE4D for ; Sun, 4 Aug 2013 20:07:59 +0000 (UTC) (envelope-from syuu@dokukino.com) Received: from mail-pd0-x22d.google.com (mail-pd0-x22d.google.com [IPv6:2607:f8b0:400e:c02::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 164E627FF for ; Sun, 4 Aug 2013 20:07:59 +0000 (UTC) Received: by mail-pd0-f173.google.com with SMTP id p11so2447049pdj.18 for ; Sun, 04 Aug 2013 13:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dokukino.com; s=google; h=mime-version:from:date:message-id:subject:to:content-type; bh=+GB2xSeLQbhTvSHG2XhEFRy2YAHk1hMiXOWWh0xce18=; b=IRQiwm8za6BhV3kCdTdVWu/NkO72j3aZSHyNTqUukFc9y5ScRmV03HvVA6SSdO7UTH HaKsQ6eFahibU50xKpE6DGaB+5x2GlpLQU5mU3iAfR/OPutcyr/h3wGt0Eaywi32HnnA t/rr2LM0cW9ble53hUZnnJPEMUF0tswVFYuqk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :x-gm-message-state; bh=+GB2xSeLQbhTvSHG2XhEFRy2YAHk1hMiXOWWh0xce18=; b=hDansQjvjYQxdrMMBOwXKQP/oDnqYNM+pWp6bie8uBWpLTt1klODvHqCiAtZvpTZM4 DxZW1lSTmWIL52rIHOTyC+VV82dYetZR37Zxezyzqk75WiUUnkHlbGEsbImGYyKEz6SC 5rEAvi8yIVs/CiUdAoDFIAq38EYPwhDjqUmOgJ0p3c5Mr1Lu7MW9xacGaIowOkpS67G2 4zQCFG8Ps183dzRFHRiwCNhoQdEQL7gTyxGCuppoQKRVabhmSHhCeSWemBt9okH6Dzzf UU5rPvmDpvuXV+YPiVRlZW+hGhjECqRgBsVogTQJvyGixUG74Ua42zAj2P5wzoCvo7d4 TUhQ== X-Received: by 10.66.149.73 with SMTP id ty9mr1763440pab.36.1375646878576; Sun, 04 Aug 2013 13:07:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.245.226 with HTTP; Sun, 4 Aug 2013 13:07:18 -0700 (PDT) From: Takuya ASADA Date: Mon, 5 Aug 2013 05:07:18 +0900 Message-ID: Subject: Standalone binary loader for BHyVe To: Peter Grehan , "freebsd-virtualization@freebsd.org" X-Gm-Message-State: ALoCoQk8qT9dSXzqadQl2rDNSrcdKVyT+rICbkig8Hciy4XdRBIWslpGio9yqVwFG+8L/oDlrh1S Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2013 20:07:59 -0000 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.