Skip to content

Commit d39f1b4

Browse files
Merge commit '34f11af226e206f388d2e9c7fe6ec29d0023c1e6' into HEAD
2 parents e2a45d9 + 34f11af commit d39f1b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+4626
-2756
lines changed

.github/ISSUE_TEMPLATE/issue.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Welcome to v86's issue tracker!
1212
1313
We use this tracker for bug reports or feature requests. For user support, questions or general comments, use the chat at https://gitter.im/copy/v86 or the forum at https://github.com/copy/v86/discussions
1414
15-
Please don't ask for support for any version of Windows. There are many existing issues at https://github.com/copy/v86/issues?q=is%253Aissue+windows. See also docs/windows-xp.md.
15+
Please don't ask for support for any version of Windows. There are many existing issues at https://github.com/copy/v86/issues?q=is%253Aissue+windows. See also docs/windows-nt.md and docs/windows-9x.md.
1616
1717
Before reporting OS incompatibilities, check existing issues and the compatibility section of the readme.
1818

.github/workflows/ci.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: make rustfmt
5454

5555
- name: Fetch kvm-unit-test cache
56-
uses: actions/cache@v3
56+
uses: actions/cache@v4
5757
id: cache-kvm-unit-test
5858
with:
5959
path: tests/kvm-unit-tests/
@@ -67,7 +67,7 @@ jobs:
6767
run: tests/kvm-unit-tests/run.js tests/kvm-unit-tests/x86/realmode.flat
6868

6969
- name: Fetch namsmtests cache
70-
uses: actions/cache@v3
70+
uses: actions/cache@v4
7171
id: cache-nasmtests
7272
with:
7373
path: tests/nasm/build/
@@ -83,7 +83,7 @@ jobs:
8383
run: make rust-test
8484

8585
- name: Fetch image cache
86-
uses: actions/cache@v3
86+
uses: actions/cache@v4
8787
id: cache-images
8888
with:
8989
path: images/
@@ -115,13 +115,14 @@ jobs:
115115
run: make expect-tests
116116

