Commit graph

67 commits

Author SHA1 Message Date
Michael Forney 2833aecc68 vmx: fix PCI ID for virtio block devices
The transitional PCI device ID for block devices is 0x1001, and the
virtio spec says that devices must have the transitional device ID or
0x1040 + the virtio device ID (2).
2022-01-24 23:48:13 +00:00
Ori Bernstein 235ef367d7 vmx: update openbsd kernel heuristics
in OpenBSD 6.9 and up, the kernel (bsd, bsd.mp) still has
the ostype symbols, but bsd.rd appears to have lost them,
even when decompressed.

so, as a result, we should use what we have, which isn't
much.
2021-09-25 16:57:58 +00:00
cinap_lenrek ad37339a1c vmx: reset virtio queue state on device reset
when a virtio device gets reset, we have to also reset the device
shadow indices: availableidx and usedidx. for extra safetly,
we also reset the buffer descriptor table addresses.

this is accomplished by adding a vioqreset(VIOQueue*) function
that brings the queue to its initial reset state.

this fixes non functional ethernet after reboot(8).
2021-07-11 12:12:51 +00:00
Sigrid Solveig Haflínudóttir 16da8c0529 vmx: emulate ps/2 intellimouse scrolling 2021-07-06 15:44:16 +00:00
cinap_lenrek 682414ce0d vmx: fix 9p debug server and make it compatible to /proc
The 9p debug server was broken as it assumed the first
tree file added would have a qid of 0 (it has a qid
of 1 as the root directory is using 0 already).

Instead, just compare File* pointers and get rid of
the table (less code).

When passing 64-bit unsigned addresses as 64-bit signed
file offsets, we have to make sure to not pass negative
offsets (filtered out by kernel and lib9p)!
This is solved by clearing and sign bit in encoding and
63-bit sign extension on decoding.

Make the mem file writable (needed for acid).

The 9p debug server provided a single directory containing
mem and regs files. This patch renames the regs file
(which is in vmx specific text format) to "xregs" and
adds "regs" and "kregs" file which use the same format
as exported by the kernels /proc filesystem.

This allows one to bind the vmx directory over a proc
directory and attach acid to a running system like:

mount -b /srv/vmx /proc/1
acid -k -lkernel 1 /sys/src/9/pc64/9pc64
2021-05-12 18:17:06 +02:00
cinap_lenrek 532c7479e9 vmx: avoid strdup() register names for register cache
If we tokenize the register file contents in a static buffer,
we can avoid having to duplicate the register names.

All callers to rpoke() provide constant register arguments
so they also do not need to be duplicated.
2021-05-12 18:04:25 +02:00
cinap_lenrek 67eac97a81 vmx: implement long mode page table translation
This allows vmx to translate virtual addresses to physical
when the gues runs in long mode.
2021-05-12 18:00:46 +02:00
Sigrid 692919521c vmx: reduce cpu load by eliminating nop-loop
Sacrifice some of the sub-millisecond timer precision in favor of less
cpu load when the timer is about to be kicked a bit early.  Result is
visible *especially* when the guest idling.

Timer proc *still* has to send to the channel (in order to kick PIT
and RTC logic), which takes time, and compensates a bit for possibly
early runs.
2021-02-23 15:54:09 +01:00
Sigrid f5d1fce9b5 vmx: clean up mksegment, memset only if segment existed (devsegment clears new ones) 2020-12-10 12:19:45 +01:00
Sigrid 93c6f8cb0d vmx(1): build vmxgdb by default, clean it up as well 2020-12-08 13:18:10 +01:00
cinap_lenrek 4ba5cb6c6a vmx: nanosec(): fix non-interruptable temporary, assign fasthz only once after xstart 2020-12-08 13:04:52 +01:00
cinap_lenrek de5770c352 vmx: add fmt checking, fix fmt errors, remove duplication for vmdebug 2020-12-08 12:40:28 +01:00
Sigrid 8f9d4d7c27 vesa: make unsupported function not an error, set return status 2020-12-08 10:08:49 +01:00
Sigrid 96850d8bb4 vmx: add -D option to enable debug messages, use vmdebug for non-fatal "errors" 2020-12-08 10:01:44 +01:00
cinap_lenrek c74458c98b vmx: add -v|-w flag to control window creation behaviour
The -v flag now does not create a new rio window,
while -w flag does (restores the old behaviour).

This allows vmx to run under vncs and is in general
mode aligned to other emulators and programs.
2020-12-07 18:59:54 +01:00
Sigrid 66b6185845 amd64, vmx: support avx/avx2 for host/guest; use *noavx= in plan9.ini to disable 2020-12-06 18:48:32 +01:00
cinap_lenrek 2063019560 vmx: mask out bits 0:2 and 24:30 of pci CONFIG_ADDRESS on read
These bits are reserved, and by the specification,
must return zero on read.

