Skip to content
Go bindings for xhyve
C Other
  1. C 99.0%
  2. Other 1.0%
Branch: master
Clone or download
Pull request Compare This branch is 9 commits ahead of tiborvass:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
main
upstream
.gitignore
Makefile
README.md
acpitbl.c
atkbdc.c
block_if.c
consport.c
dbgport.c
fbsd.c
generate.sh
inout.c
ioapic.c
kexec.c
md5c.c
mem.c
mevent.c
mptbl.c
pci_ahci.c
pci_emul.c
pci_hostbridge.c
pci_irq.c
pci_lpc.c
pci_uart.c
pci_virtio_block.c
pci_virtio_net_tap.c
pci_virtio_net_vmnet.c
pci_virtio_rnd.c
pm.c
post.c
rtc.c
smbiostbl.c
task_switch.c
uart_emul.c
upstream.patch
vatpic.c
vatpit.c
vhpet.c
vioapic.c
virtio.c
vlapic.c
vmcs.c
vmm.c
vmm_api.c
vmm_callout.c
vmm_host.c
vmm_instruction_emul.c
vmm_ioport.c
vmm_lapic.c
vmm_mem.c
vmm_stat.c
vmm_util.c
vmx.c
vmx_msr.c
vpmtmr.c
vrtc.c
x86.c
xhyve.c
xhyve.go
xmsr.c

README.md

Xhyve from Go

The goal of this project is to compile xhyve into a Go package and be able to distribute a Go binary with xhyve embedded.

Currently, the bindings are only for the main() entrypoint in xhyve.c, allowing the Go program to pass in any command line arguments to xhyve. This is a stop-gap for now, and I welcome any effort to make actual Go bindings to the underlying xhyve functions.

Installation

I only tested on OS X Yosemite, which is the first OS X version to have Hypervisor.framework which is what xhyve leverages.

$ go get github.com/tiborvass/xhyve-bindings
$ cd $GOPATH/src/github.com/tiborvass/xhyve-bindings
$ go run main/main.go upstream/test/vmlinuz upstream/test/initrd.gz

Once in the VM, type sudo halt to quit it.

Documentation

Follow Godoc.

Roadmap

  • fork-exec: Go program should be able to run multiple xhyve instances. I suggest we use the reexec package.
  • cross-compiling: We should be able to compile it from Linux. I was thinking of using xgo but any other solution that works should be good.
  • management: Start, Stop and Kill fork-exec'd xhyve instance.
  • pty: Not sure how important this is, but I wanted to have a way to attach and detach from the TTY.

Contributing

Just send pull requests, open issues.

The upstream/ directory is a git subtree. It's the first time I use that functionality so bear with me. Suggestions welcome.

If you need to update upstream, run make clean first, update upstream, and run make. It will apply a small patch upstream.patch that's currently needed.

By using cgo, we're limited to requiring all *.c files at the root of the repository, hence all those symlinks created by generate.sh when doing make. This also means, that no two C files can have the same name.

License

The bindings are under MIT License. For xhyve itself, read https://github.com/mist64/xhyve.

You can’t perform that action at this time.