117117
- name: Upload the artifact
118-
uses: actions/upload-artifact@v3
118+
uses: actions/upload-artifact@v4
119119
with:
120120
name: v86
121121
path: |
122122
build/libv86*.js
123123
build/libv86*.js.map
124124
build/v86*.wasm
125+
build/*.mjs
125126
126127
upload:
127128
name: Upload release
@@ -138,7 +139,7 @@ jobs:
138139
github_token: ${{ secrets.GITHUB_TOKEN }}
139140

140141
- name: Get artifacts
141-
uses: actions/download-artifact@v3
142+
uses: actions/download-artifact@v4
142143
with:
143144
name: v86
144145
path: build
@@ -153,5 +154,5 @@ jobs:
153154
tag: latest
154155
commit: master
155156
body: ${{ github.event.head_commit.message }}
156-
artifacts: "build/libv86*.js,build/libv86*.js.map,build/v86*.wasm"
157+
artifacts: "build/libv86*.js,build/libv86*.js.map,build/*.mjs,build/v86*.wasm"
157158
prerelease: true

.rustfmt.toml

-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@ fn_single_line = true
44
imports_indent = "Block"
55
control_brace_style = "ClosingNextLine"
66
single_line_if_else_max_width = 92
7-
ignore = [
8-
"src/rust/gen"
9-
]

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "v86"
33
version = "0.1.0"
44
publish = false
5+
edition = "2021"
56

67
[features]
78
default = []

Makefile

+61-22
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ endif
2020
WASM_OPT ?= false
2121

2222
default: build/v86-debug.wasm
23-
all: build/v86_all.js build/libv86.js build/v86.wasm
24-
all-debug: build/libv86-debug.js build/v86-debug.wasm
23+
all: build/v86_all.js build/libv86.js build/libv86.mjs build/v86.wasm
24+
all-debug: build/libv86-debug.js build/libv86-debug.mjs build/v86-debug.wasm
2525
browser: build/v86_all.js
2626

2727
# Used for nodejs builds and in order to profile code.
@@ -79,15 +79,16 @@ CARGO_FLAGS_SAFE=\
7979
CARGO_FLAGS=$(CARGO_FLAGS_SAFE) -C target-feature=+bulk-memory -C target-feature=+multivalue -C target-feature=+simd128
8080

8181
CORE_FILES=const.js config.js io.js main.js lib.js buffer.js ide.js pci.js floppy.js \
82-
memory.js dma.js pit.js vga.js vga_text.js ps2.js rtc.js uart.js \
82+
memory.js dma.js pit.js vga.js ps2.js rtc.js uart.js \
8383
acpi.js apic.js ioapic.js \
84-
state.js ne2k.js sb16.js virtio.js virtio_console.js virtio_net.js \
84+
state.js ne2k.js sb16.js virtio.js virtio_console.js virtio_net.js virtio_balloon.js \
8585
bus.js log.js cpu.js debug.js \
8686
elf.js kernel.js
8787
LIB_FILES=9p-filer.js filesystem.js jor1k.js marshall.js
8888
BROWSER_FILES=screen.js keyboard.js mouse.js speaker.js serial.js \
8989
network.js starter.js worker_bus.js dummy_screen.js \
90-
fake_network.js wisp_network.js fetch_network.js print_stats.js filestorage.js
90+
inbrowser_network.js fake_network.js wisp_network.js fetch_network.js \
91+
print_stats.js filestorage.js
9192

9293
RUST_FILES=$(shell find src/rust/ -name '*.rs') \
9394
src/rust/gen/interpreter.rs src/rust/gen/interpreter0f.rs \
@@ -142,6 +143,23 @@ build/libv86.js: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
142143
--js $(LIB_FILES)
143144
ls -lh build/libv86.js
144145

146+
build/libv86.mjs: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
147+
mkdir -p build
148+
-ls -lh build/libv86.js
149+
java -jar $(CLOSURE) \
150+
--js_output_file build/libv86.mjs\
151+
--define=DEBUG=false\
152+
$(CLOSURE_FLAGS)\
153+
--compilation_level SIMPLE\
154+
--jscomp_off=missingProperties\
155+
--output_wrapper ';let module = {exports:{}}; %output%; export default module.exports.V86;'\
156+
--js $(CORE_FILES)\
157+
--js $(BROWSER_FILES)\
158+
--js $(LIB_FILES)\
159+
--chunk_output_type=ES_MODULES\
160+
--emit_use_strict=false
161+
ls -lh build/libv86.mjs
162+
145163
build/libv86-debug.js: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
146164
mkdir -p build
147165
java -jar $(CLOSURE) \
@@ -156,6 +174,22 @@ build/libv86-debug.js: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
156174
--js $(BROWSER_FILES)\
157175
--js $(LIB_FILES)
158176

177+
build/libv86-debug.mjs: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
178+
mkdir -p build
179+
java -jar $(CLOSURE) \
180+
--js_output_file build/libv86-debug.mjs\
181+
--define=DEBUG=true\
182+
$(CLOSURE_FLAGS)\
183+
--compilation_level SIMPLE\
184+
--jscomp_off=missingProperties\
185+
--output_wrapper ';let module = {exports:{}}; %output%; export default module.exports.V86; export let {V86, CPU} = module.exports;'\
186+
--js $(CORE_FILES)\
187+
--js $(BROWSER_FILES)\
188+
--js $(LIB_FILES)\
189+
--chunk_output_type=ES_MODULES\
190+
--emit_use_strict=false
191+
ls -lh build/libv86-debug.mjs
192+
159193
src/rust/gen/jit.rs: $(JIT_DEPENDENCIES)
160194
./gen/generate_jit.js --output-dir build/ --table jit
161195
src/rust/gen/jit0f.rs: $(JIT_DEPENDENCIES)
@@ -222,6 +256,7 @@ build/zstddeclib.o: lib/zstd/zstddeclib.c
222256

223257
clean:
224258
-rm build/libv86.js
259+
-rm build/libv86.mjs
225260
-rm build/libv86-debug.js
226261
-rm build/v86_all.js
227262
-rm build/v86.wasm
@@ -259,56 +294,57 @@ build/integration-test-fs/fs.json: images/buildroot-bzimage68.bin
259294
./tools/copy-to-sha256.py build/integration-test-fs/fs.tar build/integration-test-fs/flat
260295
rm build/integration-test-fs/fs.tar build/integration-test-fs/bzImage build/integration-test-fs/initrd
261296

262-
tests: all-debug build/integration-test-fs/fs.json
263-
./tests/full/run.js
297+
tests: build/libv86-debug.js build/v86-debug.wasm build/integration-test-fs/fs.json
298+
LOG_LEVEL=3 ./tests/full/run.js
264299

265300
tests-release: build/libv86.js build/v86.wasm build/integration-test-fs/fs.json
266301
TEST_RELEASE_BUILD=1 ./tests/full/run.js
267302

268-
nasmtests: all-debug
303+
nasmtests: build/libv86-debug.js build/v86-debug.wasm
269304
$(NASM_TEST_DIR)/create_tests.js
270305
$(NASM_TEST_DIR)/gen_fixtures.js
271306
$(NASM_TEST_DIR)/run.js
272307

273-
nasmtests-force-jit: all-debug
308+
nasmtests-force-jit: build/libv86-debug.js build/v86-debug.wasm
274309
$(NASM_TEST_DIR)/create_tests.js
275310
$(NASM_TEST_DIR)/gen_fixtures.js
276311
$(NASM_TEST_DIR)/run.js --force-jit
277312

278-
jitpagingtests: all-debug
313+
jitpagingtests: build/libv86-debug.js build/v86-debug.wasm
279314
$(MAKE) -C tests/jit-paging test-jit
280315
./tests/jit-paging/run.js
281316

282-
qemutests: all-debug
317+
qemutests: build/libv86-debug.js build/v86-debug.wasm
283318
$(MAKE) -C tests/qemu test-i386
284-
./tests/qemu/run.js > build/qemu-test-result
319+
LOG_LEVEL=3 ./tests/qemu/run.js build/qemu-test-result
285320
./tests/qemu/run-qemu.js > build/qemu-test-reference
286321
diff build/qemu-test-result build/qemu-test-reference
287322

288323
qemutests-release: build/libv86.js build/v86.wasm
289324
$(MAKE) -C tests/qemu test-i386
290-
TEST_RELEASE_BUILD=1 time ./tests/qemu/run.js > build/qemu-test-result
325+
TEST_RELEASE_BUILD=1 time ./tests/qemu/run.js build/qemu-test-result
291326
./tests/qemu/run-qemu.js > build/qemu-test-reference
292327
diff build/qemu-test-result build/qemu-test-reference
293328

294-
kvm-unit-test: all-debug
329+
kvm-unit-test: build/libv86-debug.js build/v86-debug.wasm
295330
(cd tests/kvm-unit-tests && ./configure && make x86/realmode.flat)
296331
tests/kvm-unit-tests/run.js tests/kvm-unit-tests/x86/realmode.flat
297332

298333
kvm-unit-test-release: build/libv86.js build/v86.wasm
299334
(cd tests/kvm-unit-tests && ./configure && make x86/realmode.flat)
300335
TEST_RELEASE_BUILD=1 tests/kvm-unit-tests/run.js tests/kvm-unit-tests/x86/realmode.flat
301336

302-
expect-tests: all-debug build/libwabt.js
337+
expect-tests: build/libv86-debug.js build/v86-debug.wasm build/libwabt.js
303338
make -C tests/expect/tests
304339
./tests/expect/run.js
305340

306-
devices-test: all-debug
341+
devices-test: build/libv86-debug.js build/v86-debug.wasm
307342
./tests/devices/virtio_9p.js
308343
./tests/devices/virtio_console.js
309344
./tests/devices/fetch_network.js
310345
USE_VIRTIO=1 ./tests/devices/fetch_network.js
311346
./tests/devices/wisp_network.js
347+
./tests/devices/virtio_balloon.js
312348

313349
rust-test: $(RUST_FILES)
314350
env RUSTFLAGS="-D warnings" RUST_BACKTRACE=full RUST_TEST_THREADS=1 cargo test -- --nocapture
@@ -317,13 +353,16 @@ rust-test: $(RUST_FILES)
317353
rust-test-intensive:
318354
QUICKCHECK_TESTS=100000000 make rust-test
319355

320-
api-tests: all-debug
321-
# ./tests/api/clean-shutdown.js \
322-
./tests/api/reset.js \
323-
./tests/api/floppy-insert-eject.js \
324-
./tests/api/serial.js \
356+
api-tests: build/libv86-debug.js build/v86-debug.wasm
357+
./tests/api/clean-shutdown.js
358+
./tests/api/state.js
359+
./tests/api/reset.js
360+
#./tests/api/floppy-insert-eject.js # disabled for now, sometimes hangs
361+
./tests/api/serial.js
362+
./tests/api/reboot.js
363+
./tests/api/pic.js
325364

326-
all-tests: eslint kvm-unit-test qemutests qemutests-release jitpagingtests api-tests nasmtests nasmtests-force-jit tests expect-tests
365+
all-tests: eslint kvm-unit-test qemutests qemutests-release jitpagingtests api-tests nasmtests nasmtests-force-jit rust-test tests expect-tests
327366
# Skipping:
328367
# - devices-test (hangs)
329368

Readme.md

+9-15
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ list of emulated hardware:
2626
- A PCI bus. This one is partly incomplete and not used by every device.
2727
- An IDE disk controller.
2828
- An NE2000 (RTL8390) PCI network card.
29-
- A VirtIO filesystem.
29+
- Various virtio devices: Filesystem, network and balloon.
3030
- A SoundBlaster 16 sound card.
3131

3232
## Demos
@@ -62,7 +62,8 @@ list of emulated hardware:
6262
[Networking](docs/networking.md)
6363
[Alpine Linux guest setup](tools/docker/alpine/)
6464
[Arch Linux guest setup](docs/archlinux.md)
65-
[Windows 2000/XP guest setup](docs/windows-xp.md)
65+
[Windows NT guest setup](docs/windows-nt.md)
66+
[Windows 9x guest setup](docs/windows-9x.md)
6667
[9p filesystem](docs/filesystem.md)
6768
[Linux rootfs on 9p](docs/linux-9p-image.md)
6869
[Profiling](docs/profiling.md)
@@ -73,19 +74,13 @@ list of emulated hardware:
7374
Here's an overview of the operating systems supported in v86:
7475

7576
- Linux works pretty well. 64-bit kernels are not supported.
76-
- Damn Small Linux (2.4.31 kernel) works.
77-
- Fedora 30 works.
78-
- All tested versions of TinyCore work.
7977
- [Buildroot](https://buildroot.uclibc.org) can be used to build a minimal image.
8078
[humphd/browser-vm](https://github.com/humphd/browser-vm) and
8179
[darin755/browser-buildroot](https://github.com/Darin755/browser-buildroot) have some useful scripts for building one.
8280
- [SkiffOS](https://github.com/skiffos/SkiffOS/tree/master/configs/browser/v86) (based on Buildroot) can cross-compile a custom image.
83-
- Arch Linux 32 works. See [archlinux.md](docs/archlinux.md) for building an image.
84-
- Debian works.
85-
- Ubuntu works up to the latest version that supported i386 (16.04 LTS or 18.04 LTS for some variants).
81+
- Ubuntu and other Debian derivatives works up to the latest version that supported i386 (16.04 LTS or 18.04 LTS for some variants).
8682
- Alpine Linux works. An image can be built from a Dockerfile, see [tools/docker/alpine/](tools/docker/alpine/).
87-
- Slackware works.
88-
- Void Linux works.
83+
- Arch Linux 32 works. See [archlinux.md](docs/archlinux.md) for building an image.
8984
- ReactOS works.
9085
- FreeDOS, Windows 1.01 and MS-DOS run very well.
9186
- KolibriOS works.
@@ -94,8 +89,9 @@ Here's an overview of the operating systems supported in v86:
9489
- Windows 1, 3.x, 95, 98, ME, NT and 2000 work reasonably well.
9590
- In Windows 2000 and higher the PC type has to be changed from ACPI PC to Standard PC
9691
- There are some known boot issues ([#250](https://github.com/copy/v86/issues/250), [#433](https://github.com/copy/v86/issues/433), [#507](https://github.com/copy/v86/issues/507), [#555](https://github.com/copy/v86/issues/555), [#620](https://github.com/copy/v86/issues/620), [#645](https://github.com/copy/v86/issues/645))
92+
- See [Windows 9x guest setup](docs/windows-9x.md)
9793
- Windows XP, Vista and 8 work under certain conditions (see [#86](https://github.com/copy/v86/issues/86), [#208](https://github.com/copy/v86/issues/208))
98-
- See [Windows 2000/XP guest setup](docs/windows-xp.md)
94+
- See [Windows NT guest setup](docs/windows-nt.md)
9995
- Many hobby operating systems work.
10096
- 9front works.
10197
- Plan 9 doesn't work.
@@ -166,6 +162,8 @@ See [tests/Readme.md](tests/Readme.md) for more information.
166162
- [Programatically using the serial terminal](examples/serial.html)
167163
- [A Lua interpreter](examples/lua.html)
168164
- [Two instances in one window](examples/two_instances.html)
165+
- [Networking between browser windows/tabs using the Broadcast Channel API](examples/broadcast-network.html)
166+
- [TCP Terminal (fetch-based networking)](examples/tcp_terminal.html)
169167
- [Saving and restoring emulator state](examples/save_restore.html)
170168

171169
Using v86 for your own purposes is as easy as:
@@ -213,7 +211,3 @@ repository under their own licenses:
213211
## More questions?
214212

215213
Shoot me an email to `[email protected]`. Please report bugs on GitHub.
216-
217-
## Author
218-
219-
Fabian Hemmer (https://copy.sh/, `[email protected]`)

debug.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!doctype html>
22
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
33

4-
<title>Virtual x86 (debug)</title>
4+
<title>v86 (debug)</title>
55
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
66

77
<script src="src/const.js"></script>
@@ -20,7 +20,6 @@
2020
<script src="src/dma.js"></script>
2121
<script src="src/pit.js"></script>
2222
<script src="src/vga.js"></script>
23-
<script src="src/vga_text.js"></script>
2423
<script src="src/ps2.js"></script>
2524
<script src="src/rtc.js"></script>
2625
<script src="src/uart.js"></script>
@@ -31,6 +30,7 @@
3130
<script src="src/ne2k.js"></script>
3231
<script src="src/state.js"></script>
3332
<script src="src/virtio.js"></script>
33+
<script src="src/virtio_balloon.js"></script>
3434
<script src="src/virtio_console.js"></script>
3535
<script src="src/virtio_net.js"></script>
3636
<script src="src/bus.js"></script>

docs/archlinux.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Installing the ISO by hand takes a long time if you intend to recreate the image
4141

4242
### Creating a packer template
4343

44-
[Packer](https://www.packer.io/docs/builders/qemu.html) is a tool that lets you boot an ISO in any of multiple emulators (so QEMU in our case) and send pre-scripted keystrokes to bootstrap and SSH server. Once the SSH connection is established a script can be started for further provisioning.
44+
[Packer](https://www.packer.io/docs/builders/qemu.html) is a tool that lets you boot an ISO in any of multiple emulators (so QEMU in our case) and send pre-scripted keystrokes to bootstrap an SSH server. Once the SSH connection is established a script can be started for further provisioning.
4545

4646
Create a template for automating the base installation:
4747
```sh

0 commit comments

Comments
 (0)