This is also used by plan 9 for detecting config mode #1.
2020-11-02 01:01:48 +01:00
Sigrid 55945f6f24 vmx/vga: fix allocimage leaks 2020-10-23 00:16:47 +02:00
Sigrid 4a75ad5ec8 vmx: add Kmod4 2020-10-09 16:47:34 +02:00
Sigrid 6e039d7b49 vmx: does not do well with certain fb widths, so restrict it 2020-08-10 16:38:26 +02:00
Sigrid 93b475981e vmx: set xstart to either nsec or cycles depending on what is available 2020-08-07 17:08:49 +02:00
Sigrid 88a468f205 vmx(1): use _tos->cyclefreq (thanks cinap) 2020-08-01 15:23:51 +02:00
Sigrid 9965e575f8 vmx(1): add missing file 2020-07-31 15:51:32 +02:00
Sigrid 853f0e33fe vmx(1): use cycles() instead of nsec() when possible
this provides better timing and reduced number of syscalls (~2.7M old
vs ~35K new in a test)
2020-07-31 15:48:54 +02:00
Sigrid de27182a8e vmx: use _actual_ system kbmap 2020-07-31 11:24:02 +02:00
cinap_lenrek c35f95de2a vmx: handle build arch exclude in /sys/src/cmd/mkfile 2019-05-19 17:11:57 +02:00
cinap_lenrek aa52d3b13d vmx: build vmx only for 386 or amd64
vmx uses non portable word unpacking macros, breaking
the build for arm64. vmx only works on a pc anyway.
this forces objtype to 386 on these machines, similar
to what the kernel mkfiles do.
2019-05-01 08:19:29 +02:00
mischief 617bf42890 vmx: check for draw initialization errors 2019-03-06 19:10:48 -08:00
qwx 70c7a9eb07 add signed fixed size integer typedefs 2018-05-12 19:19:52 +02:00
cinap_lenrek 8a01033efc vmx: allow setting mac address of using ea:nnnnnnnnnnnn! prefix, use genrandom() to generate mac globally unique mac address 2018-02-25 21:11:41 +01:00
cinap_lenrek 9fd8894fec ether: allow spoofing of source mac address for bridges; used by vmx
to implement layer 2 bridges in userspace, we disable to auto filling
of the source mac address when bridge mode is enabled on the
connection.
2017-12-15 22:22:29 +01:00
aiju 4ad70e6055 vmx(1): fix virtio network bloomfilter 2017-12-13 22:20:12 +00:00
aiju bea6dcd122 vmx(1): fix openbsd 6.2 amd64 !entrystate bug 2017-11-27 09:30:15 +00:00
aiju e5d3aaf1aa devvmx, vmx: lilu dallas multivm 2017-08-28 17:27:41 +00:00
aiju 853049c3b9 vmx(1): don't realloc virtio queues -- breaks pointers 2017-08-28 17:19:13 +00:00
aiju 721160290f vmx(1): VGA framebuffer should be normal memory 2017-08-24 09:25:23 +00:00
aiju b0997d16c6 vmx(1): fixed code that assumed uintptr==uvlong 2017-08-24 09:01:30 +00:00
aiju 8968426327 vmx(1): memory map improvements, x86 simulator for MMIO 2017-08-24 08:06:41 +00:00
cinap_lenrek faae8eb752 vmx: allocate sticky instead of more expensive fixed segment 2017-08-14 04:18:13 +02:00
cinap_lenrek 6f6df11db7 vmx: pass multiboot framebuffer info to kernel 2017-08-13 19:19:55 +02:00
cinap_lenrek ddf977d25c vmx: fix hlt idle problem 2017-08-07 19:10:32 +02:00
aiju dffbc1e45d vmx(1): I/O string instructions, incomplete support for IDE disks, misc fixes 2017-06-27 09:21:30 +00:00
aiju b5a6dc7849 vmx: fix build on non-x86 architectures (switch vlong) 2017-06-26 22:24:00 +00:00
aiju 5883986336 vmx(1): fix translateflat on 64-bit 2017-06-22 07:31:35 +00:00
aiju 5c0bff4ba2 vmx(1): add support for (so far) crude 9p debugging fs; add gdb stub; clean up linux gdt code 2017-06-21 22:18:26 +00:00
aiju fb165d6a54 vmx(1): obsdfb: check if curmode is nil 2017-06-20 18:21:47 +00:00
aiju da6e5efe39 vmx(1): round up frame buffer size to whole pages, ignore vga access in linear framebuffer, tell openbsd about framebuffer 2017-06-20 18:20:25 +00:00
aiju 164588e3e2 vmx(1): clean up region handling code; changes to support amd64 2017-06-20 15:15:53 +00:00
aiju f1cc75b547 vmx(1): i8042: translation changes reported keyboard id 2017-06-19 11:06:26 +00:00
aiju 2806a34ec0 vmx(1): linux kernel loading; PIT fixes to support linux; support VGA 0x3D4 word writes; support sending virtio ethernet packets to a file and prepending snoopy headers 2017-06-18 22:17:35 +00:00