Showing preview only (5,151K chars total). Download the full file or copy to clipboard to get everything.
Repository: copy/v86
Branch: master
Commit: 62fd36e0bbf3
Files: 377
Total size: 4.9 MB
Directory structure:
gitextract__01xjcye/
├── .cargo/
│ └── config.toml
├── .devcontainer/
│ ├── Dockerfile
│ └── devcontainer.json
├── .editorconfig
├── .gitattributes
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ └── issue.md
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .rustfmt.toml
├── .vscode/
│ └── tasks.json
├── Cargo.toml
├── LICENSE
├── LICENSE.MIT
├── Makefile
├── Readme.md
├── bios/
│ ├── .gitignore
│ ├── COPYING.LESSER
│ ├── fetch-and-build-seabios.sh
│ ├── seabios-debug.config
│ └── seabios.config
├── debug.html
├── docs/
│ ├── .gitignore
│ ├── archlinux.md
│ ├── cpu-idling.md
│ ├── filesystem.md
│ ├── how-it-works.md
│ ├── linux-9p-image.md
│ ├── networking.md
│ ├── profiling.md
│ ├── sse-shifts.txt
│ ├── windows-9x.md
│ └── windows-nt.md
├── eslint.config.mjs
├── examples/
│ ├── alpine.html
│ ├── arch.html
│ ├── async_load.html
│ ├── basic.html
│ ├── broadcast-network.html
│ ├── destroy.html
│ ├── lang.html
│ ├── lua.html
│ ├── nodejs.js
│ ├── nodejs_state.js
│ ├── save_restore.html
│ ├── sectorc.html
│ ├── serial.html
│ ├── tcp_terminal.html
│ ├── two_instances.html
│ ├── worker.html
│ └── worker.js
├── gen/
│ ├── generate_analyzer.js
│ ├── generate_interpreter.js
│ ├── generate_jit.js
│ ├── rust_ast.js
│ ├── util.js
│ └── x86_table.js
├── index.html
├── lib/
│ ├── 9p.js
│ ├── filesystem.js
│ ├── marshall.js
│ ├── softfloat/
│ │ └── softfloat.c
│ └── zstd/
│ └── zstddeclib.c
├── manifest.json
├── package.json
├── src/
│ ├── acpi.js
│ ├── browser/
│ │ ├── dummy_screen.js
│ │ ├── fake_network.js
│ │ ├── fetch_network.js
│ │ ├── filestorage.js
│ │ ├── inbrowser_network.js
│ │ ├── keyboard.js
│ │ ├── main.js
│ │ ├── mouse.js
│ │ ├── network.js
│ │ ├── print_stats.js
│ │ ├── screen.js
│ │ ├── serial.js
│ │ ├── speaker.js
│ │ ├── starter.js
│ │ ├── wisp_network.js
│ │ └── worker_bus.js
│ ├── buffer.js
│ ├── bus.js
│ ├── cjs.js
│ ├── const.js
│ ├── cpu.js
│ ├── dma.js
│ ├── elf.js
│ ├── externs.js
│ ├── floppy.js
│ ├── ide.js
│ ├── io.js
│ ├── iso9660.js
│ ├── kernel.js
│ ├── lib.js
│ ├── log.js
│ ├── main.js
│ ├── ne2k.js
│ ├── pci.js
│ ├── pit.js
│ ├── ps2.js
│ ├── rtc.js
│ ├── rust/
│ │ ├── analysis.rs
│ │ ├── codegen.rs
│ │ ├── config.rs
│ │ ├── control_flow.rs
│ │ ├── cpu/
│ │ │ ├── apic.rs
│ │ │ ├── arith.rs
│ │ │ ├── call_indirect.rs
│ │ │ ├── cpu.rs
│ │ │ ├── fpu.rs
│ │ │ ├── global_pointers.rs
│ │ │ ├── instructions.rs
│ │ │ ├── instructions_0f.rs
│ │ │ ├── ioapic.rs
│ │ │ ├── memory.rs
│ │ │ ├── misc_instr.rs
│ │ │ ├── mod.rs
│ │ │ ├── modrm.rs
│ │ │ ├── pic.rs
│ │ │ ├── sse_instr.rs
│ │ │ ├── string.rs
│ │ │ └── vga.rs
│ │ ├── cpu_context.rs
│ │ ├── dbg.rs
│ │ ├── gen/
│ │ │ └── mod.rs
│ │ ├── jit.rs
│ │ ├── jit_instructions.rs
│ │ ├── js_api.rs
│ │ ├── leb.rs
│ │ ├── lib.rs
│ │ ├── modrm.rs
│ │ ├── opstats.rs
│ │ ├── page.rs
│ │ ├── paging.rs
│ │ ├── prefix.rs
│ │ ├── profiler.rs
│ │ ├── regs.rs
│ │ ├── softfloat.rs
│ │ ├── state_flags.rs
│ │ ├── wasmgen/
│ │ │ ├── mod.rs
│ │ │ ├── wasm_builder.rs
│ │ │ └── wasm_opcodes.rs
│ │ └── zstd.rs
│ ├── sb16.js
│ ├── state.js
│ ├── uart.js
│ ├── vga.js
│ ├── virtio.js
│ ├── virtio_balloon.js
│ ├── virtio_console.js
│ └── virtio_net.js
├── tests/
│ ├── Readme.md
│ ├── api/
│ │ ├── 2g-mem.js
│ │ ├── cdrom-insert-eject.js
│ │ ├── clean-shutdown.js
│ │ ├── floppy.js
│ │ ├── pic.js
│ │ ├── reboot.js
│ │ ├── reset.js
│ │ ├── serial.js
│ │ ├── state.js
│ │ └── test.js
│ ├── benchmark/
│ │ ├── arch-bytemark.js
│ │ ├── arch-python.js
│ │ ├── fetch-download.js
│ │ ├── linux-boot.js
│ │ └── snapshot.js
│ ├── devices/
│ │ ├── fetch_network.js
│ │ ├── testfs/
│ │ │ ├── 5d70f436aa013f4f1d5af4a5e8149b479c813ab4ceea0bcf8b01f78eac84fd25
│ │ │ └── 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730
│ │ ├── testfs.json
│ │ ├── virtio_9p.js
│ │ ├── virtio_balloon.js
│ │ ├── virtio_console.js
│ │ └── wisp_network.js
│ ├── expect/
│ │ ├── readme.md
│ │ ├── run.js
│ │ └── tests/
│ │ ├── Makefile
│ │ ├── add.asm
│ │ ├── add.wast
│ │ ├── call-ret.asm
│ │ ├── call-ret.wast
│ │ ├── do-while.asm
│ │ ├── do-while.wast
│ │ ├── if.asm
│ │ ├── if.wast
│ │ ├── inc.asm
│ │ ├── inc.wast
│ │ ├── indirect-call.asm
│ │ ├── indirect-call.wast
│ │ ├── loop.asm
│ │ ├── loop.wast
│ │ ├── mem32r.asm
│ │ ├── mem32r.wast
│ │ ├── mem32rmw.asm
│ │ ├── mem32rmw.wast
│ │ ├── mem32w.asm
│ │ ├── mem32w.wast
│ │ ├── mov-immoffs.asm
│ │ ├── mov-immoffs.wast
│ │ ├── pop.asm
│ │ ├── pop.wast
│ │ ├── push.asm
│ │ ├── push.wast
│ │ ├── sti.asm
│ │ ├── sti.wast
│ │ ├── task_switch_test.asm
│ │ ├── task_switch_test.wast
│ │ ├── task_switch_test_sse.asm
│ │ ├── task_switch_test_sse.wast
│ │ ├── while-do.asm
│ │ └── while-do.wast
│ ├── full/
│ │ └── run.js
│ ├── jit-paging/
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── run.js
│ │ └── test-jit.c
│ ├── manual/
│ │ └── gc.html
│ ├── nasm/
│ │ ├── Readme.md
│ │ ├── arith-optimisations.asm
│ │ ├── btc-imm.asm
│ │ ├── btc-reg16.asm
│ │ ├── btc-reg32.asm
│ │ ├── btr-imm.asm
│ │ ├── btr-reg16.asm
│ │ ├── btr-reg32.asm
│ │ ├── bts-imm.asm
│ │ ├── bts-reg16.asm
│ │ ├── bts-reg32.asm
│ │ ├── cmp16-setbe.asm
│ │ ├── cmpxchg-setbe.asm
│ │ ├── cmpxchg.asm
│ │ ├── cmpxchg8b.asm
│ │ ├── comiss.asm
│ │ ├── create_tests.js
│ │ ├── cvtpi2ps.asm
│ │ ├── cvtps2pi.asm
│ │ ├── cvttps2pi.asm
│ │ ├── emms.asm
│ │ ├── f2xm1.asm
│ │ ├── fchs.asm
│ │ ├── fdecstp.asm
│ │ ├── fdiv-zero.asm
│ │ ├── fdiv.asm
│ │ ├── fdivr.asm
│ │ ├── fincstp.asm
│ │ ├── footer.inc
│ │ ├── fprem.asm
│ │ ├── fprem1.asm
│ │ ├── fptan.asm
│ │ ├── fpu_m80.asm
│ │ ├── frndint.asm
│ │ ├── fsave_frstor.asm
│ │ ├── fscale.asm
│ │ ├── fsincos.asm
│ │ ├── fsqrt.asm
│ │ ├── fstenv.asm
│ │ ├── fstm80.asm
│ │ ├── fstsw.asm
│ │ ├── fxtract-zero.asm
│ │ ├── fxtract.asm
│ │ ├── fyl2x-zero.asm
│ │ ├── fyl2x.asm
│ │ ├── fyl2xp1.asm
│ │ ├── gdb-extract-def
│ │ ├── gen_fixtures.js
│ │ ├── header.inc
│ │ ├── idiv16-overflow.asm
│ │ ├── idiv32-overflow.asm
│ │ ├── idiv8-overflow.asm
│ │ ├── indirect-call.asm
│ │ ├── indirect-jump.asm
│ │ ├── jcxz.asm
│ │ ├── jump.asm
│ │ ├── lea-nop.asm
│ │ ├── leave16.asm
│ │ ├── leave32.asm
│ │ ├── loop.asm
│ │ ├── loopnz.asm
│ │ ├── loopz.asm
│ │ ├── maskmovdqu.asm
│ │ ├── maskmovq.asm
│ │ ├── mov16.asm
│ │ ├── mov_sreg.asm
│ │ ├── mov_sreg_ud1.asm
│ │ ├── mov_sreg_ud2.asm
│ │ ├── movaps.asm
│ │ ├── movd.asm
│ │ ├── movntpd.asm
│ │ ├── movntps.asm
│ │ ├── movq.asm
│ │ ├── packssdw.asm
│ │ ├── packsswb.asm
│ │ ├── packuswb.asm
│ │ ├── paddb.asm
│ │ ├── paddd.asm
│ │ ├── paddsb.asm
│ │ ├── paddsw.asm
│ │ ├── paddusb.asm
│ │ ├── paddusw.asm
│ │ ├── paddw.asm
│ │ ├── pand.asm
│ │ ├── pandn.asm
│ │ ├── pcmpeqb.asm
│ │ ├── pcmpeqd.asm
│ │ ├── pcmpeqw.asm
│ │ ├── pcmpgtb.asm
│ │ ├── pcmpgtd.asm
│ │ ├── pcmpgtw.asm
│ │ ├── pmaddwd.asm
│ │ ├── pmulhw.asm
│ │ ├── pmullw.asm
│ │ ├── pmuludq.asm
│ │ ├── pop_esp.asm
│ │ ├── pop_esp2.asm
│ │ ├── por.asm
│ │ ├── pshufw.asm
│ │ ├── pslld.asm
│ │ ├── psllq.asm
│ │ ├── psllw.asm
│ │ ├── psrad.asm
│ │ ├── psraw.asm
│ │ ├── psrld.asm
│ │ ├── psrlq.asm
│ │ ├── psrlw.asm
│ │ ├── psubb.asm
│ │ ├── psubd.asm
│ │ ├── psubsb.asm
│ │ ├── psubsw.asm
│ │ ├── psubusb.asm
│ │ ├── psubusw.asm
│ │ ├── psubw.asm
│ │ ├── punpckhbw.asm
│ │ ├── punpckhdq.asm
│ │ ├── punpckhwd.asm
│ │ ├── punpcklbw.asm
│ │ ├── punpckldq.asm
│ │ ├── punpcklwd.asm
│ │ ├── push.asm
│ │ ├── pushf.asm
│ │ ├── pxor.asm
│ │ ├── rand.js
│ │ ├── ret-imm.asm
│ │ ├── run.js
│ │ ├── shufps-edgecase.asm
│ │ └── ucomiss.asm
│ ├── qemu/
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── Readme.md
│ │ ├── compiler.h
│ │ ├── config-host.h
│ │ ├── run-qemu.js
│ │ ├── run.js
│ │ ├── test-i386-code16.S
│ │ ├── test-i386-muldiv.h
│ │ ├── test-i386-shift.h
│ │ ├── test-i386-vm86.S
│ │ ├── test-i386.c
│ │ └── test-i386.h
│ └── rust/
│ └── verify-wasmgen-dummy-output.js
├── tools/
│ ├── copy-to-sha256.py
│ ├── docker/
│ │ ├── README.md
│ │ ├── alpine/
│ │ │ ├── Dockerfile
│ │ │ ├── Readme.md
│ │ │ ├── build-state.js
│ │ │ └── build.sh
│ │ ├── exec/
│ │ │ ├── Dockerfile
│ │ │ └── build.sh
│ │ └── test-image/
│ │ └── Dockerfile
│ ├── fetch_network_harness.mjs
│ ├── fs2json.py
│ ├── mkisofs.js
│ ├── rust-lld-wrapper
│ └── split-image.py
├── v86.css
└── v86.d.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .cargo/config.toml
================================================
[build]
target-dir = "build"
================================================
FILE: .devcontainer/Dockerfile
================================================
FROM library/node:lts-bookworm
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt-get install -y nodejs nasm gdb unzip p7zip-full openjdk-17-jre wget python3 qemu-system-x86 git-core build-essential libc6-dev-i386-cross libc6-dev-i386 clang curl time
RUN npm install -g jshint
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN /root/.cargo/bin/rustup toolchain install stable && \
/root/.cargo/bin/rustup target add wasm32-unknown-unknown && \
/root/.cargo/bin/rustup component add rustfmt-preview && \
/root/.cargo/bin/rustup update && /root/.cargo/bin/rustup update nightly
================================================
FILE: .devcontainer/devcontainer.json
================================================
{
"name": "v86 dev container",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "ubuntu"
}
},
"features": {
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
"ghcr.io/jungaretti/features/ripgrep:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"yzhang.markdown-all-in-one",
"DavidAnson.vscode-markdownlint",
"christian-kohler.npm-intellisense",
"dbaeumer.vscode-eslint",
"dustypomerleau.rust-syntax",
"serayuzgur.crates",
"ms-vscode.makefile-tools",
"rust-lang.rust-analyzer"
]
}
}
}
================================================
FILE: .editorconfig
================================================
root=true
[*.js]
charset = utf-8
indent_style = space
indent_size = 4
================================================
FILE: .gitattributes
================================================
lib/zstd/* linguist-vendored
lib/softfloat/* linguist-vendored
================================================
FILE: .github/ISSUE_TEMPLATE/issue.md
================================================
---
name: Issue
about: Bug reports or feature requests
title: ''
labels: ''
assignees: ''
---
<!--
Welcome to v86's issue tracker!
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
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.
Before reporting OS incompatibilities, check existing issues and the compatibility section of the readme.
When reporting issues, please provide the following information:
- Version of v86 (see the bottom of index.html or the output of `git describe --tags HEAD`)
- Browser/OS
- The browser's console output: Open debug.html and press ctrl+shift+k (firefox) or ctrl+shift+j (chromium)
- If relevant, upload the disk images to allow developers to reproduce the problem locally
-->
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
pull_request:
jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run eslint
run: sudo npm install -g eslint; make eslint
test:
runs-on: ubuntu-latest
name: Build and test
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
filter: tree:0
- name: Setup Node.js version
uses: actions/setup-node@v4
with:
node-version: '20'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- name: Setup toolchain
run: |
rustup toolchain install stable --profile minimal
rustup target add wasm32-unknown-unknown
rustup component add rustfmt
- name: Install APT packages
run: |
sudo apt-get update -y
sudo apt-get install nasm gdb qemu-system-x86 libc6-dev-i386 -y
- name: Build all-debug
run: make all-debug
- name: Build all
run: make all
- name: Build fallback
run: make build/v86-fallback.wasm
- name: rustfmt check
run: make rustfmt
- name: Fetch kvm-unit-test cache
uses: actions/cache@v4
id: cache-kvm-unit-test
with:
path: tests/kvm-unit-tests/
key: ${{ runner.os }}-kvm-unit-test
- name: Build kvm-unit-test
if: steps.cache-kvm-unit-test.outputs.cache-hit != 'true'
run: (cd tests/kvm-unit-tests && ./configure && make x86/realmode.flat)
- name: Run kvm-unit-test
run: tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/realmode.flat
- name: Fetch namsmtests cache
uses: actions/cache@v4
id: cache-nasmtests
with:
path: tests/nasm/build/
key: ${{ runner.os }}-nasmtests
- name: Run nasmtests
run: MAX_PARALLEL_TESTS=1 make nasmtests
- name: Run nasmtests-force-jit
run: MAX_PARALLEL_TESTS=1 make nasmtests-force-jit
- name: Run rust-test
run: make rust-test
- name: Fetch image cache
uses: actions/cache@v4
id: cache-images
with:
path: images/
key: ${{ runner.os }}-images-v2
- name: Download uncached images
if: steps.cache-images.outputs.cache-hit != 'true'
run: mkdir -p images && curl --compressed --output-dir images --remote-name-all https://i.copy.sh/{linux.iso,linux3.iso,linux4.iso,buildroot-bzimage68.bin,TinyCore-11.0.iso,oberon.img,msdos.img,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img,mobius-fd-release5.img,msdos622.img}
- name: Run api-tests
run: make api-tests
- name: Run qemutests
run: make qemutests
- name: Run qemutests-release
run: make qemutests-release
- name: Run jitpagingtests
run: make jitpagingtests
- name: Run integration tests
run: MAX_PARALLEL_TESTS=1 make tests
- name: Run devices tests
run: make devices-test
- name: Run expect tests
run: make expect-tests
- name: Update package.json version
run: make update-package-json-version
- name: Upload the artifact
uses: actions/upload-artifact@v4
with:
name: v86
path: |
package.json
LICENSE
Readme.md
build/libv86*.js
build/libv86*.js.map
build/v86*.wasm
build/*.mjs
upload:
name: Upload release
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
permissions:
id-token: write
contents: write
steps:
- name: Delete old release and tag
uses: dev-drprasad/delete-tag-and-release@v1.0.1
with:
delete_release: true
tag_name: latest
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: v86
- name: Display structure of downloaded files
run: ls -R
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
name: Latest Release
tag: latest
commit: master
body: ${{ github.event.head_commit.message }}
artifacts: "build/libv86*.js,build/libv86*.js.map,build/*.mjs,build/v86*.wasm"
prerelease: true
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
================================================
FILE: .gitignore
================================================
*.swp
*.swo
tests/qemu/test-i386
tests/jit-paging/test-jit
*.map
build/
closure-compiler/
images/
*.bak
*.orig
*.wasm
*.o
*.bin
*.img
*.fixture
*.fuse_hidden*
*.DS_Store
node_modules/
Cargo.lock
build-head
src/rust/gen/interpreter.rs
src/rust/gen/interpreter0f.rs
src/rust/gen/analyzer.rs
src/rust/gen/analyzer0f.rs
src/rust/gen/jit.rs
src/rust/gen/jit0f.rs
bios/seabios
bench-results
================================================
FILE: .rustfmt.toml
================================================
use_field_init_shorthand = true
match_block_trailing_comma = true
fn_single_line = true
imports_indent = "Block"
control_brace_style = "ClosingNextLine"
single_line_if_else_max_width = 92
================================================
FILE: .vscode/tasks.json
================================================
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Fetch images",
"type": "shell",
"command": "wget -P images/ https://i.copy.sh/{linux3.iso,linux.iso,linux4.iso,buildroot-bzimage.bin,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img}"
}
]
}
================================================
FILE: Cargo.toml
================================================
[package]
name = "v86"
version = "0.1.0"
publish = false
edition = "2021"
[features]
default = []
profiler = []
[lib]
crate-type = ["cdylib"]
path = "src/rust/lib.rs"
[profile.test]
lto = false
opt-level = 2
overflow-checks = false
[profile.dev]
lto = true
opt-level = 2
panic = "abort"
overflow-checks = false
[profile.release]
lto = true
opt-level = 3
incremental = false
panic = "abort"
================================================
FILE: LICENSE
================================================
Copyright (c) 2012, The v86 contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: LICENSE.MIT
================================================
QEMU Floppy disk emulator (Intel 82078)
Copyright (c) 2003, 2007 Jocelyn Mayer
Copyright (c) 2008 Hervé Poussineau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: Makefile
================================================
CLOSURE_DIR=closure-compiler
CLOSURE=$(CLOSURE_DIR)/compiler.jar
NASM_TEST_DIR=./tests/nasm
INSTRUCTION_TABLES=src/rust/gen/jit.rs src/rust/gen/jit0f.rs \
src/rust/gen/interpreter.rs src/rust/gen/interpreter0f.rs \
src/rust/gen/analyzer.rs src/rust/gen/analyzer0f.rs \
# Only the dependencies common to both generate_{jit,interpreter}.js
GEN_DEPENDENCIES=$(filter-out gen/generate_interpreter.js gen/generate_jit.js gen/generate_analyzer.js, $(wildcard gen/*.js))
JIT_DEPENDENCIES=$(GEN_DEPENDENCIES) gen/generate_jit.js
INTERPRETER_DEPENDENCIES=$(GEN_DEPENDENCIES) gen/generate_interpreter.js
ANALYZER_DEPENDENCIES=$(GEN_DEPENDENCIES) gen/generate_analyzer.js
STRIP_DEBUG_FLAG=
ifeq ($(STRIP_DEBUG),true)
STRIP_DEBUG_FLAG=--v86-strip-debug
endif
WASM_OPT ?= false
default: build/v86-debug.wasm
all: build/v86_all.js build/libv86.js build/libv86.mjs build/v86.wasm
all-debug: build/libv86-debug.js build/libv86-debug.mjs build/v86-debug.wasm
browser: build/v86_all.js
# Used for nodejs builds and in order to profile code.
# `debug` gives identifiers a readable name, make sure it doesn't have any side effects.
CLOSURE_READABLE=--formatting PRETTY_PRINT --debug
CLOSURE_SOURCE_MAP=\
--source_map_format V3\
--create_source_map '%outname%.map'
CLOSURE_FLAGS=\
--generate_exports\
--externs src/externs.js\
--warning_level VERBOSE\
--jscomp_error accessControls\
--jscomp_error checkRegExp\
--jscomp_error checkTypes\
--jscomp_error checkVars\
--jscomp_error conformanceViolations\
--jscomp_error const\
--jscomp_error constantProperty\
--jscomp_error deprecated\
--jscomp_error deprecatedAnnotations\
--jscomp_error duplicateMessage\
--jscomp_error es5Strict\
--jscomp_error externsValidation\
--jscomp_error globalThis\
--jscomp_error invalidCasts\
--jscomp_error misplacedTypeAnnotation\
--jscomp_error missingProperties\
--jscomp_error missingReturn\
--jscomp_error msgDescriptions\
--jscomp_error nonStandardJsDocs\
--jscomp_error suspiciousCode\
--jscomp_error strictModuleDepCheck\
--jscomp_error typeInvalidation\
--jscomp_error undefinedVars\
--jscomp_error unknownDefines\
--jscomp_error visibility\
--use_types_for_optimization\
--assume_function_wrapper\
--summary_detail_level 3\
--language_in ECMASCRIPT_2020\
--language_out ECMASCRIPT_2020
CARGO_FLAGS_SAFE=\
--target wasm32-unknown-unknown \
-- \
-C linker=tools/rust-lld-wrapper \
-C link-args="--import-table --global-base=4096 $(STRIP_DEBUG_FLAG)" \
-C link-args="build/softfloat.o" \
-C link-args="build/zstddeclib.o" \
--verbose
CARGO_FLAGS=$(CARGO_FLAGS_SAFE) -C target-feature=+bulk-memory -C target-feature=+multivalue -C target-feature=+simd128
CORE_FILES=cjs.js const.js io.js main.js lib.js buffer.js ide.js pci.js floppy.js \
dma.js pit.js vga.js ps2.js rtc.js uart.js \
acpi.js iso9660.js \
state.js ne2k.js sb16.js virtio.js virtio_console.js virtio_net.js virtio_balloon.js \
bus.js log.js cpu.js \
elf.js kernel.js
LIB_FILES=9p.js filesystem.js marshall.js
BROWSER_FILES=screen.js keyboard.js mouse.js speaker.js serial.js \
network.js starter.js worker_bus.js dummy_screen.js \
inbrowser_network.js fake_network.js wisp_network.js fetch_network.js \
print_stats.js filestorage.js
RUST_FILES=$(shell find src/rust/ -name '*.rs') \
src/rust/gen/interpreter.rs src/rust/gen/interpreter0f.rs \
src/rust/gen/jit.rs src/rust/gen/jit0f.rs \
src/rust/gen/analyzer.rs src/rust/gen/analyzer0f.rs
CORE_FILES:=$(addprefix src/,$(CORE_FILES))
LIB_FILES:=$(addprefix lib/,$(LIB_FILES))
BROWSER_FILES:=$(addprefix src/browser/,$(BROWSER_FILES))
build/v86_all.js: $(CLOSURE) src/*.js src/browser/*.js lib/*.js
mkdir -p build
-ls -lh build/v86_all.js
java -jar $(CLOSURE) \
--js_output_file build/v86_all.js\
--define=DEBUG=false\
$(CLOSURE_SOURCE_MAP)\
$(CLOSURE_FLAGS)\
--compilation_level ADVANCED\
--js $(CORE_FILES)\
--js $(LIB_FILES)\
--js $(BROWSER_FILES)\
--js src/browser/main.js
ls -lh build/v86_all.js
build/v86_all_debug.js: $(CLOSURE) src/*.js src/browser/*.js lib/*.js
mkdir -p build
java -jar $(CLOSURE) \
--js_output_file build/v86_all_debug.js\
--define=DEBUG=true\
$(CLOSURE_SOURCE_MAP)\
$(CLOSURE_FLAGS)\
--compilation_level ADVANCED\
--js $(CORE_FILES)\
--js $(LIB_FILES)\
--js $(BROWSER_FILES)\
--js src/browser/main.js
build/libv86.js: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
mkdir -p build
-ls -lh build/libv86.js
java -jar $(CLOSURE) \
--js_output_file build/libv86.js\
--define=DEBUG=false\
$(CLOSURE_FLAGS)\
--compilation_level SIMPLE\
--jscomp_off=missingProperties\
--output_wrapper ';(function(){%output%}).call(this);'\
--js $(CORE_FILES)\
--js $(BROWSER_FILES)\
--js $(LIB_FILES)
ls -lh build/libv86.js
build/libv86.mjs: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
mkdir -p build
-ls -lh build/libv86.js
java -jar $(CLOSURE) \
--js_output_file build/libv86.mjs\
--define=DEBUG=false\
$(CLOSURE_FLAGS)\
--compilation_level SIMPLE\
--jscomp_off=missingProperties\
--output_wrapper ';let module = {exports:{}}; %output%; export default module.exports.V86; export let {V86, CPU} = module.exports;'\
--js $(CORE_FILES)\
--js $(BROWSER_FILES)\
--js $(LIB_FILES)\
--chunk_output_type=ES_MODULES\
--emit_use_strict=false
ls -lh build/libv86.mjs
build/libv86-debug.js: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
mkdir -p build
java -jar $(CLOSURE) \
--js_output_file build/libv86-debug.js\
--define=DEBUG=true\
$(CLOSURE_FLAGS)\
$(CLOSURE_READABLE)\
--compilation_level SIMPLE\
--jscomp_off=missingProperties\
--output_wrapper ';(function(){%output%}).call(this);'\
--js $(CORE_FILES)\
--js $(BROWSER_FILES)\
--js $(LIB_FILES)
ls -lh build/libv86-debug.js
build/libv86-debug.mjs: $(CLOSURE) src/*.js lib/*.js src/browser/*.js
mkdir -p build
java -jar $(CLOSURE) \
--js_output_file build/libv86-debug.mjs\
--define=DEBUG=true\
$(CLOSURE_FLAGS)\
$(CLOSURE_READABLE)\
--compilation_level SIMPLE\
--jscomp_off=missingProperties\
--output_wrapper ';let module = {exports:{}}; %output%; export default module.exports.V86; export let {V86, CPU} = module.exports;'\
--js $(CORE_FILES)\
--js $(BROWSER_FILES)\
--js $(LIB_FILES)\
--chunk_output_type=ES_MODULES\
--emit_use_strict=false
ls -lh build/libv86-debug.mjs
src/rust/gen/jit.rs: $(JIT_DEPENDENCIES)
./gen/generate_jit.js --output-dir build/ --table jit
src/rust/gen/jit0f.rs: $(JIT_DEPENDENCIES)
./gen/generate_jit.js --output-dir build/ --table jit0f
src/rust/gen/interpreter.rs: $(INTERPRETER_DEPENDENCIES)
./gen/generate_interpreter.js --output-dir build/ --table interpreter
src/rust/gen/interpreter0f.rs: $(INTERPRETER_DEPENDENCIES)
./gen/generate_interpreter.js --output-dir build/ --table interpreter0f
src/rust/gen/analyzer.rs: $(ANALYZER_DEPENDENCIES)
./gen/generate_analyzer.js --output-dir build/ --table analyzer
src/rust/gen/analyzer0f.rs: $(ANALYZER_DEPENDENCIES)
./gen/generate_analyzer.js --output-dir build/ --table analyzer0f
build/v86.wasm: $(RUST_FILES) build/softfloat.o build/zstddeclib.o Cargo.toml
mkdir -p build/
-BLOCK_SIZE=K ls -l build/v86.wasm
cargo rustc --release $(CARGO_FLAGS)
cp build/wasm32-unknown-unknown/release/v86.wasm build/v86.wasm
-$(WASM_OPT) && wasm-opt -O2 --strip-debug build/v86.wasm -o build/v86.wasm
BLOCK_SIZE=K ls -l build/v86.wasm
build/v86-debug.wasm: $(RUST_FILES) build/softfloat.o build/zstddeclib.o Cargo.toml
mkdir -p build/
-BLOCK_SIZE=K ls -l build/v86-debug.wasm
cargo rustc $(CARGO_FLAGS)
cp build/wasm32-unknown-unknown/debug/v86.wasm build/v86-debug.wasm
BLOCK_SIZE=K ls -l build/v86-debug.wasm
build/v86-fallback.wasm: $(RUST_FILES) build/softfloat.o build/zstddeclib.o Cargo.toml
mkdir -p build/
cargo rustc --release $(CARGO_FLAGS_SAFE)
cp build/wasm32-unknown-unknown/release/v86.wasm build/v86-fallback.wasm || true
debug-with-profiler: $(RUST_FILES) build/softfloat.o build/zstddeclib.o Cargo.toml
mkdir -p build/
cargo rustc --features profiler $(CARGO_FLAGS)
cp build/wasm32-unknown-unknown/debug/v86.wasm build/v86-debug.wasm || true
with-profiler: $(RUST_FILES) build/softfloat.o build/zstddeclib.o Cargo.toml
mkdir -p build/
cargo rustc --release --features profiler $(CARGO_FLAGS)
cp build/wasm32-unknown-unknown/release/v86.wasm build/v86.wasm || true
watch:
cargo watch -x 'rustc $(CARGO_FLAGS)' -s 'cp build/wasm32-unknown-unknown/debug/v86.wasm build/v86-debug.wasm'
build/softfloat.o: lib/softfloat/softfloat.c
mkdir -p build
clang -c -Wall \
--target=wasm32 -O3 -flto -nostdlib -fvisibility=hidden -ffunction-sections -fdata-sections \
-DSOFTFLOAT_FAST_INT64 -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 \
-o build/softfloat.o \
lib/softfloat/softfloat.c
build/zstddeclib.o: lib/zstd/zstddeclib.c
mkdir -p build
clang -c -Wall \
--target=wasm32 -O3 -flto -nostdlib -fvisibility=hidden -ffunction-sections -fdata-sections \
-DZSTDLIB_VISIBILITY="" \
-o build/zstddeclib.o \
lib/zstd/zstddeclib.c
clean:
-rm build/libv86.js
-rm build/libv86.mjs
-rm build/libv86-debug.js
-rm build/libv86-debug.mjs
-rm build/v86_all.js
-rm build/v86.wasm
-rm build/v86-debug.wasm
-rm $(INSTRUCTION_TABLES)
-rm build/*.map
-rm build/*.wast
-rm build/*.o
$(MAKE) -C $(NASM_TEST_DIR) clean
run:
python3 -m http.server 2> /dev/null
update_version:
set -e ;\
COMMIT=`git log --format="%h" -n 1` ;\
DATE=`git log --date="format:%b %e, %Y %H:%m" --format="%cd" -n 1` ;\
SEARCH='<code>Version: <a id="version" href="https://github.com/copy/v86/commits/[a-f0-9]\+">[a-f0-9]\+</a> ([^(]\+)</code>' ;\
REPLACE='<code>Version: <a id="version" href="https://github.com/copy/v86/commits/'$$COMMIT'">'$$COMMIT'</a> ('$$DATE')</code>' ;\
sed -i "s@$$SEARCH@$$REPLACE@g" index.html ;\
SEARCH='<script src="build/v86_all.js?[a-f0-9]\+"></script>' ;\
REPLACE='<script src="build/v86_all.js?'$$COMMIT'"></script>' ;\
sed -i "s@$$SEARCH@$$REPLACE@g" index.html ;\
grep $$COMMIT index.html
$(CLOSURE):
mkdir -p $(CLOSURE_DIR)
# don't upgrade until https://github.com/google/closure-compiler/issues/3972 is fixed
wget -nv -O $(CLOSURE) https://repo1.maven.org/maven2/com/google/javascript/closure-compiler/v20210601/closure-compiler-v20210601.jar
build/integration-test-fs/fs.json: images/buildroot-bzimage68.bin
mkdir -p build/integration-test-fs/flat
cp images/buildroot-bzimage68.bin build/integration-test-fs/bzImage
touch build/integration-test-fs/initrd
cd build/integration-test-fs && tar cfv fs.tar bzImage initrd
./tools/fs2json.py build/integration-test-fs/fs.tar --out build/integration-test-fs/fs.json
./tools/copy-to-sha256.py build/integration-test-fs/fs.tar build/integration-test-fs/flat
rm build/integration-test-fs/fs.tar build/integration-test-fs/bzImage build/integration-test-fs/initrd
tests: build/v86-debug.wasm build/integration-test-fs/fs.json
LOG_LEVEL=3 ./tests/full/run.js
tests-release: build/libv86.js build/v86.wasm build/integration-test-fs/fs.json
TEST_RELEASE_BUILD=1 ./tests/full/run.js
nasmtests: build/v86-debug.wasm
$(NASM_TEST_DIR)/create_tests.js
$(NASM_TEST_DIR)/gen_fixtures.js
$(NASM_TEST_DIR)/run.js
nasmtests-force-jit: build/v86-debug.wasm
$(NASM_TEST_DIR)/create_tests.js
$(NASM_TEST_DIR)/gen_fixtures.js
$(NASM_TEST_DIR)/run.js --force-jit
jitpagingtests: build/v86-debug.wasm
$(MAKE) -C tests/jit-paging test-jit
./tests/jit-paging/run.js
qemutests: build/v86-debug.wasm
$(MAKE) -C tests/qemu test-i386
LOG_LEVEL=3 ./tests/qemu/run.js build/qemu-test-result
./tests/qemu/run-qemu.js > build/qemu-test-reference
diff build/qemu-test-result build/qemu-test-reference
qemutests-release: build/libv86.mjs build/v86.wasm
$(MAKE) -C tests/qemu test-i386
TEST_RELEASE_BUILD=1 time ./tests/qemu/run.js build/qemu-test-result
./tests/qemu/run-qemu.js > build/qemu-test-reference
diff build/qemu-test-result build/qemu-test-reference
kvm-unit-test: build/v86-debug.wasm
(cd tests/kvm-unit-tests && ./configure && make x86/realmode.flat)
tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/realmode.flat
kvm-unit-test-release: build/libv86.mjs build/v86.wasm
(cd tests/kvm-unit-tests && ./configure && make x86/realmode.flat)
TEST_RELEASE_BUILD=1 tests/kvm-unit-tests/run.mjs tests/kvm-unit-tests/x86/realmode.flat
expect-tests: build/v86-debug.wasm build/libwabt.cjs
make -C tests/expect/tests
./tests/expect/run.js
devices-test: build/v86-debug.wasm
./tests/devices/virtio_9p.js
./tests/devices/virtio_console.js
./tests/devices/fetch_network.js
USE_VIRTIO=1 ./tests/devices/fetch_network.js
./tests/devices/wisp_network.js
./tests/devices/virtio_balloon.js
rust-test: $(RUST_FILES)
env RUSTFLAGS="-D warnings" RUST_BACKTRACE=full RUST_TEST_THREADS=1 cargo test -- --nocapture
./tests/rust/verify-wasmgen-dummy-output.js
rust-test-intensive:
QUICKCHECK_TESTS=100000000 make rust-test
api-tests: build/v86-debug.wasm
./tests/api/clean-shutdown.js
./tests/api/state.js
./tests/api/reset.js
./tests/api/floppy.js
./tests/api/cdrom-insert-eject.js
./tests/api/serial.js
./tests/api/reboot.js
./tests/api/pic.js
all-tests: eslint kvm-unit-test qemutests qemutests-release jitpagingtests api-tests nasmtests nasmtests-force-jit rust-test tests expect-tests
# Skipping:
# - devices-test (hangs)
eslint:
eslint src tests gen lib examples tools
rustfmt: $(RUST_FILES)
cargo fmt --all -- --check --config fn_single_line=true,control_brace_style=ClosingNextLine
build/capstone-x86.min.js:
mkdir -p build
wget -nv -P build https://github.com/AlexAltea/capstone.js/releases/download/v3.0.5-rc1/capstone-x86.min.js
build/libwabt.cjs:
mkdir -p build
wget -nv -P build https://github.com/WebAssembly/wabt/archive/1.0.6.zip
unzip -j -d build/ build/1.0.6.zip wabt-1.0.6/demo/libwabt.js
mv build/libwabt.js build/libwabt.cjs
rm build/1.0.6.zip
build/xterm.js:
curl https://cdn.jsdelivr.net/npm/xterm@5.2.1/lib/xterm.min.js > build/xterm.js
curl https://cdn.jsdelivr.net/npm/xterm@5.2.1/lib/xterm.js.map > build/xterm.js.map
curl https://cdn.jsdelivr.net/npm/xterm@5.2.1/css/xterm.css > build/xterm.css
update-package-json-version:
git describe --tags --exclude latest | sed 's/-/./' | tr - + | tee build/version
jq --arg version "$$(cat build/version)" '.version = $$version' package.json > package.json.tmp
mv package.json.tmp package.json
================================================
FILE: Readme.md
================================================
[](https://gitter.im/copy/v86) or #v86 on [irc.libera.chat](https://libera.chat/)
v86 emulates an x86-compatible CPU and hardware. Machine code is translated to
WebAssembly modules at runtime in order to achieve decent performance. Here's a
list of emulated hardware:
- An x86-compatible CPU. The instruction set is around Pentium 4 level,
including full SSE3 support. Some features are missing, in particular:
- Task gates, far calls in protected mode
- Some 16 bit protected mode features
- Single stepping (trap flag, debug registers)
- Some exceptions, especially floating point and SSE
- Multicore
- 64-bit extensions
- A floating point unit (FPU). Calculations are done using the Berkeley
SoftFloat library and therefore should be precise (but slow). Trigonometric
and log functions are emulated using 64-bit floats and may be less precise.
Not all FPU exceptions are supported.
- A floppy disk controller (8272A).
- An 8042 Keyboard Controller, PS2. With mouse support.
- An 8254 Programmable Interval Timer (PIT).
- An 8259 Programmable Interrupt Controller (PIC).
- Partial APIC support.
- A CMOS Real Time Clock (RTC).
- A generic VGA card with SVGA support and Bochs VBE Extensions.
- A PCI bus. This one is partly incomplete and not used by every device.
- An IDE disk controller.
- A built-in ISO 9660 CD-ROM generator.
- An NE2000 (RTL8390) PCI network card.
- Various virtio devices: Filesystem, network and balloon.
- A SoundBlaster 16 sound card.
## Demos
[9front](https://copy.sh/v86/?profile=9front) —
[Arch Linux](https://copy.sh/v86/?profile=archlinux) —
[Android-x86 1.6-r2](https://copy.sh/v86?profile=android) —
[Android-x86 4.4-r2](https://copy.sh/v86?profile=android4) —
[BasicLinux](https://copy.sh/v86/?profile=basiclinux) —
[Buildroot Linux](https://copy.sh/v86/?profile=buildroot) —
[Damn Small Linux](https://copy.sh/v86/?profile=dsl) —
[ELKS](https://copy.sh/v86/?profile=elks) —
[FreeDOS](https://copy.sh/v86/?profile=freedos) —
[FreeBSD](https://copy.sh/v86/?profile=freebsd) —
[FiwixOS](https://copy.sh/v86/?profile=fiwix) —
[Haiku](https://copy.sh/v86/?profile=haiku) —
[SkiffOS](https://copy.sh/v86/?profile=copy/skiffos) —
[ReactOS](https://copy.sh/v86/?profile=reactos) —
[Windows 2000](https://copy.sh/v86/?profile=windows2000) —
[Windows 98](https://copy.sh/v86/?profile=windows98) —
[Windows 95](https://copy.sh/v86/?profile=windows95) —
[Windows 1.01](https://copy.sh/v86/?profile=windows1) —
[MS-DOS 6.22](https://copy.sh/v86/?profile=msdos) —
[OpenBSD](https://copy.sh/v86/?profile=openbsd) —
[Oberon](https://copy.sh/v86/?profile=oberon) —
[KolibriOS](https://copy.sh/v86/?profile=kolibrios) —
[SkiftOS](https://copy.sh/v86?profile=skift) —
[QNX](https://copy.sh/v86/?profile=qnx)
## Documentation
[How it works](docs/how-it-works.md) —
[Networking](docs/networking.md) —
[Alpine Linux guest setup](tools/docker/alpine/) —
[Arch Linux guest setup](docs/archlinux.md) —
[Windows NT guest setup](docs/windows-nt.md) —
[Windows 9x guest setup](docs/windows-9x.md) —
[9p filesystem](docs/filesystem.md) —
[Linux rootfs on 9p](docs/linux-9p-image.md) —
[Profiling](docs/profiling.md) —
[CPU Idling](docs/cpu-idling.md)
## Compatibility
Here's an overview of the operating systems supported in v86:
- Linux works pretty well. 64-bit kernels are not supported.
- [Buildroot](https://buildroot.org/) can be used to build a minimal image.
[humphd/browser-vm](https://github.com/humphd/browser-vm) and
[darin755/browser-buildroot](https://github.com/Darin755/browser-buildroot) have some useful scripts for building one.
- [SkiffOS](https://github.com/skiffos/SkiffOS/tree/master/configs/browser/v86) (based on Buildroot) can cross-compile a custom image.
- Ubuntu and other Debian derivatives works up to the latest version that supported i386 (16.04 LTS or 18.04 LTS for some variants).
- Alpine Linux works. An image can be built from a Dockerfile, see [tools/docker/alpine/](tools/docker/alpine/).
- Arch Linux 32 works. See [archlinux.md](docs/archlinux.md) for building an image.
- ReactOS works.
- FreeDOS, Windows 1.01 and MS-DOS run very well.
- KolibriOS works.
- Haiku works.
- Android-x86 has been tested up to 4.4-r2.
- Windows 1, 3.x, 95, 98, ME, NT and 2000 work reasonably well.
- In Windows 2000 and higher the PC type has to be changed from ACPI PC to Standard PC
- 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))
- See [Windows 9x guest setup](docs/windows-9x.md)
- 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))
- See [Windows NT guest setup](docs/windows-nt.md)
- Many hobby operating systems work.
- 9front works.
- Plan 9 doesn't work.
- QNX works.
- OS/2 doesn't work.
- FreeBSD works.
- OpenBSD works with a specific boot configuration. At the `boot>` prompt type
`boot -c`, then at the `UKC>` prompt `disable mpbios` and `exit`.
- NetBSD works only with a custom kernel, see [#350](https://github.com/copy/v86/issues/350).
- SerenityOS works (only 32-bit versions).
- [SkiftOS](https://skiftos.org/) works.
You can get some information on the disk images here: https://github.com/copy/images.
## How to build, run and embed?
You need:
- make
- Rust with the wasm32-unknown-unknown target
- A version of clang compatible with Rust
- java (for Closure Compiler, not necessary when using `debug.html`)
- nodejs (a recent version is required, v16.11.1 is known to be working)
- To run tests: nasm, gdb, qemu-system, gcc, libc-i386 and rustfmt
See [tools/docker/test-image/Dockerfile](tools/docker/test-image/Dockerfile)
for a full setup on Debian or
[WSL](https://docs.microsoft.com/en-us/windows/wsl/install).
- Run `make` to build the debug build (at `debug.html`).
- Run `make all` to build the optimized build (at `index.html`).
- ROM and disk images are loaded via XHR, so if you want to try out `index.html`
locally, make sure to serve it from a local webserver. You can use `make run`
to serve the files using Python's http module.
- If you only want to embed v86 in a webpage you can use `libv86.js`. For usage,
check out the [examples](examples/). You can download it from the [release section](https://github.com/copy/v86/releases).
- For bundler-based setups (Vite/React/Next/Webpack), there is also an official npm package:
https://www.npmjs.com/package/v86
This package was originally maintained by [@giulioz](https://github.com/giulioz) (bundler-optimized fork) and was made "official" for this repo by [@basicer](https://github.com/basicer) with the author's permission.
It is published automatically from this repository via GitHub Actions ([.github/workflows/ci.yml](.github/workflows/ci.yml), Upload release job) on pushes to `master` and uses `npm publish --provenance`.
Install: `npm install v86`
### Alternatively, to build using Docker
- If you have Docker installed, you can run the whole system inside a container.
- See `tools/docker/exec` to find the Dockerfile required for this.
- You can run `docker build -f tools/docker/exec/Dockerfile -t v86:alpine-3.19 .` from the root directory to generate docker image.
- Then you can simply run `docker run -it -p 8000:8000 v86:alpine-3.19` to start the server.
- Check `localhost:8000` for hosted server.
### Running via Dev Container
- If you are using an IDE that supports Dev Containers, such as GitHub Codespaces, the Visual Studio Code Remote Container extension, or possibly others such as Jetbrains' IntelliJ IDEA, you can setup the development environment in a Dev Container.
- Follow the instructions from your development environment to setup the container.
- Run the Task "Fetch images" in order to download images for testing.
## Testing
The disk images for testing are not included in this repository. You can
download them directly from the website using:
`curl --compressed --output-dir images/ --remote-name-all https://i.copy.sh/{linux.iso,linux3.iso,linux4.iso,buildroot-bzimage68.bin,TinyCore-11.0.iso,oberon.img,msdos.img,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img,mobius-fd-release5.img,msdos622.img}`
Run integration tests: `make tests`
Run all tests: `make jshint rustfmt kvm-unit-test nasmtests nasmtests-force-jit expect-tests jitpagingtests qemutests rust-test tests`
See [tests/Readme.md](tests/Readme.md) for more information.
## API examples
- [Basic](examples/basic.html)
- [Programatically using the serial terminal](examples/serial.html)
- [A Lua interpreter](examples/lua.html)
- [Two instances in one window](examples/two_instances.html)
- [Networking between browser windows/tabs using the Broadcast Channel API](examples/broadcast-network.html)
- [TCP Terminal (fetch-based networking)](examples/tcp_terminal.html)
- [Saving and restoring emulator state](examples/save_restore.html)
Using v86 for your own purposes is as easy as:
```javascript
var emulator = new V86({
screen_container: document.getElementById("screen_container"),
bios: {
url: "../../bios/seabios.bin",
},
vga_bios: {
url: "../../bios/vgabios.bin",
},
cdrom: {
url: "../../images/linux.iso",
},
autostart: true,
});
```
See [starter.js](src/browser/starter.js).
## License
v86 is distributed under the terms of the Simplified BSD License, see
[LICENSE](LICENSE). The following third-party dependencies are included in the
repository under their own licenses:
- [`lib/softfloat/softfloat.c`](lib/softfloat/softfloat.c)
- [`lib/zstd/zstddeclib.c`](lib/zstd/zstddeclib.c)
- [`tests/kvm-unit-tests/`](tests/kvm-unit-tests)
- [`tests/qemutests/`](tests/qemutests)
- [`src/floppy.js/`](src/floppy.js) contains parts ported from qemu under the MIT license, see LICENSE.MIT.
## Credits
- CPU test cases via [QEMU](https://wiki.qemu.org/Main_Page)
- More tests via [kvm-unit-tests](https://www.linux-kvm.org/page/KVM-unit-tests)
- [zstd](https://github.com/facebook/zstd) support is included for better compression of state images
- [Berkeley SoftFloat](http://www.jhauser.us/arithmetic/SoftFloat.html) is included to precisely emulate 80-bit floating point numbers
- [The jor1k project](https://github.com/s-macke/jor1k) for 9p, filesystem and uart drivers
- [WinWorld](https://winworldpc.com/) sources of some old operating systems
- [OS/2 Museum](https://www.os2museum.com/) sources of some old operating systems
- [ArchiveOS](https://archiveos.org/) sources of several operating systems
## More questions?
Shoot me an email to `copy@copy.sh`. Please report bugs on GitHub.
================================================
FILE: bios/.gitignore
================================================
*.gz
================================================
FILE: bios/COPYING.LESSER
================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
================================================
FILE: bios/fetch-and-build-seabios.sh
================================================
set -e
git clone https://git.seabios.org/seabios.git || true
(cd seabios && git checkout rel-1.16.2)
cp seabios.config seabios/.config
make -C seabios
cp seabios/out/bios.bin seabios.bin
cp seabios/out/vgabios.bin vgabios.bin
cp seabios-debug.config seabios/.config
make -C seabios
cp seabios/out/bios.bin seabios-debug.bin
cp seabios/out/vgabios.bin vgabios-debug.bin
================================================
FILE: bios/seabios-debug.config
================================================
#
# Automatically generated file; DO NOT EDIT.
# SeaBIOS Configuration
#
#
# General Features
#
# CONFIG_COREBOOT is not set
CONFIG_QEMU=y
# CONFIG_CSM is not set
CONFIG_QEMU_HARDWARE=y
CONFIG_XEN=y
CONFIG_THREADS=y
# CONFIG_RELOCATE_INIT is not set
# CONFIG_BOOTMENU is not set
CONFIG_BOOTORDER=y
CONFIG_HOST_BIOS_GEOMETRY=y
CONFIG_ENTRY_EXTRASTACK=y
CONFIG_MALLOC_UPPERMEMORY=y
CONFIG_ROM_SIZE=0
#
# Hardware support
#
CONFIG_ATA=y
CONFIG_ATA_DMA=y
CONFIG_ATA_PIO32=y
CONFIG_AHCI=y
CONFIG_SDCARD=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_SCSI=y
CONFIG_PVSCSI=y
CONFIG_ESP_SCSI=y
CONFIG_LSI_SCSI=y
CONFIG_MEGASAS=y
CONFIG_MPT_SCSI=y
CONFIG_FLOPPY=y
CONFIG_FLASH_FLOPPY=y
# CONFIG_NVME is not set
CONFIG_PS2PORT=y
# CONFIG_USB is not set
CONFIG_SERIAL=y
# CONFIG_SERCON is not set
CONFIG_LPT=y
CONFIG_RTC_TIMER=y
CONFIG_HARDWARE_IRQ=y
CONFIG_USE_SMM=y
CONFIG_CALL32_SMM=y
CONFIG_MTRR_INIT=y
CONFIG_PMTIMER=y
CONFIG_TSC_TIMER=y
#
# BIOS interfaces
#
CONFIG_DRIVES=y
CONFIG_CDROM_BOOT=y
CONFIG_CDROM_EMU=y
CONFIG_PCIBIOS=y
CONFIG_APMBIOS=y
CONFIG_PNPBIOS=y
CONFIG_OPTIONROMS=y
CONFIG_PMM=y
CONFIG_BOOT=y
CONFIG_KEYBOARD=y
CONFIG_KBD_CALL_INT15_4F=y
CONFIG_MOUSE=y
CONFIG_S3_RESUME=y
CONFIG_VGAHOOKS=y
# CONFIG_DISABLE_A20 is not set
# CONFIG_WRITABLE_UPPERMEMORY is not set
CONFIG_TCGBIOS=y
#
# BIOS Tables
#
CONFIG_PIRTABLE=y
CONFIG_MPTABLE=y
# CONFIG_SMBIOS is not set
CONFIG_ACPI=y
CONFIG_ACPI_DSDT=y
CONFIG_FW_ROMFILE_LOAD=y
CONFIG_ACPI_PARSE=y
#
# VGA ROM
#
# CONFIG_NO_VGABIOS is not set
# CONFIG_VGA_STANDARD_VGA is not set
# CONFIG_VGA_CIRRUS is not set
# CONFIG_VGA_ATI is not set
CONFIG_VGA_BOCHS=y
# CONFIG_VGA_GEODEGX2 is not set
# CONFIG_VGA_GEODELX is not set
# CONFIG_DISPLAY_BOCHS is not set
# CONFIG_VGA_RAMFB is not set
CONFIG_VGA_BOCHS_STDVGA=y
# CONFIG_VGA_BOCHS_VMWARE is not set
# CONFIG_VGA_BOCHS_QXL is not set
# CONFIG_VGA_BOCHS_VIRTIO is not set
CONFIG_BUILD_VGABIOS=y
CONFIG_VGA_STDVGA_PORTS=y
CONFIG_VGA_FIXUP_ASM=y
CONFIG_VGA_ALLOCATE_EXTRA_STACK=y
CONFIG_VGA_EXTRA_STACK_SIZE=512
CONFIG_VGA_VBE=y
CONFIG_VGA_PCI=y
CONFIG_OVERRIDE_PCI_ID=y
CONFIG_VGA_VID=0x1234
CONFIG_VGA_DID=0x1111
#
# Debugging
#
CONFIG_DEBUG_LEVEL=8
# CONFIG_DEBUG_SERIAL is not set
# CONFIG_DEBUG_SERIAL_MMIO is not set
CONFIG_DEBUG_IO=y
================================================
FILE: bios/seabios.config
================================================
#
# Automatically generated file; DO NOT EDIT.
# SeaBIOS Configuration
#
#
# General Features
#
# CONFIG_COREBOOT is not set
CONFIG_QEMU=y
# CONFIG_CSM is not set
CONFIG_QEMU_HARDWARE=y
CONFIG_XEN=y
CONFIG_THREADS=y
# CONFIG_RELOCATE_INIT is not set
# CONFIG_BOOTMENU is not set
CONFIG_BOOTORDER=y
CONFIG_HOST_BIOS_GEOMETRY=y
CONFIG_ENTRY_EXTRASTACK=y
CONFIG_MALLOC_UPPERMEMORY=y
CONFIG_ROM_SIZE=0
#
# Hardware support
#
CONFIG_ATA=y
CONFIG_ATA_DMA=y
CONFIG_ATA_PIO32=y
CONFIG_AHCI=y
CONFIG_SDCARD=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_SCSI=y
CONFIG_PVSCSI=y
CONFIG_ESP_SCSI=y
CONFIG_LSI_SCSI=y
CONFIG_MEGASAS=y
CONFIG_MPT_SCSI=y
CONFIG_FLOPPY=y
CONFIG_FLASH_FLOPPY=y
# CONFIG_NVME is not set
CONFIG_PS2PORT=y
# CONFIG_USB is not set
CONFIG_SERIAL=y
# CONFIG_SERCON is not set
CONFIG_LPT=y
CONFIG_RTC_TIMER=y
CONFIG_HARDWARE_IRQ=y
CONFIG_USE_SMM=y
CONFIG_CALL32_SMM=y
CONFIG_MTRR_INIT=y
CONFIG_PMTIMER=y
CONFIG_TSC_TIMER=y
#
# BIOS interfaces
#
CONFIG_DRIVES=y
CONFIG_CDROM_BOOT=y
CONFIG_CDROM_EMU=y
CONFIG_PCIBIOS=y
CONFIG_APMBIOS=y
CONFIG_PNPBIOS=y
CONFIG_OPTIONROMS=y
CONFIG_PMM=y
CONFIG_BOOT=y
CONFIG_KEYBOARD=y
CONFIG_KBD_CALL_INT15_4F=y
CONFIG_MOUSE=y
CONFIG_S3_RESUME=y
CONFIG_VGAHOOKS=y
# CONFIG_DISABLE_A20 is not set
# CONFIG_WRITABLE_UPPERMEMORY is not set
CONFIG_TCGBIOS=y
#
# BIOS Tables
#
CONFIG_PIRTABLE=y
CONFIG_MPTABLE=y
# CONFIG_SMBIOS is not set
CONFIG_ACPI=y
CONFIG_ACPI_DSDT=y
CONFIG_FW_ROMFILE_LOAD=y
CONFIG_ACPI_PARSE=y
#
# VGA ROM
#
# CONFIG_NO_VGABIOS is not set
# CONFIG_VGA_STANDARD_VGA is not set
# CONFIG_VGA_CIRRUS is not set
# CONFIG_VGA_ATI is not set
CONFIG_VGA_BOCHS=y
# CONFIG_VGA_GEODEGX2 is not set
# CONFIG_VGA_GEODELX is not set
# CONFIG_DISPLAY_BOCHS is not set
# CONFIG_VGA_RAMFB is not set
CONFIG_VGA_BOCHS_STDVGA=y
# CONFIG_VGA_BOCHS_VMWARE is not set
# CONFIG_VGA_BOCHS_QXL is not set
# CONFIG_VGA_BOCHS_VIRTIO is not set
CONFIG_BUILD_VGABIOS=y
CONFIG_VGA_STDVGA_PORTS=y
CONFIG_VGA_FIXUP_ASM=y
CONFIG_VGA_ALLOCATE_EXTRA_STACK=y
CONFIG_VGA_EXTRA_STACK_SIZE=512
CONFIG_VGA_VBE=y
CONFIG_VGA_PCI=y
CONFIG_OVERRIDE_PCI_ID=y
CONFIG_VGA_VID=0x1234
CONFIG_VGA_DID=0x1111
#
# Debugging
#
CONFIG_DEBUG_LEVEL=0
================================================
FILE: debug.html
================================================
<!doctype html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>v86 (debug)</title>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,interactive-widget=resizes-content">
<script src="build/capstone-x86.min.js"></script>
<script src="build/libwabt.cjs"></script>
<script type="module" src="src/browser/main.js"></script>
<link rel="stylesheet" href="v86.css">
<div>
<div id="boot_options">
<h4>Debugger</h4>
<button id="start_reactos">ReactOS</button>
<button id="start_reactos-boot">ReactOS (boot)</button>
<br>
<button id="start_msdos">MS-DOS</button>
<button id="start_freedos">FreeDOS</button>
<button id="start_freegem">FreeDOS with FreeGEM</button>
<br>
<button id="start_windows1">Windows 1.01</button>
<button id="start_windows30">Windows 3.0</button>
<button id="start_windows31">Windows 3.1</button>
<button id="start_windows95">Windows 95</button>
<button id="start_windows95-boot">Windows 95 (boot)</button>
<br>
<button id="start_windows98">Windows 98</button>
<button id="start_windows98-boot">Windows 98 (boot)</button>
<button id="start_windowsnt3">Windows NT 3.1</button>
<button id="start_windowsnt4">Windows NT 4.0</button>
<button id="start_windows2000">Windows 2000</button>
<button id="start_windows2000-boot">Windows 2000 (boot)</button>
<br>
<button id="start_linux26">Linux 2.6 (Buildroot)</button>
<button id="start_linux3">Linux 3.18 (Buildroot)</button>
<button id="start_linux4">Linux 4.16 (Buildroot)</button>
<button id="start_buildroot">Linux 5.6 (Buildroot)</button>
<button id="start_tinycore">Tiny Core</button>
<button id="start_openwrt">OpenWRT</button>
<br>
<button id="start_archlinux">Arch Linux</button>
<button id="start_archlinux-boot">Arch Linux (boot)</button>
<button id="start_dsl">Damn Small Linux</button>
<br>
<button id="start_freebsd">FreeBSD</button>
<button id="start_freebsd-boot">FreeBSD (boot)</button>
<button id="start_openbsd">OpenBSD</button>
<button id="start_netbsd">NetBSD</button>
<br>
<button id="start_haiku">Haiku</button>
<button id="start_haiku-boot">Haiku (boot)</button>
<button id="start_minix">Minix</button>
<button id="start_serenity">SerenityOS</button>
<button id="start_qnx">QNX</button>
<button id="start_9front">9front</button>
<br>
<button id="start_oberon">Oberon</button>
<button id="start_kolibrios">KolibriOS</button>
<button id="start_solos">Solar OS</button>
<button id="start_bootchess">Bootchess</button>
<button id="start_helenos">HelenOS</button>
<br>
<!--
<hr>
Restore state: <input type="file" id="restore_state">
-->
<br>
<hr>
<table>
<tr>
<td width="350"><label for="cdrom_image">CD image</label></td>
<td>
<input type="file" id="cdrom_image">
</td>
</tr>
<tr>
<td><label for="floppy_image">Floppy disk image</label></td>
<td><input type="file" id="fda_image"> or <a id="fda_toggle_empty_disk">create empty floppy disk</a><br></td>
</tr>
<tr>
<td><label for="floppy_image">Second floppy disk image</label></td>
<td><input type="file" id="fdb_image"> or <a id="fdb_toggle_empty_disk">create empty floppy disk</a><br></td>
</tr>
<tr>
<td><label for="hda_image">Hard disk image</label></td>
<td><input type="file" id="hda_image"> or <a id="hda_toggle_empty_disk">create empty hard disk</a><br></td>
</tr>
<tr>
<td>Second hard disk image</td>
<td><input type="file" id="hdb_image"> or <a id="hdb_toggle_empty_disk">create empty hard disk</a><br></td>
</tr>
<tr>
<td><label for="multiboot_image">Multiboot kernel image (experimental)</label></td>
<td><input type="file" id="multiboot_image"><br></td>
</tr>
<tr>
<td><label for="bzimage">Kernel image (bzimage)</label></td>
<td><input type="file" id="bzimage"><br></td>
</tr>
<tr>
<td><label for="initrd">initrd</label></td>
<td><input type="file" id="initrd"><br></td>
</tr>
<tr>
<td><label for="bios">BIOS</label></td>
<td><input type="file" id="bios"><br></td>
</tr>
<tr>
<td><label for="vga_bios">VGA BIOS</label></td>
<td><input type="file" id="vga_bios"><br></td>
</tr>
<tr>
<td colspan="2"><small>Disk images are not uploaded to the server</small><hr></td>
</tr>
<tr>
<td><label for="memory_size">Memory size</label></td>
<td>
<input id="memory_size" type="number" value="128" min="16" max="2048" step="16"> MB<br>
</td>
</tr>
<tr>
<td><label for="vga_memory_size">Video Memory size</label></td>
<td>
<input id="vga_memory_size" type="number" value="8" min="1" max="128" step="1"> MB<br>
</td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td><label for="relay_url">Networking proxy (leave blank to disable)</label></td>
<td>
<input id="relay_url" type="text" value="wss://relay.widgetry.org/">
</td>
</tr>
<tr>
<td><label for="net_device_type">Network Device Type</label></td>
<td>
<select id="net_device_type">
<option value="ne2k">ne2k</option>
<option value="virtio">virtio</option>
</select>
</td>
</tr>
<tr>
<td><label for="mtu">Network MTU (only used for virtio)</label></td>
<td>
<input id="mtu" type="number" value="1500" min="68" max="65535" step="1"> B<br>
</td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td><label for="disable_audio">Disable audio</label></td>
<td>
<input id="disable_audio" type="checkbox"><br>
</td>
</tr>
<tr>
<td><label for="acpi">Enable ACPI (experimental)</label></td>
<td>
<input id="acpi" type="checkbox"><br>
</td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td><label for="boot_order">Boot order</label></td>
<td>
<select id="boot_order">
<option value="0">Auto</option>
<option value="213">CD / Floppy / Hard Disk</option>
<option value="123">CD / Hard Disk / Floppy</option>
<option value="231">Floppy / CD / Hard Disk</option>
<option value="321">Floppy / Hard Disk / CD</option>
<option value="312">Hard Disk / Floppy / CD</option>
<option value="132">Hard Disk / CD / Floppy</option>
</select>
</td>
</tr>
</table>
<br>
<button id="start_emulation">Start Emulation</button>
<br>
<br>
</div>
<div id="runtime_options" style="display: none">
<button id="dump_regs">Dump Registers</button>
<button id="dump_gdt">Dump GDT/LDT</button>
<button id="dump_idt">Dump IDT</button>
<button id="dump_pt">Dump page tables</button>
<button id="dump_log">Dump log</button>
<br>
<button id="run">Pause</button>
<button id="reset">Reset</button>
<button id="exit">Exit</button>
<button id="ctrlaltdel">Send Ctrl-Alt-Del</button>
<button id="alttab">Send Alt-Tab</button>
<button id="get_fda_image">Get floppy image</button>
<button id="get_fdb_image">Get second floppy image</button>
<button id="get_hda_image">Get hard disk image</button>
<button id="get_hdb_image">Get second hard disk image</button>
<button id="get_cdrom_image">Get CD-ROM image</button>
<button id="change_fda_image">Insert floppy image</button>
<button id="change_fdb_image">Insert second floppy image</button>
<button id="change_cdrom_image">Insert CD image</button>
<button id="save_state">Save State</button>
<button id="load_state">Load State</button>
<button id="memory_dump">Memory Dump</button>
<button id="capture_network_traffic">Capture network traffic</button>
<button id="toggle_mouse">Disable mouse</button>
<button id="lock_mouse">Lock mouse</button>
<button id="fullscreen">Go fullscreen</button>
<button id="take_screenshot">Take screenshot</button>
<button id="mute">Mute</button>
<button id="toggle_theatre">Enable theatre mode</button>
<button style="display: none" id="toggle_zoom_to_fit">Enable zoom to fit</button>
<label>
Scale:
<input type="number" min="0.25" step="0.25" value="1.0" id="scale" style="width: 50px">
</label>
</div>
<pre style="margin: 0" id="log_levels"></pre>
<pre style="display: none" id="loading"></pre>
<br>
</div>
<div id="screen_container" style="display: none">
<div id="screen"></div>
<canvas id="vga"></canvas>
<div style="position: absolute; top: 0; z-index: 10">
<textarea class="phone_keyboard"></textarea>
</div>
</div>
<div id="runtime_infos" style="display: none">
Running: <span id="running_time">0s</span> <br>
Speed: <span id="speed">0</span> mIPS<br>
Avg speed: <span id="avg_speed">0</span> mIPS<br>
<br>
<div id="info_storage" style="display: none">
<b>IDE device<span id="ide_type"></span></b><br>
Sectors read: <span id="info_storage_sectors_read">0</span><br>
Bytes read: <span id="info_storage_bytes_read">0</span><br>
Sectors written: <span id="info_storage_sectors_written">0</span><br>
Bytes written: <span id="info_storage_bytes_written">0</span><br>
Status: <span id="info_storage_status"></span><br>
<br>
</div>
<div id="info_filesystem" style="display: none">
<b>9p Filesystem</b><br>
Bytes read: <span id="info_filesystem_bytes_read">0</span><br>
Bytes written: <span id="info_filesystem_bytes_written">0</span><br>
<div style="white-space: nowrap; overflow-x: hidden">Last file: <span id="info_filesystem_last_file"></span></div>
Status: <span id="info_filesystem_status"></span><br>
<br>
</div>
<div id="info_network" style="display: none">
<b>Network</b><br>
Bytes received: <span id="info_network_bytes_received">0</span><br>
Bytes transmitted: <span id="info_network_bytes_transmitted">0</span><br>
<br>
</div>
<b>VGA</b><br>
Mode: <span id="info_vga_mode"></span><br>
Resolution: <span id="info_res">-</span><br>
<br>
Mouse: <span id="info_mouse_enabled">No</span><br>
</div>
<div id="filesystem_panel" style="display: none">
<label>
Send files to emulator<br>
<input type="file" id="filesystem_send_file" multiple>
</label>
<br><br>
<label>
Get file from emulator<br>
<input type="text" id="filesystem_get_file" placeholder="Absolute path">
</label>
</div>
<div id="debug_panel" style="display: none">
</div>
<br style="clear: both"><br>
<textarea spellcheck="false" cols="40" rows="12" id="serial" style="display: none">
</textarea>
<div id="terminal"></div>
<button id="toggle_ui" style="display: none">Hide UI</button>
<div id="theatre_background" style="display: none"></div>
================================================
FILE: docs/.gitignore
================================================
node_modules
================================================
FILE: docs/archlinux.md
================================================
See [Alpine setup](../tools/docker/alpine/Readme.md) for a more reliable and
faster way to automatically build Linux images for v86.
(This document partly also applies to other Linuxes)
Choosing an installer ISO
-------------------------
Download Arch Linux 32 from https://archlinux32.org.
Basic installation using QEMU
-----------------------
Installing Arch Linux with these instructions will result in a raw disk image that can be booted by v86.
```sh
# fetch archlinux32 installer
wget https://mirror.archlinux32.org/archisos/archlinux32-2021.12.01-i686.iso
# Create a 10 gigabyte disk image. If you intend to pacstrap only 'base' then 1.5G should be fine also.
qemu-img create arch.img 10G
# Follow the normal installation process (you can add accel=kvm if your system supports it to speed up the installation)
qemu-system-x86_64 -m 256 -drive file=arch.img,format=raw -cdrom archlinux32-2021.12.01-i686.iso
```
For keyboard support, it is necessary to open /etc/mkinitcpio.conf and edit the following line:
```sh
MODULES="atkbd i8042"
```
For the changes to take effect, you need to regenerate the initial ramdisk with `mkinitcpio -p linux`
The resulting `arch.img` file is a bootable disk image for v86.
Scripting image creation for v86
--------------------------------
Installing the ISO by hand takes a long time if you intend to recreate the image many times. There are various reasons why you might want to do this more than once. For example: because the emulator is slow you might want to compile any new software release in QEMU which is much faster and then use the resulting image in v86 instead of making the emulator compile the software. Another reason is that the build progress potentially takes long and if you want to do automated builds in parallel to find out what configurations do and don't work you can just throw more computing power at the problem in order to solve it. This example requires that you have `packer`, `qemu` and `kpartx` installed.
### Creating a packer template
[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.
Create a template for automating the base installation:
```sh
mkdir -p packer
cat > packer/template.json << 'EOF'
{
"provisioners": [
{
"type": "shell",
"override": {
"qemu": {
"scripts": ["scripts/provision.sh"]
}
}
}
],
"builders": [
{
"accelerator": "kvm",
"type": "qemu",
"boot_command": [
"<enter><wait30><enteropenssl passwd help<wait10>",
"dhcpcd<enter><wait5>",
"echo root:root | chpasswd<enter><wait5>",
"systemctl start sshd<enter>"
],
"headless": true,
"boot_wait": "10s",
"disk_size": 1500,
"disk_interface": "ide",
"iso_url": "https://mirror.archlinux32.org/archisos/archlinux32-2021.12.01-i686.iso",
"iso_checksum": "90c6f5aecb095d5578f6c9970539da7c5e9324ec",
"iso_checksum_type": "sha1",
"ssh_wait_timeout": "120s",
"ssh_pty": true,
"ssh_username": "root",
"ssh_password": "root",
"ssh_port": 22,
"format": "raw",
"vm_name": "archlinux",
"disk_detect_zeroes": "unmap",
"memory": 2048,
"vnc_bind_address": "0.0.0.0"
}
]
}
EOF
```
You can tweak the options a bit to match your situation. For debugging, you can set `headless` to `false`. That will show you the VNC connection instead of running the `boot_command` in the background. For a `base` pacstrap, using a 2 GB disk image should be sufficient. The `raw` disk format is important. v86 does not read qcow2 images, only raw disk images. If your system does not support KVM (the default accelerator), you can change `"accelerator": "none"` to the settings, in macos you may use `"accelerator": "hvf"`. Other accelerator options can be found [here](https://www.packer.io/docs/builders/qemu.html#accelerator).
After gaining SSH connectivity to the VM, packer will run the `scripts/provisioning.sh` script in the guest.
### Creating the Arch Linux installation script
Create a script for your Arch Linux installation. This runs in the live Arch Linux environment, so you need to partition the disk, do a pacstrap, and install a bootloader.
```sh
mkdir -p packer/scripts
### Write your own or copy paste the example below
vim packer/scripts/provision.sh
```
An example script to install Arch Linux with the root mounted using the 9p network filesystem:
```sh
#!/bin/bash
echo "Creating a GPT partition on /dev/sda1"
echo -e "g\nn\n\n\n\nw" | fdisk /dev/sda
# In case you might want to create a DOS partition instead. It doesn't really matter.
#echo "Creating a DOS partition on /dev/sda1"
#echo -e "o\nn\np\n1\n\n\nw" | fdisk /dev/sda
echo "Formatting /dev/sda1 to ext4"
mkfs -t ext4 /dev/sda1
echo "Mounting new filesystem"
mount -t ext4 /dev/sda1 /mnt
echo "Create pacman package cache dir"
mkdir -p /mnt/var/cache/pacman/pkg
# We don't want the pacman cache to fill up the image. After reboot whatever tarballs pacman has cached are gone.
echo "Mount the package cache dir in memory so it doesn't fill up the image"
mount -t tmpfs none /mnt/var/cache/pacman/pkg
echo "Updating archlinux-keyring"
pacman -Sy archlinux-keyring --noconfirm
# uncomment to remove signing if unable to resolve signing errors
sed -i 's/SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
# Install the Arch Linux base system, feel free to add packages you need here
echo "Performing pacstrap"
pacstrap -i /mnt base linux dhcpcd curl openssh --noconfirm
echo "Writing fstab"
genfstab -p /mnt >> /mnt/etc/fstab
# When the Linux boots we want it to automatically log in on tty1 as root
echo "Ensuring root autologin on tty1"
mkdir -p /mnt/etc/systemd/system/getty@tty1.service.d
cat << 'EOF' > /mnt/etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin root --noclear %I $TERM
EOF
# This is the tricky part. The current root will be mounted on /dev/sda1 but after we reboot
# it will try to mount root during boot using the 9p network filesystem. This means the emulator
# will request all files over the network using XMLHttpRequests from the server. This is great
# because then you only need to provide the client with a saved state (the memory) and the
# session will start instantly and load needed files on the fly. This is fast and it saves bandwidth.
echo "Ensuring root is remounted using 9p after reboot"
mkdir -p /mnt/etc/initcpio/hooks
cat << 'EOF' > /mnt/etc/initcpio/hooks/9p_root
run_hook() {
mount_handler="mount_9p_root"
}
mount_9p_root() {
msg ":: mounting '$root' on real root (9p)"
# Note the host9p. We won't mount /dev/sda1 on root anymore,
# instead we mount the network filesystem and the emulator will
# retrieve the files on the fly.
if ! mount -t 9p host9p "$1"; then
echo "You are now being dropped into an emergency shell."
launch_interactive_shell
msg "Trying to continue (this will most likely fail) ..."
fi
}
EOF
echo "Adding initcpio build hook for 9p root remount"
mkdir -p /mnt/etc/initcpio/install
cat << 'EOF' > /mnt/etc/initcpio/install/9p_root
#!/bin/bash
build() {
add_runscript
}
EOF
# We need to load some modules into the kernel for it to play nice with the emulator
# The atkbd and i8042 modules are for keyboard input in the browser. If you do not
# want to use the network filesystem you only need these. The 9p, 9pnet and 9pnet_virtio
# modules are needed for being able to mount 9p network filesystems using the emulator.
echo "Configure mkinitcpio for 9p"
sed -i 's/MODULES=()/MODULES=(atkbd i8042 libps2 serio serio_raw psmouse virtio_pci virtio_pci_modern_dev 9p 9pnet 9pnet_virtio fscache netfs)/g' /mnt/etc/mkinitcpio.conf
# Because we want to mount the root filesystem over the network during boot, we need to
# hook into initcpio. If you do not want to mount the root filesystem during boot but
# only want to mount a 9p filesystem later, you can leave this out. Once the system
# has been booted you should be able to mount 9p filesystems with mount -t 9p host9p /blabla
# without this hook.
sed -i 's/fsck"/fsck 9p_root"/g' /mnt/etc/mkinitcpio.conf
# enable ssh password auth and root login
sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
echo "Writing the installation script"
cat << 'EOF' > /mnt/bootstrap.sh
#!/usr/bin/bash
echo "Re-generate initial ramdisk environment"
mkinitcpio -p linux
# uncomment to remove signing if you are unable to resolve signing errors otherwise
sed -i 's/SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
pacman -S --noconfirm syslinux gptfdisk
syslinux-install_update -i -a -m
# disabling ldconfig to speed up boot (to remove Rebuild dynamic linker cache...)
# you may want to comment this out
echo "Disabling ldconfig service"
systemctl mask ldconfig.service
sync
EOF
echo "Chrooting and bootstrapping the installation"
arch-chroot /mnt bash bootstrap.sh
cat << 'EOF' > /mnt/boot/syslinux/syslinux.cfg
# Config file for Syslinux -
# /boot/syslinux/syslinux.cfg
#
# Comboot modules:
# * menu.c32 - provides a text menu
# * vesamenu.c32 - provides a graphical menu
# * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
# * hdt.c32 - hardware detection tool
# * reboot.c32 - reboots the system
#
# To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
# If /usr and /boot are on the same file system, symlink the files instead
# of copying them.
#
# If you do not use a menu, a 'boot:' prompt will be shown and the system
# will boot automatically after 5 seconds.
#
# Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
# The wiki provides further configuration examples
DEFAULT arch
PROMPT 0 # Set to 1 if you always want to display the boot: prompt
TIMEOUT 100
# Menu Configuration
# Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux
UI menu.c32
#UI vesamenu.c32
# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU TITLE Arch Linux
#MENU BACKGROUND splash.png
MENU COLOR border 30;44 #40ffffff #a0000000 std
MENU COLOR title 1;36;44 #9033ccff #a0000000 std
MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel 37;44 #50ffffff #a0000000 std
MENU COLOR help 37;40 #c0ffffff #a0000000 std
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
# boot sections follow
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*
LABEL arch
MENU LABEL Arch Linux 9p
LINUX ../vmlinuz-linux
APPEND root=/dev/sda1 rw quiet
INITRD ../initramfs-linux.img
LABEL arch2
MENU LABEL Arch Linux Disk
LINUX ../vmlinuz-linux
APPEND root=/dev/sda1 rw quiet disablehooks=9p_root
INITRD ../initramfs-linux.img
LABEL hdt
MENU LABEL HDT (Hardware Detection Tool)
COM32 hdt.c32
LABEL reboot
MENU LABEL Reboot
COM32 reboot.c32
LABEL poweroff
MENU LABEL Poweroff
COM32 poweroff.c32
EOF
umount -R /mnt
```
With the packer template and the script you have enough to create an image that can be booted by v86. But because this example script installs an Arch Linux that wants to mount root over the network with 9p, we need to host that filesystem first. If you do not want to use 9p, you can just run `(cd packer && packer build -force template.json)` to build the image.
### Creating the 9p filesystem
Now that we have an image that contains a filesystem, we can convert that filesystem into something we can host on the webserver together with the v86 library.
To do so, we need to mount the image once and create a json mapping of the filesystem. The following script shows how to map the filesystem in an automated fashion.
Create a script to builds the image and then creates v86 compatible artifacts:
```sh
vim build.sh
```
Example script:
```sh
#!/bin/sh
SRC=packer
TARGET=output
# build the boxfile from the iso
(cd $SRC && sudo PACKER_LOG=1 PACKER_LOG_PATH="./packer.log" packer build -force template.json)
# test if there is a boxfile where we expected it
if [ ! -f $SRC/output-qemu/archlinux ]; then
echo "Looks like something went wrong building the image, maybe try again?"
exit 1
fi;
# clean up any previous loops and mounts
echo "Making sure mountpoint is empty"
LOOP_DEV=$(sudo losetup -f)
sudo umount diskmount -f || /bin/true
sudo kpartx -d $LOOP_DEV || /bin/true
sudo losetup -d $LOOP_DEV || /bin/true
# mount the generated raw image, we do that so we can create
# a json mapping of it and copy it to host on the webserver
mkdir -p diskmount
echo "Mounting the created image so we can convert it to a p9 image"
sudo losetup $LOOP_DEV $SRC/output-qemu/archlinux
sudo kpartx -a $LOOP_DEV
sudo mount /dev/mapper/$(basename $LOOP_DEV)p1 diskmount
# make images dir
mkdir -p $TARGET
mkdir -p $TARGET/images
mkdir -p $TARGET/images/arch
# map the filesystem to json with fs2json
sudo ./tools/fs2json.py --out $TARGET/images/fs.json diskmount
sudo ./tools/copy-to-sha256.py diskmount $TARGET/images/arch
# copy the filesystem and chown to nonroot user
echo "Copying the filesystem to $TARGET/arch"
mkdir $TARGET/arch -p
sudo rsync -q -av diskmount/ $TARGET/arch
sudo chown -R $(whoami):$(whoami) $TARGET/arch
# clean up mount
echo "Cleaning up mounts"
sudo umount diskmount -f
sudo kpartx -d $LOOP_DEV
sudo losetup -d $LOOP_DEV
# Move the image to the images dir
sudo mv $SRC/output-qemu/archlinux $TARGET/images/arch.img
```
Given that the packer template and provision.sh is rooted at `packer` (adjust the value of `$SRC` otherwise), run the `build.sh` at root of your `v86` repo:
```
chmod +x build.sh
./build.sh
```
Generated artifacts are now available for serving from `output`.
### Using the created artifacts in v86
Now that we have everything we need to host a server that serves an Arch Linux environment over the network.
Create a checkout of v86 and run `make build/libv86.js`.
We can then edit `examples/arch.html`, we have two options:
1. Boot Arch Linux from the 9p filesystem (generated .bin artifacts at `/output/images/arch`):
```sh
filesystem: {
baseurl: "../output/images/arch/",
basefs: "../output/images/fs.json",
},
bzimage_initrd_from_filesystem: true,
cmdline: [
"rw",
"root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose",
].join(" "),
acpi: false,
autostart: true,
```
2. Boot the Arch Linux from the qemu raw disk image:
```sh
hda: {
url: "../output/images/arch.img",
# set to true if you want to load it asynchrously during runtime (for this option we need to run a webserver that supports the Range header)
# NOTE: async: false is slow but proved to be more realiable
async: false,
# This needs to be the size of the raw disk.
size: 1.5 * 1024 * 1024 * 1024,
# See the `disk_size` item in the packer template.
},
acpi: false,
autostart: true,
```
Next, we need a webserver that supports the Range header. For example [this extension of the SimpleHTTPServer](https://github.com/smgoller/rangehttpserver). At your `v86` root, run:
```sh
wget https://raw.githubusercontent.com/smgoller/rangehttpserver/master/RangeHTTPServer.py
python2 RangeHTTPServer.py
```
Now that the webserver is running, point your browser to `http://localhost:8000/examples/arch.html`. Wait for the Linux to boot. When the system is up, click 'Save state to file'. Your browser will download a `v86state.bin` file. Copy that file to `/your/v86/dir/images`. You can then edit `examples/arch.html` again and add a 'state' key to the `V86` array.
```sh
initial_state: {
"url": "http://localhost:8000/images/v86state.bin",
},
```
If you refresh `http://localhost:8000/examples/arch.html` you will see that the state is restored instantly and all required files are loaded over the network on the fly.
### Networking
The emulator can emulate a network card. For more information [look at the networking documentation](https://github.com/copy/v86/blob/master/docs/networking.md). To set up networking in the VM, add the following item to the `V86` array in the `examples/arch.html` file:
```sh
network_relay_url: "ws://localhost:8080/",
```
This will make the emulator try to connect to a [WebSockets proxy](https://github.com/benjamincburns/websockproxy). Running the proxy is very easy if you use the Docker container.
```sh
sudo docker run --privileged -p 8080:80 --name relay bennottelling/websockproxy
```
**NOTE:** original `benjamincburns/jor1k-relay:latest` has throttling built-in by default which will degrade the networking. `bennottelling/websockproxy` has this throttling removed via [websockproxy/issues/4#issuecomment-317255890](https://github.com/benjamincburns/websockproxy/issues/4#issuecomment-317255890).
You can check if the relay is running correctly by going to `http://localhost:8080/` in your browser. There you should see a message that reads `Can "Upgrade" only to "Websocket".`.
Now you should be able to get network connectivity in the virtual machine. If you are restoring from a saved state, you might need to first run:
```sh
ip link set enp0s5 down
rmmod ne2k-pci
```
To bring the network up, run:
```sh
modprobe ne2k-pci
dhcpcd -w4 enp0s5
```
It might take a while for a carrier to become available on the interface. If the `dhcpcd` command fails shortly after booting, wait a bit and try again a bit later. If you are using the 9p network filesystem you can use the developer tools networking tab (in chrome) to get a sense of what is going on by looking at the files that are being downloaded.
When the network is up you should be able to curl a website. To check, run `curl icanhazip.com`. There you should see the public IP of the machine running the proxy.
You can't do inbound traffic into the VM with the websockproxy Docker container because it uses a basic NAT. To SSH into the VM running in the browser, you can create a reverse SSH tunnel to expose the SSH port of the sshd in the VM to the outside world. You may need to start `sshd` first, it may also be reasonable to change root password:
```sh
passwd root
systemctl start sshd
```
then create a reverse SSH tunnel:
```sh
# This will create a port 1122 on the example.com server
# which forwards to the SSH in the VM
ssh root@example.com -R 1122:localhost:22
```
Now on the `example.com` server you should be able to SSH into your browser tab by running `ssh root@localhost -p 1122`.
================================================
FILE: docs/cpu-idling.md
================================================
Some operating systems don't support `hlt` instruction, because of this, the CPU spin loops instead of idling.
Here are some solutions for different OSes:
## MS-DOS (using DOSIdle)
1. Download `DOSID251.zip` from https://www.vogons.org/viewtopic.php?p=438763#p438763
2. Unzip DOSIDLE.EXE from archive in any location (recommended to root of C:).
3. Run `edit C:\autoexec.bat`
4. Add to file: `C:\path\to\dosidle.exe`
5. Save changes (*press Alt + F and x*) and restart the VM.
**Note:** To hide output when starting DOSIdle, change `C:\path\to\dosidle.exe` to `C:\path\to\dosidle.exe > nul` on step №4.
## FreeDOS ([source](https://narkive.com/UGrcO8wU.2))
1. Run `edit C:\fdconfig.sys` (or `edit C:\config.sys`)
2. Add to file: `IDLEHALT=1`
3. Save changes (*press Alt + F and x*) and restart FreeDOS.
## Windows 9x (using AmnHLT)
1. Download `amnhltm.zip` from http://toogam.com/software/archive/drivers/cpu/cpuidle/amnhltm.zip ([mirror](https://web.archive.org/web/20060212132151/http://www.user.cityline.ru/~maxamn/amnhltm.zip))
2. Unzip the archive in any location.
3. **Note**: If you have installed VBE9x, restart Windows, press F8 on boot, select *Command prompt only*, run `cd C:\path\to\amnhlt\`, and follow to the next step.
4. Run `AMNHLT.BAT`
5. Restart Windows, and AmnHLT will start automatically on next boot (you can safely delete archive and unpacked folder).
## Windows 98+ and Unix-like
These systems are already supports `hlt`, no further action is required.
================================================
FILE: docs/filesystem.md
================================================
A 9p filesystem is supported by v86, using a virtio transport. There are several
ways it can be set up.
### Guest mount
In all cases, the filesystem is mounted in the guest system using the `9p`
filesystem type and the `host9p` device tag. Typically you want to be specific
with the version and transport options:
```sh
mount -t 9p -o trans=virtio,version=9p2000.L host9p /mnt/9p/
```
Here are kernel arguments you can use to boot directly off the 9p filesystem:
```
rw root=host9p rootfstype=9p rootflags=trans=virtio,version=9p2000.L
```
The `aname` option can be used to pick the directory from 9p to mount. The `rw`
argument makes this a read-write root filesystem.
### JSON/HTTP Filesystem
This is the standard way to setup the 9p filesystem. It loads files over
HTTP on-demand into an in-memory filesystem in JS. This allows files to be
exchanged with the guest OS. See `create_file` and `read_file` in
[`starter.js`](https://github.com/copy/v86/blob/master/src/browser/starter.js).
This mode is enabled by passing the following options to `V86`:
```javascript
filesystem: {
basefs: "../9p/fs.json",
baseurl: "../9p/base/",
}
```
Here, `basefs` is a json file created using
[fs2json.py](tools/fs2json.py) and the `baseurl` directory is created using
[copy-to-sha256.py](tools/copy-to-sha256.py).
If `basefs` and `baseurl` are omitted, an empty 9p filesystem is created. Unless
you configure one of the alternative modes.
### Function Handler
You can handle 9p messages directly in JavaScript yourself by providing a
function as `handle9p` under `filesystem`:
```javascript
filesystem: {
handle9p: async (reqBuf, reply) => {
// reqBuf is a Uint8Array of the entire request frame.
// you can parse these bytes using a library or reading the 9p spec.
// once you formulate a response, you send the reply frame as a
// Uint8Array by passing it to reply: reply(respBuf)
}
}
```
This allows you to implement a 9p server or custom proxy in JS. However, this
filesystem will not be cached (unless cached in the guest OS), functions like
`create_file` and `read_file` will not be available, and you will be responsible
for keeping its state in sync with any machine save states.
### WebSocket Proxy
You can also back the 9p virtio filesystem with a 9p server over WebSocket by
providing a WS proxy URL:
```javascript
filesystem: {
proxy_url: "ws://localhost:8080/"
}
```
Simlar to using `handle9p`, this filesystem will not be available in JS and
will need to be re-mounted after restoring state.
The WS proxy just needs to hand off messages with a connection to a normal 9p
server. Each binary WebSocket message is the full buffer of a request or a
reply.
To implement, request message bytes can just be sent directly to the 9p
connection, but the 9p reply stream needs to be buffered into a single binary
WebSocket message. The proxy must at least parse the first 4 bytes to get the
message size and use it to buffer a full message before sending over WebSocket.
The [wanix](https://github.com/tractordev/wanix) CLI has a `serve` command that
not only serves a directory over HTTP, but also over 9P via WebSocket. You can
see how it [implements a proxy][1] in Go.
[1]: https://github.com/tractordev/wanix/blob/main/cmd/wanix/serve.go#L117-L177
================================================
FILE: docs/how-it-works.md
================================================
Here's an overview of v86's workings. For details, check the
[source](https://github.com/copy/v86/tree/master/src).
The major limitations of WebAssembly are (for the purpose of making emulators with jit):
- structured control flow (no arbitrary jumps)
- no control over registers (you can't keep hardware registers in wasm locals across functions)
- no mmap (paging needs to be fully emulated)
- no patching
- module generation is fairly slow, but at least it's asynchronous, so other things can keep running
- there is some memory overhead per module, so you can't generate more than a few thousand
v86 has an interpreted mode, which collects entry points (targets of function
calls and indirect jumps). It also measures the hotness per page, so that
compilation is focused on code that is often executed. Once a page is
considered hot, code is generated for the entire page and up to `MAX_PAGES`
that are directly reachable from it.
v86 generates a single function with a big switch statement (brtable), to
ensure that all functions and targets of indirect jumps are reachable from
other modules. The remaining control flow is handled using the "stackifier"
algorithm (well-explained in
[this blog post](https://medium.com/leaningtech/solving-the-structured-control-flow-problem-once-and-for-all-5123117b1ee2)).
At the moment, there is no linking of wasm modules. The current module is
exited, and the main loop detects if a new module can be entered.
In practice, I found that browsers don't handle this structure (deep brtables,
with locals being used across the entire function) very well, and `MAX_PAGES`
has to be set to fairly low, otherwise memory usage blows up. It's likely that
improvements are possible (generating fewer entry points, splitting code across
multiple functions).
Code-generation happens in two passes. The first pass finds all basic block
boundaries, the second generates code for each basic block. Instruction
decoding is generated by a [set of
scripts](https://github.com/copy/v86/tree/master/gen) from a [table of
instructions](https://github.com/copy/v86/blob/master/gen/x86_table.js). It's
also used to [generate
tests](https://github.com/copy/v86/blob/master/tests/nasm/create_tests.js).
To handle paging, v86 generates code similar to this (see `gen_safe_read`):
```
entry <- tlb[addr >> 12 << 2]
if entry & MASK == TLB_VALID && (addr & 0xFFF) <= 0xFFC - bytes: goto fast
entry <- safe_read_jit_slow(addr, instruction_pointer)
if page_fault: goto exit-with-pagefault
fast: mem[(entry & ~0xFFF) ^ addr]
```
There is a 4 MB cache that acts like a tlb. It contains the physical address,
read-only bit, whether the page contains code (in order to invalidate it on
write) and whether the page points to mmio. Any of those cases are handled in
the slow path (`safe_read_jit_slow`), as well as walking the page tables and
triggering page faults. The fast path is taken in the vast majority of times.
The remaining code generation is mostly a straight-forward, 1-to-1 translation
of x86 to wasm. The only analysis done is to optimise generation of condional
jumps immediately after arithmetic instructions, e.g.:
```
cmp eax, 52
setb eax
```
becomes:
```
... // code for cmp
eax <- eax < 52
```
A lazy flag mechanism is used to speed arithmetic (applies to both jit and
interpreted mode, see
[`arith.rs`](https://github.com/copy/v86/blob/master/src/rust/cpu/arith.rs) and
[`misc_instr.rs`](https://github.com/copy/v86/blob/master/src/rust/cpu/misc_instr.rs)).
There's a wip that tries to elide most lazy-flags updates:
https://github.com/copy/v86/pull/466
FPU instructions are emulated using softfloat (very slow, but unfortunately
some code relies on 80 bit floats).
================================================
FILE: docs/linux-9p-image.md
================================================
In order to create a Linux image that can mount the 9p file system, add the following lines to the kernel configuration:
```
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_9P_DEBUG=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_9P_FS=y
CONFIG_9P_FSCACHE=y
CONFIG_9P_FS_POSIX_ACL=y
```
A Dockerfile for this build is here: https://github.com/ysangkok/build-v86-9p-linux
Using initcpio
--------------
This allows you to remount the root file system using 9p. No changes are necessary if you only want to mount a 9p filesystem after booting.
Add the following files:
`/etc/initcpio/hooks/9p_root`
```bash
#!/usr/bin/bash
run_hook() {
mount_handler="mount_9p_root"
}
mount_9p_root() {
msg ":: mounting '$root' on real root (9p)"
if ! mount -t 9p host9p "$1"; then
echo "You are now being dropped into an emergency shell."
launch_interactive_shell
msg "Trying to continue (this will most likely fail) ..."
fi
}
```
<hr>
`/etc/initcpio/install/9p_root`
```bash
#!/bin/bash
build() {
add_runscript
}
```
Change the following options in `/etc/mkinitcpio.conf`:
```bash
MODULES="virtio_pci 9p 9pnet 9pnet_virtio"
HOOKS="base udev autodetect modconf block filesystems keyboard fsck 9p_root" # appended 9p_root
```
================================================
FILE: docs/networking.md
================================================
# v86 networking
User guide to networking in v86.
## Introduction
On the most basic level, networking in v86 is comprised of two components:
* an emulation of the guest's [Network Interface Controller](https://en.wikipedia.org/wiki/Network_interface_controller) (NIC), and
* a network backend which passes ethernet frames between the NIC and a virtual and/or physical [ethernet network](https://en.wikipedia.org/wiki/Ethernet).
There are two **NIC emulations** supported by v86 to chose from, either **`ne2k`** (NE2000/RTL8390-compatible NIC) or **`virtio`** ([VirtIO](http://wiki.osdev.org/Virtio)-compatible device). The right choice simply depends on the driver support in the guest OS, older OSes like FreeDOS only support NE2000, more modern ones usually support VirtIO. In case both are supported by the guest OS it's recommended to try VirtIO first and only fall back to NE2000 if that fails. In some cases it will also be necessary to manually load a driver or similar to activate the NIC and/or networking in the guest OS, yet modern systems usually auto-detect an available NIC during installation and when booting.
There are also several **network backends** to chose from which emulate the network that the virtual NIC is connected to, they differ in their requirements and in the degree of network access and services provided to guests. Some provide only limited network access, others full access to a physical network which may include a gateway to the Internet. Backends may require a specific type of proxy server to operate.
### Backend URL schemes
The active network backend is configured through a user-specified **backend URL**. Each backend has at least one distinct URL scheme as specified below, where `PROXY` is the DNS hostname or IP address of a compatible proxy server, `PORT` its optional TCP port number (and its default), and `QUERY` is some HTTP query field fragment:
| Backend | Backend URL scheme(s) | Example(s) |
| :------ | :-------------------- | :--------- |
| **[inbrowser](#the-inbrowser-backend)** | `inbrowser` | `inbrowser` |
| **[wsproxy](#the-wsproxy-backend)** | `"ws://" PROXY [":" PORT=80] ["/" ...]`<br>`"wss://" PROXY [":" PORT=443] ["/" ...]` | `wss://relay.widgetry.org/` |
| **[wisp](#the-wisp-backend)** | `"wisp://" PROXY [":" PORT=80] ["/" ...]`<br>`"wisps://" PROXY [":" PORT=443] ["/" ...]` | `wisp://localhost:12345` |
| **[fetch](#the-fetch-backend)** | `"fetch" [ "://" PROXY [":" PORT] ["/" QUERY] ]` | `fetch`<br>`fetch://localhost:1234/?url=` |
Note that `wss://` and `wisps://` are the TLS-secured transports of `ws://` and `wisp://`, respectively.
> [!TIP]
> Since public proxy servers provide only limited bandwidth it is recommended to install and use a local, private proxy server for best results. All proxy servers allow to be executed on the local machine, in a VM running on the local machine, in a local network or even publicly on the Internet (which is generally not recommended, of course). Many proxy servers are distributed as Docker containers which is the recommended way of installing them, otherwise install into a VM.
## Network setup
### Web interface setup
Network setup in the v86 web interface at **https://copy.sh/v86/** is straightforward, simply copy the backend URL into the text box named **`Networking proxy`** or select one of the presets to configure the network backend. The guest's NIC emulation (NE2000 or VirtIO) is automatically configured when selecting the guest image in the web interface.
### Embedded v86 setup
JavaScript applications that do not use the v86 web interface (but instead embed V86 into their architecture) setup their network by using the common `config` object that they pass to the V86 constructor. Network settings are members of the object **`config.net_device`**, all settings are optional except for `relay_url`.
#### General `net_device` settings
Common options in `config.net_device`:
| net_device | type | description |
| :------------ | :--- | :--- |
| **type** | str | The type of emulated NIC provided to the guest OS, either `ne2k` or `virtio`. Default: `ne2k`. |
| **relay_url** | str | The network backend URL, see [Backend URL schemes](#backend-url-schemes) for details. Note that the CORS proxy server of the `fetch` backend is defined in field `cors_proxy` below. This option is required. |
| **id** | int | Network id, all v86 network instances with the same id share the same network namespace. Default: `0`.<br>*(TODO: class `NetworkAdapter` should also get options.net_device as an argument, at least options.net_device.id).* |
#### Special `net_device` settings
Backends `fetch` and `wisp` support a couple of special settings in `config.net_device` to control virtual network components emulated by the backend:
| net_device | type | description |
| :------------- | :--- | :--- |
| **router_mac** | str | MAC address of virtual network peers (ARP, PING, DHCP, DNS, NTP, UDP echo and TCP peers) in common MAC address notation. Default `52:54:0:1:2:3`. |
| **router_ip** | str | IP address of virtual network peers (ARP, PING, DHCP, DNS and TCP peers) in dotted IP notation. Default `192.168.86.1`. |
| **vm_ip** | str | IP address to be assigned to the guest by DHCP in dotted IP notation. Default `192.168.86.100`. |
| **masquerade** | bool | If `True`, announce `router_ip` as the router's and DNS server's IP addresses in generated DHCP replies, and also generate ARP replies to IPs outside the router's subnet `255.255.255.0`. Default: `True`. |
| **dns_method** | str | DNS method to use, either `static` or `doh`. `static`: use built-in DNS server, `doh`: use [DNS-over-HTTPS](https://en.wikipedia.org/wiki/DNS_over_HTTPS) (DoH). Defaults to `static` for `fetch` and to `doh` for `wisp` backend. |
| **doh_server** | str | Host name or IP address (and optional port number) of the DoH server if `dns_method` is `doh`. The value is expanded to the URL `https://DOH_SERVER/dns-query`. Default: `cloudflare-dns.com`. |
| **cors_proxy** | str | CORS proxy server URL, do not use a proxy if undefined. Default: undefined (`fetch` backend only). |
| **mtu** | int | The MTU used for the virtual network. Increasing it can improve performance. This only works if the NIC type is `virtio`. Default: `1500` |
#### Example `net_device` settings
* **Example 1:** Provide an emulated NE2000 NIC to the guest OS and use the `wsproxy` backend with a secure wsproxy server at public host `relay.widgetry.org` listening at default TLS port 443:
```javascript
let example_1 = new V86({
net_device: {
relay_url: "wss://relay.widgetry.org/"
},
// ...
});
```
* **Example 2:** Provide a VirtIO NIC to the guest OS and use the `fetch` backend with a CORS proxy server at the local machine listening at port number 23456:
```javascript
let example_2 = new V86({
net_device: {
type: "virtio",
relay_url: "fetch",
cors_proxy: "https://localhost:23456/?url="
},
// ...
});
```
## Network backends
One way to compare the different network backends is how they operate on different layers of the TCP/IP Model (see [Wikipedia](https://en.wikipedia.org/wiki/OSI_model#Comparison_with_TCP/IP_model) for a comparison to the OSI model), approximately:
Network Peer Backend v86 Guest
[ Application ] <---- fetch ----> +-----+ [ Application ]
[ Transport ] <---- wisp -----> | v86 | [ Transport ]
[ Network ] | | [ Network ]
[ Access ] <--- wsproxy ---> +-----+ <---> [ Access ]
and inbrowser
Fig. 1: Network backends in v86
v86 guests strictly expect to exchange raw ethernet frames with their (emulated) network card, hence the higher the layer that a v86 network backend operates on the more virtualized the network becomes and the more work has to be done by the backend to fill in for the missing layers.
In order to facilitate this for backend implementations, v86 provides helper functions to encode/decode ethernet frames, ARP and IPv4 packets, UDP datagrams, TCP streams and HTTP requests/responses. v86 can also provide minimal but sufficient ARP, ICMP-echo, DHCP, DNS (including DoH) and NTP services to guests.
The v86 architecture is open for additional network backend implementations, for a basic example see [examples/two_instances.html](../examples/two_instances.html).
### The `inbrowser` backend
This backend provides raw ethernet services for multiple v86 guests running within the same browser process (meaning within the same web page and/or in separate browser tabs). It works standalone without a proxy server, but it also does not provide any access to external networks.
The `inbrowser` backend is implemented using the browser-internal [BroadcastChannel](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel) API, due to its simplicity it is the most efficient backend, however all VMs have to share the same browser resources.
### The `wsproxy` backend
A backend based on a proxy server that provides raw ethernet services to guests using the [WebSocket](https://en.wikipedia.org/wiki/WebSocket) protocol for transport. It depends on the specific proxy server what kind of network configuration it presents to guests, but usually a separate IP subnet with DHCP and DNS services and optional access to the server's physical network and possibly Internet are provided.
Since this backend (including its proxy server) only forwards unmodified ethernet frames it is inherently efficient while providing full physical network emulation to guests.
**Proxy server**
* **[websockproxy](https://github.com/benjamincburns/websockproxy)** -- one TAP device for all clients, integrates dnsmasq for DHCP/DNS, no TLS, original server by benjamincburns
* Docker container [`benjamincburns/jor1k-relay`](https://hub.docker.com/r/benjamincburns/jor1k-relay) is throttled, see [this comment](https://github.com/benjamincburns/websockproxy/issues/4#issuecomment-317255890)
* Docker container [`bellenottelling/websockproxy`](https://hub.docker.com/r/bellenottelling/websockproxy) is unthrottled
* [See here](https://github.com/copy/v86/discussions/1175#discussioncomment-11199254) for step-by-step instructions on how to unthrottle websockproxy manually.
* **[go-websockproxy](https://github.com/gdm85/go-websockproxy)** -- one TAP device for all clients, written in Go, without integraded DHCP but with integrated TLS support
* **[node-relay](https://github.com/krishenriksen/node-relay)** -- like websockproxy but written for NodeJS (dnsmasq/no TLS), see [New websocket ethernet switch built using Node.js #777](https://github.com/copy/v86/discussions/777)
* **[wsnic](https://github.com/chschnell/wsnic)** -- uses a single bridge and one TAP device per client, integrates dnsmasq for DHCP/DNS and stunnel for TLS
* **[RootlessRelay](https://github.com/obegron/rootlessRelay)** -- uses its own network stack that doesn't require TUN/TAP devices, has a built-in reverse proxy and admin interface, see [RootlessRelay #1442](https://github.com/copy/v86/discussions/1442)
[See here](https://github.com/copy/v86/discussions/1199#discussioncomment-12026845) for a benchmark comparing the download performance of these proxy servers.
### The `wisp` backend
The `wisp` backend implements the client side of the [WISP protocol](https://github.com/MercuryWorkshop/wisp-protocol). WISP is a client/server protocol designed to exchange messages containing UDP and TCP payloads between a WebSocket client and a WISP-compatible proxy server. Note that WISP transports only the packet payloads, not the raw UDP or TCP packets.
This backend monitors outbound traffic from guests and wraps/unwraps TCP payload data in WISP messages. A TCP state machine is included to terminate the guest's TCP stream. In addition to the TCP stream, virtual replies to ARP, DHCP, DNS, NTP, ICMP-Ping and UDP-Echo requests from guests are generated (to a certain degree). See PR [#1097](https://github.com/copy/v86/pull/1097) for additional information about this backend.
v86 guests are isolated from each other when using the `wisp` backend.
**WISP-compatible proxy server**
* **[wisp-js](https://www.npmjs.com/package/@mercuryworkshop/wisp-js)**
* **[epoxy-tls](https://github.com/MercuryWorkshop/epoxy-tls)**
> [!NOTE]
> The WISP protocol only supports UDP and TCP client sockets in the v86 guest, any server sockets listening in the guest are not supported.
> [!NOTE]
> This WISP implementation does not support UDP, only TCP. Once UDP is added, regular DNS over UDP will become the default (instead of DoH), and the builtin NTP and UDP-Echo servers will be removed.
### The `fetch` backend
The `fetch` backend uses the browser's [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API to allow guests to send HTTP requests to external HTTP servers and to receive related HTTP responses. This is however complicated by the fact that browsers add [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) to HTTP requests initiated by `fetch()`, and that they check the CORS headers of related HTTP responses to block access to external web resources not authorized to `fetch()` in the given context.
This backend is efficient and very useful in cases where CORS is not in the way, otherwise (and in general) a CORS proxy server must be used to provide access to HTTP servers on the open Internet.
Like the [`wisp`](#the-wisp-backend) backend, the `fetch` backend handles DHCP and ARP requests from guests internally, and additionally monitors the guest's outbound traffic for HTTP requests which it translates into calls to `fetch()`. NTP, ICMP pings and UDP echo packets are handled to a certain degree. Note that `fetch()` performs the DNS lookup using the browser's internal DNS client. See PR [#1061](https://github.com/copy/v86/pull/1061) for additional technical details.
Starting with PR [#1233](https://github.com/copy/v86/pull/1233), the TCP guest listener can be accessed from JS API, see the [examples/tcp_terminal.html](../examples/tcp_terminal.html) example.
v86 guests are isolated from each other when using the `fetch` backend.
v86 guests have HTTP access to the host's `localhost` using the URL `http://<port>.external` (e.g. `1234.external` -> `localhost:1234`).
**CORS proxy server**
* **[cors-anywhere](https://github.com/Rob--W/cors-anywhere)** -- NodeJS
* **[uncors](https://github.com/chschnell/uncors)** -- A simple PHP-based CORS proxy server for Apache2.
> [!TIP]
> You can pass the following flags to **chromium** to allow browsing without restrictions when using the fetch backend:
>
> --disable-web-security --user-data-dir=/tmp/test
>
> **NOTE:** This turns off the same-origin policy and should only be used temporarily!
## Related topics
### v86 run-time state images
v86 supports saving and restoring the guest's and emulator's run-time state in **state image** files.
When restoring a state image, v86 randomises the restored guest's MAC address to make sure that multiple VMs restored from the same state image use different MAC addresses. However, the restored guest OS is unaware that its NIC's MAC address has changed which prevents it from sending and receiving packets correctly. There are several workarounds:
- Unload the network driver before saving the state. On Linux, unloading can be
done using `rmmod ne2k-pci` or `echo 0000:00:05.0 >
/sys/bus/pci/drivers/ne2k-pci/unbind` and loading (after the state has been
loaded) using `modprobe ne2k-pci` or `echo 0000:00:05.0 >
/sys/bus/pci/drivers/ne2k-pci/bind`
- Pass `preserve_mac_from_state_image: true` to the V86 constructor. This
causes MAC addresses to be shared between all VMs with the same state image.
- Pass `mac_address_translation: true` to the V86 constructor. This causes v86
to present the old MAC address to the guest OS, but translate it to a
randomised MAC address in outgoing packets (and vice-versa for incoming
packets). This mechanism currently only supports the ethernet, ipv4, dhcp and
arp protcols. See `translate_mac_address` in
[`src/ne2k.js`](https://github.com/copy/v86/blob/master/src/ne2k.js). This is
currently used in Windows, ReactOS and SerenityOS profiles.
- Some OSes don't cache the MAC address when the driver loads and therefore
don't need any of the above workarounds. This seems to be the case for Haiku,
OpenBSD and FreeBSD.
Note that the same applies to IP addresses, so a DHCP client should only be run
after the state has been loaded.
### NodeJS
Network backends `wsproxy` and `wisp` depend on a browser-compatible `WebSocket` constructor being present which is the case since NodeJS v22, backends `inbrowser` and `fetch` should work straightaway.
## Links
* [`examples/two_instances.html`](../examples/two_instances.html), example code that shows how to connect two VMs in a web page with a virtual ethernet crossover cable.
* [`examples/broadcast-network.html`](../examples/broadcast-network.html), example code that shows the raw packet API.
* [`examples/tcp_terminal.html`](../examples/tcp_terminal.html), example code that shows how to communicate with a guest TCP port on the `fetch` backend.
* [DC through windows OS for experimental lab #1195](https://github.com/copy/v86/discussions/1195), demonstrates how to setup a Domain Controller for two Windows VMs (XP and Server 2003) using a virtual crossover cable.
* [Working on a new cross-platform network relay that is a full virtualized network #1064](https://github.com/copy/v86/discussions/1064) (used in [env86 #1085](https://github.com/copy/v86/discussions/1085))
================================================
FILE: docs/profiling.md
================================================
v86 has a built-in profiler, which instruments generated code to count certain
events and types of instructions. It can be used by building with `make
debug-with-profiler` and opening debug.html.
For debugging networking, packet logging is available in the UI in both debug
and release builds. The resulting `traffic.hex` file can be loaded in Wireshark
using file -> import from hex -> tick direction indication, timestamp %s.%f.
================================================
FILE: docs/sse-shifts.txt
================================================
0F F1 PSLLW mm mm/m64 mmx Shift Packed Data Left Logical
66 0F F1 PSLLW xmm xmm/m128 sse2 Shift Packed Data Left Logical
0F F2 PSLLD mm mm/m64 mmx Shift Packed Data Left Logical
66 0F F2 PSLLD xmm xmm/m128 sse2 Shift Packed Data Left Logical
0F F3 PSLLQ mm mm/m64 mmx Shift Packed Data Left Logical
66 0F F3 PSLLQ xmm xmm/m128 sse2 Shift Packed Data Left Logical
0F E1 PSRAW mm mm/m64 mmx Shift Packed Data Right Arithmetic
66 0F E1 PSRAW xmm xmm/m128 sse2 Shift Packed Data Right Arithmetic
0F E2 PSRAD mm mm/m64 mmx Shift Packed Data Right Arithmetic
66 0F E2 PSRAD xmm xmm/m128 sse2 Shift Packed Data Right Arithmetic
0F D1 PSRLW mm mm/m64 mmx Shift Packed Data Right Logical
66 0F D1 PSRLW xmm xmm/m128 sse2 Shift Packed Data Right Logical
0F D2 PSRLD mm mm/m64 mmx Shift Packed Data Right Logical
66 0F D2 PSRLD xmm xmm/m128 sse2 Shift Packed Data Right Logical
0F D3 PSRLQ mm mm/m64 mmx Shift Packed Data Right Logical
66 0F D3 PSRLQ xmm xmm/m128 sse2 Shift Packed Data Right Logical
0F 71 PSRLW mm imm8 mmx Shift Packed Data Right Logical
66 0F 71 PSRLW xmm imm8 sse2 Shift Packed Data Right Logical
0F 71 PSRAW mm imm8 mmx Shift Packed Data Right Arithmetic
66 0F 71 PSRAW xmm imm8 sse2 Shift Packed Data Right Arithmetic
0F 71 PSLLW mm imm8 mmx Shift Packed Data Left Logical
66 0F 71 PSLLW xmm imm8 sse2 Shift Packed Data Left Logical
0F 72 PSRLD mm imm8 mmx Shift Double Quadword Right Logical
66 0F 72 PSRLD xmm imm8 sse2 Shift Double Quadword Right Logical
0F 72 PSRAD mm imm8 mmx Shift Packed Data Right Arithmetic
66 0F 72 PSRAD xmm imm8 sse2 Shift Packed Data Right Arithmetic
0F 72 PSLLD mm imm8 mmx Shift Packed Data Left Logical
66 0F 72 PSLLD xmm imm8 sse2 Shift Packed Data Left Logical
0F 73 PSRLQ mm imm8 mmx Shift Packed Data Right Logical
66 0F 73 PSRLQ xmm imm8 sse2 Shift Packed Data Right Logical
66 0F 73 PSRLDQ xmm imm8 sse2 Shift Double Quadword Right Logical
0F 73 PSLLQ mm imm8 mmx Shift Packed Data Left Logical
66 0F 73 PSLLQ xmm imm8 sse2 Shift Packed Data Left Logical
66 0F 73 PSLLDQ xmm imm8 sse2 Shift Double Quadword Left Logical
================================================
FILE: docs/windows-9x.md
================================================
## Installing using QEMU
Recommended versions:
- Windows 95 OSR2(.5)
- Windows 98 Second Edition (SE)
-------------
1. Create a disk image (up to 2 GB):
```sh
qemu-img create -f raw hdd.img <size in megabytes>M
```
2. Run QEMU with the following settings:
```sh
qemu-system-i386 -m 128 -M pc,acpi=off -drive file=hdd.img,format=raw
```
- add `-cdrom /path/to/installCD.iso`, if you use a CD version.
- add `-fda /path/to/boot_floppy.img -boot a`, if you use a floppy version or your install CD is non-bootable.
- (optionally) add `-device sb16` to enable sound
- (optionally) add `-nic user,model=ne2k_pci` or `-device ne2k_pci,netdev=<...>` to enable networking
3. For Windows 98: select "Start Windows 98 Setup from CD-ROM". For Windows 95: select "Load NEC IDE CDROM driver" and run `fdisk` to create partition, restart emulator, run `format c:` and `D:\WIN95\SETUP`.
4. To change floppy disk, press *Ctrl+Alt+2* to switch to the QEMU Monitor, run `change floppy0 /path/to/new_floppy_image` and press *Ctrl+Alt+1* to switch to VGA.
5. Follow the installation guide on the screen.
> [!TIP]
> For transfer files from host to guest, use [genisoimage](https://wiki.debian.org/genisoimage) ([UltraISO](https://www.ultraiso.com/) and [PowerISO](https://www.poweriso.com/) for Windows and Mac) for creating CD-ISO image or [dosfstools](https://github.com/dosfstools/dosfstools) ([WinImage](https://www.winimage.com/download.htm) for Windows) for creating floppy disk images, then mount the created image to QEMU.
## Troubleshooting
### "Windows protection" errors during startup
Apply [FIX95CPU](http://lonecrusader.x10host.com/fix95cpu.html) or [patcher9x](https://github.com/JHRobotics/patcher9x#installation).
### "VFBACKUP could no load VFD.VXD" on startup (Windows 95)
**Workaround #1**:
*Source: [#1185](https://github.com/copy/v86/issues/1185)*
1. Mount the installation CD (or `Disk 3` for the RTM version on floppy disks).
2. Open the "MS-DOS prompt" and run:
For the CD version:
```bat
extract /a /l C:\Windows\System <cd-rom letter>:\WIN95\WIN95_02.CAB vfd.vxd
```
For the floppy version:
```bat
extract /a /l C:\Windows\System <floppy drive letter>:\WIN95_03.CAB vfd.vxd
```
**Workaround #2**:
*Source: [#289](https://github.com/copy/v86/issues/289)*
1. Open the Start menu, click on "Run" and run `sysedit`.
2. Find `C:\AUTOEXEC.BAT` and add `smartdrv` to the top of the file.
3. Press File -> Save.
## Floppy disk support
Currently, the floppy drive in v86 works only with MS-DOS compatibility mode.
To check this: open the Start menu, click on "Control Panel" and "System", select "Performance" tab.
If it says *"Drive A is using MS-DOS compatibility mode file system"*, the floppy drive should work properly in v86. If not, try this solution:
1. Click on "Device Manager" in "System Properties".
2. Open "Floppy disk controllers", select "Standard Floppy Disk Controller" and press "Remove" at the bottom.
3. Restart Windows.
## Enabling True Color (32 bpp)
The default VGA display driver only supports 640x480x4 video mode, to fix this, you can install **Universal VBE9x Video Display Driver** or **VMDisp9x**.
### Universal VBE9x Video Display Driver
> [!WARNING]
> After installing, DOS Mode (and other programs and games that require it) may not work properly.
> This is a problem in VBE9x, not v86, see [#110](https://github.com/copy/v86/issues/110).
> Also, this driver doesn't support DirectX, DirectDraw and OpenGL.
1. Download driver from https://bearwindows.zcm.com.au/vbe9x.htm and unpack into Windows.
2. Right-click on the Desktop, click on "Properties".
3. Click "Advanced" > "Adapter" > "Change".
4. Press "Next", select "Display a of all the drivers in a specific location..." and press again "Next".
5. Press "Have Disk...", click "Browse" and go to folder with unpacked driver. Inside the folder with driver, should be folders like `032mb`, `064mb`, `128mb`. Choose a version based on needed video memory size (for example, `032mb`), then select `vbemp.inf` inside.
6. Select "VBE Miniport" adapter, press "OK" and "Next".
7. After installing, restart Windows.
### VMDisp9x (Windows 95)
> [!WARNING]
> This driver can run DOS Mode with some graphical glitches. However, DirectX and/or DirectDraw may not work properly with this driver.
> Also, this driver doesn't support OpenGL.
1. Download `vmdisp9x-<...>-driver-2d.img` from https://github.com/JHRobotics/vmdisp9x/releases.
2. Mount as floppy image, right-click on the Desktop, click on "Properties".
3. Click "Advanced" > "Adapter" > "Change".
4. Press "Have Disk...", click "Browse" and go to the floppy.
5. Select "VESA ISA" adapter and press "OK".
6. After installing, restart Windows.
## CPU idling on Windows 95
See about [installing AmnHLT](cpu-idling.md#windows-9x-using-amnhlt).
## Enabling networking on Windows 95 (requires install CD)
1. Open the Start menu, click on "Control Panel" and "Add New Hardware".
2. Press "Next", select "No" and select next options:
| Option | Value |
|:--------------|:------------------|
| Hardware type | Network adapters |
| Manufacturers | Novell |
| Models | NE2000 Compatible |
3. Press "Next" and restart Windows.
4. After restarting, right-click on "My computer", select "Propeties".
5. Open "Device Manager" tab, select "NE2000 Compatible" (in "Network adapters") and press "Properties"
6. Open "Resources", change values by selecting the properties and click on "Change Setting":
| Option | Value |
|:-------------------|:------------|
| Interrupt Request | 10 |
| Input/Output Range | 0300 - 031F |
7. In "Control Panel", open "Network", click on "Add", choose "Protocol" and select the following options:
| Option | Value |
|:------------------|:----------|
| Manufacturers | Microsoft |
| Network Protocols | TCP/IP |
8. (optionally) Set "Primary Network Logon" to `Windows Logon`.
## Enabling sound manually
> [!NOTE]
> If you don't have an install CD, use the Sound Blaster 16 driver from https://web.archive.org/web/20210814023225/https://www.claunia.com/qemu/drivers/index.html (unpack `sbw9xup.exe` as a zip archive).
1. Open "Start" menu, click on "Control Panel" and "Add New Hardware".
2. Press "Next", select "No" and select the following options:
| Option | Value |
|:--------------|:-----------------------------------------|
| Hardware type | Sound, video and game cotrollers |
| Manufacturers | Creative Labs |
| Models | Creative Labs Sound Blaster 16 or AWE-32 |
3. Restart Windows.
================================================
FILE: docs/windows-nt.md
================================================
- [Windows NT 3.1](#windows-nt-31) / [3.51](#windows-nt-351) / [4.0](#windows-nt-40)
- [Windows 2000/XP](#windows-2000xp)
- [Windows Vista and newer](#windows-vista-and-newer)
------------------------
## Windows NT 3.1
### Installing using QEMU
1. Install MS-DOS and [Oak CD-ROM Driver](https://www.dosdays.co.uk/topics/Software/optical_downloads.php).
2. Create 4 blank floppy disk images:
- run `qemu-img create -f raw floppy.img 1440K`
- mount (`-fda floppy.img`) and run `format A:` in a VM
3. Run QEMU with the following settings for installation:
```sh
qemu-system-i386 -m 64 -drive file=hdd.img,format=raw -cpu pentium -M pc,acpi=off -cdrom InstallCD.iso
```
4. Run `xcopy /v <CD-ROM letter>:\I386\ C:\install\` in a VM to copy all files, disable the CD-ROM driver.
5. Run QEMU with the following settings:
```sh
qemu-system-i386 -m 64 -drive file=hdd.img,format=raw -cpu pentium -M pc,acpi=off
```
6. Run `C:\install\winnt /F /C` in a VM.
7. Follow the setup instructions. To change floppy disk, press *Ctrl+Alt+2* to switch to the QEMU Monitor, run `change floppy0 /path/to/new_floppy_image` and press *Ctrl+Alt+1* to switch to VGA.
## Windows NT 3.51
### Installing
> [!NOTE]
> In newer versions of QEMU, the Windows Setup may not work, you can use an older version of QEMU, PCem, 86Box or PCBox instead.
1. If you install via MS-DOS, install [the Oak CD-ROM Driver](https://www.dosdays.co.uk/topics/Software/optical_downloads.php) and run `<CD-ROM letter>:\I386\WINNT /B`.
2. Follow the setup instructions.
3. After installing, download NT 3.51 SuperPack ([here](https://bearwindows.zcm.com.au/winnt351.htm#4) or [here](https://alter.org.ua/en/soft/nt_spack/nt3/)), unpack the archive into a Windows and copy files from `FAT32` (`SYS\FAT32`) and `RENEW` (`SYS\RENEW`) folders in `C:\WINNT35\system32\drivers` with replacing.
### Enabling networking
1. Open "Control Panel" > "Network", install Windows NT Networking (installation CD required).
2. In "Network Adapter Card Detection", press Continue three times, set `Network Adapter Card: Novell NE2000 Compatible Adapter`.
3. Set the following settings and click Continue:
```
IRQ Level: 10
I/O Port Address: 0x300
```
4. In "Bus Location", press OK. Check the boxes "TCP/IP Transport" and "Enable Automatic DHCP Configuration" in the next window.
5. In "TCP/IP Configuration", check the box "Enable Automatic DHCP Configuration".
6. Restart the VM.
## Windows NT 4.0
Recommended version: Windows NT 4.0 SP1
### Installing using QEMU
1. Run QEMU with the following settings for installation:
```sh
qemu-system-i386 -m 64 -drive file=hdd.img,format=raw -cdrom InstallCD.iso -cpu pentium -M pc,acpi=off
```
2. On setup startup, press F5 and select "Standard PC".
3. Follow the setup instructions.
### Running in v86
Due to a problem with CPUID, you need to add `cpuid_level: 2` and `acpi: false` to the V86 constructor (not supported in the UI):
```js
var emulator = new V86({
...
cpuid_level: 2,
acpi: false
});
```
## Windows 2000/XP
### Installing using QEMU
1. Run QEMU with the following settings for installation:
```sh
qemu-system-i386 -m 512 -drive file=hdd.img,format=raw -cdrom InstallCD.iso
```
Optional:
- add `-device sb16` to enable sound
- add `-nic user,model=ne2k_pci` or `-device ne2k_pci,netdev=<...>` to enable networking
2. Follow the setup instructions.
3. This step fixes the error `Uncaught RangeError: Maximum call stack size exceeded` in Chromium during Windows 2000/XP startup in v86.
After installation, change the computer type to "Standard PC" as described [here](http://web.archive.org/web/20220528021535/https://www.scm-pc-card.de/file/manual/FAQ/acpi_uninstallation_windows_xp_english.pdf):
1. Open Start menu, right-click on "My Computer", select "Manage"
2. Open Device Manager, open Computer, right-click on "ACPI Uniprocessor PC"
3. Select "Update Driver..." > "No, not this time"
4. Select "Install from a list or specific location (Advanced)" > Next > "Don't search. I will choose the driver to install."
5. Choose "Standard PC", press Next > Finish.
6. Restart the VM, follow multiple "Found New Hardware Wizard" dialogs with default options.
### Enabling True Color (for Windows 2000)
> [!NOTE]
> This driver doesn't support DirectX, DirectDraw and OpenGL.
1. Download driver from https://bearwindows.zcm.com.au/vbemp.htm and unpack into Windows.
2. Open Start menu, right-click on "My Computer", select "Manage"
3. Open Device Manager, open Computer and right-click on "Video Controller".
4. Press "Properties", select "Driver" tab and press "Update Driver".
5. Select "Display a list of the known drivers for this device...", choose "Display adapters".
5. Press "Have Disk...", click "Browse" and go to folder with unpacked driver. Go to `VBE20\W2K\PNP`, then select `vbemppnp.inf` inside.
6. Select "VBE Miniport" adapter, press "Yes" and "Next".
7. After installing, restart the VM.
### Enabling sound
*Source: [#1049](https://github.com/copy/v86/issues/1049)*
1. Right-click on "My computer" > "System Properties", select "Hardware" tab, press "Hardware Wizard"
2. Press "Next" > "Add/Troubleshoot a device" > "Add a new device"
3. Select "No, I want to select the hardware from a list" > "Sound, video and game controllers"
4. Select the following options and press "Next":
```
Hardware type: Sound, video and game cotrollers
Manufacturers: Creative Technology Ltd.
Models: Sound Blaster 16 or AWE32 or compatible (WDM)
```
## Windows Vista and newer
### Installing using QEMU
1. Run QEMU with the following settings for installation:
```sh
qemu-system-i386 -m 1024 -drive file=hdd.img,format=raw -cdrom InstallCD.iso
```
Optionally add `-accel kvm` (for Linux host), `-accel whpx` (for Windows host) or `-accel hvf` (for MacOS host) to use hypervisor acceleration.
2. Follow the setup instructions.
### Running in v86
Enable ACPI and set the memory size to 512 MB or more.
### Enabling networking (ne2k)
*Source: https://phaq.phunsites.net/2007/05/21/vista-on-xen-using-ne2000-in-favor-to-rtl8139/*
1. Download https://phaq.phunsites.net/files/2007/05/drivercd.iso_.zip, unpack the archive, mount the ISO to the VM (`-cdrom path/to/drivercd.iso` or `change ide1-cd0 path/to/drivercd.iso` in QEMU Monitor), unpack the archive from CDROM into Windows.
2. Open Start Menu > "Control Panel" > "System" > "Device Manager"
3. Right-click on "Ethernet Controller" > "Update Driver Software", press "Browse my computer for driver software".
4. Click "Browse" and go to folder with unpacked driver, select `WIN2000` folder, press "Install this driver software anyway".
================================================
FILE: eslint.config.mjs
================================================
export default [
{
"languageOptions": {
"globals": {
"process": "readonly",
"window": "writable",
"navigator": "writable",
"location": "writable",
"document": "readonly",
"console": "readonly",
"crypto": "readonly",
"alert": "readonly",
"performance": "readonly",
"URL": "readonly",
"WebAssembly": "readonly",
"setTimeout": "readonly",
"setInterval": "readonly",
"clearTimeout": "readonly",
"clearInterval": "readonly",
"requestAnimationFrame": "readonly",
"cancelAnimationFrame": "readonly",
"Buffer": "readonly",
"FileReader": "readonly",
"TextEncoder": "readonly",
"TextDecoder": "readonly",
"fetch": "readonly",
"Headers": "readonly",
"Response": "readonly",
"WebSocket": "readonly",
"Blob": "readonly",
"File": "readonly",
"XMLHttpRequest": "readonly",
"URLSearchParams": "readonly",
"ImageData": "readonly",
"Image": "readonly",
"OffscreenCanvas": "readonly",
"BroadcastChannel": "readonly",
"HTMLElement": "readonly",
"HTMLTextAreaElement": "readonly",
"AudioContext": "readonly",
"AudioWorkletProcessor": "readonly",
"webkitAudioContext": "readonly",
"AudioWorkletNode": "readonly",
"Worker": "readonly",
"postMessage": "readonly",
"importScripts": "readonly",
"DEBUG": "writable"
}
},
rules: {
"eol-last": "error",
//"no-extra-parens": "error",
"no-trailing-spaces": "error",
"no-extra-semi": "error",
"no-tabs": "error",
"quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
"keyword-spacing": ["error", { "overrides": {
"if": { "after": false },
"for": { "after": false },
"while": { "after": false },
"switch": { "after": false },
"catch": { "after": false },
} }],
"semi": "error",
"no-useless-return": "error",
"eqeqeq": "error",
"no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 0 }],
//"no-var": "error",
"radix": "error",
"comma-style": ["error", "last"],
//"comma-dangle": ["error", "always-multiline"],
"no-sequences": "error",
//"one-var": ["error", "never"],
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
//"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
//"no-constant-condition": "error",
//"no-control-regex": "error",
//"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
//"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
//"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-prototype-builtins": "error",
//"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-undef": "error",
"no-unexpected-multiline": "error",
//"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
//"no-unused-vars": "error",
"no-useless-backreference": "error",
"no-useless-catch": "error",
//"no-useless-escape": "error",
"no-with": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"strict": "error"
}
}
];
================================================
FILE: examples/alpine.html
================================================
<!doctype html>
<title>Alpine</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: { url: "../bios/seabios.bin" },
vga_bios: { url: "../bios/vgabios.bin" },
filesystem: {
baseurl: "../images/alpine-rootfs-flat",
basefs: "../images/alpine-fs.json",
},
autostart: true,
bzimage_initrd_from_filesystem: true,
cmdline: "rw root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose modules=virtio_pci tsc=reliable",
//initial_state: { url: "../images/alpine-state.bin" },
});
};
</script>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/arch.html
================================================
<!doctype html>
<title>Archlinux</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
filesystem: {
baseurl: "../images/arch/",
basefs: "../images/fs.json",
},
autostart: true,
bzimage_initrd_from_filesystem: true,
cmdline: [
"rw",
"root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose",
"init=/usr/bin/init-openrc",
].join(" "),
});
document.getElementById("save_file").onclick = async function()
{
const new_state = await emulator.save_state();
var a = document.createElement("a");
a.download = "v86state.bin";
a.href = window.URL.createObjectURL(new Blob([new_state]));
a.dataset.downloadurl = "application/octet-stream:" + a.download + ":" + a.href;
a.click();
this.blur();
};
document.getElementById("restore_file").onchange = function()
{
if(this.files.length)
{
var filereader = new FileReader();
emulator.stop();
filereader.onload = async function(e)
{
await emulator.restore_state(e.target.result);
emulator.run();
};
filereader.readAsArrayBuffer(this.files[0]);
this.value = "";
}
this.blur();
};
};
</script>
<input id="save_file" type="button" value="Save state to file">
Restore from file: <input id="restore_file" type="file">
<hr>
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/async_load.html
================================================
<!doctype html>
<title>Asynchronous loading of disk images</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
// Async loading of the iso image
// Note how the emulation starts without downloading the 50MB image
// Support of the "Range: bytes=..." header is required on the server, CORS
// is required if the server is on a different host
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 64 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/dsl-4.11.rc2.iso",
async: true,
// size can be determined automatically, but costs an extra request
// and might not work reliably
size: 52824064,
},
autostart: true,
});
}
</script>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/basic.html
================================================
<!doctype html>
<title>Basic Emulator</title><!-- not BASIC! -->
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = window.emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 32 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux.iso",
},
autostart: true,
});
}
</script>
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/broadcast-network.html
================================================
<!doctype html>
<title>Networking via Broadcast Channel API</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = window.emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 64 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
bzimage: {
url: "../images/buildroot-bzimage68.bin",
},
autostart: true,
});
var broadcast = new BroadcastChannel("v86-network");
broadcast.addEventListener("message", function(e) {
emulator.bus.send("net0-receive", e.data);
});
emulator.add_listener("net0-send", function(packet) {
broadcast.postMessage(packet);
});
}
</script>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<pre>
# This example allows network across multiple browser tabs by using BroadcastChannels.
# Configure a static IP
ifconfig eth0 up arp 10.5.0.x
# Ping by IP
ping 10.5.0.x
# Run a DNS server and send a query (10.5.0.x for server, 10.5.0.y for record)
echo "anotherhost 10.5.0.y" | dnsd -c - -v - server
nslookup -type=a anotherhost 10.5.0.x - client
# Telnet calculator
socat TCP-L:23,fork exec:bc
# Simple HTTP server
socat TCP-L:80,crlf,fork system:'echo HTTP/1.1 200 OK;echo;lua /root/test.lua'
</pre>
================================================
FILE: examples/destroy.html
================================================
<!doctype html>
<title>Destroyable Emulator</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 32 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux.iso",
},
autostart: true,
});
setTimeout(() => { emulator.destroy(); }, 1000);
}
</script>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/lang.html
================================================
<!doctype html>
<title>Basic Emulator</title><!-- not BASIC! -->
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var start = Date.now();
setInterval(function()
{
document.getElementById("time").textContent = Math.round((Date.now() - start) / 1000);
}, 999);
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
initial_state: {
url: "../images/arch_state-v2.bin.zst",
},
filesystem: {
baseurl: "../images/arch/",
},
autostart: true,
});
document.getElementById("status").textContent += ".";
emulator.add_listener("emulator-ready", async function()
{
document.getElementById("status").textContent += ".";
var code = "console.log(3 * 7);\n";
var buffer = new Uint8Array(code.length);
buffer.set(code.split("").map(function(chr) { return chr.charCodeAt(0); }));
await emulator.create_file("/root/code.js", buffer);
emulator.serial0_send("node /root/code.js > /root/out.txt 2> /root/out.txt\n");
});
var serial_out = "";
emulator.add_listener("serial0-output-byte", async function(byte)
{
var chr = String.fromCharCode(byte);
serial_out += chr;
if(serial_out.endsWith("root@nyu"))
{
const data = await emulator.read_file("/root/out.txt");
document.getElementById("output").textContent += String.fromCharCode.apply(this, data);
}
});
}
</script>
<pre><span id=time></span> <span id=status></span></pre>
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<hr>
<pre id=output></pre>
================================================
FILE: examples/lua.html
================================================
<!doctype html>
<title>Lua interpreter</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 32 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
// Uncomment to see what's going on
//screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
bzimage: {
url: "../images/buildroot-bzimage68.bin",
},
autostart: true,
disable_keyboard: true,
disable_mouse: true,
});
var data = "";
var do_output = false;
emulator.add_listener("serial0-output-byte", function(byte)
{
var char = String.fromCharCode(byte);
if(char !== "\r")
{
data += char;
}
if(do_output)
{
document.getElementById("result").textContent += char;
}
if(data.endsWith("~% "))
{
console.log("Now ready");
document.getElementById("status").textContent = "Ready.\n";
document.getElementById("run").disabled = false;
do_output = false;
}
});
document.getElementById("source").onkeydown = function(e)
{
if(e.which == 13 && e.ctrlKey)
{
document.getElementById("run").onclick();
}
};
document.getElementById("run").onclick = function()
{
var code = document.getElementById("source").value;
emulator.serial0_send("lua -e " + bashEscape(code) + "\n");
document.getElementById("result").textContent = "";
document.getElementById("status").textContent = "Running ...\n";
this.disabled = true;
do_output = true;
};
};
// https://gist.github.com/creationix/2502704
// Implement bash string escaping.
function bashEscape(arg)
{
arg = arg.replace(/\t+/g, "");
return "'" + arg.replace(/'+/g, function (val) {
return "'" + val.replace(/'/g, "\\'") + "'";
}) + "'";
}
</script>
<textarea id=source rows=20 cols=80>
k = 1
x = 0
while k < 1000 do
x = x + 1 / (k * k)
k = k + 2
end
print(math.sqrt(x*8))
function factorial(n)
if n == 0 then
return 1
else
return n * factorial(n - 1)
end
end
print("factorial(10):", factorial(10))
</textarea>
<button disabled id=run>run (ctrl-enter)</button>
<br>
<hr>
<pre id=status>Wait for boot ...</pre>
<pre id=result></pre>
<hr>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/nodejs.js
================================================
#!/usr/bin/env node
import path from "node:path";
import fs from "node:fs";
import url from "node:url";
import { V86 } from "../build/libv86.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.setEncoding("utf8");
console.log("Now booting, please stand by ...");
var emulator = new V86({
bios: { url: __dirname + "/../bios/seabios.bin" },
vga_bios: { url: __dirname + "/../bios/vgabios.bin" },
cdrom: { url: __dirname + "/../images/linux4.iso" },
autostart: true,
net_device: {
type: "virtio",
relay_url: "fetch",
},
});
emulator.add_listener("serial0-output-byte", function(byte)
{
var chr = String.fromCharCode(byte);
if(chr <= "~")
{
process.stdout.write(chr);
}
});
process.stdin.on("data", function(c)
{
if(c === "\u0003")
{
// ctrl c
emulator.destroy();
process.stdin.pause();
}
else
{
emulator.serial0_send(c);
}
});
================================================
FILE: examples/nodejs_state.js
================================================
#!/usr/bin/env node
import fs from "node:fs";
import url from "node:url";
import { V86 } from "../build/libv86.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
console.log("Use F2 to save the state and F3 to restore.");
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.setEncoding("utf8");
console.log("Now booting, please stand by ...");
var emulator = new V86({
bios: { url: __dirname + "/../bios/seabios.bin" },
cdrom: { url: __dirname + "/../images/linux4.iso" },
autostart: true,
});
emulator.add_listener("serial0-output-byte", function(byte)
{
var chr = String.fromCharCode(byte);
if(chr <= "~")
{
process.stdout.write(chr);
}
});
var state;
process.stdin.on("data", async function(c)
{
if(c === "\u0003")
{
// ctrl c
emulator.destroy();
process.stdin.pause();
}
else if(c === "\x1b\x4f\x51")
{
// f2
state = await emulator.save_state();
console.log("--- Saved ---");
}
else if(c === "\x1b\x4f\x52")
{
// f3
if(state)
{
console.log("--- Restored ---");
await emulator.restore_state(state);
}
}
else
{
emulator.serial0_send(c);
}
});
================================================
FILE: examples/save_restore.html
================================================
<!doctype html>
<title>Save and restore</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 32 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux.iso",
},
autostart: true,
});
var state;
document.getElementById("save_restore").onclick = async function()
{
var button = this;
if(state)
{
button.value = "Save state";
await emulator.restore_state(state);
state = undefined;
}
else
{
const new_state = await emulator.save_state();
console.log("Saved state of " + new_state.byteLength + " bytes");
button.value = "Restore state";
state = new_state;
}
button.blur();
};
document.getElementById("save_file").onclick = async function()
{
const new_state = await emulator.save_state();
var a = document.createElement("a");
a.download = "v86state.bin";
a.href = window.URL.createObjectURL(new Blob([new_state]));
a.dataset.downloadurl = "application/octet-stream:" + a.download + ":" + a.href;
a.click();
this.blur();
};
document.getElementById("restore_file").onchange = function()
{
if(this.files.length)
{
var filereader = new FileReader();
emulator.stop();
filereader.onload = async function(e)
{
await emulator.restore_state(e.target.result);
emulator.run();
};
filereader.readAsArrayBuffer(this.files[0]);
this.value = "";
}
this.blur();
};
};
</script>
<input id="save_restore" type="button" value="Save state">
<input id="save_file" type="button" value="Save state to file">
Restore from file: <input id="restore_file" type="file">
<hr>
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/sectorc.html
================================================
<!doctype html>
<title>v86: sectorc</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
const libc = `int tmp1;
int tmp2;
void shutdown()
{
/* Shutdown via APM: coded in asm machine code directly */
// Check for APM
// | mov ah,0x53; mov al,0x00; xor bx,bx; int 0x15; jc error
asm 180; asm 83; asm 176; asm 0; asm 49; asm 219;
asm 205; asm 21; asm 114; asm 55;
// Disconnect from any APM interface
// | mov ah,0x53; mov al,0x04; xor bx,bx; int 0x15
// | jc maybe_error; jmp no_error
asm 180; asm 83; asm 176; asm 4; asm 49; asm 219;
asm 205; asm 21; asm 114; asm 2; asm 235; asm 5;
// Label: maybe_error
// | cmp ah,0x03; jne error
asm 128; asm 252; asm 3; asm 117; asm 38;
// Label: no_error
// Connect to APM interface
// | mov ah,0x53; mov al,0x01; xor bx,bx; int 0x15; jc error
asm 180; asm 83; asm 176; asm 1; asm 49; asm 219;
asm 205; asm 21; asm 114; asm 28;
// Enable power management for all devices
// | mov ah,0x53; mov al,0x08; mov bx,0x0001; mov cx,0x0001
// | int 0x15; jc error
asm 180; asm 83; asm 176; asm 8;
asm 187; asm 1; asm 0; asm 185; asm 1; asm 0;
asm 205; asm 21; asm 114; asm 14;
// Set the power state for all devices
// | mov ah,0x53; mov al,0x7; mov bx,0x0001; mov cx,0x0003
// | int 0x15; jc error
asm 180; asm 83; asm 176; asm 7;
asm 187; asm 1; asm 0; asm 185; asm 3; asm 0;
asm 205; asm 21; asm 114; asm 0;
// Label: error
// | hlt; jmp error
asm 244; asm 235; asm 253;
}
int store_far_seg;
int store_far_off;
int store_far_val;
void store_far()
{
// mov es, store_far_seg
store_far_seg = store_far_seg;
asm 142; asm 192;
// mov si, store_far_off
store_far_off = store_far_off;
asm 137; asm 198;
// mov es:[si], store_far_val
store_far_val = store_far_val;
asm 38; asm 137; asm 4;
}
int div10_unsigned_n;
int div10_unsigned_q;
int div10_unsigned_r;
void div10_unsigned()
{
/* Taken from "Hacker's Delight", modified to "fit your screen" */
tmp1 = ( div10_unsigned_n >> 1 ) & 32767; // unsigned
tmp2 = ( div10_unsigned_n >> 2 ) & 16383; // unsigned
div10_unsigned_q = tmp1 + tmp2;
tmp1 = ( div10_unsigned_q >> 4 ) & 4095; // unsigned
div10_unsigned_q = div10_unsigned_q + tmp1;
tmp1 = ( div10_unsigned_q >> 8 ) & 255; // unsigned
div10_unsigned_q = div10_unsigned_q + tmp1;
div10_unsigned_q = ( div10_unsigned_q >> 3 ) & 8191; // unsigned
div10_unsigned_r = div10_unsigned_n
- ( ( div10_unsigned_q << 3 ) + ( div10_unsigned_q << 1 ) );
if( div10_unsigned_r > 9 ){
div10_unsigned_q = div10_unsigned_q + 1;
div10_unsigned_r = div10_unsigned_r - 10;
}
}
int print_ch;
void print_char()
{
/* Implement print char via serial port bios function accessed via int 0x14 */
print_ch = print_ch; // mov ax,[&print_ch]
asm 180; asm 1; // mov ah,1
asm 186; asm 0; asm 0 ; // mov dx,0
asm 205; asm 20; // int 0x14
}
// uses 'print_ch'
void print_newline()
{
print_ch = 10;
print_char();
}
int print_num; // input
int print_u16_bufptr;
int print_u16_cur;
void print_u16()
{
print_u16_bufptr = 30000; // buffer for ascii digits
if( print_num == 0 ){
print_ch = 48;
print_char();
}
print_u16_cur = print_num;
while( print_u16_cur != 0 ){
div10_unsigned_n = print_u16_cur;
div10_unsigned();
*(int*) print_u16_bufptr = div10_unsigned_r;
print_u16_bufptr = print_u16_bufptr + 1;
print_u16_cur = div10_unsigned_q;
}
while( print_u16_bufptr != 30000 ){ // emit them in reverse over
print_u16_bufptr = print_u16_bufptr - 1;
print_ch = ( *(int*) print_u16_bufptr & 255 ) + 48;
print_char();
}
}
// uses 'print_num' and 'print_ch'
void print_i16()
{
if( print_num < 0 ){
print_ch = 45; print_char(); // '-'
print_num = 0 - print_num;
}
print_u16();
}
void vga_init()
{
// mov ah,0; mov al,0x13; int 0x10
asm 180; asm 0; asm 176; asm 19; asm 205; asm 16;
}
void vga_clear()
{
// push di; xor di,di; mov bx,0xa000; mov es,bx;
// mov cx,0x7d00; xor ax,ax; rep stos; pop di
asm 87 ; asm 49 ; asm 255; asm 187; asm 0; asm 160;
asm 142; asm 195; asm 185; asm 0; asm 125; asm 49;
asm 192; asm 243; asm 171; asm 95;
}
int pixel_x;
int pixel_y;
void vga_set_pixel()
{
// need to multiply pixel_y by 320 = 256 + 64
// use 'tmp1' for pixel index
tmp1 = ( ( pixel_y << 8 ) + ( pixel_y << 6 ) ) + pixel_x;
// store to 0xa000:pixel_idx
// mov bx,0xa000; mov es,bx; mov bx,ax; mov BYTE PTR es:[bx],0xf
tmp1 = tmp1;
asm 187; asm 0; asm 160; asm 142; asm 195;
asm 137; asm 195; asm 38; asm 198; asm 7; asm 15;
}
int port_num;
int port_val;
void port_inb()
{
dx = port_num;
// mov dx,WORD PTR [0x464]; in al,dx
asm 139; asm 22; asm 160; asm 4; asm 236;
// mov WORD PTR [0x464],ax
asm 137; asm 6; asm 100; asm 4;
port_val = ax;
}
void port_inw()
{
// mov dx,WORD PTR [0x464]; in ax,dx
dx = port_num;
asm 139; asm 22; asm 160; asm 4; asm 237;
// mov WORD PTR [0x464],ax
asm 137; asm 6; asm 100; asm 4;
port_val = ax;
}
void port_outb()
{
dx = port_num;
ax = port_val;
// mov dx,WORD PTR [0x464]
asm 139; asm 22; asm 160; asm 4;
// mov ax,WORD PTR [0x464]
asm 139; asm 6; asm 100; asm 4;
// outb dx,al
asm 238;
}
void port_outw()
{
dx = port_num;
ax = port_val;
// mov dx,WORD PTR [0x464]
asm 139; asm 22; asm 160; asm 4;
// mov ax,WORD PTR [0x464]
asm 139; asm 6; asm 100; asm 4;
// outb dx,al
asm 239;
}
void dump_code_segment_and_shutdown()
{
/* NOTE: This code is in a different segment from data, and our compiled pointer accesses
do not leave the data segment, so we need a little machine code to grab data from the
code segment and stash it in a variable for C */
i = 0;
while( i < 8192 ){ /* Just assuming 8K is enough.. might not be true */
// (put "i" in ax); mov si,ax; mov ax,cs:[si]; mov [&a],ax
i = i; asm 137; asm 198; asm 46; asm 139; asm 4; asm 137; asm 133; asm 98; asm 0;
print_ch = a;
print_char();
i = i + 1;
}
shutdown();
}
`;
const start = `void _start()
{
main();
shutdown();
}
`;
const hello = `int buf;
int ptr;
int len;
void vga_write()
{
/* Text vga is located at b800:0000 */
store_far_seg = 47104; // segment: 0xb800
store_far_off = idx << 1;
store_far_val = ( 15 << 8 ) | ( ch & 255 ); // white fg and black bg
store_far();
}
int x_off;
int y_off;
void vga_write_ch()
{
if( ch != 10 ){
idx = y_off + x_off;
vga_write();
x_off = x_off + 1;
}
if( ( ch == 10 ) | ( x_off == 80 ) ){
y_off = y_off + 80;
x_off = 0;
}
}
int idx;
void vga_clear()
{
idx = 0;
while( idx < 2000 ){ // 80x25
ch = 32; // char: ' '
vga_write();
idx = idx + 1;
}
pos = 0;
}
void main()
{
// dump_code_segment_and_shutdown();
vga_clear();
ch = 72; vga_write_ch();
ch = 101; vga_write_ch();
ch = 108; vga_write_ch();
ch = 108; vga_write_ch();
ch = 111; vga_write_ch();
ch = 10; vga_write_ch();
ch = 32; vga_write_ch();
ch = 102; vga_write_ch();
ch = 114; vga_write_ch();
ch = 111; vga_write_ch();
ch = 109; vga_write_ch();
ch = 10; vga_write_ch();
ch = 32; vga_write_ch();
ch = 32; vga_write_ch();
ch = 83; vga_write_ch();
ch = 101; vga_write_ch();
ch = 99; vga_write_ch();
ch = 116; vga_write_ch();
ch = 111; vga_write_ch();
ch = 114; vga_write_ch();
ch = 67; vga_write_ch();
ch = 10; vga_write_ch();
ch = 32; vga_write_ch();
ch = 32; vga_write_ch();
ch = 32; vga_write_ch();
i = 0;
while( i < 10 ){
ch = 33; vga_write_ch();
i = i + 1;
}
while( 1 ){ }
}
`;
const sinwave = `/* A Sine-wave Animation
Math time:
---------------------------
Along the range [0, pi] we can approximate sin(x) very crudely with a 2nd order quadratic
That is: y = a * x^2 + b * x + c
Three unknowns need three constraints, so picking the easy ones:
x = 0, y = 0
x = pi/2, y = 1
x = pi, y = 0
Solving the linear system:
| 0 0 1 | | a | | 0 |
| pi^2/4 pi/2 1 | * | b | = | 1 |
| pi^2 pi 1 | | c | | 0 |
We get:
a = -4 / pi^2
b = 4 / pi
c = 0
And:
y = 4x(pi - x)/(pi^2)
Engineering time:
---------------------------
We are working with a 320x200 vga. We also don't have floating-point math. So, the
goal here is to do all the math in integer screen coordinates and accept some pixel
approximation error.
First, we want to center the wave in the middle, y = 100
We'll let y vary +-50 pixels to remain on the screen, so [50, 150]
We want to show an entire cycle (2pi) on the x-axis, so *50 gives us [0, ~314]
This implies that the "x-origin" is at x = 157
Substituting in everything, we get:
y ~= 100 + x*(157 - x)/125
The division by 125 is problematic as we don't have division. But luckily 128 is close enough.
Thus, we get:
y ~= 100 + (x*(157 - x)) >> 7
The rest is just adjusting for the [0, pi] range reduction by negating the approximation
along [pi, 2pi]
NOTE: the screen coordinate system is upside-down and I don't bother to correct for that.
it simply means that the animation starts at a +pi phase offset
*/
int y;
int x;
int x_0;
void sin_positive_approx()
{
y = ( x_0 * ( 157 - x_0 ) ) >> 7;
}
void sin()
{
x_0 = x;
while( x_0 > 314 ){
x_0 = x_0 - 314;
}
if( x_0 <= 157 ){
sin_positive_approx();
}
if( x_0 > 157 ){
x_0 = x_0 - 157;
sin_positive_approx();
y = 0 - y;
}
y = 100 + y;
}
int offset;
int x_end;
void draw_sine_wave()
{
x = offset;
x_end = x + 314;
while( x <= x_end ){
sin();
pixel_x = x - offset;
pixel_y = y;
vga_set_pixel();
x = x + 1;
}
}
int v_1;
int v_2;
void delay()
{
v_1 = 0;
while( v_1 < 50 ){
v_2 = 0;
while( v_2 < 10000 ){
v_2 = v_2 + 1;
}
v_1 = v_1 + 1;
}
}
void main()
{
vga_init();
offset = 0;
while( 1 ){
vga_clear();
draw_sine_wave();
delay();
offset = offset + 1;
if( offset >= 314 ){ // mod the value to avoid 2^16 integer overflow
offset = offset - 314;
}
}
}
`;
const twinkle = `/* References:
http://muruganad.com/8086/8086-assembly-language-program-to-play-sound-using-pc-speaker.html
https://en.wikipedia.org/wiki/Twinkle,_Twinkle,_Little_Star
*/
void delay_1()
{
v_1 = 0;
while( v_1 < 4000 ){
v_2 = 0;
while( v_2 < 10000 ){
v_2 = v_2 + 1;
}
v_1 = v_1 + 1;
}
}
void delay_2()
{
v_1 = 0;
while( v_1 < 300 ){
v_2 = 0;
while( v_2 < 10000 ){
v_2 = v_2 + 1;
}
v_1 = v_1 + 1;
}
}
void audio_init()
{
// Configure PIC2 mode
port_num = 67;
port_val = 182;
port_outb();
}
void audio_enable()
{
// Set bits 0 and 1 to enable
port_num = 97;
port_inb();
port_val = port_val | 3;
port_outb();
}
void audio_disable()
{
// Clear bits 0 and 1 to enable
port_num = 97;
port_inb();
port_val = port_val & 65532;
port_outb();
}
int audio_freq;
void audio_freq_set()
{
// Set frequency
port_num = 66;
port_val = audio_freq & 255;
port_outb();
port_val = ( audio_freq >> 8 ) & 255;
port_outb();
}
int note;
void play_quarter_note()
{
audio_freq = note;
audio_freq_set();
audio_enable();
delay_1();
audio_disable();
delay_2();
}
void play_half_note()
{
audio_freq = note;
audio_freq_set();
audio_enable();
delay_1();
delay_1();
audio_disable();
delay_2();
}
void play_section_1()
{
note = C; play_quarter_note();
note = C; play_quarter_note();
note = G; play_quarter_note();
note = G; play_quarter_note();
note = A; play_quarter_note();
note = A; play_quarter_note();
note = G; play_half_note();
note = F; play_quarter_note();
note = F; play_quarter_note();
note = E; play_quarter_note();
note = E; play_quarter_note();
note = D; play_quarter_note();
note = D; play_quarter_note();
note = C; play_half_note();
}
void play_section_2()
{
note = G; play_quarter_note();
note = G; play_quarter_note();
note = F; play_quarter_note();
note = F; play_quarter_note();
note = E; play_quarter_note();
note = E; play_quarter_note();
note = D; play_half_note();
note = G; play_quarter_note();
note = G; play_quarter_note();
note = F; play_quarter_note();
note = F; play_quarter_note();
note = E; play_quarter_note();
note = E; play_quarter_note();
note = D; play_half_note();
}
void main()
{
audio_init();
audio_enable();
C = 4560;
D = 4063;
E = 3619;
F = 3416;
G = 3043;
A = 2711;
play_section_1();
play_section_2();
play_section_1();
audio_disable();
}
`;
document.getElementById("source").onkeydown = function(e)
{
if(e.which == 13 && e.ctrlKey)
{
document.getElementById("run").onclick();
}
};
document.getElementById("source").textContent = sinwave;
document.getElementById("source").onkeydown = function(e)
{
if(e.which == 13 && e.ctrlKey)
{
document.getElementById("run").onclick();
}
};
document.getElementById("examples").onchange = function()
{
document.getElementById("source").textContent = { sinwave, twinkle, hello }[this.value];
};
let emulator;
document.getElementById("run").onclick = run;
function run()
{
emulator && emulator.destroy();
emulator = window.emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 32 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: { url: "../bios/seabios.bin" },
vga_bios: { url: "../bios/vgabios.bin" },
fda: { url: "../images/sectorc.bin" },
autostart: true,
});
emulator.add_listener("emulator-ready", () => {
const source = libc + document.getElementById("source").value + start;
emulator.serial0_send(source);
});
document.getElementById("run").onclick = stop;
document.getElementById("run").textContent = "stop";
};
function stop()
{
emulator && emulator.destroy();
document.getElementById("run").onclick = run;
document.getElementById("run").textContent = "run (ctrl-enter)";
}
}
</script>
<br>
<textarea id=source rows=20 cols=80>
</textarea>
<br>
<select id=examples>
<option value=sinwave>Sine wave</option>
<option value=hello>Hello</option>
<option value=twinkle>Twinkle (audio)</option>
</select>
<button id=run>run (ctrl-enter)</button>
<br>
<hr>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<hr>
<a href="https://github.com/xorvoid/sectorc">sectorc</a> on <a href="/v86/">v86</a>
================================================
FILE: examples/serial.html
================================================
<!doctype html>
<title>Serial example</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = new V86({
wasm_path: "../build/v86.wasm",
// Uncomment to see what's going on
//screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
bzimage: {
url: "../images/buildroot-bzimage68.bin",
async: false,
},
filesystem: {},
cmdline: "tsc=reliable mitigations=off random.trust_cpu=on",
autostart: true,
disable_keyboard: true,
});
// In this example we wait for output from the serial terminal, which
// should be running busybox. We log in as soon as a prompt appears and then
// retrieve a directory listing of the root directory
var data = "";
var stages = [
{
test: "~% ",
send: "ls -1 --color=never /\n",
},
{
test: "~% ",
send: "lua -e 'print(3+4)'\n",
},
];
var stage = 0;
emulator.add_listener("serial0-output-byte", function(byte)
{
var char = String.fromCharCode(byte);
if(char === "\r")
{
return;
}
data += char;
document.getElementById("terminal").value += char;
var current = stages[stage];
if(!current)
{
return;
}
if(data.endsWith(current.test))
{
stage++;
emulator.serial0_send(current.send);
var log = "Sending: " + current.send.replace(/\n/g, "\\n") + "\n";
document.getElementById("log").value += log;
}
});
};
</script>
<textarea readonly rows=25 cols=60 id="log">Waiting for boot ...
</textarea>
<textarea readonly rows=25 cols=60 id="terminal"></textarea>
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/tcp_terminal.html
================================================
<!doctype html>
<title>TCP Terminal</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var emulator = window.emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 64 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
bzimage: {
url: "../images/buildroot-bzimage68.bin",
},
net_device: {
relay_url: "fetch",
type: "virtio"
},
autostart: true
});
var is_connected = false, connection = null;
function clear_log()
{
document.getElementById("log").value = "";
}
function write_log(text)
{
document.getElementById("log").value += text;
}
function on_connect()
{
document.getElementById("connect").innerHTML = "Disconnect";
document.getElementById("send").disabled = false;
is_connected = true;
}
function on_disconnect()
{
document.getElementById("connect").innerHTML = "Connect";
document.getElementById("send").disabled = true;
is_connected = false;
}
document.getElementById("connect").onclick = async function() {
if(!is_connected)
{
clear_log();
let port = parseInt(document.getElementById("port").value);
write_log("> Probing port " + port + "\n");
let open = await emulator.network_adapter.tcp_probe(port);
if(open)
{
connection = emulator.network_adapter.connect(port);
connection.on("connect", function()
{
write_log("> Connected\n\n");
on_connect();
});
connection.on("data", function(data)
{
write_log(new TextDecoder().decode(data));
});
connection.on("close", function()
{
write_log("\n> Closed by listener");
on_disconnect();
});
connection.on("shutdown", function()
{
write_log("\n> Shutdown by listener");
on_disconnect();
});
}
else
{
write_log("> Probing failed");
}
}
else
{
connection.close();
write_log("\n> Closed by client");
on_disconnect();
}
}
document.getElementById("send").onclick = function()
{
connection.write(new TextEncoder().encode(document.getElementById("prompt").value + "\r\n"));
document.getElementById("prompt").value = "";
}
document.getElementById("prompt").onkeydown = function(e)
{
if(e.which == 13 && is_connected)
{
document.getElementById("send").onclick();
}
};
clear_log();
}
</script>
<div id="screen_container" style="float: left">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<div style="float: left; margin: 10px">
<textarea readonly cols="60" rows="15" id="log"></textarea><br>
Port: <input type="number" min="1" max="65535" value="1234" id="port" />
<button id="connect">Connect</button> <input type="text" id="prompt" />
<button id="send" disabled="true">Send (enter)</button>
<h3>Getting started</h3>
<ol>
<li>Run <code>udhcpc</code></li>
<li>Run any TCP server:
<ul>
<li>Echo: <code>socat -v PIPE TCP-L:1234,fork</code></li>
<li>(more examples on <a href="broadcast-network.html">broadcast-network.html</a>)</li>
</ul>
<li>Type a port number and press "Connect"</li>
</ol>
</div>
================================================
FILE: examples/two_instances.html
================================================
<!doctype html>
<title>Two emulators</title>
<script src="../build/libv86.js"></script>
<script>
"use strict";
window.onload = function()
{
var container1 = document.getElementById("screen_container1");
var container2 = document.getElementById("screen_container2");
var emulator1 = new V86({
wasm_path: "../build/v86.wasm",
screen_container: container1,
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux4.iso",
},
autostart: true,
});
var emulator2 = new V86({
wasm_path: "../build/v86.wasm",
screen_container: container2,
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux4.iso",
},
autostart: true,
});
emulator2.keyboard_set_status(false);
container1.addEventListener("mousedown", function(e)
{
container1.style.borderColor = "yellow";
container2.style.borderColor = "black";
emulator1.keyboard_set_status(true);
emulator2.keyboard_set_status(false);
}, false);
container2.addEventListener("mousedown", function(e)
{
container1.style.borderColor = "black";
container2.style.borderColor = "yellow";
emulator1.keyboard_set_status(false);
emulator2.keyboard_set_status(true);
}, false);
emulator1.add_listener("serial0-output-byte", function(byte)
{
var char = String.fromCharCode(byte);
emulator2.serial0_send(char);
});
emulator1.add_listener("net0-send", function(data)
{
emulator2.bus.send("net0-receive", data);
});
emulator2.add_listener("net0-send", function(data)
{
emulator1.bus.send("net0-receive", data);
});
};
</script>
To set up networking:
<pre>
# first VM
ifconfig eth0 up arp 10.5.0.2
# second VM
ifconfig eth0 up arp 10.5.0.3
ping 10.5.0.2
</pre>
Click on a screen to control it.
<hr>
<div id="screen_container1" style="float: left; margin: 10px; border: 3px solid yellow;">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<div id="screen_container2" style="float: left; margin: 10px; border: 3px solid black;">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
================================================
FILE: examples/worker.html
================================================
<!doctype html>
<title>Worker</title>
<script>
"use strict";
window.onload = function()
{
var worker = new Worker("worker.js");
var terminal = document.getElementById("terminal");
worker.onmessage = function(e)
{
terminal.textContent += e.data;
}
terminal.onkeypress = function(e)
{
e.preventDefault();
worker.postMessage(String.fromCharCode(e.which));
};
}
var start = Date.now();
setInterval(function()
{
document.getElementById("time").textContent = (Date.now() - start) / 1000 | 0;
});
</script>
<span id=time></span>s
<hr>
<textarea rows=25 cols=80 id=terminal></textarea>
================================================
FILE: examples/worker.js
================================================
importScripts("../build/libv86.js");
/* global V86 */
var emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 32 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
bios: {
url: "../bios/seabios.bin",
},
vga_bios: {
url: "../bios/vgabios.bin",
},
cdrom: {
url: "../images/linux4.iso",
},
autostart: true,
});
emulator.add_listener("serial0-output-byte", function(byte)
{
var chr = String.fromCharCode(byte);
this.postMessage(chr);
}.bind(this));
this.onmessage = function(e)
{
emulator.serial0_send(e.data);
};
================================================
FILE: gen/generate_analyzer.js
================================================
#!/usr/bin/env node
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import url from "node:url";
import x86_table from "./x86_table.js";
import * as rust_ast from "./rust_ast.js";
import { hex, get_switch_value, get_switch_exist, finalize_table_rust } from "./util.js";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const OUT_DIR = path.join(__dirname, "..", "src/rust/gen/");
fs.mkdirSync(OUT_DIR, { recursive: true });
const table_arg = get_switch_value("--table");
const gen_all = get_switch_exist("--all");
const to_generate = {
analyzer: gen_all || table_arg === "analyzer",
analyzer0f: gen_all || table_arg === "analyzer0f",
};
assert(
Object.keys(to_generate).some(k => to_generate[k]),
"Pass --table [analyzer|analyzer0f] or --all to pick which tables to generate"
);
gen_table();
function gen_read_imm_call(op, size_variant)
{
let size = (op.os || op.opcode % 2 === 1) ? size_variant : 8;
if(op.imm8 || op.imm8s || op.imm16 || op.imm1632 || op.imm32 || op.immaddr)
{
if(op.imm8)
{
return "cpu.read_imm8()";
}
else if(op.imm8s)
{
return "cpu.read_imm8s()";
}
else
{
if(op.immaddr)
{
// immaddr: depends on address size
return "cpu.read_moffs()";
}
else
{
assert(op.imm1632 || op.imm16 || op.imm32);
if(op.imm1632 && size === 16 || op.imm16)
{
return "cpu.read_imm16()";
}
else
{
assert(op.imm1632 && size === 32 || op.imm32);
return "cpu.read_imm32()";
}
}
}
}
else
{
return undefined;
}
}
function gen_call(name, args)
{
args = args || [];
return `${name}(${args.join(", ")});`;
}
/*
* Current naming scheme:
* instr(16|32|)_(66|F2|F3)?0F?[0-9a-f]{2}(_[0-7])?(_mem|_reg|)
*/
function make_instruction_name(encoding, size)
{
const suffix = encoding.os ? String(size) : "";
const opcode_hex = hex(encoding.opcode & 0xFF, 2);
const first_prefix = (encoding.opcode & 0xFF00) === 0 ? "" : hex(encoding.opcode >> 8 & 0xFF, 2);
const second_prefix = (encoding.opcode & 0xFF0000) === 0 ? "" : hex(encoding.opcode >> 16 & 0xFF, 2);
const fixed_g_suffix = encoding.fixed_g === undefined ? "" : `_${encoding.fixed_g}`;
assert(first_prefix === "" || first_prefix === "0F" || first_prefix === "F2" || first_prefix === "F3");
assert(second_prefix === "" || second_prefix === "66" || second_prefix === "F2" || second_prefix === "F3");
return `instr${suffix}_${second_prefix}${first_prefix}${opcode_hex}${fixed_g_suffix}`;
}
function gen_instruction_body(encodings, size)
{
const encoding = encodings[0];
let has_66 = [];
let has_F2 = [];
let has_F3 = [];
let no_prefix = [];
for(let e of encodings)
{
if((e.opcode >>> 16) === 0x66) has_66.push(e);
else if((e.opcode >>> 8 & 0xFF) === 0xF2 || (e.opcode >>> 16) === 0xF2) has_F2.push(e);
else if((e.opcode >>> 8 & 0xFF) === 0xF3 || (e.opcode >>> 16) === 0xF3) has_F3.push(e);
else no_prefix.push(e);
}
if(has_F2.length || has_F3.length)
{
assert((encoding.opcode & 0xFF0000) === 0 || (encoding.opcode & 0xFF00) === 0x0F00);
}
if(has_66.length)
{
assert((encoding.opcode & 0xFF00) === 0x0F00);
}
const code = [];
if(encoding.e)
{
code.push("let modrm_byte = cpu.read_imm8();");
}
if(has_66.length || has_F2.length || has_F3.length)
{
const if_blocks = [];
if(has_66.length) {
const body = gen_instruction_body_after_prefix(has_66, size);
if_blocks.push({ condition: "cpu.prefixes & prefix::PREFIX_66 != 0", body, });
}
if(has_F2.length) {
const body = gen_instruction_body_after_prefix(has_F2, size);
if_blocks.push({ condition: "cpu.prefixes & prefix::PREFIX_F2 != 0", body, });
}
if(has_F3.length) {
const body = gen_instruction_body_after_prefix(has_F3, size);
if_blocks.push({ condition: "cpu.prefixes & prefix::PREFIX_F3 != 0", body, });
}
const else_block = {
body: gen_instruction_body_after_prefix(no_prefix, size),
};
return [].concat(
code,
{
type: "if-else",
if_blocks,
else_block,
}
);
}
else {
return [].concat(
code,
gen_instruction_body_after_prefix(encodings, size)
);
}
}
function gen_instruction_body_after_prefix(encodings, size)
{
const encoding = encodings[0];
if(encoding.fixed_g !== undefined)
{
assert(encoding.e);
// instruction with modrm byte where the middle 3 bits encode the instruction
// group by opcode without prefix plus middle bits of modrm byte
let cases = encodings.reduce((cases_by_opcode, case_) => {
assert(typeof case_.fixed_g === "number");
cases_by_opcode[case_.opcode & 0xFFFF | case_.fixed_g << 16] = case_;
return cases_by_opcode;
}, Object.create(null));
cases = Object.values(cases).sort((e1, e2) => e1.fixed_g - e2.fixed_g);
return [
{
type: "switch",
condition: "modrm_byte >> 3 & 7",
cases: cases.map(case_ => {
const fixed_g = case_.fixed_g;
const body = gen_instruction_body_after_fixed_g(case_, size);
return {
conditions: [fixed_g],
body,
};
}),
default_case: {
body: [
"analysis.ty = analysis::AnalysisType::BlockBoundary;",
"analysis.no_next_instruction = true;",
],
}
},
];
}
else {
assert(encodings.length === 1);
return gen_instruction_body_after_fixed_g(encodings[0], size);
}
}
function gen_instruction_body_after_fixed_g(encoding, size)
{
const imm_read = gen_read_imm_call(encoding, size);
const instruction_postfix = [];
if(encoding.custom_sti) {
instruction_postfix.push("analysis.ty = analysis::AnalysisType::STI;");
}
else if(
encoding.block_boundary &&
// jump_offset_imm: Is a block boundary, but gets a different type (Jump) below
!encoding.jump_offset_imm || (!encoding.custom && encoding.e))
{
instruction_postfix.push("analysis.ty = analysis::AnalysisType::BlockBoundary;");
}
if(encoding.no_next_instruction)
{
instruction_postfix.push("analysis.no_next_instruction = true;");
}
if(encoding.absolute_jump)
{
instruction_postfix.push("analysis.absolute_jump = true;");
}
if(encoding.prefix)
{
const instruction_name = "analysis::" + make_instruction_name(encoding, size) + "_analyze";
const args = ["cpu", "analysis"];
assert(!imm_read);
return [].concat(
gen_call(instruction_name, args),
instruction_postfix
);
}
else if(encoding.e)
{
// instruction with modrm byte where the middle 3 bits encode a register
const reg_postfix = [];
const mem_postfix = [];
if(encoding.mem_ud)
{
mem_postfix.push(
"analysis.ty = analysis::AnalysisType::BlockBoundary;"
);
}
if(encoding.reg_ud)
{
reg_postfix.push(
"analysis.ty = analysis::AnalysisType::BlockBoundary;"
);
}
if(encoding.ignore_mod)
{
assert(!imm_read, "Unexpected instruction (ignore mod with immediate value)");
// Has modrm byte, but the 2 mod bits are ignored and both
// operands are always registers (0f20-0f24)
return instruction_postfix;
}
else
{
return [].concat(
{
type: "if-else",
if_blocks: [{
condition: "modrm_byte < 0xC0",
body: [].concat(
gen_call("analysis::modrm_analyze", ["cpu", "modrm_byte"]),
mem_postfix,
),
}],
else_block: {
body: reg_postfix,
},
},
imm_read ? [imm_read + ";"] : [],
instruction_postfix
);
}
}
else
{
// instruction without modrm byte or prefix
const body = [];
if(imm_read)
{
if(encoding.jump_offset_imm)
{
body.push("let jump_offset = " + imm_read + ";");
if(encoding.conditional_jump)
{
assert(
(encoding.opcode & ~0xF) === 0x70 ||
(encoding.opcode & ~0xF) === 0x0F80 ||
(encoding.opcode & ~0x3) === 0xE0
);
const condition_index = encoding.opcode & 0xFF;
body.push(`analysis.ty = analysis::AnalysisType::Jump { offset: jump_offset as i32, condition: Some(0x${hex(condition_index, 2)}), is_32: cpu.osize_32() };`);
}
else
{
body.push(`analysis.ty = analysis::AnalysisType::Jump { offset: jump_offset as i32, condition: None, is_32: cpu.osize_32() };`);
}
}
else
{
body.push(imm_read + ";");
}
}
if(encoding.extra_imm16)
{
assert(imm_read);
body.push(gen_call("cpu.read_imm16"));
}
else if(encoding.extra_imm8)
{
assert(imm_read);
body.push(gen_call("cpu.read_imm8"));
}
return [].concat(
body,
instruction_postfix
);
}
}
function gen_table()
{
let by_opcode = Object.create(null);
let by_opcode0f = Object.create(null);
for(let o of x86_table)
{
let opcode = o.opcode;
if((opcode & 0xFF00) === 0x0F00)
{
opcode &= 0xFF;
by_opcode0f[opcode] = by_opcode0f[opcode] || [];
by_opcode0f[opcode].push(o);
}
else
{
opcode &= 0xFF;
by_opcode[opcode] = by_opcode[opcode] || [];
by_opcode[opcode].push(o);
}
}
let cases = [];
for(let opcode = 0; opcode < 0x100; opcode++)
{
let encoding = by_opcode[opcode];
assert(encoding && encoding.length);
let opcode_hex = hex(opcode, 2);
let opcode_high_hex = hex(opcode | 0x100, 2);
if(encoding[0].os)
{
cases.push({
conditions: [`0x${opcode_hex}`],
body: gen_instruction_body(encoding, 16),
});
cases.push({
conditions: [`0x${opcode_high_hex}`],
body: gen_instruction_body(encoding, 32),
});
}
else
{
cases.push({
conditions: [`0x${opcode_hex}`, `0x${opcode_high_hex}`],
body: gen_instruction_body(encoding, undefined),
});
}
}
const table = {
type: "switch",
condition: "opcode",
cases,
default_case: {
body: ["dbg_assert!(false);"]
},
};
if(to_generate.analyzer)
{
const code = [
"#[cfg_attr(rustfmt, rustfmt_skip)]",
"use crate::analysis;",
"use crate::prefix;",
"use crate::cpu_context;",
"pub fn analyzer(opcode: u32, cpu: &mut cpu_context::CpuContext, analysis: &mut analysis::Analysis) {",
table,
"}",
];
finalize_table_rust(
OUT_DIR,
"analyzer.rs",
rust_ast.print_syntax_tree([].concat(code)).join("\n") + "\n"
);
}
const cases0f = [];
for(let opcode = 0; opcode < 0x100; opcode++)
{
let encoding = by_opcode0f[opcode];
assert(encoding && encoding.length);
let opcode_hex = hex(opcode, 2);
let opcode_high_hex = hex(opcode | 0x100, 2);
if(encoding[0].os)
{
cases0f.push({
conditions: [`0x${opcode_hex}`],
body: gen_instruction_body(encoding, 16),
});
cases0f.push({
conditions: [`0x${opcode_high_hex}`],
body: gen_instruction_body(encoding, 32),
});
}
else
{
let block = {
conditions: [`0x${opcode_hex}`, `0x${opcode_high_hex}`],
body: gen_instruction_body(encoding, undefined),
};
cases0f.push(block);
}
}
const table0f = {
type: "switch",
condition: "opcode",
cases: cases0f,
default_case: {
body: ["dbg_assert!(false);"]
},
};
if(to_generate.analyzer0f)
{
const code = [
"#![allow(unused)]",
"#[cfg_attr(rustfmt, rustfmt_skip)]",
"use crate::analysis;",
"use crate::prefix;",
"use crate::cpu_context;",
"pub fn analyzer(opcode: u32, cpu: &mut cpu_context::CpuContext, analysis: &mut analysis::Analysis) {",
table0f,
"}"
];
finalize_table_rust(
OUT_DIR,
"analyzer0f.rs",
rust_ast.print_syntax_tree([].concat(code)).join("\n") + "\n"
);
}
}
================================================
FILE: gen/generate_interpreter.js
================================================
#!/usr/bin/env node
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import url from "node:url";
import x86_table from "./x86_table.js";
import * as rust_ast from "./rust_ast.js";
import { hex, get_switch_value, get_switch_exist, finalize_table_rust } from "./util.js";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const OUT_DIR = path.join(__dirname, "..", "src/rust/gen/");
fs.mkdirSync(OUT_DIR, { recursive: true });
const table_arg = get_switch_value("--table");
const gen_all = get_switch_exist("--all");
const to_generate = {
interpreter: gen_all || table_arg === "interpreter",
interpreter0f: gen_all || table_arg === "interpreter0f",
};
assert(
Object.keys(to_generate).some(k => to_generate[k]),
"Pass --table [interpreter|interpreter0f] or --all to pick which tables to generate"
);
gen_table();
function wrap_imm_call(imm)
{
return `match ${imm} { Ok(o) => o, Err(()) => return }`;
}
function gen_read_imm_call(op, size_variant)
{
let size = (op.os || op.opcode % 2 === 1) ? size_variant : 8;
if(op.imm8 || op.imm8s || op.imm16 || op.imm1632 || op.imm32 || op.immaddr)
{
if(op.imm8)
{
return wrap_imm_call("read_imm8()");
}
else if(op.imm8s)
{
return wrap_imm_call("read_imm8s()");
}
else
{
if(op.immaddr)
{
// immaddr: depends on address size
return wrap_imm_call("read_moffs()");
}
else
{
assert(op.imm1632 || op.imm16 || op.imm32);
if(op.imm1632 && size === 16 || op.imm16)
{
return wrap_imm_call("read_imm16()");
}
else
{
assert(op.imm1632 && size === 32 || op.imm32);
return wrap_imm_call("read_imm32s()");
}
}
}
}
else
{
return undefined;
}
}
function gen_call(name, args)
{
args = args || [];
return `${name}(${args.join(", ")});`;
}
/*
* Current naming scheme:
* instr(16|32|)_(66|F2|F3)?0F?[0-9a-f]{2}(_[0-7])?(_mem|_reg|)
*/
function make_instruction_name(encoding, size)
{
const suffix = encoding.os ? String(size) : "";
const opcode_hex = hex(encoding.opcode & 0xFF, 2);
const first_prefix = (encoding.opcode & 0xFF00) === 0 ? "" : hex(encoding.opcode >> 8 & 0xFF, 2);
const second_prefix = (encoding.opcode & 0xFF0000) === 0 ? "" : hex(encoding.opcode >> 16 & 0xFF, 2);
const fixed_g_suffix = encoding.fixed_g === undefined ? "" : `_${encoding.fixed_g}`;
const module = first_prefix === "0F" || second_prefix === "0F" ? "instructions_0f" : "instructions";
assert(first_prefix === "" || first_prefix === "0F" || first_prefix === "F2" || first_prefix === "F3");
assert(second_prefix === "" || second_prefix === "66" || second_prefix === "F2" || second_prefix === "F3");
return `${module}::instr${suffix}_${second_prefix}${first_prefix}${opcode_hex}${fixed_g_suffix}`;
}
function gen_instruction_body(encodings, size)
{
const encoding = encodings[0];
let has_66 = [];
let has_F2 = [];
let has_F3 = [];
let no_prefix = [];
for(let e of encodings)
{
if((e.opcode >>> 16) === 0x66) has_66.push(e);
else if((e.opcode >>> 8 & 0xFF) === 0xF2 || (e.opcode >>> 16) === 0xF2) has_F2.push(e);
else if((e.opcode >>> 8 & 0xFF) === 0xF3 || (e.opcode >>> 16) === 0xF3) has_F3.push(e);
else no_prefix.push(e);
}
if(has_F2.length || has_F3.length)
{
assert((encoding.opcode & 0xFF0000) === 0 || (encoding.opcode & 0xFF00) === 0x0F00);
}
if(has_66.length)
{
assert((encoding.opcode & 0xFF00) === 0x0F00);
}
const code = [];
if(encoding.e)
{
code.push(`let modrm_byte = ${wrap_imm_call("read_imm8()")};`);
}
if(has_66.length || has_F2.length || has_F3.length)
{
const if_blocks = [];
if(has_66.length) {
const body = gen_instruction_body_after_prefix(has_66, size);
if_blocks.push({ condition: "prefixes_ & prefix::PREFIX_66 != 0", body, });
}
if(has_F2.length) {
const body = gen_instruction_body_after_prefix(has_F2, size);
if_blocks.push({ condition: "prefixes_ & prefix::PREFIX_F2 != 0", body, });
}
if(has_F3.length) {
const body = gen_instruction_body_after_prefix(has_F3, size);
if_blocks.push({ condition: "prefixes_ & prefix::PREFIX_F3 != 0", body, });
}
const check_prefixes = encoding.sse ? "(prefix::PREFIX_66 | prefix::PREFIX_F2 | prefix::PREFIX_F3)" : "(prefix::PREFIX_F2 | prefix::PREFIX_F3)";
const else_block = {
body: [].concat(
"dbg_assert!((prefixes_ & " + check_prefixes + ") == 0);",
gen_instruction_body_after_prefix(no_prefix, size)
)
};
return [].concat(
"let prefixes_ = *prefixes;",
code,
{
type: "if-else",
if_blocks,
else_block,
}
);
}
else {
return [].concat(
code,
gen_instruction_body_after_prefix(encodings, size)
);
}
}
function gen_instruction_body_after_prefix(encodings, size)
{
const encoding = encodings[0];
if(encoding.fixed_g !== undefined)
{
assert(encoding.e);
// instruction with modrm byte where the middle 3 bits encode the instruction
// group by opcode without prefix plus middle bits of modrm byte
let cases = encodings.reduce((cases_by_opcode, case_) => {
assert(typeof case_.fixed_g === "number");
cases_by_opcode[case_.opcode & 0xFFFF | case_.fixed_g << 16] = case_;
return cases_by_opcode;
}, Object.create(null));
cases = Object.values(cases).sort((e1, e2) => e1.fixed_g - e2.fixed_g);
return [
{
type: "switch",
gitextract__01xjcye/ ├── .cargo/ │ └── config.toml ├── .devcontainer/ │ ├── Dockerfile │ └── devcontainer.json ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ └── issue.md │ └── workflows/ │ └── ci.yml ├── .gitignore ├── .rustfmt.toml ├── .vscode/ │ └── tasks.json ├── Cargo.toml ├── LICENSE ├── LICENSE.MIT ├── Makefile ├── Readme.md ├── bios/ │ ├── .gitignore │ ├── COPYING.LESSER │ ├── fetch-and-build-seabios.sh │ ├── seabios-debug.config │ └── seabios.config ├── debug.html ├── docs/ │ ├── .gitignore │ ├── archlinux.md │ ├── cpu-idling.md │ ├── filesystem.md │ ├── how-it-works.md │ ├── linux-9p-image.md │ ├── networking.md │ ├── profiling.md │ ├── sse-shifts.txt │ ├── windows-9x.md │ └── windows-nt.md ├── eslint.config.mjs ├── examples/ │ ├── alpine.html │ ├── arch.html │ ├── async_load.html │ ├── basic.html │ ├── broadcast-network.html │ ├── destroy.html │ ├── lang.html │ ├── lua.html │ ├── nodejs.js │ ├── nodejs_state.js │ ├── save_restore.html │ ├── sectorc.html │ ├── serial.html │ ├── tcp_terminal.html │ ├── two_instances.html │ ├── worker.html │ └── worker.js ├── gen/ │ ├── generate_analyzer.js │ ├── generate_interpreter.js │ ├── generate_jit.js │ ├── rust_ast.js │ ├── util.js │ └── x86_table.js ├── index.html ├── lib/ │ ├── 9p.js │ ├── filesystem.js │ ├── marshall.js │ ├── softfloat/ │ │ └── softfloat.c │ └── zstd/ │ └── zstddeclib.c ├── manifest.json ├── package.json ├── src/ │ ├── acpi.js │ ├── browser/ │ │ ├── dummy_screen.js │ │ ├── fake_network.js │ │ ├── fetch_network.js │ │ ├── filestorage.js │ │ ├── inbrowser_network.js │ │ ├── keyboard.js │ │ ├── main.js │ │ ├── mouse.js │ │ ├── network.js │ │ ├── print_stats.js │ │ ├── screen.js │ │ ├── serial.js │ │ ├── speaker.js │ │ ├── starter.js │ │ ├── wisp_network.js │ │ └── worker_bus.js │ ├── buffer.js │ ├── bus.js │ ├── cjs.js │ ├── const.js │ ├── cpu.js │ ├── dma.js │ ├── elf.js │ ├── externs.js │ ├── floppy.js │ ├── ide.js │ ├── io.js │ ├── iso9660.js │ ├── kernel.js │ ├── lib.js │ ├── log.js │ ├── main.js │ ├── ne2k.js │ ├── pci.js │ ├── pit.js │ ├── ps2.js │ ├── rtc.js │ ├── rust/ │ │ ├── analysis.rs │ │ ├── codegen.rs │ │ ├── config.rs │ │ ├── control_flow.rs │ │ ├── cpu/ │ │ │ ├── apic.rs │ │ │ ├── arith.rs │ │ │ ├── call_indirect.rs │ │ │ ├── cpu.rs │ │ │ ├── fpu.rs │ │ │ ├── global_pointers.rs │ │ │ ├── instructions.rs │ │ │ ├── instructions_0f.rs │ │ │ ├── ioapic.rs │ │ │ ├── memory.rs │ │ │ ├── misc_instr.rs │ │ │ ├── mod.rs │ │ │ ├── modrm.rs │ │ │ ├── pic.rs │ │ │ ├── sse_instr.rs │ │ │ ├── string.rs │ │ │ └── vga.rs │ │ ├── cpu_context.rs │ │ ├── dbg.rs │ │ ├── gen/ │ │ │ └── mod.rs │ │ ├── jit.rs │ │ ├── jit_instructions.rs │ │ ├── js_api.rs │ │ ├── leb.rs │ │ ├── lib.rs │ │ ├── modrm.rs │ │ ├── opstats.rs │ │ ├── page.rs │ │ ├── paging.rs │ │ ├── prefix.rs │ │ ├── profiler.rs │ │ ├── regs.rs │ │ ├── softfloat.rs │ │ ├── state_flags.rs │ │ ├── wasmgen/ │ │ │ ├── mod.rs │ │ │ ├── wasm_builder.rs │ │ │ └── wasm_opcodes.rs │ │ └── zstd.rs │ ├── sb16.js │ ├── state.js │ ├── uart.js │ ├── vga.js │ ├── virtio.js │ ├── virtio_balloon.js │ ├── virtio_console.js │ └── virtio_net.js ├── tests/ │ ├── Readme.md │ ├── api/ │ │ ├── 2g-mem.js │ │ ├── cdrom-insert-eject.js │ │ ├── clean-shutdown.js │ │ ├── floppy.js │ │ ├── pic.js │ │ ├── reboot.js │ │ ├── reset.js │ │ ├── serial.js │ │ ├── state.js │ │ └── test.js │ ├── benchmark/ │ │ ├── arch-bytemark.js │ │ ├── arch-python.js │ │ ├── fetch-download.js │ │ ├── linux-boot.js │ │ └── snapshot.js │ ├── devices/ │ │ ├── fetch_network.js │ │ ├── testfs/ │ │ │ ├── 5d70f436aa013f4f1d5af4a5e8149b479c813ab4ceea0bcf8b01f78eac84fd25 │ │ │ └── 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730 │ │ ├── testfs.json │ │ ├── virtio_9p.js │ │ ├── virtio_balloon.js │ │ ├── virtio_console.js │ │ └── wisp_network.js │ ├── expect/ │ │ ├── readme.md │ │ ├── run.js │ │ └── tests/ │ │ ├── Makefile │ │ ├── add.asm │ │ ├── add.wast │ │ ├── call-ret.asm │ │ ├── call-ret.wast │ │ ├── do-while.asm │ │ ├── do-while.wast │ │ ├── if.asm │ │ ├── if.wast │ │ ├── inc.asm │ │ ├── inc.wast │ │ ├── indirect-call.asm │ │ ├── indirect-call.wast │ │ ├── loop.asm │ │ ├── loop.wast │ │ ├── mem32r.asm │ │ ├── mem32r.wast │ │ ├── mem32rmw.asm │ │ ├── mem32rmw.wast │ │ ├── mem32w.asm │ │ ├── mem32w.wast │ │ ├── mov-immoffs.asm │ │ ├── mov-immoffs.wast │ │ ├── pop.asm │ │ ├── pop.wast │ │ ├── push.asm │ │ ├── push.wast │ │ ├── sti.asm │ │ ├── sti.wast │ │ ├── task_switch_test.asm │ │ ├── task_switch_test.wast │ │ ├── task_switch_test_sse.asm │ │ ├── task_switch_test_sse.wast │ │ ├── while-do.asm │ │ └── while-do.wast │ ├── full/ │ │ └── run.js │ ├── jit-paging/ │ │ ├── Makefile │ │ ├── README.md │ │ ├── run.js │ │ └── test-jit.c │ ├── manual/ │ │ └── gc.html │ ├── nasm/ │ │ ├── Readme.md │ │ ├── arith-optimisations.asm │ │ ├── btc-imm.asm │ │ ├── btc-reg16.asm │ │ ├── btc-reg32.asm │ │ ├── btr-imm.asm │ │ ├── btr-reg16.asm │ │ ├── btr-reg32.asm │ │ ├── bts-imm.asm │ │ ├── bts-reg16.asm │ │ ├── bts-reg32.asm │ │ ├── cmp16-setbe.asm │ │ ├── cmpxchg-setbe.asm │ │ ├── cmpxchg.asm │ │ ├── cmpxchg8b.asm │ │ ├── comiss.asm │ │ ├── create_tests.js │ │ ├── cvtpi2ps.asm │ │ ├── cvtps2pi.asm │ │ ├── cvttps2pi.asm │ │ ├── emms.asm │ │ ├── f2xm1.asm │ │ ├── fchs.asm │ │ ├── fdecstp.asm │ │ ├── fdiv-zero.asm │ │ ├── fdiv.asm │ │ ├── fdivr.asm │ │ ├── fincstp.asm │ │ ├── footer.inc │ │ ├── fprem.asm │ │ ├── fprem1.asm │ │ ├── fptan.asm │ │ ├── fpu_m80.asm │ │ ├── frndint.asm │ │ ├── fsave_frstor.asm │ │ ├── fscale.asm │ │ ├── fsincos.asm │ │ ├── fsqrt.asm │ │ ├── fstenv.asm │ │ ├── fstm80.asm │ │ ├── fstsw.asm │ │ ├── fxtract-zero.asm │ │ ├── fxtract.asm │ │ ├── fyl2x-zero.asm │ │ ├── fyl2x.asm │ │ ├── fyl2xp1.asm │ │ ├── gdb-extract-def │ │ ├── gen_fixtures.js │ │ ├── header.inc │ │ ├── idiv16-overflow.asm │ │ ├── idiv32-overflow.asm │ │ ├── idiv8-overflow.asm │ │ ├── indirect-call.asm │ │ ├── indirect-jump.asm │ │ ├── jcxz.asm │ │ ├── jump.asm │ │ ├── lea-nop.asm │ │ ├── leave16.asm │ │ ├── leave32.asm │ │ ├── loop.asm │ │ ├── loopnz.asm │ │ ├── loopz.asm │ │ ├── maskmovdqu.asm │ │ ├── maskmovq.asm │ │ ├── mov16.asm │ │ ├── mov_sreg.asm │ │ ├── mov_sreg_ud1.asm │ │ ├── mov_sreg_ud2.asm │ │ ├── movaps.asm │ │ ├── movd.asm │ │ ├── movntpd.asm │ │ ├── movntps.asm │ │ ├── movq.asm │ │ ├── packssdw.asm │ │ ├── packsswb.asm │ │ ├── packuswb.asm │ │ ├── paddb.asm │ │ ├── paddd.asm │ │ ├── paddsb.asm │ │ ├── paddsw.asm │ │ ├── paddusb.asm │ │ ├── paddusw.asm │ │ ├── paddw.asm │ │ ├── pand.asm │ │ ├── pandn.asm │ │ ├── pcmpeqb.asm │ │ ├── pcmpeqd.asm │ │ ├── pcmpeqw.asm │ │ ├── pcmpgtb.asm │ │ ├── pcmpgtd.asm │ │ ├── pcmpgtw.asm │ │ ├── pmaddwd.asm │ │ ├── pmulhw.asm │ │ ├── pmullw.asm │ │ ├── pmuludq.asm │ │ ├── pop_esp.asm │ │ ├── pop_esp2.asm │ │ ├── por.asm │ │ ├── pshufw.asm │ │ ├── pslld.asm │ │ ├── psllq.asm │ │ ├── psllw.asm │ │ ├── psrad.asm │ │ ├── psraw.asm │ │ ├── psrld.asm │ │ ├── psrlq.asm │ │ ├── psrlw.asm │ │ ├── psubb.asm │ │ ├── psubd.asm │ │ ├── psubsb.asm │ │ ├── psubsw.asm │ │ ├── psubusb.asm │ │ ├── psubusw.asm │ │ ├── psubw.asm │ │ ├── punpckhbw.asm │ │ ├── punpckhdq.asm │ │ ├── punpckhwd.asm │ │ ├── punpcklbw.asm │ │ ├── punpckldq.asm │ │ ├── punpcklwd.asm │ │ ├── push.asm │ │ ├── pushf.asm │ │ ├── pxor.asm │ │ ├── rand.js │ │ ├── ret-imm.asm │ │ ├── run.js │ │ ├── shufps-edgecase.asm │ │ └── ucomiss.asm │ ├── qemu/ │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── Readme.md │ │ ├── compiler.h │ │ ├── config-host.h │ │ ├── run-qemu.js │ │ ├── run.js │ │ ├── test-i386-code16.S │ │ ├── test-i386-muldiv.h │ │ ├── test-i386-shift.h │ │ ├── test-i386-vm86.S │ │ ├── test-i386.c │ │ └── test-i386.h │ └── rust/ │ └── verify-wasmgen-dummy-output.js ├── tools/ │ ├── copy-to-sha256.py │ ├── docker/ │ │ ├── README.md │ │ ├── alpine/ │ │ │ ├── Dockerfile │ │ │ ├── Readme.md │ │ │ ├── build-state.js │ │ │ └── build.sh │ │ ├── exec/ │ │ │ ├── Dockerfile │ │ │ └── build.sh │ │ └── test-image/ │ │ └── Dockerfile │ ├── fetch_network_harness.mjs │ ├── fs2json.py │ ├── mkisofs.js │ ├── rust-lld-wrapper │ └── split-image.py ├── v86.css └── v86.d.ts
Showing preview only (664K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (7101 symbols across 129 files)
FILE: gen/generate_analyzer.js
constant OUT_DIR (line 14) | const OUT_DIR = path.join(__dirname, "..", "src/rust/gen/");
function gen_read_imm_call (line 32) | function gen_read_imm_call(op, size_variant)
function gen_call (line 75) | function gen_call(name, args)
function make_instruction_name (line 85) | function make_instruction_name(encoding, size)
function gen_instruction_body (line 99) | function gen_instruction_body(encodings, size)
function gen_instruction_body_after_prefix (line 171) | function gen_instruction_body_after_prefix(encodings, size)
function gen_instruction_body_after_fixed_g (line 218) | function gen_instruction_body_after_fixed_g(encoding, size)
function gen_table (line 357) | function gen_table()
FILE: gen/generate_interpreter.js
constant OUT_DIR (line 14) | const OUT_DIR = path.join(__dirname, "..", "src/rust/gen/");
function wrap_imm_call (line 32) | function wrap_imm_call(imm)
function gen_read_imm_call (line 37) | function gen_read_imm_call(op, size_variant)
function gen_call (line 80) | function gen_call(name, args)
function make_instruction_name (line 90) | function make_instruction_name(encoding, size)
function gen_instruction_body (line 105) | function gen_instruction_body(encodings, size)
function gen_instruction_body_after_prefix (line 183) | function gen_instruction_body_after_prefix(encodings, size)
function gen_instruction_body_after_fixed_g (line 231) | function gen_instruction_body_after_fixed_g(encoding, size)
function gen_table (line 351) | function gen_table()
FILE: gen/generate_jit.js
constant OUT_DIR (line 14) | const OUT_DIR = path.join(__dirname, "..", "src/rust/gen/");
function gen_read_imm_call (line 32) | function gen_read_imm_call(op, size_variant)
function gen_call (line 75) | function gen_call(name, args)
function make_instruction_name (line 85) | function make_instruction_name(encoding, size)
function gen_instruction_body (line 99) | function gen_instruction_body(encodings, size)
function gen_instruction_body_after_prefix (line 171) | function gen_instruction_body_after_prefix(encodings, size)
function gen_instruction_body_after_fixed_g (line 218) | function gen_instruction_body_after_fixed_g(encoding, size)
function gen_table (line 435) | function gen_table()
FILE: gen/rust_ast.js
function indent (line 3) | function indent(lines, how_much)
function print_syntax_tree (line 8) | function print_syntax_tree(statements)
FILE: gen/util.js
constant CYAN_FMT (line 5) | const CYAN_FMT = "\x1b[36m%s\x1b[0m";
function hex (line 7) | function hex(n, pad)
function get_switch_value (line 15) | function get_switch_value(arg_switch)
function get_switch_exist (line 27) | function get_switch_exist(arg_switch)
function finalize_table_rust (line 32) | function finalize_table_rust(out_dir, name, contents)
FILE: gen/x86_table.js
constant TESTS_ASSUME_INTEL (line 12) | const TESTS_ASSUME_INTEL = false;
FILE: lib/9p.js
constant TRACK_FILENAMES (line 23) | const TRACK_FILENAMES = false;
constant VIRTIO_9P_F_MOUNT_TAG (line 26) | const VIRTIO_9P_F_MOUNT_TAG = 0;
constant VIRTIO_9P_MAX_TAGLEN (line 28) | const VIRTIO_9P_MAX_TAGLEN = 254;
constant MAX_REPLYBUFFER_SIZE (line 30) | const MAX_REPLYBUFFER_SIZE = 16 * 1024 * 1024;
constant EPERM (line 35) | const EPERM = 1;
constant ENOENT (line 36) | const ENOENT = 2;
constant EEXIST (line 37) | const EEXIST = 17;
constant EINVAL (line 38) | const EINVAL = 22;
constant EOPNOTSUPP (line 39) | const EOPNOTSUPP = 95;
constant ENOTEMPTY (line 40) | const ENOTEMPTY = 39;
constant EPROTO (line 41) | const EPROTO = 71;
constant P9_LOCK_TYPE_RDLCK (line 68) | const P9_LOCK_TYPE_RDLCK = 0;
constant P9_LOCK_TYPE_WRLCK (line 69) | const P9_LOCK_TYPE_WRLCK = 1;
constant P9_LOCK_TYPE_UNLCK (line 70) | const P9_LOCK_TYPE_UNLCK = 2;
constant P9_LOCK_TYPES (line 71) | const P9_LOCK_TYPES = ["shared", "exclusive", "unlock"];
constant P9_LOCK_FLAGS_BLOCK (line 73) | const P9_LOCK_FLAGS_BLOCK = 1;
constant P9_LOCK_FLAGS_RECLAIM (line 74) | const P9_LOCK_FLAGS_RECLAIM = 2;
constant P9_LOCK_SUCCESS (line 76) | const P9_LOCK_SUCCESS = 0;
constant P9_LOCK_BLOCKED (line 77) | const P9_LOCK_BLOCKED = 1;
constant P9_LOCK_ERROR (line 78) | const P9_LOCK_ERROR = 2;
constant P9_LOCK_GRACE (line 79) | const P9_LOCK_GRACE = 3;
function range (line 85) | function range(size)
function init_virtio (line 94) | function init_virtio(cpu, configspace_taglen, configspace_tagname, receive)
function Virtio9p (line 181) | function Virtio9p(filesystem, cpu, bus) {
function Virtio9pHandler (line 896) | function Virtio9pHandler(handle_fn, cpu) {
function Virtio9pProxy (line 973) | function Virtio9pProxy(url, cpu)
FILE: lib/filesystem.js
constant S_IRWXUGO (line 17) | const S_IRWXUGO = 0x1FF;
constant S_IFMT (line 18) | const S_IFMT = 0xF000;
constant S_IFSOCK (line 19) | const S_IFSOCK = 0xC000;
constant S_IFLNK (line 20) | const S_IFLNK = 0xA000;
constant S_IFREG (line 21) | const S_IFREG = 0x8000;
constant S_IFBLK (line 22) | const S_IFBLK = 0x6000;
constant S_IFDIR (line 23) | const S_IFDIR = 0x4000;
constant S_IFCHR (line 24) | const S_IFCHR = 0x2000;
constant STATUS_INVALID (line 36) | const STATUS_INVALID = -0x1;
constant STATUS_OK (line 37) | const STATUS_OK = 0x0;
constant STATUS_ON_STORAGE (line 38) | const STATUS_ON_STORAGE = 0x2;
constant STATUS_UNLINKED (line 39) | const STATUS_UNLINKED = 0x4;
constant STATUS_FORWARDING (line 40) | const STATUS_FORWARDING = 0x5;
function FS (line 62) | function FS(storage, qidcounter) {
function Inode (line 321) | function Inode(qidnumber)
function FSMountInfo (line 1487) | function FSMountInfo(filesystem)
function FSLockRegion (line 1676) | function FSLockRegion()
FILE: lib/marshall.js
function Marshall (line 12) | function Marshall(typelist, input, struct, offset) {
function Unmarshall (line 76) | function Unmarshall(typelist, struct, state) {
FILE: lib/softfloat/softfloat.c
type uint128 (line 179) | struct uint128 { uint64_t v0, v64; }
type uint64_extra (line 180) | struct uint64_extra { uint64_t extra, v; }
type uint128_extra (line 181) | struct uint128_extra { uint64_t extra; struct uint128 v; }
type uint128 (line 183) | struct uint128 { uint64_t v64, v0; }
type uint64_extra (line 184) | struct uint64_extra { uint64_t v, extra; }
type uint128_extra (line 185) | struct uint128_extra { struct uint128 v; uint64_t extra; }
function INLINE (line 224) | INLINE uint_fast8_t softfloat_countLeadingZeros16( uint16_t a )
function INLINE (line 228) | INLINE uint_fast8_t softfloat_countLeadingZeros32( uint32_t a )
function INLINE (line 232) | INLINE uint_fast8_t softfloat_countLeadingZeros64( uint64_t a )
function uint128 (line 240) | uint128 softfloat_mul64ByShifted32To128( uint64_t a, uint32_t b )
function uint128 (line 248) | uint128 softfloat_mul64To128( uint64_t a, uint64_t b )
function uint128 (line 257) | uint128 softfloat_mul128By32( uint64_t a64, uint64_t a0, uint32_t b )
function INLINE (line 265) | INLINE
type float16_t (line 396) | typedef struct { uint16_t v; } float16_t;
type float32_t (line 397) | typedef struct { uint32_t v; } float32_t;
type float64_t (line 398) | typedef struct { uint64_t v; } float64_t;
type float128_t (line 399) | typedef struct { uint64_t v[2]; } float128_t;
type extFloat80M (line 407) | struct extFloat80M { uint64_t signif; uint16_t signExp; }
type extFloat80M (line 409) | struct extFloat80M { uint16_t signExp; uint64_t signif; }
type extFloat80_t (line 424) | typedef struct extFloat80M extFloat80_t;
function softfloat_raiseFlags (line 758) | void softfloat_raiseFlags( uint_fast8_t flags )
type commonNaN (line 881) | struct commonNaN {
type commonNaN (line 908) | struct commonNaN
type commonNaN (line 914) | struct commonNaN
type commonNaN (line 943) | struct commonNaN
type commonNaN (line 949) | struct commonNaN
type commonNaN (line 978) | struct commonNaN
type commonNaN (line 984) | struct commonNaN
type commonNaN (line 1025) | struct commonNaN
type uint128 (line 1032) | struct uint128
type commonNaN (line 1032) | struct commonNaN
type uint128 (line 1043) | struct uint128
type commonNaN (line 1074) | struct commonNaN
type uint128 (line 1080) | struct uint128
type commonNaN (line 1080) | struct commonNaN
type uint128 (line 1091) | struct uint128
type extFloat80M (line 1114) | struct extFloat80M
type commonNaN (line 1114) | struct commonNaN
type commonNaN (line 1123) | struct commonNaN
type extFloat80M (line 1123) | struct extFloat80M
type extFloat80M (line 1133) | struct extFloat80M
type extFloat80M (line 1134) | struct extFloat80M
type extFloat80M (line 1135) | struct extFloat80M
type commonNaN (line 1155) | struct commonNaN
type commonNaN (line 1164) | struct commonNaN
function softfloat_f16UIToCommonNaN (line 1191) | void softfloat_f16UIToCommonNaN( uint_fast16_t uiA, struct commonNaN *zP...
function uint_fast16_t (line 1249) | uint_fast16_t softfloat_commonNaNToF16UI( const struct commonNaN *aPtr )
function INLINE (line 1392) | INLINE
function INLINE (line 1412) | INLINE uint32_t softfloat_shiftRightJam32( uint32_t a, uint_fast16_t dist )
function INLINE (line 1434) | INLINE uint64_t softfloat_shiftRightJam64( uint64_t a, uint_fast32_t dist )
function INLINE (line 1458) | INLINE uint_fast8_t softfloat_countLeadingZeros16( uint16_t a )
function INLINE (line 1480) | INLINE uint_fast8_t softfloat_countLeadingZeros32( uint32_t a )
function INLINE (line 1570) | INLINE
function INLINE (line 1586) | INLINE
function INLINE (line 1602) | INLINE
function uint128 (line 1618) | uint128
type uint128 (line 1627) | struct uint128
function uint128 (line 1640) | uint128
type uint128 (line 1649) | struct uint128
function uint64_extra (line 1662) | uint64_extra
type uint64_extra (line 1672) | struct uint64_extra
function uint128 (line 1689) | uint128
type uint128 (line 1702) | struct uint128
function uint128_extra (line 1716) | uint128_extra
type uint128_extra (line 1728) | struct uint128_extra
function uint64_extra (line 1754) | uint64_extra
type uint64_extra (line 1770) | struct uint64_extra
type uint128 (line 1788) | struct uint128
type uint128_extra (line 1811) | struct uint128_extra
function uint128 (line 1844) | uint128
type uint128 (line 1853) | struct uint128
function uint128 (line 1880) | uint128
type uint128 (line 1890) | struct uint128
function uint128 (line 1914) | uint128 softfloat_mul64ByShifted32To128( uint64_t a, uint32_t b )
type uint128 (line 1924) | struct uint128
type uint128 (line 1932) | struct uint128
function uint128 (line 1943) | uint128 softfloat_mul128By32( uint64_t a64, uint64_t a0, uint32_t b )
type uint128 (line 1955) | struct uint128
function INLINE (line 2013) | INLINE
type extFloat80M (line 2528) | struct extFloat80M
type uint128 (line 2529) | struct uint128
type exp8_sig16 (line 2568) | struct exp8_sig16 { int_fast8_t exp; uint_fast16_t sig; }
type exp8_sig16 (line 2569) | struct exp8_sig16
type exp16_sig32 (line 2589) | struct exp16_sig32 { int_fast16_t exp; uint_fast32_t sig; }
type exp16_sig32 (line 2590) | struct exp16_sig32
type exp16_sig64 (line 2610) | struct exp16_sig64 { int_fast16_t exp; uint_fast64_t sig; }
type exp16_sig64 (line 2611) | struct exp16_sig64
type exp32_sig64 (line 2635) | struct exp32_sig64 { int_fast32_t exp; uint64_t sig; }
type exp32_sig64 (line 2636) | struct exp32_sig64
type exp32_sig128 (line 2661) | struct exp32_sig128 { int_fast32_t exp; struct uint128 sig; }
type exp32_sig128 (line 2662) | struct exp32_sig128
type extFloat80M (line 2696) | struct extFloat80M
type extFloat80M (line 2697) | struct extFloat80M
type extFloat80M (line 2698) | struct extFloat80M
type extFloat80M (line 2700) | struct extFloat80M
type extFloat80M (line 2706) | struct extFloat80M
type extFloat80M (line 2709) | struct extFloat80M
type extFloat80M (line 2713) | struct extFloat80M
type extFloat80M (line 2714) | struct extFloat80M
type extFloat80M (line 2715) | struct extFloat80M
type extFloat80M (line 2721) | struct extFloat80M
type extFloat80M (line 2721) | struct extFloat80M
function uint_fast16_t (line 2767) | uint_fast16_t
function softfloat_f32UIToCommonNaN (line 2830) | void softfloat_f32UIToCommonNaN( uint_fast32_t uiA, struct commonNaN *zP...
function uint_fast32_t (line 2888) | uint_fast32_t softfloat_commonNaNToF32UI( const struct commonNaN *aPtr )
function uint_fast32_t (line 2946) | uint_fast32_t
function softfloat_f64UIToCommonNaN (line 3009) | void softfloat_f64UIToCommonNaN( uint_fast64_t uiA, struct commonNaN *zP...
function uint_fast64_t (line 3067) | uint_fast64_t softfloat_commonNaNToF64UI( const struct commonNaN *aPtr )
function uint_fast64_t (line 3127) | uint_fast64_t
function extF80M_isSignalingNaN (line 3186) | bool extF80M_isSignalingNaN( const extFloat80_t *aPtr )
function softfloat_extF80UIToCommonNaN (line 3250) | void
function softfloat_commonNaNToExtF80UI (line 3312) | struct uint128 softfloat_commonNaNToExtF80UI( const struct commonNaN *aP...
function softfloat_propagateNaNExtF80UI (line 3376) | struct uint128
function f128M_isSignalingNaN (line 3476) | bool f128M_isSignalingNaN( const float128_t *aPtr )
function softfloat_f128UIToCommonNaN (line 3543) | void
function softfloat_commonNaNToF128UI (line 3606) | struct uint128 softfloat_commonNaNToF128UI( const struct commonNaN *aPtr )
function softfloat_propagateNaNF128UI (line 3670) | struct uint128
function softfloat_eq128 (line 3745) | bool softfloat_eq128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t ...
function softfloat_le128 (line 3799) | bool softfloat_le128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t ...
function softfloat_lt128 (line 3853) | bool softfloat_lt128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t ...
function softfloat_shortShiftLeft128 (line 3907) | struct uint128
function softfloat_shortShiftRight128 (line 3965) | struct uint128
function softfloat_shortShiftRightJam64 (line 4022) | uint64_t softfloat_shortShiftRightJam64( uint64_t a, uint_fast8_t dist )
function softfloat_shortShiftRightJam64Extra (line 4076) | struct uint64_extra
function softfloat_shortShiftRightJam128 (line 4135) | struct uint128
function softfloat_shortShiftRightJam128Extra (line 4198) | struct uint128_extra
function softfloat_shiftRightJam32 (line 4259) | uint32_t softfloat_shiftRightJam32( uint32_t a, uint_fast16_t dist )
function softfloat_shiftRightJam64 (line 4313) | uint64_t softfloat_shiftRightJam64( uint64_t a, uint_fast32_t dist )
function softfloat_shiftRightJam64Extra (line 4368) | struct uint64_extra
function softfloat_shiftRightJam128 (line 4432) | struct uint128
function softfloat_shiftRightJam128Extra (line 4503) | struct uint128_extra
function softfloat_shortShiftRightJamM (line 4582) | static
function softfloat_shiftRightJam256M (line 4611) | void
function uint_fast8_t (line 4773) | uint_fast8_t softfloat_countLeadingZeros16( uint16_t a )
function uint_fast8_t (line 4835) | uint_fast8_t softfloat_countLeadingZeros32( uint32_t a )
function uint_fast8_t (line 4901) | uint_fast8_t softfloat_countLeadingZeros64( uint64_t a )
function softfloat_add128 (line 4974) | struct uint128
function softfloat_add256M (line 5031) | void
function softfloat_sub128 (line 5099) | struct uint128
function softfloat_sub256M (line 5156) | void
function softfloat_mul64ByShifted32To128 (line 5223) | struct uint128 softfloat_mul64ByShifted32To128( uint64_t a, uint32_t b )
function softfloat_mul64To128 (line 5281) | struct uint128 softfloat_mul64To128( uint64_t a, uint64_t b )
function softfloat_mul128By32 (line 5349) | struct uint128 softfloat_mul128By32( uint64_t a64, uint64_t a0, uint32_t...
function softfloat_mul128To256M (line 5411) | void
function softfloat_approxRecip32_1 (line 5535) | uint32_t softfloat_approxRecip32_1( uint32_t a )
function softfloat_approxRecipSqrt32_1 (line 5654) | uint32_t softfloat_approxRecipSqrt32_1( unsigned int oddExpA, uint32_t a )
function uint_fast32_t (line 5728) | uint_fast32_t
function uint_fast64_t (line 5823) | uint_fast64_t
function int_fast32_t (line 5922) | int_fast32_t
function int_fast64_t (line 6022) | int_fast64_t
function softfloat_normSubnormalF16Sig (line 6122) | struct exp8_sig16 softfloat_normSubnormalF16Sig( uint_fast16_t sig )
function float16_t (line 6178) | float16_t
function float16_t (line 6292) | float16_t
function float16_t (line 6354) | float16_t softfloat_addMagsF16( uint_fast16_t uiA, uint_fast16_t uiB )
function float16_t (line 6539) | float16_t softfloat_subMagsF16( uint_fast16_t uiA, uint_fast16_t uiB )
function float16_t (line 6728) | float16_t
function softfloat_normSubnormalF32Sig (line 6953) | struct exp16_sig32 softfloat_normSubnormalF32Sig( uint_fast32_t sig )
function float32_t (line 7009) | float32_t
function float32_t (line 7123) | float32_t
function float32_t (line 7184) | float32_t softfloat_addMagsF32( uint_fast32_t uiA, uint_fast32_t uiB )
function float32_t (line 7313) | float32_t softfloat_subMagsF32( uint_fast32_t uiA, uint_fast32_t uiB )
function float32_t (line 7458) | float32_t
function softfloat_normSubnormalF64Sig (line 7681) | struct exp16_sig64 softfloat_normSubnormalF64Sig( uint_fast64_t sig )
function float64_t (line 7737) | float64_t
function float64_t (line 7855) | float64_t
function float64_t (line 7916) | float64_t
function float64_t (line 8047) | float64_t
function float64_t (line 8192) | float64_t
function float64_t (line 8392) | float64_t
function softfloat_normSubnormalExtF80Sig (line 8685) | struct exp32_sig64 softfloat_normSubnormalExtF80Sig( uint_fast64_t sig )
function extFloat80_t (line 8741) | extFloat80_t
function extFloat80_t (line 8998) | extFloat80_t
function extFloat80_t (line 9073) | extFloat80_t
function extFloat80_t (line 9231) | extFloat80_t
function softfloat_normSubnormalF128Sig (line 9388) | struct exp32_sig128
function float128_t (line 9457) | float128_t
function float128_t (line 9629) | float128_t
function float128_t (line 9713) | float128_t
function float128_t (line 9870) | float128_t
function float128_t (line 10011) | float128_t
function float16_t (line 10415) | float16_t ui32_to_f16( uint32_t a )
function float32_t (line 10482) | float32_t ui32_to_f32( uint32_t a )
function float64_t (line 10541) | float64_t ui32_to_f64( uint32_t a )
function extFloat80_t (line 10602) | extFloat80_t ui32_to_extF80( uint32_t a )
function ui32_to_extF80M (line 10665) | void ui32_to_extF80M( uint32_t a, extFloat80_t *zPtr )
function ui32_to_extF80M (line 10674) | void ui32_to_extF80M( uint32_t a, extFloat80_t *zPtr )
function float128_t (line 10739) | float128_t ui32_to_f128( uint32_t a )
function ui32_to_f128M (line 10803) | void ui32_to_f128M( uint32_t a, float128_t *zPtr )
function ui32_to_f128M (line 10812) | void ui32_to_f128M( uint32_t a, float128_t *zPtr )
function float16_t (line 10879) | float16_t ui64_to_f16( uint64_t a )
function float32_t (line 10945) | float32_t ui64_to_f32( uint64_t a )
function float64_t (line 11011) | float64_t ui64_to_f64( uint64_t a )
function extFloat80_t (line 11072) | extFloat80_t ui64_to_extF80( uint64_t a )
function ui64_to_extF80M (line 11135) | void ui64_to_extF80M( uint64_t a, extFloat80_t *zPtr )
function ui64_to_extF80M (line 11144) | void ui64_to_extF80M( uint64_t a, extFloat80_t *zPtr )
function float128_t (line 11209) | float128_t ui64_to_f128( uint64_t a )
function ui64_to_f128M (line 11281) | void ui64_to_f128M( uint64_t a, float128_t *zPtr )
function ui64_to_f128M (line 11290) | void ui64_to_f128M( uint64_t a, float128_t *zPtr )
function float16_t (line 11368) | float16_t i32_to_f16( int32_t a )
function float32_t (line 11441) | float32_t i32_to_f32( int32_t a )
function float64_t (line 11501) | float64_t i32_to_f64( int32_t a )
function extFloat80_t (line 11568) | extFloat80_t i32_to_extF80( int32_t a )
function i32_to_extF80M (line 11636) | void i32_to_extF80M( int32_t a, extFloat80_t *zPtr )
function i32_to_extF80M (line 11645) | void i32_to_extF80M( int32_t a, extFloat80_t *zPtr )
function float128_t (line 11714) | float128_t i32_to_f128( int32_t a )
function i32_to_f128M (line 11782) | void i32_to_f128M( int32_t a, float128_t *zPtr )
function i32_to_f128M (line 11791) | void i32_to_f128M( int32_t a, float128_t *zPtr )
function float16_t (line 11864) | float16_t i64_to_f16( int64_t a )
function float32_t (line 11936) | float32_t i64_to_f32( int64_t a )
function float64_t (line 12008) | float64_t i64_to_f64( int64_t a )
function extFloat80_t (line 12068) | extFloat80_t i64_to_extF80( int64_t a )
function i64_to_extF80M (line 12136) | void i64_to_extF80M( int64_t a, extFloat80_t *zPtr )
function i64_to_extF80M (line 12145) | void i64_to_extF80M( int64_t a, extFloat80_t *zPtr )
function float128_t (line 12214) | float128_t i64_to_f128( int64_t a )
function i64_to_f128M (line 12290) | void i64_to_f128M( int64_t a, float128_t *zPtr )
function i64_to_f128M (line 12299) | void i64_to_f128M( int64_t a, float128_t *zPtr )
function uint_fast32_t (line 12384) | uint_fast32_t f16_to_ui32( float16_t a, uint_fast8_t roundingMode, bool ...
function uint_fast64_t (line 12470) | uint_fast64_t f16_to_ui64( float16_t a, uint_fast8_t roundingMode, bool ...
function int_fast32_t (line 12568) | int_fast32_t f16_to_i32( float16_t a, uint_fast8_t roundingMode, bool ex...
function int_fast64_t (line 12657) | int_fast64_t f16_to_i64( float16_t a, uint_fast8_t roundingMode, bool ex...
function uint_fast32_t (line 12746) | uint_fast32_t f16_to_ui32_r_minMag( float16_t a, bool exact )
function uint_fast64_t (line 12835) | uint_fast64_t f16_to_ui64_r_minMag( float16_t a, bool exact )
function int_fast32_t (line 12924) | int_fast32_t f16_to_i32_r_minMag( float16_t a, bool exact )
function int_fast64_t (line 13014) | int_fast64_t f16_to_i64_r_minMag( float16_t a, bool exact )
function float32_t (line 13104) | float32_t f16_to_f32( float16_t a )
function float64_t (line 13199) | float64_t f16_to_f64( float16_t a )
function extFloat80_t (line 13294) | extFloat80_t f16_to_extF80( float16_t a )
function f16_to_extF80M (line 13399) | void f16_to_extF80M( float16_t a, extFloat80_t *zPtr )
function f16_to_extF80M (line 13408) | void f16_to_extF80M( float16_t a, extFloat80_t *zPtr )
function float128_t (line 13510) | float128_t f16_to_f128( float16_t a )
function f16_to_f128M (line 13610) | void f16_to_f128M( float16_t a, float128_t *zPtr )
function f16_to_f128M (line 13619) | void f16_to_f128M( float16_t a, float128_t *zPtr )
function float16_t (line 13721) | float16_t f16_roundToInt( float16_t a, uint_fast8_t roundingMode, bool e...
function float16_t (line 13842) | float16_t f16_add( float16_t a, float16_t b )
function float16_t (line 13914) | float16_t f16_sub( float16_t a, float16_t b )
function float16_t (line 13987) | float16_t f16_mul( float16_t a, float16_t b )
function float16_t (line 14127) | float16_t f16_mulAdd( float16_t a, float16_t b, float16_t c )
function float16_t (line 14194) | float16_t f16_div( float16_t a, float16_t b )
function float16_t (line 14379) | float16_t f16_rem( float16_t a, float16_t b )
function float16_t (line 14555) | float16_t f16_sqrt( float16_t a )
function f16_eq (line 14690) | bool f16_eq( float16_t a, float16_t b )
function f16_le (line 14757) | bool f16_le( float16_t a, float16_t b )
function f16_lt (line 14825) | bool f16_lt( float16_t a, float16_t b )
function f16_eq_signaling (line 14893) | bool f16_eq_signaling( float16_t a, float16_t b )
function f16_le_quiet (line 14957) | bool f16_le_quiet( float16_t a, float16_t b )
function f16_lt_quiet (line 15030) | bool f16_lt_quiet( float16_t a, float16_t b )
function f16_isSignalingNaN (line 15102) | bool f16_isSignalingNaN( float16_t a )
function uint_fast32_t (line 15156) | uint_fast32_t f32_to_ui32( float32_t a, uint_fast8_t roundingMode, bool ...
function uint_fast64_t (line 15242) | uint_fast64_t f32_to_ui64( float32_t a, uint_fast8_t roundingMode, bool ...
function int_fast32_t (line 15340) | int_fast32_t f32_to_i32( float32_t a, uint_fast8_t roundingMode, bool ex...
function int_fast64_t (line 15426) | int_fast64_t f32_to_i64( float32_t a, uint_fast8_t roundingMode, bool ex...
function uint_fast32_t (line 15524) | uint_fast32_t f32_to_ui32_r_minMag( float32_t a, bool exact )
function uint_fast64_t (line 15614) | uint_fast64_t f32_to_ui64_r_minMag( float32_t a, bool exact )
function int_fast32_t (line 15706) | int_fast32_t f32_to_i32_r_minMag( float32_t a, bool exact )
function int_fast64_t (line 15797) | int_fast64_t f32_to_i64_r_minMag( float32_t a, bool exact )
function float16_t (line 15893) | float16_t f32_to_f16( float32_t a )
function float64_t (line 15983) | float64_t f32_to_f64( float32_t a )
function extFloat80_t (line 16078) | extFloat80_t f32_to_extF80( float32_t a )
function f32_to_extF80M (line 16183) | void f32_to_extF80M( float32_t a, extFloat80_t *zPtr )
function f32_to_extF80M (line 16192) | void f32_to_extF80M( float32_t a, extFloat80_t *zPtr )
function float128_t (line 16294) | float128_t f32_to_f128( float32_t a )
function f32_to_f128M (line 16394) | void f32_to_f128M( float32_t a, float128_t *zPtr )
function f32_to_f128M (line 16403) | void f32_to_f128M( float32_t a, float128_t *zPtr )
function float32_t (line 16509) | float32_t f32_roundToInt( float32_t a, uint_fast8_t roundingMode, bool e...
function float32_t (line 16630) | float32_t f32_add( float32_t a, float32_t b )
function float32_t (line 16702) | float32_t f32_sub( float32_t a, float32_t b )
function float32_t (line 16775) | float32_t f32_mul( float32_t a, float32_t b )
function float32_t (line 16912) | float32_t f32_mulAdd( float32_t a, float32_t b, float32_t c )
function float32_t (line 16976) | float32_t f32_div( float32_t a, float32_t b )
function float32_t (line 17158) | float32_t f32_rem( float32_t a, float32_t b )
function float32_t (line 17328) | float32_t f32_sqrt( float32_t a )
function f32_eq (line 17451) | bool f32_eq( float32_t a, float32_t b )
function f32_le (line 17518) | bool f32_le( float32_t a, float32_t b )
function f32_lt (line 17586) | bool f32_lt( float32_t a, float32_t b )
function f32_eq_signaling (line 17654) | bool f32_eq_signaling( float32_t a, float32_t b )
function f32_le_quiet (line 17718) | bool f32_le_quiet( float32_t a, float32_t b )
function f32_lt_quiet (line 17791) | bool f32_lt_quiet( float32_t a, float32_t b )
function f32_isSignalingNaN (line 17863) | bool f32_isSignalingNaN( float32_t a )
function uint_fast32_t (line 17917) | uint_fast32_t f64_to_ui32( float64_t a, uint_fast8_t roundingMode, bool ...
function uint_fast64_t (line 18001) | uint_fast64_t f64_to_ui64( float64_t a, uint_fast8_t roundingMode, bool ...
function int_fast32_t (line 18106) | int_fast32_t f64_to_i32( float64_t a, uint_fast8_t roundingMode, bool ex...
function int_fast64_t (line 18190) | int_fast64_t f64_to_i64( float64_t a, uint_fast8_t roundingMode, bool ex...
function uint_fast32_t (line 18295) | uint_fast32_t f64_to_ui32_r_minMag( float64_t a, bool exact )
function uint_fast64_t (line 18385) | uint_fast64_t f64_to_ui64_r_minMag( float64_t a, bool exact )
function int_fast32_t (line 18480) | int_fast32_t f64_to_i32_r_minMag( float64_t a, bool exact )
function int_fast64_t (line 18578) | int_fast64_t f64_to_i64_r_minMag( float64_t a, bool exact )
function float16_t (line 18680) | float16_t f64_to_f16( float64_t a )
function float32_t (line 18770) | float32_t f64_to_f32( float64_t a )
function extFloat80_t (line 18860) | extFloat80_t f64_to_extF80( float64_t a )
function f64_to_extF80M (line 18965) | void f64_to_extF80M( float64_t a, extFloat80_t *zPtr )
function f64_to_extF80M (line 18974) | void f64_to_extF80M( float64_t a, extFloat80_t *zPtr )
function float128_t (line 19076) | float128_t f64_to_f128( float64_t a )
function f64_to_f128M (line 19178) | void f64_to_f128M( float64_t a, float128_t *zPtr )
function f64_to_f128M (line 19187) | void f64_to_f128M( float64_t a, float128_t *zPtr )
function float64_t (line 19295) | float64_t f64_roundToInt( float64_t a, uint_fast8_t roundingMode, bool e...
function float64_t (line 19416) | float64_t f64_add( float64_t a, float64_t b )
function float64_t (line 19492) | float64_t f64_sub( float64_t a, float64_t b )
function float64_t (line 19569) | float64_t f64_mul( float64_t a, float64_t b )
function float64_t (line 19719) | float64_t f64_mulAdd( float64_t a, float64_t b, float64_t c )
function float64_t (line 19783) | float64_t f64_div( float64_t a, float64_t b )
function float64_t (line 19957) | float64_t f64_rem( float64_t a, float64_t b )
function float64_t (line 20148) | float64_t f64_sqrt( float64_t a )
function f64_eq (line 20283) | bool f64_eq( float64_t a, float64_t b )
function f64_le (line 20350) | bool f64_le( float64_t a, float64_t b )
function f64_lt (line 20419) | bool f64_lt( float64_t a, float64_t b )
function f64_eq_signaling (line 20488) | bool f64_eq_signaling( float64_t a, float64_t b )
function f64_le_quiet (line 20552) | bool f64_le_quiet( float64_t a, float64_t b )
function f64_lt_quiet (line 20626) | bool f64_lt_quiet( float64_t a, float64_t b )
function f64_isSignalingNaN (line 20699) | bool f64_isSignalingNaN( float64_t a )
function uint_fast32_t (line 20753) | uint_fast32_t
function uint_fast64_t (line 20838) | uint_fast64_t
function int_fast32_t (line 20924) | int_fast32_t
function int_fast64_t (line 21009) | int_fast64_t
function uint_fast32_t (line 21100) | uint_fast32_t extF80_to_ui32_r_minMag( extFloat80_t a, bool exact )
function uint_fast64_t (line 21190) | uint_fast64_t extF80_to_ui64_r_minMag( extFloat80_t a, bool exact )
function int_fast32_t (line 21280) | int_fast32_t extF80_to_i32_r_minMag( extFloat80_t a, bool exact )
function int_fast64_t (line 21379) | int_fast64_t extF80_to_i64_r_minMag( extFloat80_t a, bool exact )
function float16_t (line 21475) | float16_t extF80_to_f16( extFloat80_t a )
function float32_t (line 21573) | float32_t extF80_to_f32( extFloat80_t a )
function float64_t (line 21671) | float64_t extF80_to_f64( extFloat80_t a )
function float128_t (line 21769) | float128_t extF80_to_f128( extFloat80_t a )
function extFloat80_t (line 21846) | extFloat80_t
function extFloat80_t (line 22001) | extFloat80_t extF80_add( extFloat80_t a, extFloat80_t b )
function extFloat80_t (line 22083) | extFloat80_t extF80_sub( extFloat80_t a, extFloat80_t b )
function extFloat80_t (line 22166) | extFloat80_t extF80_mul( extFloat80_t a, extFloat80_t b )
function extFloat80_t (line 22326) | extFloat80_t extF80_div( extFloat80_t a, extFloat80_t b )
function extFloat80_t (line 22531) | extFloat80_t extF80_rem( extFloat80_t a, extFloat80_t b )
function extFloat80_t (line 22758) | extFloat80_t extF80_sqrt( extFloat80_t a )
function extF80_eq (line 22936) | bool extF80_eq( extFloat80_t a, extFloat80_t b )
function extF80_le (line 23011) | bool extF80_le( extFloat80_t a, extFloat80_t b )
function extF80_lt (line 23086) | bool extF80_lt( extFloat80_t a, extFloat80_t b )
function extF80_eq_signaling (line 23160) | bool extF80_eq_signaling( extFloat80_t a, extFloat80_t b )
function extF80_le_quiet (line 23230) | bool extF80_le_quiet( extFloat80_t a, extFloat80_t b )
function extF80_lt_quiet (line 23310) | bool extF80_lt_quiet( extFloat80_t a, extFloat80_t b )
function extF80_isSignalingNaN (line 23389) | bool extF80_isSignalingNaN( extFloat80_t a )
function uint_fast32_t (line 23445) | uint_fast32_t
function uint_fast32_t (line 23456) | uint_fast32_t
function uint_fast64_t (line 23548) | uint_fast64_t
function uint_fast64_t (line 23559) | uint_fast64_t
function int_fast32_t (line 23647) | int_fast32_t
function int_fast32_t (line 23658) | int_fast32_t
function int_fast64_t (line 23749) | int_fast64_t
function int_fast64_t (line 23760) | int_fast64_t
function uint_fast32_t (line 23848) | uint_fast32_t extF80M_to_ui32_r_minMag( const extFloat80_t *aPtr, bool e...
function uint_fast32_t (line 23857) | uint_fast32_t extF80M_to_ui32_r_minMag( const extFloat80_t *aPtr, bool e...
function uint_fast64_t (line 23961) | uint_fast64_t extF80M_to_ui64_r_minMag( const extFloat80_t *aPtr, bool e...
function uint_fast64_t (line 23970) | uint_fast64_t extF80M_to_ui64_r_minMag( const extFloat80_t *aPtr, bool e...
function int_fast32_t (line 24071) | int_fast32_t extF80M_to_i32_r_minMag( const extFloat80_t *aPtr, bool exa...
function int_fast32_t (line 24080) | int_fast32_t extF80M_to_i32_r_minMag( const extFloat80_t *aPtr, bool exa...
function int_fast64_t (line 24193) | int_fast64_t extF80M_to_i64_r_minMag( const extFloat80_t *aPtr, bool exa...
function int_fast64_t (line 24202) | int_fast64_t extF80M_to_i64_r_minMag( const extFloat80_t *aPtr, bool exa...
function float16_t (line 24310) | float16_t extF80M_to_f16( const extFloat80_t *aPtr )
function float16_t (line 24319) | float16_t extF80M_to_f16( const extFloat80_t *aPtr )
function float32_t (line 24424) | float32_t extF80M_to_f32( const extFloat80_t *aPtr )
function float32_t (line 24433) | float32_t extF80M_to_f32( const extFloat80_t *aPtr )
function float64_t (line 24538) | float64_t extF80M_to_f64( const extFloat80_t *aPtr )
function float64_t (line 24547) | float64_t extF80M_to_f64( const extFloat80_t *aPtr )
function extF80M_to_f128M (line 24652) | void extF80M_to_f128M( const extFloat80_t *aPtr, float128_t *zPtr )
function extF80M_to_f128M (line 24661) | void extF80M_to_f128M( const extFloat80_t *aPtr, float128_t *zPtr )
function extF80M_roundToInt (line 24779) | void
function extF80M_roundToInt (line 24794) | void
function extF80M_add (line 24955) | void
function extF80M_add (line 24996) | void
function extF80M_sub (line 25057) | void
function extF80M_sub (line 25098) | void
function extF80M_mul (line 25161) | void
function extF80M_mul (line 25172) | void
function extF80M_div (line 25302) | void
function extF80M_div (line 25313) | void
function extF80M_rem (line 25498) | void
function extF80M_rem (line 25509) | void
function extF80M_sqrt (line 25704) | void extF80M_sqrt( const extFloat80_t *aPtr, extFloat80_t *zPtr )
function extF80M_sqrt (line 25713) | void extF80M_sqrt( const extFloat80_t *aPtr, extFloat80_t *zPtr )
function extF80M_eq (line 25886) | bool extF80M_eq( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_eq (line 25895) | bool extF80M_eq( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_le (line 25985) | bool extF80M_le( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_le (line 25994) | bool extF80M_le( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_lt (line 26093) | bool extF80M_lt( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_lt (line 26102) | bool extF80M_lt( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_eq_signaling (line 26201) | bool extF80M_eq_signaling( const extFloat80_t *aPtr, const extFloat80_t ...
function extF80M_eq_signaling (line 26210) | bool extF80M_eq_signaling( const extFloat80_t *aPtr, const extFloat80_t ...
function extF80M_le_quiet (line 26296) | bool extF80M_le_quiet( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_le_quiet (line 26305) | bool extF80M_le_quiet( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_lt_quiet (line 26410) | bool extF80M_lt_quiet( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function extF80M_lt_quiet (line 26419) | bool extF80M_lt_quiet( const extFloat80_t *aPtr, const extFloat80_t *bPtr )
function uint_fast32_t (line 26522) | uint_fast32_t
function uint_fast64_t (line 26610) | uint_fast64_t
function int_fast32_t (line 26708) | int_fast32_t f128_to_i32( float128_t a, uint_fast8_t roundingMode, bool ...
function int_fast64_t (line 26795) | int_fast64_t f128_to_i64( float128_t a, uint_fast8_t roundingMode, bool ...
function uint_fast32_t (line 26892) | uint_fast32_t f128_to_ui32_r_minMag( float128_t a, bool exact )
function uint_fast64_t (line 26983) | uint_fast64_t f128_to_ui64_r_minMag( float128_t a, bool exact )
function int_fast32_t (line 27090) | int_fast32_t f128_to_i32_r_minMag( float128_t a, bool exact )
function int_fast64_t (line 27192) | int_fast64_t f128_to_i64_r_minMag( float128_t a, bool exact )
function float16_t (line 27307) | float16_t f128_to_f16( float128_t a )
function float32_t (line 27404) | float32_t f128_to_f32( float128_t a )
function extFloat80_t (line 27501) | extFloat80_t f128_to_extF80( float128_t a )
function float64_t (line 27612) | float64_t f128_to_f64( float128_t a )
function float128_t (line 27714) | float128_t
function float128_t (line 27887) | float128_t f128_add( float128_t a, float128_t b )
function float128_t (line 27967) | float128_t f128_sub( float128_t a, float128_t b )
function float128_t (line 28048) | float128_t f128_mul( float128_t a, float128_t b )
function float128_t (line 28211) | float128_t f128_mulAdd( float128_t a, float128_t b, float128_t c )
function float128_t (line 28278) | float128_t f128_div( float128_t a, float128_t b )
function float128_t (line 28479) | float128_t f128_rem( float128_t a, float128_t b )
function float128_t (line 28671) | float128_t f128_sqrt( float128_t a )
function f128_eq (line 28874) | bool f128_eq( float128_t a, float128_t b )
function f128_le (line 28948) | bool f128_le( float128_t a, float128_t b )
function f128_lt (line 29022) | bool f128_lt( float128_t a, float128_t b )
function f128_eq_signaling (line 29096) | bool f128_eq_signaling( float128_t a, float128_t b )
function f128_le_quiet (line 29166) | bool f128_le_quiet( float128_t a, float128_t b )
function f128_lt_quiet (line 29246) | bool f128_lt_quiet( float128_t a, float128_t b )
function f128_isSignalingNaN (line 29325) | bool f128_isSignalingNaN( float128_t a )
function uint_fast32_t (line 29381) | uint_fast32_t
function uint_fast32_t (line 29391) | uint_fast32_t
function uint_fast64_t (line 29481) | uint_fast64_t
function uint_fast64_t (line 29491) | uint_fast64_t
function int_fast32_t (line 29585) | int_fast32_t
function int_fast32_t (line 29595) | int_fast32_t
function int_fast64_t (line 29685) | int_fast64_t
function int_fast64_t (line 29695) | int_fast64_t
function uint_fast32_t (line 29789) | uint_fast32_t f128M_to_ui32_r_minMag( const float128_t *aPtr, bool exact )
function uint_fast32_t (line 29798) | uint_fast32_t f128M_to_ui32_r_minMag( const float128_t *aPtr, bool exact )
function uint_fast64_t (line 29893) | uint_fast64_t f128M_to_ui64_r_minMag( const float128_t *aPtr, bool exact )
function uint_fast64_t (line 29902) | uint_fast64_t f128M_to_ui64_r_minMag( const float128_t *aPtr, bool exact )
function int_fast32_t (line 30009) | int_fast32_t f128M_to_i32_r_minMag( const float128_t *aPtr, bool exact )
function int_fast32_t (line 30018) | int_fast32_t f128M_to_i32_r_minMag( const float128_t *aPtr, bool exact )
function int_fast64_t (line 30117) | int_fast64_t f128M_to_i64_r_minMag( const float128_t *aPtr, bool exact )
function int_fast64_t (line 30126) | int_fast64_t f128M_to_i64_r_minMag( const float128_t *aPtr, bool exact )
function float16_t (line 30243) | float16_t f128M_to_f16( const float128_t *aPtr )
function float16_t (line 30252) | float16_t f128M_to_f16( const float128_t *aPtr )
function float32_t (line 30358) | float32_t f128M_to_f32( const float128_t *aPtr )
function float32_t (line 30367) | float32_t f128M_to_f32( const float128_t *aPtr )
function f128M_to_extF80M (line 30469) | void f128M_to_extF80M( const float128_t *aPtr, extFloat80_t *zPtr )
function f128M_to_extF80M (line 30478) | void f128M_to_extF80M( const float128_t *aPtr, extFloat80_t *zPtr )
function float64_t (line 30572) | float64_t f128M_to_f64( const float128_t *aPtr )
function float64_t (line 30581) | float64_t f128M_to_f64( const float128_t *aPtr )
function f128M_roundToInt (line 30686) | void
function f128M_roundToInt (line 30701) | void
function f128M_add (line 30910) | void
function f128M_add (line 30948) | void
function f128M_sub (line 31009) | void
function f128M_sub (line 31047) | void
function f128M_mul (line 31109) | void
function f128M_mul (line 31119) | void
function f128M_mulAdd (line 31267) | void
function f128M_mulAdd (line 31295) | void
function f128M_div (line 31363) | void
function f128M_div (line 31373) | void
function f128M_rem (line 31552) | void
function f128M_rem (line 31562) | void
function f128M_sqrt (line 31736) | void f128M_sqrt( const float128_t *aPtr, float128_t *zPtr )
function f128M_sqrt (line 31745) | void f128M_sqrt( const float128_t *aPtr, float128_t *zPtr )
function f128M_eq (line 31966) | bool f128M_eq( const float128_t *aPtr, const float128_t *bPtr )
function f128M_eq (line 31975) | bool f128M_eq( const float128_t *aPtr, const float128_t *bPtr )
function f128M_le (line 32067) | bool f128M_le( const float128_t *aPtr, const float128_t *bPtr )
function f128M_le (line 32076) | bool f128M_le( const float128_t *aPtr, const float128_t *bPtr )
function f128M_lt (line 32162) | bool f128M_lt( const float128_t *aPtr, const float128_t *bPtr )
function f128M_lt (line 32171) | bool f128M_lt( const float128_t *aPtr, const float128_t *bPtr )
function f128M_eq_signaling (line 32258) | bool f128M_eq_signaling( const float128_t *aPtr, const float128_t *bPtr )
function f128M_eq_signaling (line 32267) | bool f128M_eq_signaling( const float128_t *aPtr, const float128_t *bPtr )
function f128M_le_quiet (line 32352) | bool f128M_le_quiet( const float128_t *aPtr, const float128_t *bPtr )
function f128M_le_quiet (line 32361) | bool f128M_le_quiet( const float128_t *aPtr, const float128_t *bPtr )
function f128M_lt_quiet (line 32450) | bool f128M_lt_quiet( const float128_t *aPtr, const float128_t *bPtr )
function f128M_lt_quiet (line 32459) | bool f128M_lt_quiet( const float128_t *aPtr, const float128_t *bPtr )
FILE: lib/zstd/zstddeclib.c
function MEM_STATIC (line 259) | MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) ...
type BYTE (line 340) | typedef uint8_t BYTE;
type U16 (line 341) | typedef uint16_t U16;
type S16 (line 342) | typedef int16_t S16;
type U32 (line 343) | typedef uint32_t U32;
type S32 (line 344) | typedef int32_t S32;
type U64 (line 345) | typedef uint64_t U64;
type S64 (line 346) | typedef int64_t S64;
type BYTE (line 352) | typedef unsigned char BYTE;
type U16 (line 356) | typedef unsigned short U16;
type S16 (line 357) | typedef signed short S16;
type U32 (line 361) | typedef unsigned int U32;
type S32 (line 362) | typedef signed int S32;
type U64 (line 365) | typedef unsigned long long U64;
type S64 (line 366) | typedef signed long long S64;
function MEM_32bits (line 394) | MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
function MEM_64bits (line 395) | MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
function MEM_isLittleEndian (line 397) | MEM_STATIC unsigned MEM_isLittleEndian(void)
function MEM_STATIC (line 407) | MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) mem...
function MEM_STATIC (line 408) | MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) mem...
function MEM_STATIC (line 409) | MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) mem...
function MEM_STATIC (line 410) | MEM_STATIC size_t MEM_readST(const void* memPtr) { return *(const size_t...
function MEM_STATIC (line 412) | MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = v...
function MEM_STATIC (line 413) | MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(U32*)memPtr = v...
function MEM_STATIC (line 414) | MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(U64*)memPtr = v...
type unalign16 (line 422) | typedef struct { U16 v; } unalign16;
type unalign32 (line 423) | typedef struct { U32 v; } unalign32;
type unalign64 (line 424) | typedef struct { U64 v; } unalign64;
type unalignArch (line 425) | typedef struct { size_t v; } unalignArch;
type unalign16 (line 428) | typedef struct { U16 v; } __attribute__((packed)) unalign16;
type unalign32 (line 429) | typedef struct { U32 v; } __attribute__((packed)) unalign32;
type unalign64 (line 430) | typedef struct { U64 v; } __attribute__((packed)) unalign64;
type unalignArch (line 431) | typedef struct { size_t v; } __attribute__((packed)) unalignArch;
function MEM_STATIC (line 434) | MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign16*)p...
function MEM_STATIC (line 435) | MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign32*)p...
function MEM_STATIC (line 436) | MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign64*)p...
function MEM_STATIC (line 437) | MEM_STATIC size_t MEM_readST(const void* ptr) { return ((const unalignAr...
function MEM_STATIC (line 439) | MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign16*)memP...
function MEM_STATIC (line 440) | MEM_STATIC void MEM_write32(void* memPtr, U32 value) { ((unalign32*)memP...
function MEM_STATIC (line 441) | MEM_STATIC void MEM_write64(void* memPtr, U64 value) { ((unalign64*)memP...
function MEM_STATIC (line 448) | MEM_STATIC U16 MEM_read16(const void* memPtr)
function MEM_STATIC (line 453) | MEM_STATIC U32 MEM_read32(const void* memPtr)
function MEM_STATIC (line 458) | MEM_STATIC U64 MEM_read64(const void* memPtr)
function MEM_STATIC (line 463) | MEM_STATIC size_t MEM_readST(const void* memPtr)
function MEM_STATIC (line 468) | MEM_STATIC void MEM_write16(void* memPtr, U16 value)
function MEM_STATIC (line 473) | MEM_STATIC void MEM_write32(void* memPtr, U32 value)
function MEM_STATIC (line 478) | MEM_STATIC void MEM_write64(void* memPtr, U64 value)
function MEM_STATIC (line 485) | MEM_STATIC U32 MEM_swap32(U32 in)
function MEM_STATIC (line 500) | MEM_STATIC U64 MEM_swap64(U64 in)
function MEM_STATIC (line 519) | MEM_STATIC size_t MEM_swapST(size_t in)
function MEM_STATIC (line 529) | MEM_STATIC U16 MEM_readLE16(const void* memPtr)
function MEM_STATIC (line 539) | MEM_STATIC void MEM_writeLE16(void* memPtr, U16 val)
function MEM_STATIC (line 550) | MEM_STATIC U32 MEM_readLE24(const void* memPtr)
function MEM_STATIC (line 555) | MEM_STATIC void MEM_writeLE24(void* memPtr, U32 val)
function MEM_STATIC (line 561) | MEM_STATIC U32 MEM_readLE32(const void* memPtr)
function MEM_STATIC (line 569) | MEM_STATIC void MEM_writeLE32(void* memPtr, U32 val32)
function MEM_STATIC (line 577) | MEM_STATIC U64 MEM_readLE64(const void* memPtr)
function MEM_STATIC (line 585) | MEM_STATIC void MEM_writeLE64(void* memPtr, U64 val64)
function MEM_STATIC (line 593) | MEM_STATIC size_t MEM_readLEST(const void* memPtr)
function MEM_STATIC (line 601) | MEM_STATIC void MEM_writeLEST(void* memPtr, size_t val)
function MEM_STATIC (line 611) | MEM_STATIC U32 MEM_readBE32(const void* memPtr)
function MEM_STATIC (line 619) | MEM_STATIC void MEM_writeBE32(void* memPtr, U32 val32)
function MEM_STATIC (line 627) | MEM_STATIC U64 MEM_readBE64(const void* memPtr)
function MEM_STATIC (line 635) | MEM_STATIC void MEM_writeBE64(void* memPtr, U64 val64)
function MEM_STATIC (line 643) | MEM_STATIC size_t MEM_readBEST(const void* memPtr)
function MEM_STATIC (line 651) | MEM_STATIC void MEM_writeBEST(void* memPtr, size_t val)
type ZSTD_ErrorCode (line 743) | typedef enum {
type ZSTD_ErrorCode (line 806) | typedef ZSTD_ErrorCode ERR_enum;
function ERR_isError (line 817) | ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxC...
function ERR_STATIC (line 819) | ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(cod...
function ERR_STATIC (line 832) | ERR_STATIC const char* ERR_getErrorName(size_t code)
type FSE_CTable (line 1004) | typedef unsigned FSE_CTable;
type FSE_DTable (line 1077) | typedef unsigned FSE_DTable;
type BIT_CStream_t (line 1371) | typedef struct {
type BIT_DStream_t (line 1405) | typedef struct {
type BIT_DStream_status (line 1413) | typedef enum { BIT_DStream_unfinished = 0,
function BIT_highbit32 (line 1453) | MEM_STATIC unsigned BIT_highbit32 (U32 val)
function MEM_STATIC (line 1497) | MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
function MEM_STATIC (line 1512) | MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC,
function MEM_STATIC (line 1525) | MEM_STATIC void BIT_addBitsFast(BIT_CStream_t* bitC,
function MEM_STATIC (line 1537) | MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC)
function MEM_STATIC (line 1553) | MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
function MEM_STATIC (line 1568) | MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC)
function MEM_STATIC (line 1586) | MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBu...
function MEM_STATIC (line 1634) | MEM_STATIC size_t BIT_getUpperBits(size_t bitContainer, U32 const start)
function MEM_STATIC (line 1639) | MEM_STATIC size_t BIT_getMiddleBits(size_t bitContainer, U32 const start...
function MEM_STATIC (line 1647) | MEM_STATIC size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
function MEM_STATIC (line 1659) | MEM_STATIC size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits)
function MEM_STATIC (line 1675) | MEM_STATIC size_t BIT_lookBitsFast(const BIT_DStream_t* bitD, U32 nbBits)
function MEM_STATIC (line 1682) | MEM_STATIC void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits)
function MEM_STATIC (line 1691) | MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits)
function MEM_STATIC (line 1700) | MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits)
function MEM_STATIC (line 1714) | MEM_STATIC BIT_DStream_status BIT_reloadDStreamFast(BIT_DStream_t* bitD)
function MEM_STATIC (line 1730) | MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
function BIT_endOfDStream (line 1759) | MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream)
type FSE_repeat (line 1824) | typedef enum {
type FSE_CState_t (line 1837) | typedef struct {
type FSE_DState_t (line 1897) | typedef struct {
type FSE_symbolCompressionTransform (line 1969) | typedef struct {
function MEM_STATIC (line 1974) | MEM_STATIC void FSE_initCState(FSE_CState_t* statePtr, const FSE_CTable*...
function MEM_STATIC (line 1989) | MEM_STATIC void FSE_initCState2(FSE_CState_t* statePtr, const FSE_CTable...
function MEM_STATIC (line 2000) | MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* stat...
function MEM_STATIC (line 2009) | MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t*...
function MEM_STATIC (line 2021) | MEM_STATIC U32 FSE_getMaxNbBits(const void* symbolTTPtr, U32 symbolValue)
function MEM_STATIC (line 2031) | MEM_STATIC U32 FSE_bitCost(const void* symbolTTPtr, U32 tableLog, U32 sy...
type FSE_DTableHeader (line 2051) | typedef struct {
type FSE_decode_t (line 2056) | typedef struct
function MEM_STATIC (line 2063) | MEM_STATIC void FSE_initDState(FSE_DState_t* DStatePtr, BIT_DStream_t* b...
function MEM_STATIC (line 2072) | MEM_STATIC BYTE FSE_peekSymbol(const FSE_DState_t* DStatePtr)
function MEM_STATIC (line 2078) | MEM_STATIC void FSE_updateState(FSE_DState_t* DStatePtr, BIT_DStream_t* ...
function MEM_STATIC (line 2086) | MEM_STATIC BYTE FSE_decodeSymbol(FSE_DState_t* DStatePtr, BIT_DStream_t*...
function MEM_STATIC (line 2099) | MEM_STATIC BYTE FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStrea...
function FSE_endOfDState (line 2110) | MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
type U32 (line 2321) | typedef U32 HUF_DTable;
type HUF_CElt (line 2364) | typedef struct HUF_CElt_s HUF_CElt;
type HUF_repeat (line 2371) | typedef enum {
function FSE_versionNumber (line 2522) | unsigned FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
function FSE_isError (line 2526) | unsigned FSE_isError(size_t code) { return ERR_isError(code); }
function HUF_isError (line 2529) | unsigned HUF_isError(size_t code) { return ERR_isError(code); }
function FSE_readNCount (line 2536) | size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, uns...
function HUF_readStats (line 2650) | size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
function FSE_DTable (line 2827) | FSE_DTable* FSE_createDTable (unsigned tableLog)
function FSE_freeDTable (line 2833) | void FSE_freeDTable (FSE_DTable* dt)
function FSE_buildDTable (line 2838) | size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, u...
function FSE_buildDTable_rle (line 2901) | size_t FSE_buildDTable_rle (FSE_DTable* dt, BYTE symbolValue)
function FSE_buildDTable_raw (line 2919) | size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits)
function FORCE_INLINE_TEMPLATE (line 2945) | FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
function FSE_decompress_usingDTable (line 3008) | size_t FSE_decompress_usingDTable(void* dst, size_t originalSize,
function FSE_decompress_wksp (line 3022) | size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cS...
type FSE_DTable (line 3044) | typedef FSE_DTable DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)];
function FSE_decompress (line 3046) | size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, s...
type ZSTD_CCtx (line 3298) | typedef struct ZSTD_CCtx_s ZSTD_CCtx;
type ZSTD_DCtx (line 3321) | typedef struct ZSTD_DCtx_s ZSTD_DCtx;
type ZSTD_strategy (line 3354) | typedef enum { ZSTD_fast=1,
type ZSTD_cParameter (line 3368) | typedef enum {
type ZSTD_bounds (line 3522) | typedef struct {
type ZSTD_ResetDirective (line 3567) | typedef enum {
type ZSTD_dParameter (line 3616) | typedef enum {
type ZSTD_inBuffer (line 3669) | typedef struct ZSTD_inBuffer_s {
type ZSTD_outBuffer (line 3675) | typedef struct ZSTD_outBuffer_s {
type ZSTD_CCtx (line 3744) | typedef ZSTD_CCtx ZSTD_CStream;
type ZSTD_EndDirective (line 3751) | typedef enum {
type ZSTD_DCtx (line 3864) | typedef ZSTD_DCtx ZSTD_DStream;
type ZSTD_CDict (line 3916) | typedef struct ZSTD_CDict_s ZSTD_CDict;
type ZSTD_DDict (line 3948) | typedef struct ZSTD_DDict_s ZSTD_DDict;
type ZSTD_CCtx_params (line 4203) | typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params;
type ZSTD_Sequence (line 4205) | typedef struct {
type ZSTD_compressionParameters (line 4223) | typedef struct {
type ZSTD_frameParameters (line 4233) | typedef struct {
type ZSTD_parameters (line 4239) | typedef struct {
type ZSTD_dictContentType_e (line 4244) | typedef enum {
type ZSTD_dictLoadMethod_e (line 4250) | typedef enum {
type ZSTD_format_e (line 4255) | typedef enum {
type ZSTD_dictAttachPref_e (line 4262) | typedef enum {
type ZSTD_literalCompressionMode_e (line 4301) | typedef enum {
type ZSTD_customMem (line 4477) | typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction custo...
type ZSTD_frameProgression (line 4921) | typedef struct {
type ZSTD_frameType_e (line 5113) | typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
type ZSTD_frameHeader (line 5114) | typedef struct {
type ZSTD_nextInputType_e (line 5145) | typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ...
type XXH_errorcode (line 5261) | typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
type XXH32_hash_t (line 5342) | typedef unsigned int XXH32_hash_t;
type XXH64_hash_t (line 5343) | typedef unsigned long long XXH64_hash_t;
type XXH32_state_t (line 5364) | typedef struct XXH32_state_s XXH32_state_t;
type XXH64_state_t (line 5365) | typedef struct XXH64_state_s XXH64_state_t;
type XXH32_canonical_t (line 5428) | typedef struct { unsigned char digest[4]; } XXH32_canonical_t;
type XXH64_canonical_t (line 5429) | typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
type XXH32_state_s (line 5454) | struct XXH32_state_s {
type XXH64_state_s (line 5466) | struct XXH64_state_s {
function XXH_free (line 5562) | static void XXH_free (void* p) { free(p); }
type BYTE (line 5604) | typedef uint8_t BYTE;
type U16 (line 5605) | typedef uint16_t U16;
type U32 (line 5606) | typedef uint32_t U32;
type S32 (line 5607) | typedef int32_t S32;
type U64 (line 5608) | typedef uint64_t U64;
type BYTE (line 5610) | typedef unsigned char BYTE;
type U16 (line 5611) | typedef unsigned short U16;
type U32 (line 5612) | typedef unsigned int U32;
type S32 (line 5613) | typedef signed int S32;
type U64 (line 5614) | typedef unsigned long long U64;
function U32 (line 5622) | static U32 XXH_read32(const void* memPtr) { return *(const U32*) memPtr; }
function U64 (line 5623) | static U64 XXH_read64(const void* memPtr) { return *(const U64*) memPtr; }
type unalign (line 5629) | typedef union { U32 u32; U64 u64; } __attribute__((packed)) unalign;
function U32 (line 5631) | static U32 XXH_read32(const void* ptr) { return ((const unalign*)ptr)->u...
function U64 (line 5632) | static U64 XXH_read64(const void* ptr) { return ((const unalign*)ptr)->u...
function U32 (line 5640) | static U32 XXH_read32(const void* memPtr)
function U64 (line 5647) | static U64 XXH_read64(const void* memPtr)
function U32 (line 5683) | static U32 XXH_swap32 (U32 x)
function U64 (line 5690) | static U64 XXH_swap64 (U64 x)
type XXH_endianess (line 5707) | typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess;
type XXH_alignment (line 5719) | typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment;
function FORCE_INLINE_TEMPLATE (line 5721) | FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align(const void* ptr, XXH_endian...
function FORCE_INLINE_TEMPLATE (line 5729) | FORCE_INLINE_TEMPLATE U32 XXH_readLE32(const void* ptr, XXH_endianess en...
function U32 (line 5734) | static U32 XXH_readBE32(const void* ptr)
function FORCE_INLINE_TEMPLATE (line 5739) | FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align(const void* ptr, XXH_endian...
function FORCE_INLINE_TEMPLATE (line 5747) | FORCE_INLINE_TEMPLATE U64 XXH_readLE64(const void* ptr, XXH_endianess en...
function U64 (line 5752) | static U64 XXH_readBE64(const void* ptr)
function XXH_versionNumber (line 5779) | XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NU...
function XXH_PUBLIC_API (line 5785) | XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* restrict dstState, co...
function XXH_PUBLIC_API (line 5790) | XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* restrict dstState, co...
function U32 (line 5800) | static U32 XXH32_round(U32 seed, U32 input)
function FORCE_INLINE_TEMPLATE (line 5808) | FORCE_INLINE_TEMPLATE U32 XXH32_endian_align(const void* input, size_t l...
function XXH32 (line 5865) | XXH_PUBLIC_API unsigned int XXH32 (const void* input, size_t len, unsign...
function U64 (line 5892) | static U64 XXH64_round(U64 acc, U64 input)
function U64 (line 5900) | static U64 XXH64_mergeRound(U64 acc, U64 val)
function FORCE_INLINE_TEMPLATE (line 5908) | FORCE_INLINE_TEMPLATE U64 XXH64_endian_align(const void* input, size_t l...
function XXH64 (line 5977) | XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, ...
function XXH_PUBLIC_API (line 6008) | XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void)
function XXH_PUBLIC_API (line 6012) | XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr)
function XXH_PUBLIC_API (line 6018) | XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void)
function XXH_PUBLIC_API (line 6022) | XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr)
function XXH_PUBLIC_API (line 6031) | XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, unsign...
function XXH_PUBLIC_API (line 6044) | XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, unsign...
function FORCE_INLINE_TEMPLATE (line 6057) | FORCE_INLINE_TEMPLATE XXH_errorcode XXH32_update_endian (XXH32_state_t* ...
function XXH_PUBLIC_API (line 6115) | XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* state_in, cons...
function FORCE_INLINE_TEMPLATE (line 6127) | FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian (const XXH32_state_t* stat...
function XXH32_digest (line 6163) | XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t* state_in)
function FORCE_INLINE_TEMPLATE (line 6177) | FORCE_INLINE_TEMPLATE XXH_errorcode XXH64_update_endian (XXH64_state_t* ...
function XXH_PUBLIC_API (line 6234) | XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* state_in, cons...
function FORCE_INLINE_TEMPLATE (line 6246) | FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian (const XXH64_state_t* stat...
function XXH64_digest (line 6298) | XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t* sta...
function XXH_PUBLIC_API (line 6319) | XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH3...
function XXH_PUBLIC_API (line 6326) | XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH6...
function XXH_PUBLIC_API (line 6333) | XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonica...
function XXH_PUBLIC_API (line 6338) | XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonica...
function _force_has_format_string (line 6382) | void _force_has_format_string(const char *format, ...) {
type blockType_e (line 6476) | typedef enum { bt_raw, bt_rle, bt_compressed, bt_reserved } blockType_e;
type symbolEncodingType_e (line 6484) | typedef enum { set_basic, set_rle, set_compressed, set_repeat } symbolEn...
function ZSTD_copy8 (line 6543) | static void ZSTD_copy8(void* dst, const void* src) {
function ZSTD_copy16 (line 6552) | static void ZSTD_copy16(void* dst, const void* src) {
type ZSTD_overlap_e (line 6564) | typedef enum {
function ZSTD_wildcopy (line 6578) | void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_ov...
function MEM_STATIC (line 6617) | MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, const vo...
type seqDef (line 6640) | typedef struct seqDef_s {
type seqStore_t (line 6646) | typedef struct {
type ZSTD_sequenceLength (line 6660) | typedef struct {
function MEM_STATIC (line 6669) | MEM_STATIC ZSTD_sequenceLength ZSTD_getSequenceLength(seqStore_t const* ...
type ZSTD_frameSizeInfo (line 6691) | typedef struct {
function MEM_STATIC (line 6705) | MEM_STATIC U32 ZSTD_highbit32(U32 val) /* compress, dictBuilder, decod...
type blockProperties_t (line 6737) | typedef struct {
function ZSTD_versionNumber (line 6767) | unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; }
function ZSTD_isError (line 6779) | unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
function ZSTD_ErrorCode (line 6787) | ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(...
function ZSTD_free (line 6817) | void ZSTD_free(void* ptr, ZSTD_customMem customMem)
type DTableDesc (line 6928) | typedef struct { BYTE maxTableLog; BYTE tableType; BYTE tableLog; BYTE r...
function DTableDesc (line 6930) | static DTableDesc HUF_getDTableDesc(const HUF_DTable* table)
type HUF_DEltX1 (line 6943) | typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX1;
function HUF_readDTableX1_wksp (line 6945) | size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t...
function HUF_readDTableX1 (line 7014) | size_t HUF_readDTableX1(HUF_DTable* DTable, const void* src, size_t srcS...
function FORCE_INLINE_TEMPLATE (line 7021) | FORCE_INLINE_TEMPLATE BYTE
function HINT_INLINE (line 7041) | HINT_INLINE size_t
function FORCE_INLINE_TEMPLATE (line 7066) | FORCE_INLINE_TEMPLATE size_t
function FORCE_INLINE_TEMPLATE (line 7089) | FORCE_INLINE_TEMPLATE size_t
function HUF_DGEN (line 7189) | HUF_DGEN(HUF_decompress1X1_usingDTable_internal)
function HUF_decompress1X1_DCtx (line 7219) | size_t HUF_decompress1X1_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize,
function HUF_decompress1X1 (line 7227) | size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, s...
function HUF_decompress4X1_usingDTable (line 7233) | size_t HUF_decompress4X1_usingDTable(
function HUF_decompress4X1_DCtx_wksp_bmi2 (line 7243) | static size_t HUF_decompress4X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* d...
function HUF_decompress4X1_DCtx_wksp (line 7258) | size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t d...
function HUF_decompress4X1_DCtx (line 7266) | size_t HUF_decompress4X1_DCtx (HUF_DTable* dctx, void* dst, size_t dstSi...
function HUF_decompress4X1 (line 7272) | size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, s...
type HUF_DEltX2 (line 7287) | typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX2;
type sortedSymbol_t (line 7288) | typedef struct { BYTE symbol; BYTE weight; } sortedSymbol_t;
type U32 (line 7289) | typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1];
type rankValCol_t (line 7290) | typedef rankValCol_t rankVal_t[HUF_TABLELOG_MAX];
function HUF_fillDTableX2Level2 (line 7295) | static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, cons...
function HUF_fillDTableX2 (line 7336) | static void HUF_fillDTableX2(HUF_DEltX2* DTable, const U32 targetLog,
function HUF_readDTableX2_wksp (line 7378) | size_t HUF_readDTableX2_wksp(HUF_DTable* DTable,
function HUF_readDTableX2 (line 7478) | size_t HUF_readDTableX2(HUF_DTable* DTable, const void* src, size_t srcS...
function FORCE_INLINE_TEMPLATE (line 7486) | FORCE_INLINE_TEMPLATE U32
function FORCE_INLINE_TEMPLATE (line 7495) | FORCE_INLINE_TEMPLATE U32
function HINT_INLINE (line 7522) | HINT_INLINE size_t
function FORCE_INLINE_TEMPLATE (line 7549) | FORCE_INLINE_TEMPLATE size_t
function FORCE_INLINE_TEMPLATE (line 7576) | FORCE_INLINE_TEMPLATE size_t
function HUF_DGEN (line 7691) | HUF_DGEN(HUF_decompress1X2_usingDTable_internal)
function HUF_decompress1X2_DCtx (line 7720) | size_t HUF_decompress1X2_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize,
function HUF_decompress1X2 (line 7728) | size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, s...
function HUF_decompress4X2_usingDTable (line 7734) | size_t HUF_decompress4X2_usingDTable(
function HUF_decompress4X2_DCtx_wksp_bmi2 (line 7744) | static size_t HUF_decompress4X2_DCtx_wksp_bmi2(HUF_DTable* dctx, void* d...
function HUF_decompress4X2_DCtx_wksp (line 7759) | size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t d...
function HUF_decompress4X2_DCtx (line 7767) | size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize,
function HUF_decompress4X2 (line 7775) | size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, s...
function HUF_decompress1X_usingDTable (line 7788) | size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize,
function HUF_decompress4X_usingDTable (line 7807) | size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize,
type algo_time_t (line 7828) | typedef struct { U32 tableTime; U32 decode256Time; } algo_time_t;
function U32 (line 7856) | U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize)
function HUF_decompress (line 7883) | size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size...
function HUF_decompress4X_DCtx (line 7910) | size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSiz...
function HUF_decompress4X_hufOnly (line 7934) | size_t HUF_decompress4X_hufOnly(HUF_DTable* dctx, void* dst, size_t dstS...
function HUF_decompress4X_hufOnly_wksp (line 7942) | size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst,
function HUF_decompress1X_DCtx_wksp (line 7968) | size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t ds...
function HUF_decompress1X_DCtx (line 7998) | size_t HUF_decompress1X_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize,
function HUF_decompress1X_usingDTable_bmi2 (line 8007) | size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, c...
function HUF_decompress1X1_DCtx_wksp_bmi2 (line 8025) | size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, siz...
function HUF_decompress4X_usingDTable_bmi2 (line 8038) | size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, c...
function HUF_decompress4X_hufOnly_wksp_bmi2 (line 8055) | size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, s...
type ZSTD_cpuid_t (line 8120) | typedef struct {
function ZSTD_cpuid (line 8127) | ZSTD_cpuid(void) {
type ZSTD_seqSymbol_header (line 8377) | typedef struct {
type ZSTD_seqSymbol (line 8382) | typedef struct {
type ZSTD_entropyDTables_t (line 8391) | typedef struct {
type ZSTD_dStage (line 8399) | typedef enum { ZSTDds_getFrameHeaderSize, ZSTDds_decodeFrameHeader,
type ZSTD_dStreamStage (line 8404) | typedef enum { zdss_init=0, zdss_loadHeader,
type ZSTD_dictUses_e (line 8407) | typedef enum {
type ZSTD_outBufferMode_e (line 8413) | typedef enum {
type ZSTD_DCtx_s (line 8418) | struct ZSTD_DCtx_s
type ZSTDv01_Dctx (line 8645) | typedef struct ZSTDv01_Dctx_s ZSTDv01_Dctx;
type ZSTDv02_Dctx (line 8743) | typedef struct ZSTDv02_Dctx_s ZSTDv02_Dctx;
type ZSTDv03_Dctx (line 8840) | typedef struct ZSTDv03_Dctx_s ZSTDv03_Dctx;
type ZSTDv04_Dctx (line 8937) | typedef struct ZSTDv04_Dctx_s ZSTDv04_Dctx;
type ZBUFFv04_DCtx (line 8965) | typedef struct ZBUFFv04_DCtx_s ZBUFFv04_DCtx;
type ZSTDv05_DCtx (line 9084) | typedef struct ZSTDv05_DCtx_s ZSTDv05_DCtx;
type ZSTDv05_strategy (line 9108) | typedef enum { ZSTDv05_fast, ZSTDv05_greedy, ZSTDv05_lazy, ZSTDv05_lazy2...
type ZSTDv05_parameters (line 9109) | typedef struct {
type ZBUFFv05_DCtx (line 9125) | typedef struct ZBUFFv05_DCtx_s ZBUFFv05_DCtx;
type ZSTDv06_DCtx (line 9261) | typedef struct ZSTDv06_DCtx_s ZSTDv06_DCtx;
type ZSTDv06_frameParams_s (line 9286) | struct ZSTDv06_frameParams_s { unsigned long long frameContentSize; unsi...
type ZSTDv06_frameParams (line 9287) | typedef struct ZSTDv06_frameParams_s ZSTDv06_frameParams;
type ZBUFFv06_DCtx (line 9302) | typedef struct ZBUFFv06_DCtx_s ZBUFFv06_DCtx;
type ZSTDv07_DCtx (line 9439) | typedef struct ZSTDv07_DCtx_s ZSTDv07_DCtx;
type ZSTDv07_DDict (line 9467) | typedef struct ZSTDv07_DDict_s ZSTDv07_DDict;
type ZSTDv07_frameParams (line 9479) | typedef struct {
type ZBUFFv07_DCtx (line 9494) | typedef struct ZBUFFv07_DCtx_s ZBUFFv07_DCtx;
function ZSTD_isLegacy (line 9560) | MEM_STATIC unsigned ZSTD_isLegacy(const void* src, size_t srcSize)
function ZSTD_getDecompressedSize_legacy (line 9593) | MEM_STATIC unsigned long long ZSTD_getDecompressedSize_legacy(const void...
function MEM_STATIC (line 9625) | MEM_STATIC size_t ZSTD_decompressLegacy(
function MEM_STATIC (line 9685) | MEM_STATIC ZSTD_frameSizeInfo ZSTD_findFrameSizeInfoLegacy(const void *s...
function MEM_STATIC (line 9752) | MEM_STATIC size_t ZSTD_findFrameCompressedSizeLegacy(const void *src, si...
function MEM_STATIC (line 9758) | MEM_STATIC size_t ZSTD_freeLegacyStreamContext(void* legacyContext, U32 ...
function MEM_STATIC (line 9784) | MEM_STATIC size_t ZSTD_initLegacyStream(void** legacyContext, U32 prevVe...
function MEM_STATIC (line 9843) | MEM_STATIC size_t ZSTD_decompressLegacyStream(void* legacyContext, U32 v...
type ZSTD_DDict_s (line 9928) | struct ZSTD_DDict_s {
function ZSTD_DDict_dictSize (line 9944) | size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict)
function ZSTD_copyDDictParameters (line 9950) | void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict)
function ZSTD_loadEntropy_intoDDict (line 9981) | static size_t
function ZSTD_initDDict_internal (line 10012) | static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict,
function ZSTD_DDict (line 10037) | ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
function ZSTD_DDict (line 10062) | ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize)
function ZSTD_DDict (line 10072) | ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t ...
function ZSTD_DDict (line 10079) | const ZSTD_DDict* ZSTD_initStaticDDict(
function ZSTD_freeDDict (line 10104) | size_t ZSTD_freeDDict(ZSTD_DDict* ddict)
function ZSTD_estimateDDictSize (line 10117) | size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dic...
function ZSTD_sizeof_DDict (line 10122) | size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict)
function ZSTD_getDictID_fromDDict (line 10132) | unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict)
function ZSTD_sizeof_DCtx (line 10275) | size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx* dctx)
function ZSTD_estimateDCtxSize (line 10283) | size_t ZSTD_estimateDCtxSize(void) { return sizeof(ZSTD_DCtx); }
function ZSTD_startingInputLength (line 10286) | static size_t ZSTD_startingInputLength(ZSTD_format_e format)
function ZSTD_initDCtx_internal (line 10294) | static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx)
function ZSTD_DCtx (line 10319) | ZSTD_DCtx* ZSTD_initStaticDCtx(void *workspace, size_t workspaceSize)
function ZSTD_DCtx (line 10332) | ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
function ZSTD_DCtx (line 10344) | ZSTD_DCtx* ZSTD_createDCtx(void)
function ZSTD_clearDict (line 10350) | static void ZSTD_clearDict(ZSTD_DCtx* dctx)
function ZSTD_freeDCtx (line 10358) | size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx)
function ZSTD_copyDCtx (line 10376) | void ZSTD_copyDCtx(ZSTD_DCtx* dstDCtx, const ZSTD_DCtx* srcDCtx)
function ZSTD_isFrame (line 10392) | unsigned ZSTD_isFrame(const void* buffer, size_t size)
function ZSTD_frameHeaderSize_internal (line 10410) | static size_t ZSTD_frameHeaderSize_internal(const void* src, size_t srcS...
function ZSTD_frameHeaderSize (line 10429) | size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize)
function ZSTD_getFrameHeader_advanced (line 10441) | size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void...
function ZSTD_getFrameHeader (line 10523) | size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, si...
function ZSTD_getFrameContentSize (line 10534) | unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcS...
function readSkippableFrameSize (line 10552) | static size_t readSkippableFrameSize(void const* src, size_t srcSize)
function ZSTD_findDecompressedSize (line 10574) | unsigned long long ZSTD_findDecompressedSize(const void* src, size_t src...
function ZSTD_getDecompressedSize (line 10623) | unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcS...
function ZSTD_decodeFrameHeader (line 10634) | static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, s...
function ZSTD_frameSizeInfo (line 10650) | static ZSTD_frameSizeInfo ZSTD_errorFrameSizeInfo(size_t ret)
function ZSTD_frameSizeInfo (line 10658) | static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t...
function ZSTD_findFrameCompressedSize (line 10729) | size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
function ZSTD_decompressBound (line 10741) | unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize)
function ZSTD_insertBlock (line 10766) | size_t ZSTD_insertBlock(ZSTD_DCtx* dctx, const void* blockStart, size_t ...
function ZSTD_copyRawBlock (line 10775) | static size_t ZSTD_copyRawBlock(void* dst, size_t dstCapacity,
function ZSTD_setRleBlock (line 10788) | static size_t ZSTD_setRleBlock(void* dst, size_t dstCapacity,
function ZSTD_decompressFrame (line 10806) | static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx,
function ZSTD_decompressMultiFrame (line 10891) | static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx,
function ZSTD_decompress_usingDict (line 10984) | size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx,
function ZSTD_DDict (line 10993) | static ZSTD_DDict const* ZSTD_getDDict(ZSTD_DCtx* dctx)
function ZSTD_decompressDCtx (line 11010) | size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, void* dst, size_t dstCapacit...
function ZSTD_decompress (line 11016) | size_t ZSTD_decompress(void* dst, size_t dstCapacity, const void* src, s...
function ZSTD_nextSrcSizeToDecompress (line 11037) | size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx) { return dctx->expe...
function ZSTD_nextSrcSizeToDecompressWithInputSize (line 11049) | static size_t ZSTD_nextSrcSizeToDecompressWithInputSize(ZSTD_DCtx* dctx,...
function ZSTD_nextInputType_e (line 11057) | ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) {
function ZSTD_isSkipFrame (line 11079) | static int ZSTD_isSkipFrame(ZSTD_DCtx* dctx) { return dctx->stage == ZST...
function ZSTD_decompressContinue (line 11085) | size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCap...
function ZSTD_refDictContent (line 11236) | static size_t ZSTD_refDictContent(ZSTD_DCtx* dctx, const void* dict, siz...
function ZSTD_loadDEntropy (line 11252) | size_t
function ZSTD_decompress_insertDictionary (line 11334) | static size_t ZSTD_decompress_insertDictionary(ZSTD_DCtx* dctx, const vo...
function ZSTD_decompressBegin (line 11355) | size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx)
function ZSTD_decompressBegin_usingDict (line 11378) | size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict,...
function ZSTD_decompressBegin_usingDDict (line 11391) | size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict...
function ZSTD_getDictID_fromDict (line 11414) | unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize)
function ZSTD_getDictID_fromFrame (line 11434) | unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize)
function ZSTD_decompress_usingDDict (line 11446) | size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx,
function ZSTD_DStream (line 11462) | ZSTD_DStream* ZSTD_createDStream(void)
function ZSTD_DStream (line 11468) | ZSTD_DStream* ZSTD_initStaticDStream(void *workspace, size_t workspaceSize)
function ZSTD_DStream (line 11473) | ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem)
function ZSTD_freeDStream (line 11478) | size_t ZSTD_freeDStream(ZSTD_DStream* zds)
function ZSTD_DStreamInSize (line 11486) | size_t ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_MAX + ZSTD_bloc...
function ZSTD_DStreamOutSize (line 11487) | size_t ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_MAX; }
function ZSTD_DCtx_loadDictionary_advanced (line 11489) | size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx,
function ZSTD_DCtx_loadDictionary_byReference (line 11505) | size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void*...
function ZSTD_DCtx_loadDictionary (line 11510) | size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_...
function ZSTD_DCtx_refPrefix_advanced (line 11515) | size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix,...
function ZSTD_DCtx_refPrefix (line 11522) | size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t p...
function ZSTD_initDStream_usingDict (line 11531) | size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, s...
function ZSTD_initDStream (line 11540) | size_t ZSTD_initDStream(ZSTD_DStream* zds)
function ZSTD_initDStream_usingDDict (line 11549) | size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict*...
function ZSTD_resetDStream (line 11559) | size_t ZSTD_resetDStream(ZSTD_DStream* dctx)
function ZSTD_DCtx_refDDict (line 11566) | size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict)
function ZSTD_DCtx_setMaxWindowSize (line 11580) | size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize)
function ZSTD_DCtx_setFormat (line 11592) | size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format)
function ZSTD_bounds (line 11597) | ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
function ZSTD_dParam_withinBounds (line 11623) | static int ZSTD_dParam_withinBounds(ZSTD_dParameter dParam, int value)
function ZSTD_DCtx_setParameter (line 11636) | size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, i...
function ZSTD_DCtx_reset (line 11658) | size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset)
function ZSTD_sizeof_DStream (line 11676) | size_t ZSTD_sizeof_DStream(const ZSTD_DStream* dctx)
function ZSTD_decodingBufferSize_min (line 11681) | size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsign...
function ZSTD_estimateDStreamSize (line 11692) | size_t ZSTD_estimateDStreamSize(size_t windowSize)
function ZSTD_estimateDStreamSize_fromFrame (line 11700) | size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize)
function ZSTD_DCtx_isOverflow (line 11715) | static int ZSTD_DCtx_isOverflow(ZSTD_DStream* zds, size_t const neededIn...
function ZSTD_DCtx_updateOversizedDuration (line 11720) | static void ZSTD_DCtx_updateOversizedDuration(ZSTD_DStream* zds, size_t ...
function ZSTD_DCtx_isOversizedTooLong (line 11728) | static int ZSTD_DCtx_isOversizedTooLong(ZSTD_DStream* zds)
function ZSTD_checkOutBuffer (line 11734) | static size_t ZSTD_checkOutBuffer(ZSTD_DStream const* zds, ZSTD_outBuffe...
function ZSTD_decompressContinueStream (line 11756) | static size_t ZSTD_decompressContinueStream(
function ZSTD_decompressStream (line 11785) | size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ...
function ZSTD_decompressStream_simpleArgs (line 12070) | size_t ZSTD_decompressStream_simpleArgs (
function ZSTD_copy4 (line 12130) | static void ZSTD_copy4(void* dst, const void* src) { memcpy(dst, src, 4); }
function ZSTD_getcBlockSize (line 12139) | size_t ZSTD_getcBlockSize(const void* src, size_t srcSize,
function ZSTD_decodeLiteralsBlock (line 12162) | size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,
function ZSTD_buildSeqTable_rle (line 12429) | static void ZSTD_buildSeqTable_rle(ZSTD_seqSymbol* dt, U32 baseValue, U3...
function ZSTD_buildFSETable (line 12450) | void
function ZSTD_buildSeqTable (line 12516) | static size_t ZSTD_buildSeqTable(ZSTD_seqSymbol* DTableSpace, const ZSTD...
function ZSTD_decodeSeqHeaders (line 12563) | size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr,
type seq_t (line 12636) | typedef struct {
type ZSTD_fseState (line 12643) | typedef struct {
type seqState_t (line 12648) | typedef struct {
function HINT_INLINE (line 12666) | HINT_INLINE void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t of...
function ZSTD_safecopy (line 12699) | static void ZSTD_safecopy(BYTE* op, BYTE* const oend_w, BYTE const* ip, ...
function FORCE_NOINLINE (line 12743) | FORCE_NOINLINE
function HINT_INLINE (line 12786) | HINT_INLINE
function ZSTD_initFseState (line 12878) | static void
function FORCE_INLINE_TEMPLATE (line 12890) | FORCE_INLINE_TEMPLATE void
function FORCE_INLINE_TEMPLATE (line 12899) | FORCE_INLINE_TEMPLATE void
type ZSTD_longOffset_e (line 12917) | typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_lo...
type ZSTD_prefetch_e (line 12918) | typedef enum { ZSTD_p_noPrefetch=0, ZSTD_p_prefetch=1 } ZSTD_prefetch_e;
function FORCE_INLINE_TEMPLATE (line 12920) | FORCE_INLINE_TEMPLATE seq_t
function MEM_STATIC (line 13034) | MEM_STATIC int ZSTD_dictionaryIsActive(ZSTD_DCtx const* dctx, BYTE const...
function MEM_STATIC (line 13049) | MEM_STATIC void ZSTD_assertValidSequence(
function DONT_VECTORIZE (line 13081) | DONT_VECTORIZE
function ZSTD_decompressSequences_default (line 13202) | static size_t
function FORCE_INLINE_TEMPLATE (line 13214) | FORCE_INLINE_TEMPLATE size_t
function ZSTD_decompressSequencesLong_default (line 13307) | static size_t
function ZSTD_decompressSequences_bmi2 (line 13323) | size_t
function ZSTD_decompressSequencesLong_bmi2 (line 13336) | size_t
function ZSTD_decompressSequences (line 13357) | static size_t
function ZSTD_decompressSequencesLong (line 13380) | static size_t
function ZSTD_getLongOffsetsShare (line 13405) | static unsigned
function ZSTD_decompressBlock_internal (line 13427) | size_t
function ZSTD_checkContinuity (line 13499) | void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst)
function ZSTD_decompressBlock (line 13510) | size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx,
FILE: src/acpi.js
constant PMTIMER_FREQ_SECONDS (line 11) | const PMTIMER_FREQ_SECONDS = 3579545;
function ACPI (line 17) | function ACPI(cpu)
FILE: src/browser/dummy_screen.js
function DummyScreenAdapter (line 8) | function DummyScreenAdapter(options)
FILE: src/browser/fake_network.js
constant ETHERTYPE_IPV4 (line 6) | const ETHERTYPE_IPV4 = 0x0800;
constant ETHERTYPE_ARP (line 7) | const ETHERTYPE_ARP = 0x0806;
constant ETHERTYPE_IPV6 (line 8) | const ETHERTYPE_IPV6 = 0x86DD;
constant IPV4_PROTO_ICMP (line 10) | const IPV4_PROTO_ICMP = 1;
constant IPV4_PROTO_TCP (line 11) | const IPV4_PROTO_TCP = 6;
constant IPV4_PROTO_UDP (line 12) | const IPV4_PROTO_UDP = 17;
constant UNIX_EPOCH (line 14) | const UNIX_EPOCH = new Date("1970-01-01T00:00:00Z").getTime();
constant NTP_EPOCH (line 15) | const NTP_EPOCH = new Date("1900-01-01T00:00:00Z").getTime();
constant NTP_EPOC_DIFF (line 16) | const NTP_EPOC_DIFF = UNIX_EPOCH - NTP_EPOCH;
constant TWO_TO_32 (line 17) | const TWO_TO_32 = Math.pow(2, 32);
constant DHCP_MAGIC_COOKIE (line 19) | const DHCP_MAGIC_COOKIE = 0x63825363;
constant V86_ASCII (line 20) | const V86_ASCII = [118, 56, 54];
constant TCP_STATE_CLOSED (line 28) | const TCP_STATE_CLOSED = "closed";
constant TCP_STATE_SYN_RECEIVED (line 29) | const TCP_STATE_SYN_RECEIVED = "syn-received";
constant TCP_STATE_SYN_SENT (line 30) | const TCP_STATE_SYN_SENT = "syn-sent";
constant TCP_STATE_SYN_PROBE (line 31) | const TCP_STATE_SYN_PROBE = "syn-probe";
constant TCP_STATE_ESTABLISHED (line 33) | const TCP_STATE_ESTABLISHED = "established";
constant TCP_STATE_FIN_WAIT_1 (line 34) | const TCP_STATE_FIN_WAIT_1 = "fin-wait-1";
constant TCP_STATE_CLOSE_WAIT (line 35) | const TCP_STATE_CLOSE_WAIT = "close-wait";
constant TCP_STATE_FIN_WAIT_2 (line 36) | const TCP_STATE_FIN_WAIT_2 = "fin-wait-2";
constant TCP_STATE_LAST_ACK (line 37) | const TCP_STATE_LAST_ACK = "last-ack";
constant TCP_STATE_CLOSING (line 38) | const TCP_STATE_CLOSING = "closing";
constant TCP_DYNAMIC_PORT_START (line 42) | const TCP_DYNAMIC_PORT_START = 49152;
constant TCP_DYNAMIC_PORT_END (line 43) | const TCP_DYNAMIC_PORT_END = 65535;
constant TCP_DYNAMIC_PORT_RANGE (line 44) | const TCP_DYNAMIC_PORT_RANGE = TCP_DYNAMIC_PORT_END - TCP_DYNAMIC_PORT_S...
constant ETH_HEADER_SIZE (line 46) | const ETH_HEADER_SIZE = 14;
constant ETH_PAYLOAD_OFFSET (line 47) | const ETH_PAYLOAD_OFFSET = ETH_HEADER_SIZE;
constant MTU_DEFAULT (line 48) | const MTU_DEFAULT = 1500;
constant ETH_TRAILER_SIZE (line 49) | const ETH_TRAILER_SIZE = 4;
constant IPV4_HEADER_SIZE (line 50) | const IPV4_HEADER_SIZE = 20;
constant IPV4_PAYLOAD_OFFSET (line 51) | const IPV4_PAYLOAD_OFFSET = ETH_PAYLOAD_OFFSET + IPV4_HEADER_SIZE;
constant UDP_HEADER_SIZE (line 52) | const UDP_HEADER_SIZE = 8;
constant UDP_PAYLOAD_OFFSET (line 53) | const UDP_PAYLOAD_OFFSET = IPV4_PAYLOAD_OFFSET + UDP_HEADER_SIZE;
constant TCP_HEADER_SIZE (line 54) | const TCP_HEADER_SIZE = 20;
constant TCP_PAYLOAD_OFFSET (line 55) | const TCP_PAYLOAD_OFFSET = IPV4_PAYLOAD_OFFSET + TCP_HEADER_SIZE;
constant ICMP_HEADER_SIZE (line 56) | const ICMP_HEADER_SIZE = 4;
constant DEFAULT_DOH_SERVER (line 58) | const DEFAULT_DOH_SERVER = "cloudflare-dns.com";
function a2ethaddr (line 60) | function a2ethaddr(bytes) {
function iptolong (line 64) | function iptolong(parts) {
class GrowableRingbuffer (line 68) | class GrowableRingbuffer
method constructor (line 74) | constructor(initial_capacity, maximum_capacity)
method write (line 87) | write(src_array)
method peek (line 124) | peek(dst_array)
method remove (line 147) | remove(length)
function create_eth_encoder_buf (line 160) | function create_eth_encoder_buf(mtu = MTU_DEFAULT)
function view_set_array (line 187) | function view_set_array(offset, data, view, out)
function view_set_zeros (line 199) | function view_set_zeros(offset, length, view, out)
function view_set_string (line 212) | function view_set_string(offset, str, view, out)
function calc_inet_checksum (line 226) | function calc_inet_checksum(length, checksum, view, out)
function make_packet (line 246) | function make_packet(out, spec)
function handle_fake_tcp (line 253) | function handle_fake_tcp(packet, adapter)
function handle_fake_dns_static (line 310) | function handle_fake_dns_static(packet, adapter)
function handle_fake_dns_doh (line 353) | function handle_fake_dns_doh(packet, adapter)
function handle_fake_dns (line 384) | function handle_fake_dns(packet, adapter)
function handle_fake_ntp (line 394) | function handle_fake_ntp(packet, adapter) {
function handle_fake_dhcp (line 425) | function handle_fake_dhcp(packet, adapter) {
function handle_fake_networking (line 479) | function handle_fake_networking(data, adapter) {
function parse_eth (line 510) | function parse_eth(data, o) {
function write_eth (line 541) | function write_eth(spec, out) {
function parse_arp (line 556) | function parse_arp(data, o) {
function write_arp (line 573) | function write_arp(spec, out) {
function parse_ipv4 (line 587) | function parse_ipv4(data, o) {
function write_ipv4 (line 630) | function write_ipv4(spec, out) {
function parse_icmp (line 660) | function parse_icmp(data, o) {
function write_icmp (line 671) | function write_icmp(spec, out) {
function parse_udp (line 682) | function parse_udp(data, o) {
function write_udp (line 706) | function write_udp(spec, out) {
function parse_dns (line 738) | function parse_dns(data, o) {
function write_dns (line 789) | function write_dns(spec, out) {
function parse_dhcp (line 835) | function parse_dhcp(data, o) {
function write_dhcp (line 870) | function write_dhcp(spec, out) {
function parse_ntp (line 894) | function parse_ntp(data, o) {
function write_ntp (line 915) | function write_ntp(spec, out) {
function parse_tcp (line 935) | function parse_tcp(data, o) {
function write_tcp (line 966) | function write_tcp(spec, out) {
function fake_tcp_connect (line 1020) | function fake_tcp_connect(dport, adapter)
function fake_tcp_probe (line 1048) | function fake_tcp_probe(dport, adapter) {
function TCPConnection (line 1059) | function TCPConnection(adapter)
function arp_whohas (line 1417) | function arp_whohas(packet, adapter) {
function handle_fake_ping (line 1447) | function handle_fake_ping(packet, adapter) {
function handle_udp_echo (line 1463) | function handle_udp_echo(packet, adapter) {
FILE: src/browser/fetch_network.js
function FetchNetworkAdapter (line 22) | function FetchNetworkAdapter(bus, config)
function on_data_http (line 75) | async function on_data_http(data)
FILE: src/browser/filestorage.js
function FileStorageInterface (line 5) | function FileStorageInterface() {}
function MemoryFileStorage (line 36) | function MemoryFileStorage()
function ServerFileStorageWrapper (line 89) | function ServerFileStorageWrapper(file_storage, baseurl, zstd_decompress)
FILE: src/browser/inbrowser_network.js
function InBrowserNetworkAdapter (line 20) | function InBrowserNetworkAdapter(bus, config)
FILE: src/browser/keyboard.js
constant SHIFT_SCAN_CODE (line 4) | const SHIFT_SCAN_CODE = 0x2A;
constant SCAN_CODE_RELEASE (line 5) | const SCAN_CODE_RELEASE = 0x80;
constant PLATFOM_WINDOWS (line 7) | const PLATFOM_WINDOWS = typeof window !== "undefined" && window.navigato...
function KeyboardAdapter (line 14) | function KeyboardAdapter(bus)
FILE: src/browser/main.js
constant ON_LOCALHOST (line 9) | const ON_LOCALHOST = !location.hostname.endsWith("copy.sh");
constant DEFAULT_NETWORKING_PROXIES (line 11) | const DEFAULT_NETWORKING_PROXIES = ["wss://relay.widgetry.org/", "ws://l...
constant DEFAULT_MEMORY_SIZE (line 12) | const DEFAULT_MEMORY_SIZE = 128;
constant DEFAULT_VGA_MEMORY_SIZE (line 13) | const DEFAULT_VGA_MEMORY_SIZE = 8;
constant DEFAULT_BOOT_ORDER (line 14) | const DEFAULT_BOOT_ORDER = 0;
constant DEFAULT_MTU (line 15) | const DEFAULT_MTU = 1500;
constant DEFAULT_NIC_TYPE (line 16) | const DEFAULT_NIC_TYPE = "ne2k";
constant MAX_ARRAY_BUFFER_SIZE_MB (line 18) | const MAX_ARRAY_BUFFER_SIZE_MB = 2000;
function query_append (line 20) | function query_append()
function set_title (line 26) | function set_title(text)
function bool_arg (line 33) | function bool_arg(x)
function format_timestamp (line 38) | function format_timestamp(time)
function read_file (line 56) | function read_file(file)
function show_progress (line 68) | function show_progress(e)
function $ (line 115) | function $(id)
function onload (line 138) | function onload()
function debug_onload (line 1959) | function debug_onload()
function start_emulation (line 2041) | function start_emulation(profile, query_args)
function init_ui (line 2475) | function init_ui(profile, settings, emulator)
function init_filesystem_panel (line 3295) | function init_filesystem_panel(emulator)
function debug_start (line 3360) | function debug_start(emulator)
function onpopstate (line 3395) | function onpopstate(e)
function push_state (line 3400) | function push_state(params)
FILE: src/browser/mouse.js
function MouseAdapter (line 11) | function MouseAdapter(bus, screen_container)
FILE: src/browser/network.js
function NetworkAdapter (line 16) | function NetworkAdapter(url, bus, id)
FILE: src/browser/print_stats.js
function stats_to_string (line 3) | function stats_to_string(cpu)
function print_misc_stats (line 8) | function print_misc_stats(cpu)
function print_instruction_counts (line 162) | function print_instruction_counts(cpu)
function print_instruction_counts_offset (line 173) | function print_instruction_counts_offset(cpu, compiled, jit_exit, unguar...
FILE: src/browser/screen.js
constant DEBUG_SCREEN_LAYERS (line 5) | const DEBUG_SCREEN_LAYERS = DEBUG && false;
function ScreenAdapter (line 13) | function ScreenAdapter(options, screen_fill_buffer)
FILE: src/browser/serial.js
function TextAreaAdapter (line 11) | function TextAreaAdapter(element)
function SerialAdapter (line 193) | function SerialAdapter(element, bus)
function VirtioConsoleAdapter (line 220) | function VirtioConsoleAdapter(element, bus)
function SerialRecordingAdapter (line 249) | function SerialRecordingAdapter(bus)
function XtermJSAdapter (line 267) | function XtermJSAdapter(element, xterm_lib)
function SerialAdapterXtermJS (line 295) | function SerialAdapterXtermJS(element, bus, xterm_lib)
function VirtioConsoleAdapterXtermJS (line 331) | function VirtioConsoleAdapterXtermJS(element, bus, xterm_lib)
FILE: src/browser/speaker.js
constant DAC_QUEUE_RESERVE (line 14) | const DAC_QUEUE_RESERVE = 0.2;
constant AUDIOBUFFER_MINIMUM_SAMPLING_RATE (line 16) | const AUDIOBUFFER_MINIMUM_SAMPLING_RATE = 8000;
function SpeakerAdapter (line 22) | function SpeakerAdapter(bus)
function SpeakerMixer (line 81) | function SpeakerMixer(bus, audio_context)
function SpeakerMixerSource (line 293) | function SpeakerMixerSource(audio_context, source_node, destination_left...
function PCSpeaker (line 404) | function PCSpeaker(bus, audio_context, mixer)
function SpeakerWorkletDAC (line 457) | function SpeakerWorkletDAC(bus, audio_context, mixer)
function SpeakerBufferSourceDAC (line 886) | function SpeakerBufferSourceDAC(bus, audio_context, mixer)
function SpeakerDACDebugger (line 1036) | function SpeakerDACDebugger(audio_context, source_node)
FILE: src/browser/starter.js
function V86 (line 40) | function V86(options)
function put_on_settings (line 326) | function put_on_settings(name, buffer)
function done (line 549) | async function done()
function the_worker (line 646) | function the_worker()
function FileExistsError (line 1517) | function FileExistsError(message)
function FileNotFoundError (line 1529) | function FileNotFoundError(message)
FILE: src/browser/wisp_network.js
function WispNetworkAdapter (line 21) | function WispNetworkAdapter(wisp_url, bus, config)
FILE: src/buffer.js
constant BLOCK_SIZE (line 6) | const BLOCK_SIZE = 256;
constant ASYNC_SAFE (line 8) | const ASYNC_SAFE = false;
function SyncBuffer (line 14) | function SyncBuffer(buffer)
function AsyncXHRBuffer (line 93) | function AsyncXHRBuffer(filename, size, fixed_chunk_size)
function AsyncXHRPartfileBuffer (line 366) | function AsyncXHRPartfileBuffer(filename, size, fixed_chunk_size, partfi...
function SyncFileBuffer (line 520) | function SyncFileBuffer(file)
function AsyncFileBuffer (line 590) | function AsyncFileBuffer(file)
function buffer_from_object (line 685) | function buffer_from_object(obj, zstd_decompress_worker)
FILE: src/bus.js
function BusConnector (line 6) | function BusConnector()
FILE: src/const.js
constant LOG_ALL (line 1) | const
constant LOG_NONE (line 1) | const
constant LOG_OTHER (line 1) | const
constant LOG_CPU (line 1) | const
constant LOG_FPU (line 1) | const
constant LOG_MEM (line 1) | const
constant LOG_DMA (line 1) | const
constant LOG_IO (line 1) | const
constant LOG_PS2 (line 1) | const
constant LOG_PIC (line 1) | const
constant LOG_VGA (line 1) | const
constant LOG_PIT (line 1) | const
constant LOG_MOUSE (line 1) | const
constant LOG_PCI (line 1) | const
constant LOG_BIOS (line 1) | const
constant LOG_FLOPPY (line 1) | const
constant LOG_SERIAL (line 1) | const
constant LOG_DISK (line 1) | const
constant LOG_RTC (line 1) | const
constant LOG_ACPI (line 1) | const
constant LOG_APIC (line 1) | const
constant LOG_NET (line 1) | const
constant LOG_VIRTIO (line 1) | const
constant LOG_9P (line 1) | const
constant LOG_SB16 (line 1) | const
constant LOG_FETCH (line 1) | const
constant LOG_NAMES (line 35) | const LOG_NAMES = [
constant FLAG_CARRY (line 62) | const
constant FLAG_PARITY (line 62) | const
constant FLAG_ADJUST (line 62) | const
constant FLAG_ZERO (line 62) | const
constant FLAG_SIGN (line 62) | const
constant FLAG_TRAP (line 62) | const
constant FLAG_INTERRUPT (line 62) | const
constant FLAG_DIRECTION (line 62) | const
constant FLAG_OVERFLOW (line 62) | const
constant FLAG_IOPL (line 62) | const
constant FLAG_NT (line 62) | const
constant FLAG_RF (line 62) | const
constant FLAG_VM (line 62) | const
constant FLAG_AC (line 62) | const
constant FLAG_VIF (line 62) | const
constant FLAG_VIP (line 62) | const
constant FLAG_ID (line 62) | const
constant FLAGS_DEFAULT (line 62) | const
constant REG_EAX (line 62) | const
constant REG_ECX (line 62) | const
constant REG_EDX (line 62) | const
constant REG_EBX (line 62) | const
constant REG_ESP (line 62) | const
constant REG_EBP (line 62) | const
constant REG_ESI (line 62) | const
constant REG_EDI (line 62) | const
constant REG_ES (line 62) | const
constant REG_CS (line 62) | const
constant REG_SS (line 62) | const
constant REG_DS (line 62) | const
constant REG_FS (line 62) | const
constant REG_GS (line 62) | const
constant REG_LDTR (line 62) | const
constant MMAP_BLOCK_BITS (line 103) | const
constant MMAP_BLOCK_SIZE (line 103) | const
constant MMAP_MAX (line 103) | const
constant CR0_PG (line 109) | const CR0_PG = 1 << 31;
constant CR4_PAE (line 110) | const CR4_PAE = 1 << 5;
constant FW_CFG_SIGNATURE (line 115) | const FW_CFG_SIGNATURE = 0x00;
constant FW_CFG_ID (line 116) | const FW_CFG_ID = 0x01;
constant FW_CFG_RAM_SIZE (line 117) | const FW_CFG_RAM_SIZE = 0x03;
constant FW_CFG_NB_CPUS (line 118) | const FW_CFG_NB_CPUS = 0x05;
constant FW_CFG_MAX_CPUS (line 119) | const FW_CFG_MAX_CPUS = 0x0F;
constant FW_CFG_NUMA (line 120) | const FW_CFG_NUMA = 0x0D;
constant FW_CFG_FILE_DIR (line 121) | const FW_CFG_FILE_DIR = 0x19;
constant FW_CFG_CUSTOM_START (line 123) | const FW_CFG_CUSTOM_START = 0x8000;
constant FW_CFG_FILE_START (line 125) | const FW_CFG_FILE_START = 0xC000;
constant FW_CFG_SIGNATURE_QEMU (line 126) | const FW_CFG_SIGNATURE_QEMU = 0x554D4551;
constant WASM_TABLE_SIZE (line 130) | const WASM_TABLE_SIZE = 900;
constant WASM_TABLE_OFFSET (line 132) | const WASM_TABLE_OFFSET = 1024;
constant MIXER_CHANNEL_LEFT (line 134) | const MIXER_CHANNEL_LEFT = 0;
constant MIXER_CHANNEL_RIGHT (line 135) | const MIXER_CHANNEL_RIGHT = 1;
constant MIXER_CHANNEL_BOTH (line 136) | const MIXER_CHANNEL_BOTH = 2;
constant MIXER_SRC_MASTER (line 137) | const MIXER_SRC_MASTER = 0;
constant MIXER_SRC_PCSPEAKER (line 138) | const MIXER_SRC_PCSPEAKER = 1;
constant MIXER_SRC_DAC (line 139) | const MIXER_SRC_DAC = 2;
FILE: src/cpu.js
constant DUMP_GENERATED_WASM (line 59) | const DUMP_GENERATED_WASM = false;
constant DUMP_UNCOMPILED_ASSEMBLY (line 60) | const DUMP_UNCOMPILED_ASSEMBLY = false;
function CPU (line 63) | function CPU(bus, wm, stop_idling)
function i32 (line 1066) | function i32(x)
function to_be16 (line 1071) | function to_be16(x)
function to_be32 (line 1076) | function to_be32(x)
function handle_write (line 1570) | function handle_write(value)
function handle (line 1932) | function handle(out_byte)
function dump_table (line 2079) | function dump_table(addr, size)
function load_page_entry (line 2227) | function load_page_entry(dword_entry, pae, is_directory)
FILE: src/dma.js
function DMA (line 12) | function DMA(cpu)
FILE: src/elf.js
constant ELF_MAGIC (line 5) | const ELF_MAGIC = 0x464C457F;
constant U16 (line 9) | const U16 = { size: 2, get: types.getUint16, set: types.setUint16, };
constant U32 (line 10) | const U32 = { size: 4, get: types.getUint32, set: types.setUint32, };
function create_struct (line 76) | function create_struct(struct)
function read_elf (line 98) | function read_elf(buffer)
function read_struct (line 185) | function read_struct(view, Struct)
function read_structs (line 202) | function read_structs(view, Struct, count)
function view_slice (line 218) | function view_slice(view, offset, length)
FILE: src/floppy.js
constant FDC_IRQ_CHANNEL (line 27) | const FDC_IRQ_CHANNEL = 6;
constant FDC_DMA_CHANNEL (line 28) | const FDC_DMA_CHANNEL = 2;
constant CMOS_FDD_TYPE_NO_DRIVE (line 35) | const CMOS_FDD_TYPE_NO_DRIVE = 0x0;
constant CMOS_FDD_TYPE_360 (line 36) | const CMOS_FDD_TYPE_360 = 0x1;
constant CMOS_FDD_TYPE_1200 (line 37) | const CMOS_FDD_TYPE_1200 = 0x2;
constant CMOS_FDD_TYPE_720 (line 38) | const CMOS_FDD_TYPE_720 = 0x3;
constant CMOS_FDD_TYPE_1440 (line 39) | const CMOS_FDD_TYPE_1440 = 0x4;
constant CMOS_FDD_TYPE_2880 (line 40) | const CMOS_FDD_TYPE_2880 = 0x5;
constant CMOS_FDD_TYPE_MEDIUM (line 43) | const CMOS_FDD_TYPE_MEDIUM = {
constant REG_SRA (line 53) | const REG_SRA = 0x0;
constant REG_SRB (line 54) | const REG_SRB = 0x1;
constant REG_DOR (line 55) | const REG_DOR = 0x2;
constant REG_TDR (line 56) | const REG_TDR = 0x3;
constant REG_MSR (line 57) | const REG_MSR = 0x4;
constant REG_DSR (line 58) | const REG_DSR = 0x4;
constant REG_FIFO (line 59) | const REG_FIFO = 0x5;
constant REG_DIR (line 60) | const REG_DIR = 0x7;
constant REG_CCR (line 61) | const REG_CCR = 0x7;
constant SRA_NDRV2 (line 64) | const SRA_NDRV2 = 0x40;
constant SRA_INTPEND (line 65) | const SRA_INTPEND = 0x80;
constant SRB_MTR0 (line 68) | const SRB_MTR0 = 0x1;
constant SRB_MTR1 (line 69) | const SRB_MTR1 = 0x2;
constant SRB_DR0 (line 70) | const SRB_DR0 = 0x20;
constant SRB_RESET (line 71) | const SRB_RESET = 0xc0;
constant DOR_SEL_LO (line 74) | const DOR_SEL_LO = 0x1;
constant DOR_SEL_HI (line 75) | const DOR_SEL_HI = 0x2;
constant DOR_NRESET (line 76) | const DOR_NRESET = 0x4;
constant DOR_DMAEN (line 77) | const DOR_DMAEN = 0x8;
constant DOR_MOTEN0 (line 78) | const DOR_MOTEN0 = 0x10;
constant DOR_MOTEN1 (line 79) | const DOR_MOTEN1 = 0x20;
constant DOR_MOTEN2 (line 80) | const DOR_MOTEN2 = 0x40;
constant DOR_MOTEN3 (line 81) | const DOR_MOTEN3 = 0x80;
constant DOR_SELMASK (line 82) | const DOR_SELMASK = 0x01;
constant TDR_BOOTSEL (line 85) | const TDR_BOOTSEL = 0x4;
constant MSR_FDD0 (line 88) | const MSR_FDD0 = 0x1;
constant MSR_FDD1 (line 89) | const MSR_FDD1 = 0x2;
constant MSR_FDD2 (line 90) | const MSR_FDD2 = 0x4;
constant MSR_FDD3 (line 91) | const MSR_FDD3 = 0x8;
constant MSR_CMDBUSY (line 92) | const MSR_CMDBUSY = 0x10;
constant MSR_NDMA (line 93) | const MSR_NDMA = 0x20;
constant MSR_DIO (line 94) | const MSR_DIO = 0x40;
constant MSR_RQM (line 95) | const MSR_RQM = 0x80;
constant DSR_DRATEMASK (line 98) | const DSR_DRATEMASK = 0x3;
constant DSR_PWRDOWN (line 99) | const DSR_PWRDOWN = 0x40;
constant DSR_SWRESET (line 100) | const DSR_SWRESET = 0x80;
constant DIR_DOOR (line 103) | const DIR_DOOR = 0x80;
constant SR0_DS0 (line 106) | const SR0_DS0 = 0x1;
constant SR0_DS1 (line 107) | const SR0_DS1 = 0x2;
constant SR0_HEAD (line 108) | const SR0_HEAD = 0x4;
constant SR0_EQPMT (line 109) | const SR0_EQPMT = 0x10;
constant SR0_SEEK (line 110) | const SR0_SEEK = 0x20;
constant SR0_ABNTERM (line 111) | const SR0_ABNTERM = 0x40;
constant SR0_INVCMD (line 112) | const SR0_INVCMD = 0x80;
constant SR0_RDYCHG (line 113) | const SR0_RDYCHG = SR0_ABNTERM | SR0_INVCMD;
constant SR1_MA (line 116) | const SR1_MA = 0x1;
constant SR1_NW (line 117) | const SR1_NW = 0x2;
constant SR1_EC (line 118) | const SR1_EC = 0x80;
constant SR2_SNS (line 121) | const SR2_SNS = 0x4;
constant SR2_SEH (line 122) | const SR2_SEH = 0x8;
constant CMD_READ_TRACK (line 130) | const CMD_READ_TRACK = 0x2;
constant CMD_SPECIFY (line 131) | const CMD_SPECIFY = 0x3;
constant CMD_SENSE_DRIVE_STATUS (line 132) | const CMD_SENSE_DRIVE_STATUS = 0x4;
constant CMD_WRITE (line 133) | const CMD_WRITE = 0x5;
constant CMD_READ (line 134) | const CMD_READ = 0x6;
constant CMD_RECALIBRATE (line 135) | const CMD_RECALIBRATE = 0x7;
constant CMD_SENSE_INTERRUPT_STATUS (line 136) | const CMD_SENSE_INTERRUPT_STATUS = 0x8;
constant CMD_WRITE_DELETED_DATA (line 137) | const CMD_WRITE_DELETED_DATA = 0x9;
constant CMD_READ_ID (line 138) | const CMD_READ_ID = 0xa;
constant CMD_READ_DELETED_DATA (line 139) | const CMD_READ_DELETED_DATA = 0xc;
constant CMD_FORMAT_TRACK (line 140) | const CMD_FORMAT_TRACK = 0xd;
constant CMD_DUMP_REGS (line 141) | const CMD_DUMP_REGS = 0xe;
constant CMD_SEEK (line 142) | const CMD_SEEK = 0xf;
constant CMD_VERSION (line 143) | const CMD_VERSION = 0x10;
constant CMD_SCAN_EQUAL (line 144) | const CMD_SCAN_EQUAL = 0x11;
constant CMD_PERPENDICULAR_MODE (line 145) | const CMD_PERPENDICULAR_MODE = 0x12;
constant CMD_CONFIGURE (line 146) | const CMD_CONFIGURE = 0x13;
constant CMD_LOCK (line 147) | const CMD_LOCK = 0x14;
constant CMD_VERIFY (line 148) | const CMD_VERIFY = 0x16;
constant CMD_POWERDOWN_MODE (line 149) | const CMD_POWERDOWN_MODE = 0x17;
constant CMD_PART_ID (line 150) | const CMD_PART_ID = 0x18;
constant CMD_SCAN_LOW_OR_EQUAL (line 151) | const CMD_SCAN_LOW_OR_EQUAL = 0x19;
constant CMD_SCAN_HIGH_OR_EQUAL (line 152) | const CMD_SCAN_HIGH_OR_EQUAL = 0x1d;
constant CMD_SAVE (line 153) | const CMD_SAVE = 0x2e;
constant CMD_OPTION (line 154) | const CMD_OPTION = 0x33;
constant CMD_RESTORE (line 155) | const CMD_RESTORE = 0x4e;
constant CMD_DRIVE_SPECIFICATION (line 156) | const CMD_DRIVE_SPECIFICATION = 0x8e;
constant CMD_RELATIVE_SEEK_OUT (line 157) | const CMD_RELATIVE_SEEK_OUT = 0x8f;
constant CMD_FORMAT_AND_WRITE (line 158) | const CMD_FORMAT_AND_WRITE = 0xcd;
constant CMD_RELATIVE_SEEK_IN (line 159) | const CMD_RELATIVE_SEEK_IN = 0xcf;
constant CMD_FLAG_MULTI_TRACK (line 162) | const CMD_FLAG_MULTI_TRACK = 0x1;
constant CMD_PHASE_COMMAND (line 165) | const CMD_PHASE_COMMAND = 1;
constant CMD_PHASE_EXECUTION (line 166) | const CMD_PHASE_EXECUTION = 2;
constant CMD_PHASE_RESULT (line 167) | const CMD_PHASE_RESULT = 3;
constant CONFIG_PRETRK (line 170) | const CONFIG_PRETRK = 0xff;
constant CONFIG_FIFOTHR (line 171) | const CONFIG_FIFOTHR = 0x0f;
constant CONFIG_POLL (line 172) | const CONFIG_POLL = 0x10;
constant CONFIG_EFIFO (line 173) | const CONFIG_EFIFO = 0x20;
constant CONFIG_EIS (line 174) | const CONFIG_EIS = 0x40;
constant RESET_SENSE_INT_MAX (line 177) | const RESET_SENSE_INT_MAX = 4;
constant SECTOR_SIZE (line 180) | const SECTOR_SIZE = 512;
constant SECTOR_SIZE_CODE (line 181) | const SECTOR_SIZE_CODE = 2;
function FloppyController (line 218) | function FloppyController(cpu, fda_image, fdb_image, fdc_config)
constant DISK_FORMATS (line 1157) | const DISK_FORMATS = [
function FloppyDrive (line 1214) | function FloppyDrive(name, fdd_config, buffer, fallback_drive_type)
FILE: src/ide.js
constant CDROM_SECTOR_SIZE (line 42) | const CDROM_SECTOR_SIZE = 2048;
constant HD_SECTOR_SIZE (line 43) | const HD_SECTOR_SIZE = 512;
constant BUS_MASTER_BASE (line 45) | const BUS_MASTER_BASE = 0xB400;
constant ATA_REG_ERROR (line 50) | const ATA_REG_ERROR = 0x01;
constant ATA_REG_STATUS (line 51) | const ATA_REG_STATUS = 0x07;
constant ATA_REG_ALT_STATUS (line 52) | const ATA_REG_ALT_STATUS = 0x00;
constant ATA_REG_DATA (line 54) | const ATA_REG_DATA = 0x00;
constant ATA_REG_SECTOR (line 55) | const ATA_REG_SECTOR = 0x02;
constant ATA_REG_LBA_LOW (line 56) | const ATA_REG_LBA_LOW = 0x03;
constant ATA_REG_LBA_MID (line 57) | const ATA_REG_LBA_MID = 0x04;
constant ATA_REG_LBA_HIGH (line 58) | const ATA_REG_LBA_HIGH = 0x05;
constant ATA_REG_DEVICE (line 59) | const ATA_REG_DEVICE = 0x06;
constant ATA_REG_FEATURES (line 61) | const ATA_REG_FEATURES = 0x01;
constant ATA_REG_COMMAND (line 62) | const ATA_REG_COMMAND = 0x07;
constant ATA_REG_CONTROL (line 63) | const ATA_REG_CONTROL = 0x00;
constant BMI_REG_COMMAND (line 67) | const BMI_REG_COMMAND = 0x00;
constant BMI_REG_STATUS (line 68) | const BMI_REG_STATUS = 0x02;
constant BMI_REG_PRDT (line 69) | const BMI_REG_PRDT = 0x04;
constant ATA_ER_ABRT (line 73) | const ATA_ER_ABRT = 0x04;
constant ATA_SR_ERR (line 76) | const ATA_SR_ERR = 0x01;
constant ATA_SR_COND (line 77) | const ATA_SR_COND = 0x01;
constant ATA_SR_SENS (line 78) | const ATA_SR_SENS = 0x02;
constant ATA_SR_AERR (line 79) | const ATA_SR_AERR = 0x04;
constant ATA_SR_DRQ (line 80) | const ATA_SR_DRQ = 0x08;
constant ATA_SR_DSC (line 81) | const ATA_SR_DSC = 0x10;
constant ATA_SR_DF (line 82) | const ATA_SR_DF = 0x20;
constant ATA_SR_DRDY (line 83) | const ATA_SR_DRDY = 0x40;
constant ATA_SR_BSY (line 84) | const ATA_SR_BSY = 0x80;
constant ATA_DR_DEV (line 88) | const ATA_DR_DEV = 0x10;
constant ATA_CR_NIEN (line 92) | const ATA_CR_NIEN = 0x02;
constant ATA_CR_SRST (line 93) | const ATA_CR_SRST = 0x04;
constant ATA_CR_HOB (line 94) | const ATA_CR_HOB = 0x80;
constant ATA_CMD_DEVICE_RESET (line 97) | const ATA_CMD_DEVICE_RESET = 0x08;
constant ATA_CMD_EXECUTE_DEVICE_DIAGNOSTIC (line 98) | const ATA_CMD_EXECUTE_DEVICE_DIAGNOSTIC = 0x90;
constant ATA_CMD_FLUSH_CACHE (line 99) | const ATA_CMD_FLUSH_CACHE = 0xE7;
constant ATA_CMD_FLUSH_CACHE_EXT (line 100) | const ATA_CMD_FLUSH_CACHE_EXT = 0xEA;
constant ATA_CMD_GET_MEDIA_STATUS (line 101) | const ATA_CMD_GET_MEDIA_STATUS = 0xDA;
constant ATA_CMD_IDENTIFY_DEVICE (line 102) | const ATA_CMD_IDENTIFY_DEVICE = 0xEC;
constant ATA_CMD_IDENTIFY_PACKET_DEVICE (line 103) | const ATA_CMD_IDENTIFY_PACKET_DEVICE = 0xA1;
constant ATA_CMD_IDLE_IMMEDIATE (line 104) | const ATA_CMD_IDLE_IMMEDIATE = 0xE1;
constant ATA_CMD_INITIALIZE_DEVICE_PARAMETERS (line 105) | const ATA_CMD_INITIALIZE_DEVICE_PARAMETERS = 0x91;
constant ATA_CMD_MEDIA_LOCK (line 106) | const ATA_CMD_MEDIA_LOCK = 0xDE;
constant ATA_CMD_NOP (line 107) | const ATA_CMD_NOP = 0x00;
constant ATA_CMD_PACKET (line 108) | const ATA_CMD_PACKET = 0xA0;
constant ATA_CMD_READ_DMA (line 109) | const ATA_CMD_READ_DMA = 0xC8;
constant ATA_CMD_READ_DMA_EXT (line 110) | const ATA_CMD_READ_DMA_EXT = 0x25;
constant ATA_CMD_READ_MULTIPLE (line 111) | const ATA_CMD_READ_MULTIPLE = 0x29;
constant ATA_CMD_READ_MULTIPLE_EXT (line 112) | const ATA_CMD_READ_MULTIPLE_EXT = 0xC4;
constant ATA_CMD_READ_NATIVE_MAX_ADDRESS (line 113) | const ATA_CMD_READ_NATIVE_MAX_ADDRESS = 0xF8;
constant ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT (line 114) | const ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT = 0x27;
constant ATA_CMD_READ_SECTORS (line 115) | const ATA_CMD_READ_SECTORS = 0x20;
constant ATA_CMD_READ_SECTORS_EXT (line 116) | const ATA_CMD_READ_SECTORS_EXT = 0x24;
constant ATA_CMD_READ_VERIFY_SECTORS (line 117) | const ATA_CMD_READ_VERIFY_SECTORS = 0x40;
constant ATA_CMD_SECURITY_FREEZE_LOCK (line 118) | const ATA_CMD_SECURITY_FREEZE_LOCK = 0xF5;
constant ATA_CMD_SET_FEATURES (line 119) | const ATA_CMD_SET_FEATURES = 0xEF;
constant ATA_CMD_SET_MAX (line 120) | const ATA_CMD_SET_MAX = 0xF9;
constant ATA_CMD_SET_MULTIPLE_MODE (line 121) | const ATA_CMD_SET_MULTIPLE_MODE = 0xC6;
constant ATA_CMD_STANDBY_IMMEDIATE (line 122) | const ATA_CMD_STANDBY_IMMEDIATE = 0xE0;
constant ATA_CMD_WRITE_DMA (line 123) | const ATA_CMD_WRITE_DMA = 0xCA;
constant ATA_CMD_WRITE_DMA_EXT (line 124) | const ATA_CMD_WRITE_DMA_EXT = 0x35;
constant ATA_CMD_WRITE_MULTIPLE (line 125) | const ATA_CMD_WRITE_MULTIPLE = 0x39;
constant ATA_CMD_WRITE_MULTIPLE_EXT (line 126) | const ATA_CMD_WRITE_MULTIPLE_EXT = 0xC5;
constant ATA_CMD_WRITE_SECTORS (line 127) | const ATA_CMD_WRITE_SECTORS = 0x30;
constant ATA_CMD_WRITE_SECTORS_EXT (line 128) | const ATA_CMD_WRITE_SECTORS_EXT = 0x34;
constant ATA_CMD_NAME (line 132) | const ATA_CMD_NAME =
constant ATAPI_CMD_GET_CONFIGURATION (line 171) | const ATAPI_CMD_GET_CONFIGURATION = 0x46;
constant ATAPI_CMD_GET_EVENT_STATUS_NOTIFICATION (line 172) | const ATAPI_CMD_GET_EVENT_STATUS_NOTIFICATION = 0x4A;
constant ATAPI_CMD_INQUIRY (line 173) | const ATAPI_CMD_INQUIRY = 0x12;
constant ATAPI_CMD_MECHANISM_STATUS (line 174) | const ATAPI_CMD_MECHANISM_STATUS = 0xBD;
constant ATAPI_CMD_MODE_SENSE_6 (line 175) | const ATAPI_CMD_MODE_SENSE_6 = 0x1A;
constant ATAPI_CMD_MODE_SENSE_10 (line 176) | const ATAPI_CMD_MODE_SENSE_10 = 0x5A;
constant ATAPI_CMD_PAUSE (line 177) | const ATAPI_CMD_PAUSE = 0x45;
constant ATAPI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL (line 178) | const ATAPI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E;
constant ATAPI_CMD_READ_10 (line 179) | const ATAPI_CMD_READ_10 = 0x28;
constant ATAPI_CMD_READ_12 (line 180) | const ATAPI_CMD_READ_12 = 0xA8;
constant ATAPI_CMD_READ_CAPACITY (line 181) | const ATAPI_CMD_READ_CAPACITY = 0x25;
constant ATAPI_CMD_READ_CD (line 182) | const ATAPI_CMD_READ_CD = 0xBE;
constant ATAPI_CMD_READ_DISK_INFORMATION (line 183) | const ATAPI_CMD_READ_DISK_INFORMATION = 0x51;
constant ATAPI_CMD_READ_SUBCHANNEL (line 184) | const ATAPI_CMD_READ_SUBCHANNEL = 0x42;
constant ATAPI_CMD_READ_TOC_PMA_ATIP (line 185) | const ATAPI_CMD_READ_TOC_PMA_ATIP = 0x43;
constant ATAPI_CMD_READ_TRACK_INFORMATION (line 186) | const ATAPI_CMD_READ_TRACK_INFORMATION = 0x52;
constant ATAPI_CMD_REQUEST_SENSE (line 187) | const ATAPI_CMD_REQUEST_SENSE = 0x03;
constant ATAPI_CMD_START_STOP_UNIT (line 188) | const ATAPI_CMD_START_STOP_UNIT = 0x1B;
constant ATAPI_CMD_TEST_UNIT_READY (line 189) | const ATAPI_CMD_TEST_UNIT_READY = 0x00;
constant ATAPI_CF_NONE (line 192) | const ATAPI_CF_NONE = 0x00;
constant ATAPI_CF_NEEDS_DISK (line 193) | const ATAPI_CF_NEEDS_DISK = 0x01;
constant ATAPI_CF_UNIT_ATTN (line 194) | const ATAPI_CF_UNIT_ATTN = 0x02;
constant ATAPI_CMD (line 197) | const ATAPI_CMD =
constant ATAPI_SIGNATURE_LO (line 221) | const ATAPI_SIGNATURE_LO = 0x14;
constant ATAPI_SIGNATURE_HI (line 222) | const ATAPI_SIGNATURE_HI = 0xEB;
constant ATAPI_SK_NO_SENSE (line 225) | const ATAPI_SK_NO_SENSE = 0;
constant ATAPI_SK_RECOVERED_ERROR (line 226) | const ATAPI_SK_RECOVERED_ERROR = 1;
constant ATAPI_SK_NOT_READY (line 227) | const ATAPI_SK_NOT_READY = 2;
constant ATAPI_SK_MEDIUM_ERROR (line 228) | const ATAPI_SK_MEDIUM_ERROR = 3;
constant ATAPI_SK_HARDWARE_ERROR (line 229) | const ATAPI_SK_HARDWARE_ERROR = 4;
constant ATAPI_SK_ILLEGAL_REQUEST (line 230) | const ATAPI_SK_ILLEGAL_REQUEST = 5;
constant ATAPI_SK_UNIT_ATTENTION (line 231) | const ATAPI_SK_UNIT_ATTENTION = 6;
constant ATAPI_SK_DATA_PROTECT (line 232) | const ATAPI_SK_DATA_PROTECT = 7;
constant ATAPI_SK_BLANK_CHECK (line 233) | const ATAPI_SK_BLANK_CHECK = 8;
constant ATAPI_SK_ABORTED_COMMAND (line 234) | const ATAPI_SK_ABORTED_COMMAND = 11;
constant ATAPI_ASC_INV_FIELD_IN_CMD_PACKET (line 238) | const ATAPI_ASC_INV_FIELD_IN_CMD_PACKET = 0x24;
constant ATAPI_ASC_MEDIUM_MAY_HAVE_CHANGED (line 239) | const ATAPI_ASC_MEDIUM_MAY_HAVE_CHANGED = 0x28;
constant ATAPI_ASC_MEDIUM_NOT_PRESENT (line 240) | const ATAPI_ASC_MEDIUM_NOT_PRESENT = 0x3A;
constant LOG_DETAIL_NONE (line 243) | const LOG_DETAIL_NONE = 0x00;
constant LOG_DETAIL_REG_IO (line 244) | const LOG_DETAIL_REG_IO = 0x01;
constant LOG_DETAIL_IRQ (line 245) | const LOG_DETAIL_IRQ = 0x02;
constant LOG_DETAIL_RW (line 246) | const LOG_DETAIL_RW = 0x04;
constant LOG_DETAIL_RW_DMA (line 247) | const LOG_DETAIL_RW_DMA = 0x08;
constant LOG_DETAIL_CHS (line 248) | const LOG_DETAIL_CHS = 0x10;
constant LOG_DETAIL_ALL (line 249) | const LOG_DETAIL_ALL = 0xFF;
constant LOG_DETAILS (line 251) | const LOG_DETAILS = DEBUG ? LOG_DETAIL_NONE : 0;
function IDEController (line 274) | function IDEController(cpu, bus, ide_config)
function IDEChannel (line 368) | function IDEChannel(controller, channel_nr, channel_config, command_base...
function IDEInterface (line 803) | function IDEInterface(channel, interface_nr, buffer, is_cd)
FILE: src/io.js
constant LOG_ALL_IO (line 9) | const LOG_ALL_IO = false;
function IO (line 18) | function IO(cpu)
function r16_1 (line 181) | function r16_1()
function r16_2 (line 186) | function r16_2()
function r32 (line 191) | function r32()
function w16_1 (line 225) | function w16_1(data)
function w16_2 (line 230) | function w16_2(data)
function w32 (line 235) | function w32(data)
FILE: src/iso9660.js
constant BLOCK_SIZE (line 11) | const BLOCK_SIZE = 2 * 1024;
constant FILE_FLAGS_HIDDEN (line 13) | const FILE_FLAGS_HIDDEN = 1 << 0;
constant FILE_FLAGS_DIRECTORY (line 14) | const FILE_FLAGS_DIRECTORY = 1 << 1;
constant FILE_FLAGS_ASSOCIATED_FILE (line 15) | const FILE_FLAGS_ASSOCIATED_FILE = 1 << 2;
constant FILE_FLAGS_HAS_EXTENDED_ATTRIBUTE_RECORD (line 16) | const FILE_FLAGS_HAS_EXTENDED_ATTRIBUTE_RECORD = 1 << 3;
constant FILE_FLAGS_HAS_PERMISSIONS (line 17) | const FILE_FLAGS_HAS_PERMISSIONS = 1 << 4;
constant FILE_FLAGS_NOT_FINAL (line 18) | const FILE_FLAGS_NOT_FINAL = 1 << 7;
function generate (line 23) | function generate(files)
function is_probably_iso9660_file (line 244) | function is_probably_iso9660_file(buffer)
FILE: src/kernel.js
constant LINUX_BOOT_HDR_SETUP_SECTS (line 7) | const LINUX_BOOT_HDR_SETUP_SECTS = 0x1F1;
constant LINUX_BOOT_HDR_SYSSIZE (line 8) | const LINUX_BOOT_HDR_SYSSIZE = 0x1F4;
constant LINUX_BOOT_HDR_VIDMODE (line 9) | const LINUX_BOOT_HDR_VIDMODE = 0x1FA;
constant LINUX_BOOT_HDR_BOOT_FLAG (line 10) | const LINUX_BOOT_HDR_BOOT_FLAG = 0x1FE;
constant LINUX_BOOT_HDR_HEADER (line 11) | const LINUX_BOOT_HDR_HEADER = 0x202;
constant LINUX_BOOT_HDR_VERSION (line 12) | const LINUX_BOOT_HDR_VERSION = 0x206;
constant LINUX_BOOT_HDR_TYPE_OF_LOADER (line 13) | const LINUX_BOOT_HDR_TYPE_OF_LOADER = 0x210;
constant LINUX_BOOT_HDR_LOADFLAGS (line 14) | const LINUX_BOOT_HDR_LOADFLAGS = 0x211;
constant LINUX_BOOT_HDR_CODE32_START (line 15) | const LINUX_BOOT_HDR_CODE32_START = 0x214;
constant LINUX_BOOT_HDR_RAMDISK_IMAGE (line 16) | const LINUX_BOOT_HDR_RAMDISK_IMAGE = 0x218;
constant LINUX_BOOT_HDR_RAMDISK_SIZE (line 17) | const LINUX_BOOT_HDR_RAMDISK_SIZE = 0x21C;
constant LINUX_BOOT_HDR_HEAP_END_PTR (line 18) | const LINUX_BOOT_HDR_HEAP_END_PTR = 0x224;
constant LINUX_BOOT_HDR_CMD_LINE_PTR (line 19) | const LINUX_BOOT_HDR_CMD_LINE_PTR = 0x228;
constant LINUX_BOOT_HDR_INITRD_ADDR_MAX (line 20) | const LINUX_BOOT_HDR_INITRD_ADDR_MAX = 0x22C;
constant LINUX_BOOT_HDR_KERNEL_ALIGNMENT (line 21) | const LINUX_BOOT_HDR_KERNEL_ALIGNMENT = 0x230;
constant LINUX_BOOT_HDR_RELOCATABLE_KERNEL (line 22) | const LINUX_BOOT_HDR_RELOCATABLE_KERNEL = 0x234;
constant LINUX_BOOT_HDR_MIN_ALIGNMENT (line 23) | const LINUX_BOOT_HDR_MIN_ALIGNMENT = 0x235;
constant LINUX_BOOT_HDR_XLOADFLAGS (line 24) | const LINUX_BOOT_HDR_XLOADFLAGS = 0x236;
constant LINUX_BOOT_HDR_CMDLINE_SIZE (line 25) | const LINUX_BOOT_HDR_CMDLINE_SIZE = 0x238;
constant LINUX_BOOT_HDR_PAYLOAD_OFFSET (line 26) | const LINUX_BOOT_HDR_PAYLOAD_OFFSET = 0x248;
constant LINUX_BOOT_HDR_PAYLOAD_LENGTH (line 27) | const LINUX_BOOT_HDR_PAYLOAD_LENGTH = 0x24C;
constant LINUX_BOOT_HDR_PREF_ADDRESS (line 28) | const LINUX_BOOT_HDR_PREF_ADDRESS = 0x258;
constant LINUX_BOOT_HDR_INIT_SIZE (line 29) | const LINUX_BOOT_HDR_INIT_SIZE = 0x260;
constant LINUX_BOOT_HDR_CHECKSUM1 (line 31) | const LINUX_BOOT_HDR_CHECKSUM1 = 0xAA55;
constant LINUX_BOOT_HDR_CHECKSUM2 (line 32) | const LINUX_BOOT_HDR_CHECKSUM2 = 0x53726448;
constant LINUX_BOOT_HDR_TYPE_OF_LOADER_NOT_ASSIGNED (line 34) | const LINUX_BOOT_HDR_TYPE_OF_LOADER_NOT_ASSIGNED = 0xFF;
constant LINUX_BOOT_HDR_LOADFLAGS_LOADED_HIGH (line 36) | const LINUX_BOOT_HDR_LOADFLAGS_LOADED_HIGH = 1 << 0;
constant LINUX_BOOT_HDR_LOADFLAGS_QUIET_FLAG (line 37) | const LINUX_BOOT_HDR_LOADFLAGS_QUIET_FLAG = 1 << 5;
constant LINUX_BOOT_HDR_LOADFLAGS_KEEP_SEGMENTS (line 38) | const LINUX_BOOT_HDR_LOADFLAGS_KEEP_SEGMENTS = 1 << 6;
constant LINUX_BOOT_HDR_LOADFLAGS_CAN_USE_HEAPS (line 39) | const LINUX_BOOT_HDR_LOADFLAGS_CAN_USE_HEAPS = 1 << 7;
function load_kernel (line 42) | function load_kernel(mem8, bzimage, initrd, cmdline)
function make_linux_boot_rom (line 181) | function make_linux_boot_rom(real_mode_segment, heap_end)
FILE: src/lib.js
function pads (line 4) | function pads(str, len)
function pad0 (line 11) | function pad0(str, len)
function h (line 49) | function h(n, len)
function hex_dump (line 63) | function hex_dump(buffer)
function ByteQueue (line 246) | function ByteQueue(size)
function FloatQueue (line 317) | function FloatQueue(size)
function CircularQueue (line 412) | function CircularQueue(size)
function dump_file (line 445) | function dump_file(ab, name)
function download (line 456) | function download(file_or_blob, name)
function retry (line 686) | function retry()
function read_sized_string_from_mem (line 725) | function read_sized_string_from_mem(mem, offset, len)
constant CHARMAPS (line 743) | const CHARMAPS =
function get_charmap (line 758) | function get_charmap(encoding)
FILE: src/log.js
function set_log_level (line 19) | function set_log_level(level) {
function do_the_log (line 25) | function do_the_log(message)
function dbg_log_ (line 60) | function dbg_log_(stuff, level)
function dbg_trace (line 112) | function dbg_trace(level)
function dbg_assert (line 124) | function dbg_assert(cond, msg, level)
function dbg_assert_failed (line 135) | function dbg_assert_failed(msg)
FILE: src/main.js
function v86 (line 9) | function v86(bus, wasm)
function the_worker (line 132) | function the_worker()
FILE: src/ne2k.js
constant NE2K_LOG_VERBOSE (line 12) | const NE2K_LOG_VERBOSE = false;
constant NE2K_LOG_PACKETS (line 13) | const NE2K_LOG_PACKETS = false;
constant E8390_CMD (line 15) | const E8390_CMD = 0x00;
constant EN0_CLDALO (line 18) | const EN0_CLDALO = 0x01;
constant EN0_STARTPG (line 19) | const EN0_STARTPG = 0x01;
constant EN0_CLDAHI (line 20) | const EN0_CLDAHI = 0x02;
constant EN0_STOPPG (line 21) | const EN0_STOPPG = 0x02;
constant EN0_BOUNDARY (line 22) | const EN0_BOUNDARY = 0x03;
constant EN0_TSR (line 23) | const EN0_TSR = 0x04;
constant EN0_TPSR (line 24) | const EN0_TPSR = 0x04;
constant EN0_NCR (line 25) | const EN0_NCR = 0x05;
constant EN0_TCNTLO (line 26) | const EN0_TCNTLO = 0x05;
constant EN0_FIFO (line 27) | const EN0_FIFO = 0x06;
constant EN0_TCNTHI (line 28) | const EN0_TCNTHI = 0x06;
constant EN0_ISR (line 29) | const EN0_ISR = 0x07;
constant EN0_CRDALO (line 30) | const EN0_CRDALO = 0x08;
constant EN0_RSARLO (line 31) | const EN0_RSARLO = 0x08;
constant EN0_CRDAHI (line 32) | const EN0_CRDAHI = 0x09;
constant EN0_RSARHI (line 33) | const EN0_RSARHI = 0x09;
constant EN0_RCNTLO (line 34) | const EN0_RCNTLO = 0x0a;
constant EN0_RCNTHI (line 35) | const EN0_RCNTHI = 0x0b;
constant EN0_RSR (line 36) | const EN0_RSR = 0x0c;
constant EN0_RXCR (line 37) | const EN0_RXCR = 0x0c;
constant EN0_TXCR (line 38) | const EN0_TXCR = 0x0d;
constant EN0_COUNTER0 (line 39) | const EN0_COUNTER0 = 0x0d;
constant EN0_DCFG (line 40) | const EN0_DCFG = 0x0e;
constant EN0_COUNTER1 (line 41) | const EN0_COUNTER1 = 0x0e;
constant EN0_IMR (line 42) | const EN0_IMR = 0x0f;
constant EN0_COUNTER2 (line 43) | const EN0_COUNTER2 = 0x0f;
constant NE_DATAPORT (line 45) | const NE_DATAPORT = 0x10;
constant NE_RESET (line 46) | const NE_RESET = 0x1f;
constant ENISR_RX (line 49) | const ENISR_RX = 0x01;
constant ENISR_TX (line 50) | const ENISR_TX = 0x02;
constant ENISR_RX_ERR (line 51) | const ENISR_RX_ERR = 0x04;
constant ENISR_TX_ERR (line 52) | const ENISR_TX_ERR = 0x08;
constant ENISR_OVER (line 53) | const ENISR_OVER = 0x10;
constant ENISR_COUNTERS (line 54) | const ENISR_COUNTERS = 0x20;
constant ENISR_RDC (line 55) | const ENISR_RDC = 0x40;
constant ENISR_RESET (line 56) | const ENISR_RESET = 0x80;
constant ENISR_ALL (line 57) | const ENISR_ALL = 0x3f;
constant ENRSR_RXOK (line 59) | const ENRSR_RXOK = 0x01;
constant START_PAGE (line 61) | const START_PAGE = 0x40;
constant START_RX_PAGE (line 62) | const START_RX_PAGE = 0x40 + 12;
constant STOP_PAGE (line 63) | const STOP_PAGE = 0x80;
function translate_mac_address (line 70) | function translate_mac_address(packet, search_mac, replacement_mac)
function format_mac (line 236) | function format_mac(mac)
function dump_packet (line 248) | function dump_packet(packet, prefix)
function Ne2k (line 298) | function Ne2k(cpu, bus, preserve_mac_from_state_image, mac_address_trans...
FILE: src/pci.js
constant PCI_CONFIG_ADDRESS (line 10) | const PCI_CONFIG_ADDRESS = 0xCF8;
constant PCI_CONFIG_DATA (line 11) | const PCI_CONFIG_DATA = 0xCFC;
function PCI (line 17) | function PCI(cpu)
FILE: src/pit.js
constant OSCILLATOR_FREQ (line 11) | const OSCILLATOR_FREQ = 1193.1816666;
function PIT (line 18) | function PIT(cpu, bus)
FILE: src/ps2.js
constant PS2_LOG_VERBOSE (line 10) | const PS2_LOG_VERBOSE = false;
function PS2 (line 17) | function PS2(cpu, bus)
FILE: src/rtc.js
constant CMOS_RTC_SECONDS (line 11) | const CMOS_RTC_SECONDS = 0x00;
constant CMOS_RTC_SECONDS_ALARM (line 12) | const CMOS_RTC_SECONDS_ALARM = 0x01;
constant CMOS_RTC_MINUTES (line 13) | const CMOS_RTC_MINUTES = 0x02;
constant CMOS_RTC_MINUTES_ALARM (line 14) | const CMOS_RTC_MINUTES_ALARM = 0x03;
constant CMOS_RTC_HOURS (line 15) | const CMOS_RTC_HOURS = 0x04;
constant CMOS_RTC_HOURS_ALARM (line 16) | const CMOS_RTC_HOURS_ALARM = 0x05;
constant CMOS_RTC_DAY_WEEK (line 17) | const CMOS_RTC_DAY_WEEK = 0x06;
constant CMOS_RTC_DAY_MONTH (line 18) | const CMOS_RTC_DAY_MONTH = 0x07;
constant CMOS_RTC_MONTH (line 19) | const CMOS_RTC_MONTH = 0x08;
constant CMOS_RTC_YEAR (line 20) | const CMOS_RTC_YEAR = 0x09;
constant CMOS_STATUS_A (line 21) | const CMOS_STATUS_A = 0x0a;
constant CMOS_STATUS_B (line 22) | const CMOS_STATUS_B = 0x0b;
constant CMOS_STATUS_C (line 23) | const CMOS_STATUS_C = 0x0c;
constant CMOS_STATUS_D (line 24) | const CMOS_STATUS_D = 0x0d;
constant CMOS_DIAG_STATUS (line 25) | const CMOS_DIAG_STATUS = 0x0e;
constant CMOS_RESET_CODE (line 26) | const CMOS_RESET_CODE = 0x0f;
constant CMOS_FLOPPY_DRIVE_TYPE (line 28) | const CMOS_FLOPPY_DRIVE_TYPE = 0x10;
constant CMOS_DISK_DATA (line 29) | const CMOS_DISK_DATA = 0x12;
constant CMOS_EQUIPMENT_INFO (line 30) | const CMOS_EQUIPMENT_INFO = 0x14;
constant CMOS_MEM_BASE_LOW (line 31) | const CMOS_MEM_BASE_LOW = 0x15;
constant CMOS_MEM_BASE_HIGH (line 32) | const CMOS_MEM_BASE_HIGH = 0x16;
constant CMOS_MEM_OLD_EXT_LOW (line 33) | const CMOS_MEM_OLD_EXT_LOW = 0x17;
constant CMOS_MEM_OLD_EXT_HIGH (line 34) | const CMOS_MEM_OLD_EXT_HIGH = 0x18;
constant CMOS_DISK_DRIVE1_TYPE (line 35) | const CMOS_DISK_DRIVE1_TYPE = 0x19;
constant CMOS_DISK_DRIVE2_TYPE (line 36) | const CMOS_DISK_DRIVE2_TYPE = 0x1a;
constant CMOS_DISK_DRIVE1_CYL (line 37) | const CMOS_DISK_DRIVE1_CYL = 0x1b;
constant CMOS_DISK_DRIVE2_CYL (line 38) | const CMOS_DISK_DRIVE2_CYL = 0x24;
constant CMOS_MEM_EXTMEM_LOW (line 39) | const CMOS_MEM_EXTMEM_LOW = 0x30;
constant CMOS_MEM_EXTMEM_HIGH (line 40) | const CMOS_MEM_EXTMEM_HIGH = 0x31;
constant CMOS_CENTURY (line 41) | const CMOS_CENTURY = 0x32;
constant CMOS_MEM_EXTMEM2_LOW (line 42) | const CMOS_MEM_EXTMEM2_LOW = 0x34;
constant CMOS_MEM_EXTMEM2_HIGH (line 43) | const CMOS_MEM_EXTMEM2_HIGH = 0x35;
constant CMOS_CENTURY2 (line 44) | const CMOS_CENTURY2 = 0x37;
constant CMOS_BIOS_BOOTFLAG1 (line 45) | const CMOS_BIOS_BOOTFLAG1 = 0x38;
constant CMOS_BIOS_DISKTRANSFLAG (line 46) | const CMOS_BIOS_DISKTRANSFLAG = 0x39;
constant CMOS_BIOS_BOOTFLAG2 (line 47) | const CMOS_BIOS_BOOTFLAG2 = 0x3d;
constant CMOS_MEM_HIGHMEM_LOW (line 48) | const CMOS_MEM_HIGHMEM_LOW = 0x5b;
constant CMOS_MEM_HIGHMEM_MID (line 49) | const CMOS_MEM_HIGHMEM_MID = 0x5c;
constant CMOS_MEM_HIGHMEM_HIGH (line 50) | const CMOS_MEM_HIGHMEM_HIGH = 0x5d;
constant CMOS_BIOS_SMP_COUNT (line 51) | const CMOS_BIOS_SMP_COUNT = 0x5f;
constant BOOT_ORDER_CD_FIRST (line 54) | const BOOT_ORDER_CD_FIRST = 0x123;
constant BOOT_ORDER_HD_FIRST (line 55) | const BOOT_ORDER_HD_FIRST = 0x312;
constant BOOT_ORDER_FD_FIRST (line 56) | const BOOT_ORDER_FD_FIRST = 0x321;
function RTC (line 63) | function RTC(cpu)
FILE: src/rust/analysis.rs
type AnalysisType (line 10) | pub enum AnalysisType {
type Analysis (line 21) | pub struct Analysis {
function analyze_step (line 27) | pub fn analyze_step(mut cpu: &mut CpuContext) -> Analysis {
function analyze_step_handle_prefix (line 39) | pub fn analyze_step_handle_prefix(cpu: &mut CpuContext, analysis: &mut A...
function analyze_step_handle_segment_prefix (line 46) | pub fn analyze_step_handle_segment_prefix(
function instr16_0F_analyze (line 56) | pub fn instr16_0F_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr32_0F_analyze (line 59) | pub fn instr32_0F_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_26_analyze (line 62) | pub fn instr_26_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_2E_analyze (line 65) | pub fn instr_2E_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_36_analyze (line 68) | pub fn instr_36_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_3E_analyze (line 71) | pub fn instr_3E_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_64_analyze (line 74) | pub fn instr_64_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_65_analyze (line 77) | pub fn instr_65_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_66_analyze (line 80) | pub fn instr_66_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_67_analyze (line 84) | pub fn instr_67_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_F0_analyze (line 88) | pub fn instr_F0_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_F2_analyze (line 92) | pub fn instr_F2_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function instr_F3_analyze (line 96) | pub fn instr_F3_analyze(cpu: &mut CpuContext, analysis: &mut Analysis) {
function modrm_analyze (line 101) | pub fn modrm_analyze(ctx: &mut CpuContext, modrm_byte: u8) { modrm::skip...
FILE: src/rust/codegen.rs
function gen_add_cs_offset (line 15) | pub fn gen_add_cs_offset(ctx: &mut JitContext) {
function gen_get_eip (line 23) | pub fn gen_get_eip(builder: &mut WasmBuilder) {
function gen_set_eip_to_after_current_instruction (line 27) | pub fn gen_set_eip_to_after_current_instruction(ctx: &mut JitContext) {
function gen_set_previous_eip_offset_from_eip_with_low_bits (line 38) | pub fn gen_set_previous_eip_offset_from_eip_with_low_bits(
function gen_set_eip_low_bits (line 53) | pub fn gen_set_eip_low_bits(builder: &mut WasmBuilder, low_bits: i32) {
function gen_set_eip_low_bits_and_jump_rel32 (line 65) | pub fn gen_set_eip_low_bits_and_jump_rel32(builder: &mut WasmBuilder, lo...
function gen_relative_jump (line 81) | pub fn gen_relative_jump(builder: &mut WasmBuilder, n: i32) {
function gen_page_switch_check (line 92) | pub fn gen_page_switch_check(
function gen_update_instruction_counter (line 120) | pub fn gen_update_instruction_counter(ctx: &mut JitContext) {
function gen_get_reg8 (line 130) | pub fn gen_get_reg8(ctx: &mut JitContext, r: u32) {
function gen_get_reg8_or_alias_to_reg32 (line 152) | pub fn gen_get_reg8_or_alias_to_reg32(ctx: &mut JitContext, r: u32) -> W...
function gen_free_reg8_or_alias (line 166) | pub fn gen_free_reg8_or_alias(ctx: &mut JitContext, r: u32, local: WasmL...
function gen_get_reg16 (line 174) | pub fn gen_get_reg16(ctx: &mut JitContext, r: u32) {
function gen_get_reg32 (line 180) | pub fn gen_get_reg32(ctx: &mut JitContext, r: u32) {
function gen_set_reg8 (line 184) | pub fn gen_set_reg8(ctx: &mut JitContext, r: u32) {
function gen_set_reg8_unmasked (line 218) | pub fn gen_set_reg8_unmasked(ctx: &mut JitContext, r: u32) {
function gen_set_reg16 (line 261) | pub fn gen_set_reg16(ctx: &mut JitContext, r: u32) {
function gen_set_reg16_unmasked (line 265) | pub fn gen_set_reg16_unmasked(ctx: &mut JitContext, r: u32) {
function gen_set_reg16_local (line 285) | pub fn gen_set_reg16_local(builder: &mut WasmBuilder, local: &WasmLocal) {
function gen_set_reg32 (line 296) | pub fn gen_set_reg32(ctx: &mut JitContext, r: u32) {
function decr_exc_asize (line 300) | pub fn decr_exc_asize(ctx: &mut JitContext) {
function gen_read_reg_xmm128_into_scratch (line 312) | pub fn gen_read_reg_xmm128_into_scratch(ctx: &mut JitContext, r: u32) {
function gen_get_sreg (line 328) | pub fn gen_get_sreg(ctx: &mut JitContext, r: u32) {
function gen_get_ss_offset (line 333) | pub fn gen_get_ss_offset(ctx: &mut JitContext) {
function gen_get_flags (line 338) | pub fn gen_get_flags(builder: &mut WasmBuilder) {
function gen_get_flags_changed (line 341) | fn gen_get_flags_changed(builder: &mut WasmBuilder) {
function gen_get_last_result (line 344) | fn gen_get_last_result(builder: &mut WasmBuilder, previous_instruction: ...
function gen_get_last_op_size (line 384) | fn gen_get_last_op_size(builder: &mut WasmBuilder) {
function gen_get_last_op1 (line 387) | fn gen_get_last_op1(builder: &mut WasmBuilder, previous_instruction: &In...
function gen_get_page_fault (line 398) | pub fn gen_get_page_fault(builder: &mut WasmBuilder) {
function sign_extend_i8 (line 403) | pub fn sign_extend_i8(builder: &mut WasmBuilder) {
function sign_extend_i16 (line 411) | pub fn sign_extend_i16(builder: &mut WasmBuilder) {
function gen_fn0_const (line 418) | pub fn gen_fn0_const(builder: &mut WasmBuilder, name: &str) { builder.ca...
function gen_fn1_const (line 419) | pub fn gen_fn1_const(builder: &mut WasmBuilder, name: &str, arg0: u32) {
function gen_fn2_const (line 423) | pub fn gen_fn2_const(builder: &mut WasmBuilder, name: &str, arg0: u32, a...
function gen_modrm_fn0 (line 430) | pub fn gen_modrm_fn0(builder: &mut WasmBuilder, name: &str) {
function gen_modrm_fn1 (line 434) | pub fn gen_modrm_fn1(builder: &mut WasmBuilder, name: &str, arg0: u32) {
function gen_modrm_resolve (line 440) | pub fn gen_modrm_resolve(ctx: &mut JitContext, modrm_byte: ModrmByte) {
function gen_modrm_resolve_with_local (line 443) | pub fn gen_modrm_resolve_with_local(
function gen_modrm_resolve_with_esp_offset (line 458) | pub fn gen_modrm_resolve_with_esp_offset(
function gen_set_reg8_r (line 466) | pub fn gen_set_reg8_r(ctx: &mut JitContext, dest: u32, src: u32) {
function gen_set_reg16_r (line 473) | pub fn gen_set_reg16_r(ctx: &mut JitContext, dest: u32, src: u32) {
function gen_set_reg32_r (line 480) | pub fn gen_set_reg32_r(ctx: &mut JitContext, dest: u32, src: u32) {
function gen_modrm_resolve_safe_read8 (line 488) | pub fn gen_modrm_resolve_safe_read8(ctx: &mut JitContext, modrm_byte: Mo...
function gen_modrm_resolve_safe_read16 (line 491) | pub fn gen_modrm_resolve_safe_read16(ctx: &mut JitContext, modrm_byte: M...
function gen_modrm_resolve_safe_read32 (line 494) | pub fn gen_modrm_resolve_safe_read32(ctx: &mut JitContext, modrm_byte: M...
function gen_modrm_resolve_safe_read64 (line 497) | pub fn gen_modrm_resolve_safe_read64(ctx: &mut JitContext, modrm_byte: M...
function gen_modrm_resolve_safe_read128 (line 500) | pub fn gen_modrm_resolve_safe_read128(
function gen_safe_read8 (line 510) | pub fn gen_safe_read8(ctx: &mut JitContext, address_local: &WasmLocal) {
function gen_safe_read16 (line 513) | pub fn gen_safe_read16(ctx: &mut JitContext, address_local: &WasmLocal) {
function gen_safe_read32 (line 516) | pub fn gen_safe_read32(ctx: &mut JitContext, address_local: &WasmLocal) {
function gen_safe_read64 (line 519) | pub fn gen_safe_read64(ctx: &mut JitContext, address_local: &WasmLocal) {
function gen_safe_read128 (line 522) | pub fn gen_safe_read128(ctx: &mut JitContext, address_local: &WasmLocal,...
type GenSafeWriteValue (line 527) | enum GenSafeWriteValue<'a> {
type GenSafeReadWriteValue (line 533) | enum GenSafeReadWriteValue {
type BitSize (line 539) | pub enum BitSize {
method bytes (line 547) | pub fn bytes(&self) -> u32 {
function gen_safe_write8 (line 558) | pub fn gen_safe_write8(ctx: &mut JitContext, address_local: &WasmLocal, ...
function gen_safe_write16 (line 566) | pub fn gen_safe_write16(ctx: &mut JitContext, address_local: &WasmLocal,...
function gen_safe_write32 (line 574) | pub fn gen_safe_write32(ctx: &mut JitContext, address_local: &WasmLocal,...
function gen_safe_write64 (line 582) | pub fn gen_safe_write64(
function gen_safe_write128 (line 595) | pub fn gen_safe_write128(
function gen_safe_read (line 609) | fn gen_safe_read(
function gen_get_phys_eip_plus_mem (line 748) | pub fn gen_get_phys_eip_plus_mem(ctx: &mut JitContext, address_local: &W...
function gen_safe_write (line 825) | fn gen_safe_write(
function gen_safe_read_write (line 968) | pub fn gen_safe_read_write(
function bug_gen_safe_read_write_page_fault (line 1199) | pub fn bug_gen_safe_read_write_page_fault(bits: i32, addr: u32) {
function gen_jmp_rel16 (line 1204) | pub fn gen_jmp_rel16(builder: &mut WasmBuilder, rel16: u16) {
function gen_pop16_ss16 (line 1232) | pub fn gen_pop16_ss16(ctx: &mut JitContext) {
function gen_pop16_ss32 (line 1255) | pub fn gen_pop16_ss32(ctx: &mut JitContext) {
function gen_pop16 (line 1278) | pub fn gen_pop16(ctx: &mut JitContext) {
function gen_pop32s_ss16 (line 1287) | pub fn gen_pop32s_ss16(ctx: &mut JitContext) {
function gen_pop32s_ss32 (line 1310) | pub fn gen_pop32s_ss32(ctx: &mut JitContext) {
function gen_pop32s (line 1332) | pub fn gen_pop32s(ctx: &mut JitContext) {
function gen_adjust_stack_reg (line 1341) | pub fn gen_adjust_stack_reg(ctx: &mut JitContext, offset: u32) {
function gen_leave (line 1356) | pub fn gen_leave(ctx: &mut JitContext, os32: bool) {
function gen_task_switch_test (line 1403) | pub fn gen_task_switch_test(ctx: &mut JitContext) {
function gen_task_switch_test_mmx (line 1425) | pub fn gen_task_switch_test_mmx(ctx: &mut JitContext) {
function gen_push16 (line 1447) | pub fn gen_push16(ctx: &mut JitContext, value_local: &WasmLocal) {
function gen_push32 (line 1493) | pub fn gen_push32(ctx: &mut JitContext, value_local: &WasmLocal) {
function gen_push32_sreg (line 1540) | pub fn gen_push32_sreg(ctx: &mut JitContext, reg: u32) {
function gen_get_real_eip (line 1591) | pub fn gen_get_real_eip(ctx: &mut JitContext) {
function gen_set_last_op1 (line 1604) | pub fn gen_set_last_op1(builder: &mut WasmBuilder, source: &WasmLocal) {
function gen_set_last_result (line 1610) | pub fn gen_set_last_result(builder: &mut WasmBuilder, source: &WasmLocal) {
function gen_clear_flags_changed_bits (line 1616) | pub fn gen_clear_flags_changed_bits(builder: &mut WasmBuilder, bits_to_c...
function gen_set_last_op_size_and_flags_changed (line 1624) | pub fn gen_set_last_op_size_and_flags_changed(
function gen_set_flags_bits (line 1637) | pub fn gen_set_flags_bits(builder: &mut WasmBuilder, bits_to_set: i32) {
function gen_clear_flags_bits (line 1645) | pub fn gen_clear_flags_bits(builder: &mut WasmBuilder, bits_to_clear: i3...
type ConditionNegate (line 1654) | pub enum ConditionNegate {
function gen_getzf (line 1659) | pub fn gen_getzf(ctx: &mut JitContext, negate: ConditionNegate) {
function gen_getcf (line 1767) | pub fn gen_getcf(ctx: &mut JitContext, negate: ConditionNegate) {
function gen_getsf (line 1872) | pub fn gen_getsf(ctx: &mut JitContext, negate: ConditionNegate) {
function gen_getof (line 1929) | pub fn gen_getof(ctx: &mut JitContext) {
function gen_test_be (line 2040) | pub fn gen_test_be(ctx: &mut JitContext, negate: ConditionNegate) {
function gen_test_l (line 2151) | pub fn gen_test_l(ctx: &mut JitContext, negate: ConditionNegate) {
function gen_test_le (line 2278) | pub fn gen_test_le(ctx: &mut JitContext, negate: ConditionNegate) {
function gen_test_loopnz (line 2409) | pub fn gen_test_loopnz(ctx: &mut JitContext, is_asize_32: bool) {
function gen_test_loopz (line 2416) | pub fn gen_test_loopz(ctx: &mut JitContext, is_asize_32: bool) {
function gen_test_loop (line 2424) | pub fn gen_test_loop(ctx: &mut JitContext, is_asize_32: bool) {
function gen_test_jcxz (line 2432) | pub fn gen_test_jcxz(ctx: &mut JitContext, is_asize_32: bool) {
function gen_fpu_get_sti (line 2442) | pub fn gen_fpu_get_sti(ctx: &mut JitContext, i: u32) {
function gen_fpu_load_m32 (line 2453) | pub fn gen_fpu_load_m32(ctx: &mut JitContext, modrm_byte: ModrmByte) {
function gen_fpu_load_m64 (line 2464) | pub fn gen_fpu_load_m64(ctx: &mut JitContext, modrm_byte: ModrmByte) {
function gen_fpu_load_i16 (line 2475) | pub fn gen_fpu_load_i16(ctx: &mut JitContext, modrm_byte: ModrmByte) {
function gen_fpu_load_i32 (line 2486) | pub fn gen_fpu_load_i32(ctx: &mut JitContext, modrm_byte: ModrmByte) {
function gen_fpu_load_i64 (line 2496) | pub fn gen_fpu_load_i64(ctx: &mut JitContext, modrm_byte: ModrmByte) {
function gen_trigger_de (line 2507) | pub fn gen_trigger_de(ctx: &mut JitContext) {
function gen_trigger_ud (line 2517) | pub fn gen_trigger_ud(ctx: &mut JitContext) {
function gen_trigger_gp (line 2527) | pub fn gen_trigger_gp(ctx: &mut JitContext, error_code: u32) {
function gen_condition_fn_negated (line 2538) | pub fn gen_condition_fn_negated(ctx: &mut JitContext, condition: u8) {
function gen_condition_fn (line 2542) | pub fn gen_condition_fn(ctx: &mut JitContext, condition: u8) {
function gen_move_registers_from_locals_to_memory (line 2621) | pub fn gen_move_registers_from_locals_to_memory(ctx: &mut JitContext) {
function gen_move_registers_from_memory_to_locals (line 2634) | pub fn gen_move_registers_from_memory_to_locals(ctx: &mut JitContext) {
function gen_profiler_stat_increment (line 2648) | pub fn gen_profiler_stat_increment(builder: &mut WasmBuilder, stat: prof...
function gen_debug_track_jit_exit (line 2656) | pub fn gen_debug_track_jit_exit(builder: &mut WasmBuilder, address: u32) {
FILE: src/rust/config.rs
constant LOG_PAGE_FAULTS (line 1) | pub const LOG_PAGE_FAULTS: bool = false;
constant VMWARE_HYPERVISOR_PORT (line 3) | pub const VMWARE_HYPERVISOR_PORT: bool = true;
FILE: src/rust/control_flow.rs
constant ENTRY_NODE_ID (line 8) | const ENTRY_NODE_ID: u32 = 0xffff_ffff;
type Set (line 13) | type Set = BTreeSet<u32>;
type Graph (line 14) | type Graph = BTreeMap<u32, Set>;
function rev_graph_edges (line 17) | fn rev_graph_edges(nodes: &Graph) -> Graph {
function make_graph (line 30) | pub fn make_graph(basic_blocks: &Vec<BasicBlock>) -> Graph {
type WasmStructure (line 80) | pub enum WasmStructure {
method print (line 87) | pub fn print(&self, depth: usize) {
method branches (line 115) | fn branches(&self, edges: &Graph) -> HashSet<u32> {
method head (line 133) | pub fn head(&self) -> Box<dyn iter::Iterator<Item = u32> + '_> {
function assert_invariants (line 149) | pub fn assert_invariants(blocks: &Vec<WasmStructure>) {
function scc (line 186) | fn scc(edges: &Graph, rev_edges: &Graph) -> Vec<Vec<u32>> {
function loopify (line 241) | pub fn loopify(nodes: &Graph) -> Vec<WasmStructure> {
function blockify (line 347) | pub fn blockify(blocks: &mut Vec<WasmStructure>, edges: &Graph) {
FILE: src/rust/cpu/apic.rs
constant APIC_LOG_VERBOSE (line 6) | const APIC_LOG_VERBOSE: bool = false;
constant APIC_TIMER_FREQ (line 9) | const APIC_TIMER_FREQ: f64 = 1.0 * 1000.0 * 1000.0;
constant APIC_TIMER_MODE_MASK (line 11) | const APIC_TIMER_MODE_MASK: u32 = 3 << 17;
constant APIC_TIMER_MODE_ONE_SHOT (line 13) | const APIC_TIMER_MODE_ONE_SHOT: u32 = 0;
constant APIC_TIMER_MODE_PERIODIC (line 14) | const APIC_TIMER_MODE_PERIODIC: u32 = 1 << 17;
constant _APIC_TIMER_MODE_TSC (line 16) | const _APIC_TIMER_MODE_TSC: u32 = 2 << 17;
constant DELIVERY_MODES (line 18) | const DELIVERY_MODES: [&str; 8] = [
constant DESTINATION_MODES (line 29) | const DESTINATION_MODES: [&str; 2] = ["physical", "logical"];
constant IOAPIC_CONFIG_MASKED (line 31) | const IOAPIC_CONFIG_MASKED: u32 = 0x10000;
constant IOAPIC_DELIVERY_INIT (line 33) | const IOAPIC_DELIVERY_INIT: u8 = 5;
constant IOAPIC_DELIVERY_NMI (line 34) | const IOAPIC_DELIVERY_NMI: u8 = 4;
constant IOAPIC_DELIVERY_FIXED (line 35) | const IOAPIC_DELIVERY_FIXED: u8 = 0;
constant APIC_STRUCT_SIZE (line 39) | const APIC_STRUCT_SIZE: usize = 4 * 46;
constant _ (line 42) | const _: () = assert!(std::mem::offset_of!(Apic, timer_last_tick) == 6 *...
constant _ (line 43) | const _: () = assert!(std::mem::offset_of!(Apic, lvt_timer) == 8 * 4);
constant _ (line 44) | const _: () = assert!(std::mem::offset_of!(Apic, lvt_perf_counter) == 9 ...
constant _ (line 45) | const _: () = assert!(std::mem::offset_of!(Apic, icr0) == 14 * 4);
constant _ (line 46) | const _: () = assert!(std::mem::offset_of!(Apic, icr1) == 15 * 4);
constant _ (line 47) | const _: () = assert!(std::mem::offset_of!(Apic, irr) == 16 * 4);
constant _ (line 48) | const _: () = assert!(std::mem::offset_of!(Apic, isr) == 24 * 4);
constant _ (line 49) | const _: () = assert!(std::mem::offset_of!(Apic, tmr) == 32 * 4);
constant _ (line 50) | const _: () = assert!(std::mem::offset_of!(Apic, spurious_vector) == 40 ...
constant _ (line 51) | const _: () = assert!(std::mem::offset_of!(Apic, lvt_thermal_sensor) == ...
constant _ (line 52) | const _: () = assert!(std::mem::size_of::<Apic>() == APIC_STRUCT_SIZE);
type Apic (line 54) | pub struct Apic {
function get_apic (line 106) | pub fn get_apic() -> MutexGuard<'static, Apic> { APIC.try_lock().unwrap() }
function get_apic_addr (line 109) | pub fn get_apic_addr() -> u32 { &raw mut *get_apic() as u32 }
function read32 (line 111) | pub fn read32(addr: u32) -> u32 {
function read32_internal (line 118) | fn read32_internal(apic: &mut Apic, addr: u32) -> u32 {
function write32 (line 278) | pub fn write32(addr: u32, value: u32) {
function write32_internal (line 285) | fn write32_internal(apic: &mut Apic, addr: u32, value: u32) {
function apic_timer (line 467) | pub fn apic_timer(now: f64) -> f64 { timer(&mut get_apic(), now) }
function timer (line 469) | fn timer(apic: &mut Apic, now: f64) -> f64 {
function route (line 535) | pub fn route(
function deliver (line 547) | fn deliver(apic: &mut Apic, vector: u8, mode: u8, is_level: bool) {
function highest_irr (line 581) | fn highest_irr(apic: &mut Apic) -> Option<u8> {
function highest_isr (line 590) | fn highest_isr(apic: &mut Apic) -> Option<u8> {
function acknowledge_irq (line 599) | pub fn acknowledge_irq() -> Option<u8> { acknowledge_irq_internal(&mut g...
function acknowledge_irq_internal (line 601) | fn acknowledge_irq_internal(apic: &mut Apic) -> Option<u8> {
function register_get_bit (line 640) | fn register_get_bit(v: &[u32; 8], bit: u8) -> bool { v[(bit >> 5) as usi...
function register_set_bit (line 642) | fn register_set_bit(v: &mut [u32; 8], bit: u8) { v[(bit >> 5) as usize] ...
function register_clear_bit (line 644) | fn register_clear_bit(v: &mut [u32; 8], bit: u8) { v[(bit >> 5) as usize...
function register_get_highest_bit (line 646) | fn register_get_highest_bit(v: &[u32; 8]) -> Option<u8> {
FILE: src/rust/cpu/arith.rs
function int_log2 (line 6) | fn int_log2(x: i32) -> i32 { 31 - x.leading_zeros() as i32 }
function opsize_to_mask (line 8) | fn opsize_to_mask(op_size: i32) -> i32 {
function add (line 13) | unsafe fn add(dest_operand: i32, source_operand: i32, op_size: i32) -> i...
function adc (line 21) | unsafe fn adc(dest_operand: i32, source_operand: i32, op_size: i32) -> i...
function sub (line 35) | unsafe fn sub(dest_operand: i32, source_operand: i32, op_size: i32) -> i...
function sbb (line 43) | unsafe fn sbb(dest_operand: i32, source_operand: i32, op_size: i32) -> i...
function add8 (line 57) | pub unsafe fn add8(x: i32, y: i32) -> i32 {
function add16 (line 63) | pub unsafe fn add16(x: i32, y: i32) -> i32 {
function add32 (line 68) | pub unsafe fn add32(x: i32, y: i32) -> i32 { return add(x, y, OPSIZE_32); }
function sub8 (line 69) | pub unsafe fn sub8(x: i32, y: i32) -> i32 { return sub(x, y, OPSIZE_8); }
function sub16 (line 71) | pub unsafe fn sub16(x: i32, y: i32) -> i32 { return sub(x, y, OPSIZE_16); }
function sub32 (line 72) | pub unsafe fn sub32(x: i32, y: i32) -> i32 { return sub(x, y, OPSIZE_32); }
function adc8 (line 74) | pub unsafe fn adc8(x: i32, y: i32) -> i32 { return adc(x, y, OPSIZE_8); }
function adc16 (line 76) | pub unsafe fn adc16(x: i32, y: i32) -> i32 { return adc(x, y, OPSIZE_16); }
function adc32 (line 77) | pub unsafe fn adc32(x: i32, y: i32) -> i32 { return adc(x, y, OPSIZE_32); }
function sbb8 (line 79) | pub unsafe fn sbb8(x: i32, y: i32) -> i32 { return sbb(x, y, OPSIZE_8); }
function sbb16 (line 81) | pub unsafe fn sbb16(x: i32, y: i32) -> i32 { return sbb(x, y, OPSIZE_16); }
function sbb32 (line 82) | pub unsafe fn sbb32(x: i32, y: i32) -> i32 { return sbb(x, y, OPSIZE_32); }
function cmp8 (line 83) | pub unsafe fn cmp8(x: i32, y: i32) {
function cmp16 (line 88) | pub unsafe fn cmp16(x: i32, y: i32) {
function cmp32 (line 93) | pub unsafe fn cmp32(x: i32, y: i32) { sub(x, y, OPSIZE_32); }
function inc (line 94) | unsafe fn inc(dest_operand: i32, op_size: i32) -> i32 {
function dec (line 103) | unsafe fn dec(dest_operand: i32, op_size: i32) -> i32 {
function inc8 (line 113) | pub unsafe fn inc8(x: i32) -> i32 { return inc(x, OPSIZE_8); }
function inc16 (line 114) | pub unsafe fn inc16(x: i32) -> i32 { return inc(x, OPSIZE_16); }
function inc32 (line 115) | pub unsafe fn inc32(x: i32) -> i32 { return inc(x, OPSIZE_32); }
function dec8 (line 117) | pub unsafe fn dec8(x: i32) -> i32 { return dec(x, OPSIZE_8); }
function dec16 (line 118) | pub unsafe fn dec16(x: i32) -> i32 { return dec(x, OPSIZE_16); }
function dec32 (line 119) | pub unsafe fn dec32(x: i32) -> i32 { return dec(x, OPSIZE_32); }
function neg (line 121) | unsafe fn neg(dest_operand: i32, op_size: i32) -> i32 { sub(0, dest_oper...
function not8 (line 123) | pub unsafe fn not8(x: i32) -> i32 { return !x; }
function neg8 (line 125) | pub unsafe fn neg8(x: i32) -> i32 { return neg(x, OPSIZE_8); }
function neg16 (line 127) | pub unsafe fn neg16(x: i32) -> i32 { return neg(x, OPSIZE_16); }
function neg32 (line 128) | pub unsafe fn neg32(x: i32) -> i32 { return neg(x, OPSIZE_32); }
function mul8 (line 131) | pub unsafe fn mul8(source_operand: i32) {
function imul8 (line 145) | pub unsafe fn imul8(source_operand: i32) {
function mul16 (line 159) | pub unsafe fn mul16(source_operand: u32) {
function imul16 (line 175) | pub unsafe fn imul16(source_operand: i32) {
function imul_reg16 (line 190) | pub unsafe fn imul_reg16(mut operand1: i32, mut operand2: i32) -> i32 {
function mul32 (line 206) | pub unsafe fn mul32(source_operand: i32) {
function imul32 (line 223) | pub unsafe fn imul32(source_operand: i32) {
function imul_reg32 (line 240) | pub unsafe fn imul_reg32(operand1: i32, operand2: i32) -> i32 {
function xadd8 (line 257) | pub unsafe fn xadd8(source_operand: i32, reg: i32) -> i32 {
function xadd16 (line 263) | pub unsafe fn xadd16(source_operand: i32, reg: i32) -> i32 {
function xadd32 (line 268) | pub unsafe fn xadd32(source_operand: i32, reg: i32) -> i32 {
function cmpxchg8 (line 275) | pub unsafe fn cmpxchg8(data: i32, r: i32) -> i32 {
function cmpxchg16 (line 286) | pub unsafe fn cmpxchg16(data: i32, r: i32) -> i32 {
function cmpxchg32 (line 296) | pub unsafe fn cmpxchg32(data: i32, r: i32) -> i32 {
function bcd_daa (line 308) | pub unsafe fn bcd_daa() {
function bcd_das (line 326) | pub unsafe fn bcd_das() {
function bcd_aad (line 347) | pub unsafe fn bcd_aad(imm8: i32) {
function bcd_aam (line 359) | pub unsafe fn bcd_aam(imm8: i32) {
function bcd_aaa (line 375) | pub unsafe fn bcd_aaa() {
function bcd_aas (line 388) | pub unsafe fn bcd_aas() {
function and (line 400) | unsafe fn and(dest_operand: i32, source_operand: i32, op_size: i32) -> i...
function or (line 408) | unsafe fn or(dest_operand: i32, source_operand: i32, op_size: i32) -> i32 {
function xor (line 416) | unsafe fn xor(dest_operand: i32, source_operand: i32, op_size: i32) -> i...
function and8 (line 424) | pub unsafe fn and8(x: i32, y: i32) -> i32 { return and(x, y, OPSIZE_8); }
function and16 (line 426) | pub unsafe fn and16(x: i32, y: i32) -> i32 { return and(x, y, OPSIZE_16); }
function and32 (line 427) | pub unsafe fn and32(x: i32, y: i32) -> i32 { return and(x, y, OPSIZE_32); }
function test8 (line 428) | pub unsafe fn test8(x: i32, y: i32) { and(x, y, OPSIZE_8); }
function test16 (line 429) | pub unsafe fn test16(x: i32, y: i32) { and(x, y, OPSIZE_16); }
function test32 (line 430) | pub unsafe fn test32(x: i32, y: i32) { and(x, y, OPSIZE_32); }
function or8 (line 431) | pub unsafe fn or8(x: i32, y: i32) -> i32 { return or(x, y, OPSIZE_8); }
function or16 (line 433) | pub unsafe fn or16(x: i32, y: i32) -> i32 { return or(x, y, OPSIZE_16); }
function or32 (line 434) | pub unsafe fn or32(x: i32, y: i32) -> i32 { return or(x, y, OPSIZE_32); }
function xor8 (line 435) | pub unsafe fn xor8(x: i32, y: i32) -> i32 { return xor(x, y, OPSIZE_8); }
function xor16 (line 437) | pub unsafe fn xor16(x: i32, y: i32) -> i32 { return xor(x, y, OPSIZE_16); }
function xor32 (line 438) | pub unsafe fn xor32(x: i32, y: i32) -> i32 { return xor(x, y, OPSIZE_32); }
function rol8 (line 441) | pub unsafe fn rol8(dest_operand: i32, mut count: i32) -> i32 {
function rol16 (line 457) | pub unsafe fn rol16(dest_operand: i32, mut count: i32) -> i32 {
function rol32 (line 473) | pub unsafe fn rol32(dest_operand: i32, count: i32) -> i32 {
function rcl8 (line 488) | pub unsafe fn rcl8(dest_operand: i32, mut count: i32) -> i32 {
function rcl16 (line 505) | pub unsafe fn rcl16(dest_operand: i32, mut count: i32) -> i32 {
function rcl32 (line 522) | pub unsafe fn rcl32(dest_operand: i32, count: i32) -> i32 {
function ror8 (line 539) | pub unsafe fn ror8(dest_operand: i32, mut count: i32) -> i32 {
function ror16 (line 555) | pub unsafe fn ror16(dest_operand: i32, mut count: i32) -> i32 {
function ror32 (line 571) | pub unsafe fn ror32(dest_operand: i32, count: i32) -> i32 {
function rcr8 (line 586) | pub unsafe fn rcr8(dest_operand: i32, mut count: i32) -> i32 {
function rcr16 (line 603) | pub unsafe fn rcr16(dest_operand: i32, mut count: i32) -> i32 {
function rcr32 (line 620) | pub unsafe fn rcr32(dest_operand: i32, count: i32) -> i32 {
function div8 (line 639) | pub unsafe fn div8(source_operand: u32) {
function idiv8 (line 655) | pub unsafe fn idiv8(source_operand: i32) {
function div16_without_fault (line 671) | pub unsafe fn div16_without_fault(source_operand: u32) -> bool {
function div16 (line 684) | pub unsafe fn div16(source_operand: u32) {
function idiv16_without_fault (line 690) | pub unsafe fn idiv16_without_fault(source_operand: i32) -> bool {
function idiv16 (line 703) | pub unsafe fn idiv16(source_operand: i32) {
function div32_without_fault (line 710) | pub unsafe fn div32_without_fault(source_operand: u32) -> bool {
function div32 (line 727) | pub unsafe fn div32(source_operand: u32) {
function idiv32_without_fault (line 733) | pub unsafe fn idiv32_without_fault(source_operand: i32) -> bool {
function idiv32 (line 750) | pub unsafe fn idiv32(source_operand: i32) {
function shl8 (line 757) | pub unsafe fn shl8(dest_operand: i32, count: i32) -> i32 {
function shl16 (line 774) | pub unsafe fn shl16(dest_operand: i32, count: i32) -> i32 {
function shl32 (line 790) | pub unsafe fn shl32(dest_operand: i32, count: i32) -> i32 {
function shr8 (line 806) | pub unsafe fn shr8(dest_operand: i32, count: i32) -> i32 {
function shr16 (line 823) | pub unsafe fn shr16(dest_operand: i32, count: i32) -> i32 {
function shr32 (line 839) | pub unsafe fn shr32(dest_operand: i32, count: i32) -> i32 {
function sar8 (line 856) | pub unsafe fn sar8(dest_operand: i32, count: i32) -> i32 {
function sar16 (line 879) | pub unsafe fn sar16(dest_operand: i32, count: i32) -> i32 {
function sar32 (line 900) | pub unsafe fn sar32(dest_operand: i32, count: i32) -> i32 {
function shrd16 (line 916) | pub unsafe fn shrd16(dest_operand: i32, source_operand: i32, count: i32)...
function shrd32 (line 939) | pub unsafe fn shrd32(dest_operand: i32, source_operand: i32, count: i32)...
function shld16 (line 955) | pub unsafe fn shld16(dest_operand: i32, source_operand: i32, count: i32)...
function shld32 (line 978) | pub unsafe fn shld32(dest_operand: i32, source_operand: i32, count: i32)...
function bt_reg (line 999) | pub unsafe fn bt_reg(bit_base: i32, bit_offset: i32) {
function btc_reg (line 1003) | pub unsafe fn btc_reg(bit_base: i32, bit_offset: i32) -> i32 {
function bts_reg (line 1008) | pub unsafe fn bts_reg(bit_base: i32, bit_offset: i32) -> i32 {
function btr_reg (line 1013) | pub unsafe fn btr_reg(bit_base: i32, bit_offset: i32) -> i32 {
function bt_mem (line 1019) | pub unsafe fn bt_mem(virt_addr: i32, mut bit_offset: i32) {
function btc_mem (line 1025) | pub unsafe fn btc_mem(virt_addr: i32, mut bit_offset: i32) {
function btr_mem (line 1033) | pub unsafe fn btr_mem(virt_addr: i32, mut bit_offset: i32) {
function bts_mem (line 1041) | pub unsafe fn bts_mem(virt_addr: i32, mut bit_offset: i32) {
function bsf16 (line 1051) | pub unsafe fn bsf16(old: i32, bit_base: i32) -> i32 {
function bsf32 (line 1068) | pub unsafe fn bsf32(old: i32, bit_base: i32) -> i32 {
function bsr16 (line 1084) | pub unsafe fn bsr16(old: i32, bit_base: i32) -> i32 {
function bsr32 (line 1100) | pub unsafe fn bsr32(old: i32, bit_base: i32) -> i32 {
function popcnt (line 1116) | pub unsafe fn popcnt(v: i32) -> i32 {
function saturate_sw_to_ub (line 1128) | pub unsafe fn saturate_sw_to_ub(v: u16) -> u8 {
function saturate_sw_to_sb (line 1138) | pub unsafe fn saturate_sw_to_sb(v: i32) -> u8 {
function saturate_sd_to_sw (line 1153) | pub unsafe fn saturate_sd_to_sw(v: u32) -> u16 {
function saturate_sd_to_sb (line 1167) | pub unsafe fn saturate_sd_to_sb(v: u32) -> i8 {
function saturate_sd_to_ub (line 1181) | pub unsafe fn saturate_sd_to_ub(v: i32) -> i32 {
function saturate_ud_to_ub (line 1189) | pub unsafe fn saturate_ud_to_ub(v: u32) -> u8 {
function saturate_uw (line 1197) | pub unsafe fn saturate_uw(v: u32) -> u16 {
FILE: src/rust/cpu/call_indirect.rs
function call_indirect1 (line 2) | pub fn call_indirect1(f: fn(u16), x: u16) { f(x); }
FILE: src/rust/cpu/cpu.rs
function call_indirect1 (line 31) | pub fn call_indirect1(f: i32, x: u16);
function cpu_exception_hook (line 37) | pub fn cpu_exception_hook(interrupt: i32) -> bool;
function microtick (line 38) | pub fn microtick() -> f64;
function run_hardware_timers (line 39) | pub fn run_hardware_timers(acpi_enabled: bool, t: f64) -> f64;
function cpu_event_halt (line 40) | pub fn cpu_event_halt();
function stop_idling (line 41) | pub fn stop_idling();
function io_port_read8 (line 43) | pub fn io_port_read8(port: i32) -> i32;
function io_port_read16 (line 44) | pub fn io_port_read16(port: i32) -> i32;
function io_port_read32 (line 45) | pub fn io_port_read32(port: i32) -> i32;
function io_port_write8 (line 47) | pub fn io_port_write8(port: i32, value: i32);
function io_port_write16 (line 48) | pub fn io_port_write16(port: i32, value: i32);
function io_port_write32 (line 49) | pub fn io_port_write32(port: i32, value: i32);
function get_rand_int (line 51) | pub fn get_rand_int() -> i32;
constant WASM_TABLE_OFFSET (line 57) | pub const WASM_TABLE_OFFSET: u32 = 1024;
constant CHECK_MISSED_ENTRY_POINTS (line 75) | pub const CHECK_MISSED_ENTRY_POINTS: bool = false;
constant INTERPRETER_ITERATION_LIMIT (line 77) | pub const INTERPRETER_ITERATION_LIMIT: u32 = 100_001;
constant TIME_PER_FRAME (line 80) | pub const TIME_PER_FRAME: f64 = 1.0;
constant FLAG_SUB (line 82) | pub const FLAG_SUB: i32 = -0x8000_0000;
constant FLAG_CARRY (line 83) | pub const FLAG_CARRY: i32 = 1;
constant FLAG_PARITY (line 84) | pub const FLAG_PARITY: i32 = 4;
constant FLAG_ADJUST (line 85) | pub const FLAG_ADJUST: i32 = 16;
constant FLAG_ZERO (line 86) | pub const FLAG_ZERO: i32 = 64;
constant FLAG_SIGN (line 87) | pub const FLAG_SIGN: i32 = 128;
constant FLAG_TRAP (line 88) | pub const FLAG_TRAP: i32 = 256;
constant FLAG_INTERRUPT (line 89) | pub const FLAG_INTERRUPT: i32 = 512;
constant FLAG_DIRECTION (line 90) | pub const FLAG_DIRECTION: i32 = 1024;
constant FLAG_OVERFLOW (line 91) | pub const FLAG_OVERFLOW: i32 = 2048;
constant FLAG_IOPL (line 92) | pub const FLAG_IOPL: i32 = 1 << 12 | 1 << 13;
constant FLAG_NT (line 93) | pub const FLAG_NT: i32 = 1 << 14;
constant FLAG_RF (line 94) | pub const FLAG_RF: i32 = 1 << 16;
constant FLAG_VM (line 95) | pub const FLAG_VM: i32 = 1 << 17;
constant FLAG_AC (line 96) | pub const FLAG_AC: i32 = 1 << 18;
constant FLAG_VIF (line 97) | pub const FLAG_VIF: i32 = 1 << 19;
constant FLAG_VIP (line 98) | pub const FLAG_VIP: i32 = 1 << 20;
constant FLAG_ID (line 99) | pub const FLAG_ID: i32 = 1 << 21;
constant FLAGS_DEFAULT (line 100) | pub const FLAGS_DEFAULT: i32 = 1 << 1;
constant FLAGS_MASK (line 101) | pub const FLAGS_MASK: i32 = FLAG_CARRY
constant FLAGS_ALL (line 118) | pub const FLAGS_ALL: i32 =
constant OPSIZE_8 (line 120) | pub const OPSIZE_8: i32 = 7;
constant OPSIZE_16 (line 121) | pub const OPSIZE_16: i32 = 15;
constant OPSIZE_32 (line 122) | pub const OPSIZE_32: i32 = 31;
constant EAX (line 124) | pub const EAX: i32 = 0;
constant ECX (line 125) | pub const ECX: i32 = 1;
constant EDX (line 126) | pub const EDX: i32 = 2;
constant EBX (line 127) | pub const EBX: i32 = 3;
constant ESP (line 128) | pub const ESP: i32 = 4;
constant EBP (line 129) | pub const EBP: i32 = 5;
constant ESI (line 130) | pub const ESI: i32 = 6;
constant EDI (line 131) | pub const EDI: i32 = 7;
constant AX (line 133) | pub const AX: i32 = 0;
constant CX (line 134) | pub const CX: i32 = 1;
constant DX (line 135) | pub const DX: i32 = 2;
constant BX (line 136) | pub const BX: i32 = 3;
constant SP (line 137) | pub const SP: i32 = 4;
constant BP (line 138) | pub const BP: i32 = 5;
constant SI (line 139) | pub const SI: i32 = 6;
constant DI (line 140) | pub const DI: i32 = 7;
constant AL (line 142) | pub const AL: i32 = 0;
constant CL (line 143) | pub const CL: i32 = 1;
constant DL (line 144) | pub const DL: i32 = 2;
constant BL (line 145) | pub const BL: i32 = 3;
constant AH (line 146) | pub const AH: i32 = 4;
constant CH (line 147) | pub const CH: i32 = 5;
constant DH (line 148) | pub const DH: i32 = 6;
constant BH (line 149) | pub const BH: i32 = 7;
constant ES (line 151) | pub const ES: i32 = 0;
constant CS (line 152) | pub const CS: i32 = 1;
constant SS (line 153) | pub const SS: i32 = 2;
constant DS (line 154) | pub const DS: i32 = 3;
constant FS (line 155) | pub const FS: i32 = 4;
constant GS (line 156) | pub const GS: i32 = 5;
constant TR (line 157) | pub const TR: i32 = 6;
constant LDTR (line 159) | pub const LDTR: i32 = 7;
constant PAGE_TABLE_PRESENT_MASK (line 160) | pub const PAGE_TABLE_PRESENT_MASK: i32 = 1 << 0;
constant PAGE_TABLE_RW_MASK (line 161) | pub const PAGE_TABLE_RW_MASK: i32 = 1 << 1;
constant PAGE_TABLE_USER_MASK (line 162) | pub const PAGE_TABLE_USER_MASK: i32 = 1 << 2;
constant PAGE_TABLE_ACCESSED_MASK (line 163) | pub const PAGE_TABLE_ACCESSED_MASK: i32 = 1 << 5;
constant PAGE_TABLE_DIRTY_MASK (line 164) | pub const PAGE_TABLE_DIRTY_MASK: i32 = 1 << 6;
constant PAGE_TABLE_PSE_MASK (line 165) | pub const PAGE_TABLE_PSE_MASK: i32 = 1 << 7;
constant PAGE_TABLE_GLOBAL_MASK (line 166) | pub const PAGE_TABLE_GLOBAL_MASK: i32 = 1 << 8;
constant MMAP_BLOCK_BITS (line 167) | pub const MMAP_BLOCK_BITS: i32 = 17;
constant MMAP_BLOCK_SIZE (line 168) | pub const MMAP_BLOCK_SIZE: i32 = 1 << MMAP_BLOCK_BITS;
constant CR0_PE (line 169) | pub const CR0_PE: i32 = 1;
constant CR0_MP (line 170) | pub const CR0_MP: i32 = 1 << 1;
constant CR0_EM (line 171) | pub const CR0_EM: i32 = 1 << 2;
constant CR0_TS (line 172) | pub const CR0_TS: i32 = 1 << 3;
constant CR0_ET (line 173) | pub const CR0_ET: i32 = 1 << 4;
constant CR0_WP (line 174) | pub const CR0_WP: i32 = 1 << 16;
constant CR0_AM (line 175) | pub const CR0_AM: i32 = 1 << 18;
constant CR0_NW (line 176) | pub const CR0_NW: i32 = 1 << 29;
constant CR0_CD (line 177) | pub const CR0_CD: i32 = 1 << 30;
constant CR0_PG (line 178) | pub const CR0_PG: i32 = 1 << 31;
constant CR4_VME (line 179) | pub const CR4_VME: i32 = 1;
constant CR4_PVI (line 180) | pub const CR4_PVI: i32 = 1 << 1;
constant CR4_TSD (line 181) | pub const CR4_TSD: i32 = 1 << 2;
constant CR4_PSE (line 182) | pub const CR4_PSE: i32 = 1 << 4;
constant CR4_DE (line 183) | pub const CR4_DE: i32 = 1 << 3;
constant CR4_PAE (line 184) | pub const CR4_PAE: i32 = 1 << 5;
constant CR4_PGE (line 185) | pub const CR4_PGE: i32 = 1 << 7;
constant CR4_OSFXSR (line 186) | pub const CR4_OSFXSR: i32 = 1 << 9;
constant CR4_OSXMMEXCPT (line 187) | pub const CR4_OSXMMEXCPT: i32 = 1 << 10;
constant CR4_SMEP (line 188) | pub const CR4_SMEP: i32 = 1 << 20;
constant TSR_BACKLINK (line 190) | pub const TSR_BACKLINK: i32 = 0x00;
constant TSR_CR3 (line 191) | pub const TSR_CR3: i32 = 0x1C;
constant TSR_EIP (line 192) | pub const TSR_EIP: i32 = 0x20;
constant TSR_EFLAGS (line 193) | pub const TSR_EFLAGS: i32 = 0x24;
constant TSR_EAX (line 195) | pub const TSR_EAX: i32 = 0x28;
constant TSR_ECX (line 196) | pub const TSR_ECX: i32 = 0x2c;
constant TSR_EDX (line 197) | pub const TSR_EDX: i32 = 0x30;
constant TSR_EBX (line 198) | pub const TSR_EBX: i32 = 0x34;
constant TSR_ESP (line 199) | pub const TSR_ESP: i32 = 0x38;
constant TSR_EBP (line 200) | pub const TSR_EBP: i32 = 0x3c;
constant TSR_ESI (line 201) | pub const TSR_ESI: i32 = 0x40;
constant TSR_EDI (line 202) | pub const TSR_EDI: i32 = 0x44;
constant TSR_ES (line 204) | pub const TSR_ES: i32 = 0x48;
constant TSR_CS (line 205) | pub const TSR_CS: i32 = 0x4c;
constant TSR_SS (line 206) | pub const TSR_SS: i32 = 0x50;
constant TSR_DS (line 207) | pub const TSR_DS: i32 = 0x54;
constant TSR_FS (line 208) | pub const TSR_FS: i32 = 0x58;
constant TSR_GS (line 209) | pub const TSR_GS: i32 = 0x5c;
constant TSR_LDT (line 210) | pub const TSR_LDT: i32 = 0x60;
constant IA32_TIME_STAMP_COUNTER (line 212) | pub const IA32_TIME_STAMP_COUNTER: i32 = 0x10;
constant IA32_PLATFORM_ID (line 213) | pub const IA32_PLATFORM_ID: i32 = 0x17;
constant IA32_APIC_BASE (line 214) | pub const IA32_APIC_BASE: i32 = 0x1B;
constant MSR_TEST_CTRL (line 215) | pub const MSR_TEST_CTRL: i32 = 0x33;
constant MSR_SMI_COUNT (line 216) | pub const MSR_SMI_COUNT: i32 = 0x34;
constant IA32_FEAT_CTL (line 217) | pub const IA32_FEAT_CTL: i32 = 0x3A;
constant IA32_SPEC_CTRL (line 218) | pub const IA32_SPEC_CTRL: i32 = 0x48;
constant IA32_BIOS_UPDT_TRIG (line 219) | pub const IA32_BIOS_UPDT_TRIG: i32 = 0x79;
constant IA32_BIOS_SIGN_ID (line 220) | pub const IA32_BIOS_SIGN_ID: i32 = 0x8B;
constant IA32_PMC0 (line 221) | pub const IA32_PMC0: i32 = 0xC1;
constant IA32_PMC1 (line 222) | pub const IA32_PMC1: i32 = 0xC2;
constant MSR_PLATFORM_INFO (line 223) | pub const MSR_PLATFORM_INFO: i32 = 0xCE;
constant MSR_TSX_FORCE_ABORT (line 224) | pub const MSR_TSX_FORCE_ABORT: i32 = 0x10F;
constant IA32_TSX_CTRL (line 225) | pub const IA32_TSX_CTRL: i32 = 0x122;
constant IA32_MCU_OPT_CTRL (line 226) | pub const IA32_MCU_OPT_CTRL: i32 = 0x123;
constant MISC_FEATURE_ENABLES (line 227) | pub const MISC_FEATURE_ENABLES: i32 = 0x140;
constant IA32_SYSENTER_CS (line 228) | pub const IA32_SYSENTER_CS: i32 = 0x174;
constant IA32_SYSENTER_ESP (line 229) | pub const IA32_SYSENTER_ESP: i32 = 0x175;
constant IA32_SYSENTER_EIP (line 230) | pub const IA32_SYSENTER_EIP: i32 = 0x176;
constant IA32_MCG_CAP (line 231) | pub const IA32_MCG_CAP: i32 = 0x179;
constant IA32_PERFEVTSEL0 (line 232) | pub const IA32_PERFEVTSEL0: i32 = 0x186;
constant IA32_PERFEVTSEL1 (line 233) | pub const IA32_PERFEVTSEL1: i32 = 0x187;
constant IA32_MISC_ENABLE (line 234) | pub const IA32_MISC_ENABLE: i32 = 0x1A0;
constant IA32_PAT (line 235) | pub const IA32_PAT: i32 = 0x277;
constant IA32_RTIT_CTL (line 236) | pub const IA32_RTIT_CTL: i32 = 0x570;
constant MSR_PKG_C2_RESIDENCY (line 237) | pub const MSR_PKG_C2_RESIDENCY: i32 = 0x60D;
constant IA32_KERNEL_GS_BASE (line 238) | pub const IA32_KERNEL_GS_BASE: i32 = 0xC0000101u32 as i32;
constant MSR_AMD64_LS_CFG (line 239) | pub const MSR_AMD64_LS_CFG: i32 = 0xC0011020u32 as i32;
constant MSR_AMD64_DE_CFG (line 240) | pub const MSR_AMD64_DE_CFG: i32 = 0xC0011029u32 as i32;
constant IA32_APIC_BASE_BSP (line 242) | pub const IA32_APIC_BASE_BSP: i32 = 1 << 8;
constant IA32_APIC_BASE_EXTD (line 243) | pub const IA32_APIC_BASE_EXTD: i32 = 1 << 10;
constant IA32_APIC_BASE_EN (line 244) | pub const IA32_APIC_BASE_EN: i32 = 1 << 11;
constant IOAPIC_MEM_ADDRESS (line 246) | pub const IOAPIC_MEM_ADDRESS: u32 = 0xFEC00000;
constant IOAPIC_MEM_SIZE (line 247) | pub const IOAPIC_MEM_SIZE: u32 = 32;
constant APIC_MEM_ADDRESS (line 248) | pub const APIC_MEM_ADDRESS: u32 = 0xFEE00000;
constant APIC_MEM_SIZE (line 249) | pub const APIC_MEM_SIZE: u32 = 0x1000;
constant MXCSR_MASK (line 251) | pub const MXCSR_MASK: i32 = 0xffff;
constant MXCSR_FZ (line 252) | pub const MXCSR_FZ: i32 = 1 << 15;
constant MXCSR_DAZ (line 253) | pub const MXCSR_DAZ: i32 = 1 << 6;
constant MXCSR_RC_SHIFT (line 254) | pub const MXCSR_RC_SHIFT: i32 = 13;
constant VALID_TLB_ENTRY_MAX (line 256) | pub const VALID_TLB_ENTRY_MAX: i32 = 10000;
constant TLB_VALID (line 257) | pub const TLB_VALID: i32 = 1 << 0;
constant TLB_READONLY (line 258) | pub const TLB_READONLY: i32 = 1 << 1;
constant TLB_NO_USER (line 259) | pub const TLB_NO_USER: i32 = 1 << 2;
constant TLB_IN_MAPPED_RANGE (line 260) | pub const TLB_IN_MAPPED_RANGE: i32 = 1 << 3;
constant TLB_GLOBAL (line 261) | pub const TLB_GLOBAL: i32 = 1 << 4;
constant TLB_HAS_CODE (line 262) | pub const TLB_HAS_CODE: i32 = 1 << 5;
constant IVT_SIZE (line 263) | pub const IVT_SIZE: u32 = 0x400;
constant CPU_EXCEPTION_DE (line 264) | pub const CPU_EXCEPTION_DE: i32 = 0;
constant CPU_EXCEPTION_DB (line 265) | pub const CPU_EXCEPTION_DB: i32 = 1;
constant CPU_EXCEPTION_NMI (line 266) | pub const CPU_EXCEPTION_NMI: i32 = 2;
constant CPU_EXCEPTION_BP (line 267) | pub const CPU_EXCEPTION_BP: i32 = 3;
constant CPU_EXCEPTION_OF (line 268) | pub const CPU_EXCEPTION_OF: i32 = 4;
constant CPU_EXCEPTION_BR (line 269) | pub const CPU_EXCEPTION_BR: i32 = 5;
constant CPU_EXCEPTION_UD (line 270) | pub const CPU_EXCEPTION_UD: i32 = 6;
constant CPU_EXCEPTION_NM (line 271) | pub const CPU_EXCEPTION_NM: i32 = 7;
constant CPU_EXCEPTION_DF (line 272) | pub const CPU_EXCEPTION_DF: i32 = 8;
constant CPU_EXCEPTION_TS (line 273) | pub const CPU_EXCEPTION_TS: i32 = 10;
constant CPU_EXCEPTION_NP (line 274) | pub const CPU_EXCEPTION_NP: i32 = 11;
constant CPU_EXCEPTION_SS (line 275) | pub const CPU_EXCEPTION_SS: i32 = 12;
constant CPU_EXCEPTION_GP (line 276) | pub const CPU_EXCEPTION_GP: i32 = 13;
constant CPU_EXCEPTION_PF (line 277) | pub const CPU_EXCEPTION_PF: i32 = 14;
constant CPU_EXCEPTION_MF (line 278) | pub const CPU_EXCEPTION_MF: i32 = 16;
constant CPU_EXCEPTION_AC (line 279) | pub const CPU_EXCEPTION_AC: i32 = 17;
constant CPU_EXCEPTION_MC (line 280) | pub const CPU_EXCEPTION_MC: i32 = 18;
constant CPU_EXCEPTION_XM (line 281) | pub const CPU_EXCEPTION_XM: i32 = 19;
constant CPU_EXCEPTION_VE (line 282) | pub const CPU_EXCEPTION_VE: i32 = 20;
constant CHECK_TLB_INVARIANTS (line 284) | pub const CHECK_TLB_INVARIANTS: bool = false;
constant DEBUG (line 286) | pub const DEBUG: bool = cfg!(debug_assertions);
constant LOOP_COUNTER (line 288) | pub const LOOP_COUNTER: i32 = 100_003;
constant TSC_RATE (line 291) | pub const TSC_RATE: f64 = 1_000_000.0;
constant TSC_ENABLE_IMPRECISE_BROWSER_WORKAROUND (line 297) | const TSC_ENABLE_IMPRECISE_BROWSER_WORKAROUND: bool = true;
constant TSC_VERBOSE_LOGGING (line 300) | const TSC_VERBOSE_LOGGING: bool = false;
type Code (line 318) | pub struct Code {
type LastJump (line 334) | pub enum LastJump {
method phys_address (line 350) | pub fn phys_address(&self) -> Option<u32> {
method name (line 358) | pub fn name(&self) -> &'static str {
type SegmentSelector (line 370) | pub struct SegmentSelector {
method of_u16 (line 375) | pub fn of_u16(raw: u16) -> SegmentSelector { SegmentSelector { raw } }
method rpl (line 376) | pub fn rpl(&self) -> u8 { (self.raw & 3) as u8 }
method is_gdt (line 377) | pub fn is_gdt(&self) -> bool { (self.raw & 4) == 0 }
method descriptor_offset (line 378) | pub fn descriptor_offset(&self) -> u16 { (self.raw & !7) as u16 }
method is_null (line 380) | pub fn is_null(&self) -> bool { self.is_gdt() && self.descriptor_offse...
type SelectorNullOrInvalid (line 385) | pub enum SelectorNullOrInvalid {
type SegmentDescriptor (line 390) | pub struct SegmentDescriptor {
method of_u64 (line 395) | pub fn of_u64(raw: u64) -> SegmentDescriptor { SegmentDescriptor { raw...
method base (line 396) | pub fn base(&self) -> i32 {
method limit (line 400) | pub fn limit(&self) -> u32 { (self.raw & 0xffff | ((self.raw >> 48) & ...
method access_byte (line 401) | pub fn access_byte(&self) -> u8 { ((self.raw >> 40) & 0xff) as u8 }
method flags (line 402) | pub fn flags(&self) -> u8 { ((self.raw >> 48 >> 4) & 0xf) as u8 }
method is_system (line 404) | pub fn is_system(&self) -> bool { self.access_byte() & 0x10 == 0 }
method system_type (line 405) | pub fn system_type(&self) -> u8 { self.access_byte() & 0xF }
method accessed (line 407) | pub fn accessed(&self) -> bool { self.access_byte() & 1 == 1 }
method is_rw (line 408) | pub fn is_rw(&self) -> bool { self.access_byte() & 2 == 2 }
method is_dc (line 409) | pub fn is_dc(&self) -> bool { self.access_byte() & 4 == 4 }
method is_executable (line 410) | pub fn is_executable(&self) -> bool { self.access_byte() & 8 == 8 }
method is_present (line 411) | pub fn is_present(&self) -> bool { self.access_byte() & 0x80 == 0x80 }
method is_writable (line 412) | pub fn is_writable(&self) -> bool { self.is_rw() && !self.is_executabl...
method is_readable (line 413) | pub fn is_readable(&self) -> bool { self.is_rw() || !self.is_executabl...
method is_conforming_executable (line 414) | pub fn is_conforming_executable(&self) -> bool { self.is_dc() && self....
method dpl (line 415) | pub fn dpl(&self) -> u8 { (self.access_byte() >> 5) & 3 }
method is_32 (line 416) | pub fn is_32(&self) -> bool { self.flags() & 4 == 4 }
method effective_limit (line 417) | pub fn effective_limit(&self) -> u32 {
method set_busy (line 425) | pub fn set_busy(&self) -> SegmentDescriptor {
method set_accessed (line 430) | pub fn set_accessed(&self) -> SegmentDescriptor {
type InterruptDescriptor (line 437) | pub struct InterruptDescriptor {
method of_u64 (line 442) | pub fn of_u64(raw: u64) -> InterruptDescriptor { InterruptDescriptor {...
method offset (line 443) | pub fn offset(&self) -> i32 { (self.raw & 0xffff | self.raw >> 32 & 0x...
method selector (line 444) | pub fn selector(&self) -> u16 { (self.raw >> 16 & 0xffff) as u16 }
method access_byte (line 445) | pub fn access_byte(&self) -> u8 { (self.raw >> 40 & 0xff) as u8 }
method dpl (line 446) | pub fn dpl(&self) -> u8 { (self.access_byte() >> 5 & 3) as u8 }
method gate_type (line 447) | pub fn gate_type(&self) -> u8 { self.access_byte() & 7 }
method is_32 (line 448) | pub fn is_32(&self) -> bool { self.access_byte() & 8 == 8 }
method is_present (line 449) | pub fn is_present(&self) -> bool { self.access_byte() & 0x80 == 0x80 }
method reserved_zeros_are_valid (line 450) | pub fn reserved_zeros_are_valid(&self) -> bool { self.access_byte() & ...
constant TASK_GATE (line 452) | const TASK_GATE: u8 = 0b101;
constant INTERRUPT_GATE (line 453) | const INTERRUPT_GATE: u8 = 0b110;
constant TRAP_GATE (line 454) | const TRAP_GATE: u8 = 0b111;
function switch_cs_real_mode (line 457) | pub unsafe fn switch_cs_real_mode(selector: i32) {
function get_tss_ss_esp (line 466) | unsafe fn get_tss_ss_esp(dpl: u8) -> OrPageFault<(i32, i32)> {
function iret16 (line 491) | pub unsafe fn iret16() { iret(true); }
function iret32 (line 492) | pub unsafe fn iret32() { iret(false); }
function iret (line 494) | pub unsafe fn iret(is_16: bool) {
function call_interrupt_vector (line 783) | pub unsafe fn call_interrupt_vector(
function far_jump (line 1113) | pub unsafe fn far_jump(eip: i32, selector: i32, is_call: bool, is_osize_...
function far_return (line 1454) | pub unsafe fn far_return(eip: i32, selector: i32, stack_adjust: i32, is_...
function do_task_switch (line 1595) | pub unsafe fn do_task_switch(selector: i32, error_code: Option<i32>) {
function after_block_boundary (line 1810) | pub unsafe fn after_block_boundary() { jit_block_boundary = true; }
function track_jit_exit (line 1813) | pub fn track_jit_exit(phys_addr: u32) {
function get_eflags (line 1820) | pub unsafe fn get_eflags() -> i32 {
function readable_or_pagefault (line 1830) | pub unsafe fn readable_or_pagefault(addr: i32, size: i32) -> OrPageFault...
function writable_or_pagefault (line 1845) | pub unsafe fn writable_or_pagefault(addr: i32, size: i32) -> OrPageFault...
function writable_or_pagefault_cpl (line 1849) | pub unsafe fn writable_or_pagefault_cpl(other_cpl: u8, addr: i32, size: ...
function translate_address_read_no_side_effects (line 1864) | pub fn translate_address_read_no_side_effects(address: i32) -> OrPageFau...
function translate_address_read (line 1867) | pub fn translate_address_read(address: i32) -> OrPageFault<u32> {
function translate_address_read_jit (line 1870) | pub unsafe fn translate_address_read_jit(address: i32) -> OrPageFault<u3...
function translate_address_write (line 1874) | pub unsafe fn translate_address_write(address: i32) -> OrPageFault<u32> {
function translate_address_write_jit_and_can_skip_dirty (line 1877) | pub unsafe fn translate_address_write_jit_and_can_skip_dirty(
function translate_address_system_read (line 1891) | pub unsafe fn translate_address_system_read(address: i32) -> OrPageFault...
function translate_address_system_write (line 1894) | pub unsafe fn translate_address_system_write(address: i32) -> OrPageFaul...
function translate_address (line 1899) | pub unsafe fn translate_address(
function translate_address_write_and_can_skip_dirty (line 1918) | pub unsafe fn translate_address_write_and_can_skip_dirty(address: i32) -...
function do_page_walk (line 1942) | pub unsafe fn do_page_walk(
function full_clear_tlb (line 2155) | pub unsafe fn full_clear_tlb() {
function clear_tlb (line 2175) | pub unsafe fn clear_tlb() {
function trigger_de_jit (line 2204) | pub unsafe fn trigger_de_jit(eip_offset_in_page: i32) {
function trigger_ud_jit (line 2212) | pub unsafe fn trigger_ud_jit(eip_offset_in_page: i32) {
function trigger_nm_jit (line 2220) | pub unsafe fn trigger_nm_jit(eip_offset_in_page: i32) {
function trigger_gp_jit (line 2228) | pub unsafe fn trigger_gp_jit(code: i32, eip_offset_in_page: i32) {
function trigger_fault_end_jit (line 2236) | pub unsafe fn trigger_fault_end_jit() {
function trigger_pagefault (line 2259) | pub unsafe fn trigger_pagefault(addr: i32, present: bool, write: bool, u...
function tlb_set_has_code (line 2288) | pub fn tlb_set_has_code(physical_page: Page, has_code: bool) {
function tlb_set_has_code_multiple (line 2310) | pub fn tlb_set_has_code_multiple(physical_pages: &HashSet<Page>, has_cod...
function check_tlb_invariants (line 2331) | pub fn check_tlb_invariants() {
constant DISABLE_EIP_TRANSLATION_OPTIMISATION (line 2356) | pub const DISABLE_EIP_TRANSLATION_OPTIMISATION: bool = false;
function read_imm8 (line 2358) | pub unsafe fn read_imm8() -> OrPageFault<i32> {
function read_imm8s (line 2370) | pub unsafe fn read_imm8s() -> OrPageFault<i32> { return Ok(read_imm8()? ...
function read_imm16 (line 2372) | pub unsafe fn read_imm16() -> OrPageFault<i32> {
function read_imm32s (line 2388) | pub unsafe fn read_imm32s() -> OrPageFault<i32> {
function is_osize_32 (line 2402) | pub unsafe fn is_osize_32() -> bool {
function is_asize_32 (line 2407) | pub unsafe fn is_asize_32() -> bool {
function lookup_segment_selector (line 2412) | pub unsafe fn lookup_segment_selector(
function switch_seg (line 2450) | pub unsafe fn switch_seg(reg: i32, selector_raw: i32) -> bool {
function load_tr (line 2577) | pub unsafe fn load_tr(selector: i32) {
function load_ldt (line 2631) | pub unsafe fn load_ldt(selector: i32) -> OrPageFault<()> {
function log_segment_null (line 2684) | pub unsafe fn log_segment_null(segment: i32) {
function get_seg (line 2692) | pub unsafe fn get_seg(segment: i32) -> OrPageFault<i32> {
function set_cr0 (line 2705) | pub unsafe fn set_cr0(cr0: i32) {
function set_cr3 (line 2732) | pub unsafe fn set_cr3(mut cr3: i32) {
function load_pdpte (line 2748) | pub unsafe fn load_pdpte(cr3: i32) {
function cpl_changed (line 2768) | pub unsafe fn cpl_changed() { *last_virt_eip = -1 }
function update_cs_size (line 2770) | pub unsafe fn update_cs_size(new_size: bool) {
function test_privileges_for_io (line 2777) | pub unsafe fn test_privileges_for_io(port: i32, size: i32) -> bool {
function popa16 (line 2822) | pub unsafe fn popa16() {
function popa32 (line 2835) | pub unsafe fn popa32() {
function get_state_flags (line 2848) | pub fn get_state_flags() -> CachedStateFlags { unsafe { *state_flags } }
function get_seg_cs (line 2851) | pub fn get_seg_cs() -> i32 { unsafe { *segment_offsets.offset(CS as isiz...
function get_seg_ss (line 2853) | pub unsafe fn get_seg_ss() -> i32 { return *segment_offsets.offset(SS as...
function segment_prefix (line 2855) | pub unsafe fn segment_prefix(default_segment: i32) -> i32 {
function get_seg_prefix (line 2866) | pub unsafe fn get_seg_prefix(default_segment: i32) -> OrPageFault<i32> {
function get_seg_prefix_ds (line 2882) | pub unsafe fn get_seg_prefix_ds(offset: i32) -> OrPageFault<i32> {
function get_seg_prefix_ss (line 2886) | pub unsafe fn get_seg_prefix_ss(offset: i32) -> OrPageFault<i32> {
function modrm_resolve (line 2890) | pub unsafe fn modrm_resolve(modrm_byte: i32) -> OrPageFault<i32> {
function run_instruction (line 2899) | pub unsafe fn run_instruction(opcode: i32) { gen::interpreter::run(opcod...
function run_instruction0f_16 (line 2900) | pub unsafe fn run_instruction0f_16(opcode: i32) { gen::interpreter0f::ru...
function run_instruction0f_32 (line 2901) | pub unsafe fn run_instruction0f_32(opcode: i32) { gen::interpreter0f::ru...
function cycle_internal (line 2903) | pub unsafe fn cycle_internal() {
function get_phys_eip (line 3056) | pub unsafe fn get_phys_eip() -> OrPageFault<u32> {
function jit_run_interpreted (line 3067) | unsafe fn jit_run_interpreted(mut phys_addr: u32) {
function update_state_flags (line 3114) | pub fn update_state_flags() {
function has_flat_segmentation (line 3126) | pub unsafe fn has_flat_segmentation() -> bool {
function run_prefix_instruction (line 3134) | pub unsafe fn run_prefix_instruction() {
function segment_prefix_op (line 3138) | pub unsafe fn segment_prefix_op(seg: i32) {
function main_loop (line 3146) | pub unsafe fn main_loop() -> f64 {
function do_many_cycles_native (line 3184) | pub unsafe fn do_many_cycles_native() {
function trigger_de (line 3195) | pub unsafe fn trigger_de() {
function trigger_ud (line 3207) | pub unsafe fn trigger_ud() {
function trigger_nm (line 3220) | pub unsafe fn trigger_nm() {
function trigger_gp (line 3233) | pub unsafe fn trigger_gp(code: i32) {
function virt_boundary_read16 (line 3245) | pub unsafe fn virt_boundary_read16(low: u32, high: u32) -> i32 {
function virt_boundary_read32s (line 3252) | pub unsafe fn virt_boundary_read32s(low: u32, high: u32) -> i32 {
function virt_boundary_write16 (line 3274) | pub unsafe fn virt_boundary_write16(low: u32, high: u32, value: i32) {
function virt_boundary_write32 (line 3282) | pub unsafe fn virt_boundary_write32(low: u32, high: u32, value: i32) {
function safe_read8 (line 3306) | pub unsafe fn safe_read8(addr: i32) -> OrPageFault<i32> {
function safe_read16 (line 3310) | pub unsafe fn safe_read16(addr: i32) -> OrPageFault<i32> {
function safe_read32s (line 3319) | pub unsafe fn safe_read32s(addr: i32) -> OrPageFault<i32> {
function safe_read_f32 (line 3328) | pub unsafe fn safe_read_f32(addr: i32) -> OrPageFault<f32> {
function safe_read64s (line 3332) | pub unsafe fn safe_read64s(addr: i32) -> OrPageFault<u64> {
function safe_read128s (line 3341) | pub unsafe fn safe_read128s(addr: i32) -> OrPageFault<reg128> {
function report_safe_read_jit_slow (line 3354) | pub fn report_safe_read_jit_slow(address: u32, entry: i32) {
function report_safe_write_jit_slow (line 3375) | pub fn report_safe_write_jit_slow(address: u32, entry: i32) {
function report_safe_read_write_jit_slow (line 3401) | pub fn report_safe_read_write_jit_slow(address: u32, entry: i32) {
type ScratchBuffer (line 3426) | struct ScratchBuffer([u8; 0x1000 * 2]);
function safe_read_slow_jit (line 3429) | pub unsafe fn safe_read_slow_jit(
function safe_read8_slow_jit (line 3524) | pub unsafe fn safe_read8_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read16_slow_jit (line 3528) | pub unsafe fn safe_read16_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read32s_slow_jit (line 3532) | pub unsafe fn safe_read32s_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read64s_slow_jit (line 3536) | pub unsafe fn safe_read64s_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read128s_slow_jit (line 3540) | pub unsafe fn safe_read128s_slow_jit(addr: i32, eip: i32) -> i32 {
function get_phys_eip_slow_jit (line 3545) | pub unsafe fn get_phys_eip_slow_jit(addr: i32) -> i32 {
function safe_read_write8_slow_jit (line 3556) | pub unsafe fn safe_read_write8_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read_write16_slow_jit (line 3560) | pub unsafe fn safe_read_write16_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read_write32s_slow_jit (line 3564) | pub unsafe fn safe_read_write32s_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_read_write64_slow_jit (line 3568) | pub unsafe fn safe_read_write64_slow_jit(addr: i32, eip: i32) -> i32 {
function safe_write_slow_jit (line 3572) | pub unsafe fn safe_write_slow_jit(
function safe_write8_slow_jit (line 3664) | pub unsafe fn safe_write8_slow_jit(addr: i32, value: u32, eip_offset_in_...
function safe_write16_slow_jit (line 3668) | pub unsafe fn safe_write16_slow_jit(addr: i32, value: u32, eip_offset_in...
function safe_write32_slow_jit (line 3672) | pub unsafe fn safe_write32_slow_jit(addr: i32, value: u32, eip_offset_in...
function safe_write64_slow_jit (line 3676) | pub unsafe fn safe_write64_slow_jit(addr: i32, value: u64, eip_offset_in...
function safe_write128_slow_jit (line 3680) | pub unsafe fn safe_write128_slow_jit(
function safe_write8 (line 3689) | pub unsafe fn safe_write8(addr: i32, value: i32) -> OrPageFault<()> {
function safe_write16 (line 3706) | pub unsafe fn safe_write16(addr: i32, value: i32) -> OrPageFault<()> {
function safe_write32 (line 3727) | pub unsafe fn safe_write32(addr: i32, value: i32) -> OrPageFault<()> {
function safe_write64 (line 3751) | pub unsafe fn safe_write64(addr: i32, value: u64) -> OrPageFault<()> {
function safe_write128 (line 3775) | pub unsafe fn safe_write128(addr: i32, value: reg128) -> OrPageFault<()> {
function safe_read_write8 (line 3800) | pub unsafe fn safe_read_write8(addr: i32, instruction: &dyn Fn(i32) -> i...
function safe_read_write16 (line 3821) | pub unsafe fn safe_read_write16(addr: i32, instruction: &dyn Fn(i32) -> ...
function safe_read_write32 (line 3849) | pub unsafe fn safe_read_write32(addr: i32, instruction: &dyn Fn(i32) -> ...
function get_reg8_index (line 3876) | fn get_reg8_index(index: i32) -> i32 { return index << 2 & 12 | index >>...
function read_reg8 (line 3878) | pub unsafe fn read_reg8(index: i32) -> i32 {
function write_reg8 (line 3883) | pub unsafe fn write_reg8(index: i32, value: i32) {
function get_reg16_index (line 3888) | fn get_reg16_index(index: i32) -> i32 { return index << 1; }
function read_reg16 (line 3890) | pub unsafe fn read_reg16(index: i32) -> i32 {
function write_reg16 (line 3895) | pub unsafe fn write_reg16(index: i32, value: i32) {
function read_reg32 (line 3900) | pub unsafe fn read_reg32(index: i32) -> i32 {
function write_reg32 (line 3905) | pub unsafe fn write_reg32(index: i32, value: i32) {
function read_mmx32s (line 3910) | pub unsafe fn read_mmx32s(r: i32) -> i32 { (*fpu_st.offset(r as isize))....
function read_mmx64s (line 3912) | pub unsafe fn read_mmx64s(r: i32) -> u64 { (*fpu_st.offset(r as isize))....
function write_mmx_reg64 (line 3914) | pub unsafe fn write_mmx_reg64(r: i32, data: u64) { (*fpu_st.offset(r as ...
function read_xmm_f32 (line 3916) | pub unsafe fn read_xmm_f32(r: i32) -> f32 { return (*reg_xmm.offset(r as...
function read_xmm32 (line 3918) | pub unsafe fn read_xmm32(r: i32) -> i32 { return (*reg_xmm.offset(r as i...
function read_xmm64s (line 3920) | pub unsafe fn read_xmm64s(r: i32) -> u64 { (*reg_xmm.offset(r as isize))...
function read_xmm128s (line 3922) | pub unsafe fn read_xmm128s(r: i32) -> reg128 { return *reg_xmm.offset(r ...
function write_xmm_f32 (line 3924) | pub unsafe fn write_xmm_f32(r: i32, data: f32) { (*reg_xmm.offset(r as i...
function write_xmm32 (line 3926) | pub unsafe fn write_xmm32(r: i32, data: i32) { (*reg_xmm.offset(r as isi...
function write_xmm64 (line 3928) | pub unsafe fn write_xmm64(r: i32, data: u64) { (*reg_xmm.offset(r as isi...
function write_xmm_f64 (line 3929) | pub unsafe fn write_xmm_f64(r: i32, data: f64) { (*reg_xmm.offset(r as i...
function write_xmm128 (line 3931) | pub unsafe fn write_xmm128(r: i32, i0: i32, i1: i32, i2: i32, i3: i32) {
function write_xmm128_2 (line 3938) | pub unsafe fn write_xmm128_2(r: i32, i0: u64, i1: u64) {
function write_xmm_reg128 (line 3942) | pub unsafe fn write_xmm_reg128(r: i32, data: reg128) { *reg_xmm.offset(r...
function transition_fpu_to_mmx (line 3945) | pub fn transition_fpu_to_mmx() {
function task_switch_test (line 3952) | pub unsafe fn task_switch_test() -> bool {
function set_mxcsr (line 3962) | pub unsafe fn set_mxcsr(new_mxcsr: i32) {
function task_switch_test_jit (line 3992) | pub unsafe fn task_switch_test_jit(eip_offset_in_page: i32) {
function task_switch_test_mmx (line 3998) | pub unsafe fn task_switch_test_mmx() -> bool {
function task_switch_test_mmx_jit (line 4016) | pub unsafe fn task_switch_test_mmx_jit(eip_offset_in_page: i32) {
function read_moffs (line 4032) | pub unsafe fn read_moffs() -> OrPageFault<i32> {
function get_real_eip (line 4043) | pub unsafe fn get_real_eip() -> i32 {
function get_stack_reg (line 4048) | pub unsafe fn get_stack_reg() -> i32 {
function set_stack_reg (line 4057) | pub unsafe fn set_stack_reg(value: i32) {
function get_reg_asize (line 4066) | pub unsafe fn get_reg_asize(reg: i32) -> i32 {
function set_reg_asize (line 4077) | pub unsafe fn set_reg_asize(is_asize_32: bool, reg: i32, value: i32) {
function decr_ecx_asize (line 4087) | pub unsafe fn decr_ecx_asize(is_asize_32: bool) -> i32 {
function set_tsc (line 4099) | pub unsafe fn set_tsc(low: u32, high: u32) {
function read_tsc (line 4106) | pub unsafe fn read_tsc() -> u64 {
function vm86_mode (line 4156) | pub unsafe fn vm86_mode() -> bool { return *flags & FLAG_VM == FLAG_VM; }
function getiopl (line 4159) | pub unsafe fn getiopl() -> i32 { return *flags >> 12 & 3; }
function get_opstats_buffer (line 4163) | pub unsafe fn get_opstats_buffer(
function get_opstats_buffer (line 4198) | pub unsafe fn get_opstats_buffer() -> f64 { 0.0 }
function clear_tlb_code (line 4200) | pub fn clear_tlb_code(page: i32) {
function invlpg (line 4209) | pub unsafe fn invlpg(addr: i32) {
function update_eflags (line 4221) | pub unsafe fn update_eflags(new_flags: i32) {
function get_valid_tlb_entries_count (line 4256) | pub unsafe fn get_valid_tlb_entries_count() -> i32 {
function get_valid_global_tlb_entries_count (line 4272) | pub unsafe fn get_valid_global_tlb_entries_count() -> i32 {
function trigger_np (line 4288) | pub unsafe fn trigger_np(code: i32) {
function trigger_ss (line 4300) | pub unsafe fn trigger_ss(code: i32) {
function store_current_tsc (line 4312) | pub unsafe fn store_current_tsc() { *current_tsc = read_tsc(); }
function handle_irqs (line 4315) | pub unsafe fn handle_irqs() {
function pic_call_irq (line 4328) | unsafe fn pic_call_irq(interrupt_nr: u8) {
function device_raise_irq (line 4338) | unsafe fn device_raise_irq(i: u8) {
function device_lower_irq (line 4347) | unsafe fn device_lower_irq(i: u8) {
function io_port_read8 (line 4355) | pub fn io_port_read8(port: i32) -> i32 {
function io_port_read16 (line 4368) | pub fn io_port_read16(port: i32) -> i32 { unsafe { js::io_port_read16(po...
function io_port_read32 (line 4369) | pub fn io_port_read32(port: i32) -> i32 { unsafe { js::io_port_read32(po...
function io_port_write8 (line 4371) | pub fn io_port_write8(port: i32, value: i32) {
function io_port_write16 (line 4390) | pub fn io_port_write16(port: i32, value: i32) { unsafe { js::io_port_wri...
function io_port_write32 (line 4391) | pub fn io_port_write32(port: i32, value: i32) { unsafe { js::io_port_wri...
function check_page_switch (line 4395) | pub unsafe fn check_page_switch(block_addr: u32, next_block_addr: u32) {
function reset_cpu (line 4413) | pub unsafe fn reset_cpu() {
function set_cpuid_level (line 4501) | pub unsafe fn set_cpuid_level(level: u32) { cpuid_level = level }
FILE: src/rust/cpu/fpu.rs
constant FPU_C0 (line 8) | const FPU_C0: u16 = 0x100;
constant FPU_C1 (line 9) | const FPU_C1: u16 = 0x200;
constant FPU_C2 (line 10) | const FPU_C2: u16 = 0x400;
constant FPU_C3 (line 11) | const FPU_C3: u16 = 0x4000;
constant FPU_RESULT_FLAGS (line 12) | const FPU_RESULT_FLAGS: u16 = FPU_C0 | FPU_C1 | FPU_C2 | FPU_C3;
constant FPU_EX_I (line 14) | const FPU_EX_I: u16 = 1 << 0;
constant FPU_EX_D (line 16) | const FPU_EX_D: u16 = 1 << 1;
constant FPU_EX_Z (line 17) | const FPU_EX_Z: u16 = 1 << 2;
constant FPU_EX_O (line 19) | const FPU_EX_O: u16 = 1 << 3;
constant FPU_EX_U (line 20) | const FPU_EX_U: u16 = 1 << 4;
constant FPU_EX_P (line 22) | const FPU_EX_P: u16 = 1 << 5;
constant FPU_EX_SF (line 23) | const FPU_EX_SF: u16 = 1 << 6;
function fpu_write_st (line 25) | pub fn fpu_write_st(index: i32, value: F80) {
function fpu_get_st0 (line 32) | pub unsafe fn fpu_get_st0() -> F80 {
function fpu_stack_fault (line 43) | pub unsafe fn fpu_stack_fault() {
function fpu_zero_fault (line 48) | pub unsafe fn fpu_zero_fault() {
function fpu_underflow_fault (line 53) | pub unsafe fn fpu_underflow_fault() {
function fpu_sti_empty (line 58) | pub unsafe fn fpu_sti_empty(mut i: i32) -> bool {
function fpu_get_sti_jit (line 65) | pub unsafe fn fpu_get_sti_jit(dst: *mut F80, i: i32) { *dst = fpu_get_st...
function fpu_get_sti (line 67) | pub unsafe fn fpu_get_sti(mut i: i32) -> F80 {
function fpu_get_sti_f64 (line 82) | pub unsafe fn fpu_get_sti_f64(mut i: i
Condensed preview — 377 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,322K chars).
[
{
"path": ".cargo/config.toml",
"chars": 29,
"preview": "[build]\ntarget-dir = \"build\"\n"
},
{
"path": ".devcontainer/Dockerfile",
"chars": 604,
"preview": "FROM library/node:lts-bookworm\n\nARG DEBIAN_FRONTEND=noninteractive\nRUN apt update && \\\n apt-get install -y nodejs nas"
},
{
"path": ".devcontainer/devcontainer.json",
"chars": 611,
"preview": "{\n\t\"name\": \"v86 dev container\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\",\n\t\t\"args\": {\n\t\t\t\"VARIANT\": \"ubuntu\"\n\t\t}\n\t},\n\t\"f"
},
{
"path": ".editorconfig",
"chars": 71,
"preview": "root=true\n\n[*.js]\ncharset = utf-8\nindent_style = space\nindent_size = 4\n"
},
{
"path": ".gitattributes",
"chars": 63,
"preview": "lib/zstd/* linguist-vendored\nlib/softfloat/* linguist-vendored\n"
},
{
"path": ".github/ISSUE_TEMPLATE/issue.md",
"chars": 1023,
"preview": "---\nname: Issue\nabout: Bug reports or feature requests\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n<!--\nWelcome to v86's is"
},
{
"path": ".github/workflows/ci.yml",
"chars": 4818,
"preview": "name: CI\n\non:\n push:\n pull_request:\n\njobs:\n eslint:\n name: eslint\n runs-on: ubuntu-latest\n steps:\n - na"
},
{
"path": ".gitignore",
"chars": 385,
"preview": "*.swp\n*.swo\ntests/qemu/test-i386\ntests/jit-paging/test-jit\n*.map\nbuild/\nclosure-compiler/\nimages/\n*.bak\n*.orig\n*.wasm\n*."
},
{
"path": ".rustfmt.toml",
"chars": 188,
"preview": "use_field_init_shorthand = true\nmatch_block_trailing_comma = true\nfn_single_line = true\nimports_indent = \"Block\"\ncontrol"
},
{
"path": ".vscode/tasks.json",
"chars": 434,
"preview": "{\n // See https://go.microsoft.com/fwlink/?LinkId=733558\n // for the documentation about the tasks.json format\n "
},
{
"path": "Cargo.toml",
"chars": 395,
"preview": "[package]\nname = \"v86\"\nversion = \"0.1.0\"\npublish = false\nedition = \"2021\"\n\n[features]\ndefault = []\nprofiler = []\n\n[lib]\n"
},
{
"path": "LICENSE",
"chars": 1306,
"preview": "Copyright (c) 2012, The v86 contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with o"
},
{
"path": "LICENSE.MIT",
"chars": 1140,
"preview": "QEMU Floppy disk emulator (Intel 82078)\n\nCopyright (c) 2003, 2007 Jocelyn Mayer\nCopyright (c) 2008 Hervé Poussineau\n\nPer"
},
{
"path": "Makefile",
"chars": 14487,
"preview": "CLOSURE_DIR=closure-compiler\nCLOSURE=$(CLOSURE_DIR)/compiler.jar\nNASM_TEST_DIR=./tests/nasm\n\nINSTRUCTION_TABLES=src/rust"
},
{
"path": "Readme.md",
"chars": 10954,
"preview": "[](https://gitter.im/copy/v86) o"
},
{
"path": "bios/.gitignore",
"chars": 5,
"preview": "*.gz\n"
},
{
"path": "bios/COPYING.LESSER",
"chars": 7639,
"preview": "\t\t GNU LESSER GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software"
},
{
"path": "bios/fetch-and-build-seabios.sh",
"chars": 371,
"preview": "set -e\ngit clone https://git.seabios.org/seabios.git || true\n(cd seabios && git checkout rel-1.16.2)\n\ncp seabios.config "
},
{
"path": "bios/seabios-debug.config",
"chars": 2237,
"preview": "#\n# Automatically generated file; DO NOT EDIT.\n# SeaBIOS Configuration\n#\n\n#\n# General Features\n#\n# CONFIG_COREBOOT is no"
},
{
"path": "bios/seabios.config",
"chars": 2148,
"preview": "#\n# Automatically generated file; DO NOT EDIT.\n# SeaBIOS Configuration\n#\n\n#\n# General Features\n#\n# CONFIG_COREBOOT is no"
},
{
"path": "debug.html",
"chars": 12679,
"preview": "<!doctype html>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\n<title>v86 (debug)</title>\n<meta na"
},
{
"path": "docs/.gitignore",
"chars": 13,
"preview": "node_modules\n"
},
{
"path": "docs/archlinux.md",
"chars": 18995,
"preview": "See [Alpine setup](../tools/docker/alpine/Readme.md) for a more reliable and\nfaster way to automatically build Linux ima"
},
{
"path": "docs/cpu-idling.md",
"chars": 1485,
"preview": "Some operating systems don't support `hlt` instruction, because of this, the CPU spin loops instead of idling.\nHere are "
},
{
"path": "docs/filesystem.md",
"chars": 3322,
"preview": "A 9p filesystem is supported by v86, using a virtio transport. There are several\nways it can be set up.\n\n### Guest mount"
},
{
"path": "docs/how-it-works.md",
"chars": 3710,
"preview": "Here's an overview of v86's workings. For details, check the\n[source](https://github.com/copy/v86/tree/master/src).\n\nThe"
},
{
"path": "docs/linux-9p-image.md",
"chars": 1260,
"preview": "In order to create a Linux image that can mount the 9p file system, add the following lines to the kernel configuration:"
},
{
"path": "docs/networking.md",
"chars": 17823,
"preview": "# v86 networking\n\nUser guide to networking in v86.\n\n## Introduction\n\nOn the most basic level, networking in v86 is compr"
},
{
"path": "docs/profiling.md",
"chars": 432,
"preview": "v86 has a built-in profiler, which instruments generated code to count certain\nevents and types of instructions. It can "
},
{
"path": "docs/sse-shifts.txt",
"chars": 2857,
"preview": " 0F F1 PSLLW \tmm \tmm/m64 \t mmx \t Shift Packed Data Left Logical\n66 0F F1 PSLLW \txmm \txmm/m128 "
},
{
"path": "docs/windows-9x.md",
"chars": 6656,
"preview": "## Installing using QEMU\n\nRecommended versions:\n - Windows 95 OSR2(.5)\n - Windows 98 Second Edition (SE)\n\n-------------\n"
},
{
"path": "docs/windows-nt.md",
"chars": 6643,
"preview": "\n - [Windows NT 3.1](#windows-nt-31) / [3.51](#windows-nt-351) / [4.0](#windows-nt-40)\n - [Windows 2000/XP](#windows-200"
},
{
"path": "eslint.config.mjs",
"chars": 5618,
"preview": "export default [\n {\n \"languageOptions\": {\n \"globals\": {\n \"process\": \"readonly\",\n "
},
{
"path": "examples/alpine.html",
"chars": 1018,
"preview": "<!doctype html>\n<title>Alpine</title>\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\nwindow.onload = "
},
{
"path": "examples/arch.html",
"chars": 2157,
"preview": "<!doctype html>\n<title>Archlinux</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwindow.onlo"
},
{
"path": "examples/async_load.html",
"chars": 1230,
"preview": "<!doctype html>\n<title>Asynchronous loading of disk images</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n"
},
{
"path": "examples/basic.html",
"chars": 894,
"preview": "<!doctype html>\n<title>Basic Emulator</title><!-- not BASIC! -->\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"u"
},
{
"path": "examples/broadcast-network.html",
"chars": 1636,
"preview": "<!doctype html>\n<title>Networking via Broadcast Channel API</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>"
},
{
"path": "examples/destroy.html",
"chars": 837,
"preview": "<!doctype html>\n<title>Destroyable Emulator</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\n"
},
{
"path": "examples/lang.html",
"chars": 2171,
"preview": "<!doctype html>\n<title>Basic Emulator</title><!-- not BASIC! -->\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"u"
},
{
"path": "examples/lua.html",
"chars": 2787,
"preview": "<!doctype html>\n<title>Lua interpreter</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwindo"
},
{
"path": "examples/nodejs.js",
"chars": 1043,
"preview": "#!/usr/bin/env node\n\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport url from \"node:url\";\nimport { V86 } "
},
{
"path": "examples/nodejs_state.js",
"chars": 1291,
"preview": "#!/usr/bin/env node\n\nimport fs from \"node:fs\";\nimport url from \"node:url\";\nimport { V86 } from \"../build/libv86.mjs\";\n\nc"
},
{
"path": "examples/save_restore.html",
"chars": 2511,
"preview": "<!doctype html>\n<title>Save and restore</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwind"
},
{
"path": "examples/sectorc.html",
"chars": 15003,
"preview": "<!doctype html>\n<title>v86: sectorc</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwindow.o"
},
{
"path": "examples/serial.html",
"chars": 2152,
"preview": "<!doctype html>\n<title>Serial example</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwindow"
},
{
"path": "examples/tcp_terminal.html",
"chars": 4080,
"preview": "<!doctype html>\n<title>TCP Terminal</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwindow.o"
},
{
"path": "examples/two_instances.html",
"chars": 2587,
"preview": "<!doctype html>\n<title>Two emulators</title>\n\n<script src=\"../build/libv86.js\"></script>\n<script>\n\"use strict\";\n\nwindow."
},
{
"path": "examples/worker.html",
"chars": 645,
"preview": "<!doctype html>\n<title>Worker</title>\n\n<script>\n\"use strict\";\n\nwindow.onload = function()\n{\n var worker = new Worker("
},
{
"path": "examples/worker.js",
"chars": 603,
"preview": "importScripts(\"../build/libv86.js\");\n\n/* global V86 */\n\nvar emulator = new V86({\n wasm_path: \"../build/v86.wasm\",\n "
},
{
"path": "gen/generate_analyzer.js",
"chars": 14204,
"preview": "#!/usr/bin/env node\n\n\nimport assert from \"node:assert/strict\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\ni"
},
{
"path": "gen/generate_interpreter.js",
"chars": 14563,
"preview": "#!/usr/bin/env node\n\n\nimport assert from \"node:assert/strict\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\ni"
},
{
"path": "gen/generate_jit.js",
"chars": 16672,
"preview": "#!/usr/bin/env node\n\n\nimport assert from \"node:assert/strict\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\ni"
},
{
"path": "gen/rust_ast.js",
"chars": 2307,
"preview": "import assert from \"node:assert/strict\";\n\nfunction indent(lines, how_much)\n{\n return lines.map(line => \" \".repeat(how"
},
{
"path": "gen/util.js",
"chars": 856,
"preview": "import fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\n\nconst CYAN_FMT = \"\\x1b[36m%"
},
{
"path": "gen/x86_table.js",
"chars": 47968,
"preview": "// http://ref.x86asm.net/coder32.html\n\nconst zf = 1 << 6;\nconst of = 1 << 11;\nconst cf = 1 << 0;\nconst af = 1 << 4;\ncons"
},
{
"path": "index.html",
"chars": 43065,
"preview": "<!doctype html>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\n<title>v86</title>\n<meta name=\"view"
},
{
"path": "lib/9p.js",
"chars": 41413,
"preview": "// -------------------------------------------------\n// --------------------- 9P ------------------------\n// -----------"
},
{
"path": "lib/filesystem.js",
"chars": 55896,
"preview": "// -------------------------------------------------\n// ----------------- FILESYSTEM---------------------\n// -----------"
},
{
"path": "lib/marshall.js",
"chars": 4452,
"preview": "// -------------------------------------------------\n// ------------------ Marshall ---------------------\n// -----------"
},
{
"path": "lib/softfloat/softfloat.c",
"chars": 1324966,
"preview": "/**** start inlining ../../source/8086-SSE/softfloat_raiseFlags.c ****/\n\r\n/*============================================"
},
{
"path": "lib/zstd/zstddeclib.c",
"chars": 578415,
"preview": "#define malloc v86_malloc\n#define free v86_free\n#include <stddef.h>\nvoid *calloc(size_t nmemb, size_t size);\nvoid *memse"
},
{
"path": "manifest.json",
"chars": 238,
"preview": "{\n \"name\": \"v86\",\n \"short_name\": \"v86\",\n \"start_url\": \"/v86/\",\n \"display\": \"standalone\",\n \"icons\": [\n "
},
{
"path": "package.json",
"chars": 454,
"preview": "{\n \"name\": \"v86\",\n \"version\": \"0.5\",\n \"license\": \"BSD-2-Clause\",\n \"description\": \"x86 PC emulator and x86-to-wasm JI"
},
{
"path": "src/acpi.js",
"chars": 5774,
"preview": "// http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf\n\nimport { v86 } from \"./main.js\";\nimport { LOG_ACPI } "
},
{
"path": "src/browser/dummy_screen.js",
"chars": 2804,
"preview": "import { dbg_assert } from \"../log.js\";\nimport { get_charmap } from \"../lib.js\";\n\n/**\n * @constructor\n * @param {Object="
},
{
"path": "src/browser/fake_network.js",
"chars": 47016,
"preview": "import { LOG_FETCH } from \"../const.js\";\nimport { h } from \"../lib.js\";\nimport { dbg_assert, dbg_log } from \"../log.js\";"
},
{
"path": "src/browser/fetch_network.js",
"chars": 9063,
"preview": "import { LOG_FETCH } from \"../const.js\";\nimport { dbg_log } from \"../log.js\";\n\nimport {\n create_eth_encoder_buf,\n "
},
{
"path": "src/browser/filestorage.js",
"chars": 4113,
"preview": "import { dbg_assert } from \"../log.js\";\nimport { load_file } from \"../lib.js\";\n\n/** @interface */\nexport function FileSt"
},
{
"path": "src/browser/inbrowser_network.js",
"chars": 1681,
"preview": "// For Types Only\nimport { BusConnector } from \"../bus.js\";\n\n/**\n * Network adapter \"inbrowser\" which connects the emula"
},
{
"path": "src/browser/keyboard.js",
"chars": 14591,
"preview": "// For Types Only\nimport { BusConnector } from \"../bus.js\";\n\nconst SHIFT_SCAN_CODE = 0x2A;\nconst SCAN_CODE_RELEASE = 0x8"
},
{
"path": "src/browser/main.js",
"chars": 100521,
"preview": "import { V86 } from \"./starter.js\";\nimport { LOG_NAMES } from \"../const.js\";\nimport { SyncBuffer, SyncFileBuffer } from "
},
{
"path": "src/browser/mouse.js",
"chars": 7433,
"preview": "import { dbg_log } from \"../log.js\";\n\n// For Types Only\nimport { BusConnector } from \"../bus.js\";\n\n/**\n * @constructor\n "
},
{
"path": "src/browser/network.js",
"chars": 3253,
"preview": "// For Types Only\nimport { BusConnector } from \"../bus.js\";\n\n/**\n * An ethernet-through-websocket adapter, to be used wi"
},
{
"path": "src/browser/print_stats.js",
"chars": 9323,
"preview": "import { pads } from \"../lib.js\";\n\nexport function stats_to_string(cpu)\n{\n return print_misc_stats(cpu) + print_instr"
},
{
"path": "src/browser/screen.js",
"chars": 30677,
"preview": "import { dbg_assert } from \"../log.js\";\nimport { get_charmap } from \"../lib.js\";\n\n// Draws entire buffer and visualizes "
},
{
"path": "src/browser/serial.js",
"chars": 7970,
"preview": "import { dbg_assert, dbg_log } from \"../log.js\";\n\n// For Types Only\nimport { BusConnector } from \"../bus.js\";\n\n/**\n * @c"
},
{
"path": "src/browser/speaker.js",
"chars": 31930,
"preview": "import {\n MIXER_CHANNEL_BOTH, MIXER_CHANNEL_LEFT, MIXER_CHANNEL_RIGHT,\n MIXER_SRC_PCSPEAKER, MIXER_SRC_DAC, MIXER_"
},
{
"path": "src/browser/starter.js",
"chars": 45612,
"preview": "import { v86 } from \"../main.js\";\nimport { LOG_CPU, WASM_TABLE_OFFSET, WASM_TABLE_SIZE } from \"../const.js\";\nimport { ge"
},
{
"path": "src/browser/wisp_network.js",
"chars": 8357,
"preview": "import { LOG_NET } from \"../const.js\";\nimport { dbg_log } from \"../log.js\";\n\nimport {\n create_eth_encoder_buf,\n ha"
},
{
"path": "src/browser/worker_bus.js",
"chars": 1165,
"preview": "import { dbg_assert } from \"../log.js\";\n\n/** @constructor */\nexport var Connector = function(pair)\n{\n this.listeners "
},
{
"path": "src/buffer.js",
"chars": 19979,
"preview": "import { CPU } from \"./cpu.js\";\nimport { load_file, get_file_size } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from"
},
{
"path": "src/bus.js",
"chars": 1888,
"preview": "import { dbg_assert } from \"./log.js\";\n\nexport var Bus = {};\n\n/** @constructor */\nexport function BusConnector()\n{\n t"
},
{
"path": "src/cjs.js",
"chars": 96,
"preview": "/**\n * @define {boolean}\n * Overridden for production by closure compiler\n */\nvar DEBUG = true;\n"
},
{
"path": "src/const.js",
"chars": 3339,
"preview": "export const\n LOG_ALL = -1,\n LOG_NONE = 0,\n\n LOG_OTHER = 0x0000001,\n LOG_CPU = 0x0000002,\n LOG_FPU = "
},
{
"path": "src/cpu.js",
"chars": 76929,
"preview": "import {\n LOG_CPU, LOG_BIOS,\n FW_CFG_SIGNATURE, FW_CFG_SIGNATURE_QEMU,\n WASM_TABLE_SIZE, WASM_TABLE_OFFSET, FW_"
},
{
"path": "src/dma.js",
"chars": 14304,
"preview": "import { LOG_DMA } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_log } from \"./log.js\";\n\n// For Types On"
},
{
"path": "src/elf.js",
"chars": 5987,
"preview": "import { dbg_log, LOG_LEVEL } from \"./log.js\";\n\n// A minimal elf parser for loading 32 bit, x86, little endian, executab"
},
{
"path": "src/externs.js",
"chars": 559,
"preview": "var global = {};\nvar process = { hrtime: function() {} };\n\n/**\n * @param {string} name\n * @param {function()} processor\n"
},
{
"path": "src/floppy.js",
"chars": 53254,
"preview": "// v86 Floppy Disk Controller emulation\n//\n// This file is licensed under both BSD and MIT, see LICENSE and LICENSE.MIT."
},
{
"path": "src/ide.js",
"chars": 96209,
"preview": "import { LOG_DISK } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./log.js\";\nimp"
},
{
"path": "src/io.js",
"chars": 13233,
"preview": "import { LOG_IO, MMAP_BLOCK_BITS, MMAP_BLOCK_SIZE, MMAP_MAX } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { "
},
{
"path": "src/iso9660.js",
"chars": 11426,
"preview": "// Source: https://wiki.osdev.org/ISO_9660\n\n// Limitations:\n// - can only generate iso files\n// - only supports a single"
},
{
"path": "src/kernel.js",
"chars": 8305,
"preview": "import { h } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./log.js\";\n\n\n// https://www.kernel.org/doc/Documentat"
},
{
"path": "src/lib.js",
"chars": 18274,
"preview": "import { dbg_assert } from \"./log.js\";\n\n// pad string with spaces on the right\nexport function pads(str, len)\n{\n str "
},
{
"path": "src/log.js",
"chars": 3100,
"preview": "if(typeof DEBUG === \"undefined\")\n{\n globalThis.DEBUG = true;\n}\n\nimport { LOG_NAMES } from \"./const.js\";\nimport { pad0"
},
{
"path": "src/main.js",
"chars": 5458,
"preview": "import { CPU } from \"./cpu.js\";\nimport { save_state, restore_state } from \"./state.js\";\nexport { V86 } from \"./browser/s"
},
{
"path": "src/ne2k.js",
"chars": 39064,
"preview": "import { LOG_NET } from \"./const.js\";\nimport { h, hex_dump } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./log"
},
{
"path": "src/pci.js",
"chars": 17573,
"preview": "import { LOG_PCI } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./log.js\";\n\n// "
},
{
"path": "src/pit.js",
"chars": 9203,
"preview": "import { v86 } from \"./main.js\";\nimport { LOG_PIT } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_log } "
},
{
"path": "src/ps2.js",
"chars": 21774,
"preview": "import { LOG_PS2 } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_log } from \"./log.js\";\n\n// For Types On"
},
{
"path": "src/rtc.js",
"chars": 12707,
"preview": "import { v86 } from \"./main.js\";\nimport { LOG_RTC } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_assert"
},
{
"path": "src/rust/analysis.rs",
"chars": 3272,
"preview": "#![allow(non_snake_case)]\n\nuse crate::cpu_context::CpuContext;\nuse crate::gen;\nuse crate::modrm;\nuse crate::prefix::{PRE"
},
{
"path": "src/rust/codegen.rs",
"chars": 89752,
"preview": "use crate::cpu::cpu::{\n tlb_data, FLAG_CARRY, FLAG_OVERFLOW, FLAG_SIGN, FLAG_ZERO, OPSIZE_16, OPSIZE_32, OPSIZE_8,\n "
},
{
"path": "src/rust/config.rs",
"chars": 89,
"preview": "pub const LOG_PAGE_FAULTS: bool = false;\n\npub const VMWARE_HYPERVISOR_PORT: bool = true;\n"
},
{
"path": "src/rust/control_flow.rs",
"chars": 14612,
"preview": "use std::collections::HashSet;\nuse std::collections::{BTreeMap, BTreeSet};\nuse std::iter;\n\nuse crate::jit::{BasicBlock, "
},
{
"path": "src/rust/cpu/apic.rs",
"chars": 19147,
"preview": "// See Intel's System Programming Guide\n\nuse crate::cpu::{cpu::js, global_pointers::acpi_enabled, ioapic};\nuse std::sync"
},
{
"path": "src/rust/cpu/arith.rs",
"chars": 38278,
"preview": "use crate::cpu::cpu::*;\nuse crate::cpu::global_pointers::*;\nuse crate::cpu::memory;\nuse crate::cpu::misc_instr::{getaf, "
},
{
"path": "src/rust/cpu/call_indirect.rs",
"chars": 65,
"preview": "#[no_mangle]\npub fn call_indirect1(f: fn(u16), x: u16) { f(x); }\n"
},
{
"path": "src/rust/cpu/cpu.rs",
"chars": 145758,
"preview": "#![allow(non_upper_case_globals)]\n\nuse crate::config;\nuse crate::cpu::fpu::fpu_set_tag_word;\nuse crate::cpu::global_poin"
},
{
"path": "src/rust/cpu/fpu.rs",
"chars": 26148,
"preview": "use crate::cpu::cpu::*;\nuse crate::cpu::global_pointers::*;\nuse crate::paging::OrPageFault;\nuse crate::softfloat::{Preci"
},
{
"path": "src/rust/cpu/global_pointers.rs",
"chars": 4060,
"preview": "#![allow(non_upper_case_globals)]\n\nuse crate::cpu::cpu::reg128;\nuse crate::softfloat::F80;\nuse crate::state_flags::Cache"
},
{
"path": "src/rust/cpu/instructions.rs",
"chars": 100313,
"preview": "#![allow(non_snake_case)]\n\nuse crate::cpu::arith::*;\nuse crate::cpu::cpu::js;\nuse crate::cpu::cpu::*;\nuse crate::cpu::fp"
},
{
"path": "src/rust/cpu/instructions_0f.rs",
"chars": 183025,
"preview": "#![allow(non_snake_case)]\n\nunsafe fn undefined_instruction() {\n dbg_assert!(false, \"Undefined instructions\");\n tri"
},
{
"path": "src/rust/cpu/ioapic.rs",
"chars": 9924,
"preview": "// http://download.intel.com/design/chipsets/datashts/29056601.pdf\n\nuse crate::cpu::{apic, global_pointers::acpi_enabled"
},
{
"path": "src/rust/cpu/memory.rs",
"chars": 10297,
"preview": "mod ext {\n extern \"C\" {\n pub fn mmap_read8(addr: u32) -> i32;\n pub fn mmap_read32(addr: u32) -> i32;\n\n "
},
{
"path": "src/rust/cpu/misc_instr.rs",
"chars": 19183,
"preview": "use crate::cpu::cpu::*;\nuse crate::cpu::fpu::{\n fpu_load_m80, fpu_load_status_word, fpu_set_status_word, fpu_store_m8"
},
{
"path": "src/rust/cpu/mod.rs",
"chars": 278,
"preview": "pub mod apic;\npub mod arith;\npub mod call_indirect;\npub mod cpu;\npub mod fpu;\npub mod global_pointers;\npub mod instructi"
},
{
"path": "src/rust/cpu/modrm.rs",
"chars": 5490,
"preview": "use crate::cpu::cpu::*;\nuse crate::paging::OrPageFault;\n\npub unsafe fn resolve_modrm16(modrm_byte: i32) -> OrPageFault<i"
},
{
"path": "src/rust/cpu/pic.rs",
"chars": 10868,
"preview": "#![allow(non_snake_case)]\n\n// Programmable Interrupt Controller\n// http://stanislavs.org/helppc/8259.html\n\nuse std::sync"
},
{
"path": "src/rust/cpu/sse_instr.rs",
"chars": 11846,
"preview": "use crate::cpu::cpu::*;\nuse crate::cpu::global_pointers::mxcsr;\n\npub unsafe fn mov_r_m64(addr: i32, r: i32) {\n // mov"
},
{
"path": "src/rust/cpu/string.rs",
"chars": 25201,
"preview": "// string operations\n//\n// cmp si di\n// movs 0 1 1/w A4\n// cmps 1 1 1/r A6\n// stos 0 0 "
},
{
"path": "src/rust/cpu/vga.rs",
"chars": 6623,
"preview": "#![allow(non_upper_case_globals)]\n#![allow(static_mut_refs)]\n\n// Safety of allow(static_mut_refs) in this file:\n// These"
},
{
"path": "src/rust/cpu_context.rs",
"chars": 1942,
"preview": "use crate::cpu::memory;\nuse crate::prefix::{PREFIX_MASK_ADDRSIZE, PREFIX_MASK_OPSIZE};\nuse crate::state_flags::CachedSta"
},
{
"path": "src/rust/dbg.rs",
"chars": 2127,
"preview": "#[allow(dead_code)]\npub const DEBUG: bool = cfg!(debug_assertions);\n\n#[cfg(target_arch = \"wasm32\")]\nextern \"C\" {\n pub"
},
{
"path": "src/rust/gen/mod.rs",
"chars": 214,
"preview": "#[rustfmt::skip]\npub mod interpreter;\n#[rustfmt::skip]\npub mod interpreter0f;\n\n#[rustfmt::skip]\npub mod jit;\n#[rustfmt::"
},
{
"path": "src/rust/jit.rs",
"chars": 91609,
"preview": "use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};\nuse std::iter::FromIterator;\nuse std::mem::{self, MaybeUni"
},
{
"path": "src/rust/jit_instructions.rs",
"chars": 306288,
"preview": "#![allow(non_snake_case)]\n\nuse crate::codegen;\nuse crate::codegen::{BitSize, ConditionNegate};\nuse crate::cpu::cpu::{\n "
},
{
"path": "src/rust/js_api.rs",
"chars": 184,
"preview": "use crate::cpu::cpu::translate_address_system_read;\n\n#[no_mangle]\npub unsafe fn translate_address_system_read_js(addr: i"
},
{
"path": "src/rust/leb.rs",
"chars": 1429,
"preview": "pub fn write_leb_i32(buf: &mut Vec<u8>, v: i32) { write_leb_i64(buf, v as i64); }\n\npub fn write_leb_i64(buf: &mut Vec<u8"
},
{
"path": "src/rust/lib.rs",
"chars": 332,
"preview": "#[macro_use]\nmod dbg;\n\n#[macro_use]\nmod paging;\n\npub mod cpu;\n\npub mod js_api;\npub mod profiler;\n\nmod analysis;\nmod code"
},
{
"path": "src/rust/modrm.rs",
"chars": 10223,
"preview": "use crate::codegen;\nuse crate::cpu::global_pointers;\nuse crate::cpu_context::CpuContext;\nuse crate::jit::JitContext;\nuse"
},
{
"path": "src/rust/opstats.rs",
"chars": 8207,
"preview": "use crate::wasmgen::wasm_builder::WasmBuilder;\n\nconst SIZE: usize = if cfg!(feature = \"profiler\") { 8192 } else { 0 };\n\n"
},
{
"path": "src/rust/page.rs",
"chars": 439,
"preview": "use std::ops::RangeInclusive;\n\n#[derive(Copy, Clone, Eq, Hash, PartialEq)]\npub struct Page(u32);\nimpl Page {\n pub fn "
},
{
"path": "src/rust/paging.rs",
"chars": 479,
"preview": "pub type OrPageFault<T> = Result<T, ()>;\n\nmacro_rules! return_on_pagefault {\n ($expr:expr) => {\n match $expr {"
},
{
"path": "src/rust/prefix.rs",
"chars": 483,
"preview": "pub const PREFIX_REPZ: u8 = 0b01000;\npub const PREFIX_REPNZ: u8 = 0b10000;\npub const PREFIX_MASK_REP: u8 = PREFIX_REPZ |"
},
{
"path": "src/rust/profiler.rs",
"chars": 3842,
"preview": "#[allow(non_camel_case_types)]\npub enum stat {\n COMPILE,\n COMPILE_SKIPPED_NO_NEW_ENTRY_POINTS,\n COMPILE_WRONG_A"
},
{
"path": "src/rust/regs.rs",
"chars": 800,
"preview": "pub const ES: u32 = 0;\npub const CS: u32 = 1;\npub const SS: u32 = 2;\npub const DS: u32 = 3;\npub const FS: u32 = 4;\npub c"
},
{
"path": "src/rust/softfloat.rs",
"chars": 8852,
"preview": "extern \"C\" {\n fn extF80M_add(x: *const F80, y: *const F80, ptr: *mut F80);\n fn extF80M_sub(x: *const F80, y: *cons"
},
{
"path": "src/rust/state_flags.rs",
"chars": 969,
"preview": "#[derive(Copy, Clone, PartialEq, Eq)]\n#[repr(transparent)]\npub struct CachedStateFlags(u8);\n\nimpl CachedStateFlags {\n "
},
{
"path": "src/rust/wasmgen/mod.rs",
"chars": 40,
"preview": "pub mod wasm_builder;\nmod wasm_opcodes;\n"
},
{
"path": "src/rust/wasmgen/wasm_builder.rs",
"chars": 39005,
"preview": "use std::collections::HashMap;\nuse std::mem::transmute;\n\nuse crate::leb::{\n write_fixed_leb16_at_idx, write_fixed_leb"
},
{
"path": "src/rust/wasmgen/wasm_opcodes.rs",
"chars": 5013,
"preview": "macro_rules! c {\n ($x:ident, $y:expr) => {\n #[allow(dead_code)]\n pub const $x: u8 = $y;\n };\n}\n\n// ht"
},
{
"path": "src/rust/zstd.rs",
"chars": 2813,
"preview": "use std::alloc;\n\nextern \"C\" {\n fn ZSTD_createDStream() -> u32;\n fn ZSTD_freeDStream(ctx: u32) -> i32;\n fn ZSTD_"
},
{
"path": "src/sb16.js",
"chars": 50384,
"preview": "import {\n LOG_SB16,\n MIXER_CHANNEL_BOTH, MIXER_CHANNEL_LEFT, MIXER_CHANNEL_RIGHT,\n MIXER_SRC_PCSPEAKER, MIXER_S"
},
{
"path": "src/state.js",
"chars": 9874,
"preview": "import { h } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./log.js\";\nimport { CPU } from \"./cpu.js\";\n\nconst STA"
},
{
"path": "src/uart.js",
"chars": 11963,
"preview": "import { LOG_SERIAL } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_log } from \"./log.js\";\n\n// For Types"
},
{
"path": "src/vga.js",
"chars": 82205,
"preview": "import { LOG_VGA } from \"./const.js\";\nimport { h } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./log.js\";\n\n// "
},
{
"path": "src/virtio.js",
"chars": 47219,
"preview": "import { LOG_VIRTIO } from \"./const.js\";\nimport { h, int_log2 } from \"./lib.js\";\nimport { dbg_assert, dbg_log } from \"./"
},
{
"path": "src/virtio_balloon.js",
"chars": 7314,
"preview": "// https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-2900003\n\nimport { LOG_PCI } from \"./co"
},
{
"path": "src/virtio_console.js",
"chars": 9439,
"preview": "import { dbg_assert } from \"./log.js\";\nimport { VirtIO, VIRTIO_F_VERSION_1 } from \"./virtio.js\";\nimport * as marshall fr"
},
{
"path": "src/virtio_net.js",
"chars": 7926,
"preview": "// https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-2900003\n\nimport { dbg_assert } from \"."
},
{
"path": "tests/Readme.md",
"chars": 1338,
"preview": "Use the corresponding `make` target in the root directory to run a test. The\nfollowing list is roughtly sorted from most"
},
{
"path": "tests/api/2g-mem.js",
"chars": 2136,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\nimport fs from \"node:fs\";\n\nconst __dirname = url.fileURLToPath(new URL("
},
{
"path": "tests/api/cdrom-insert-eject.js",
"chars": 1733,
"preview": "#!/usr/bin/env node\n\nimport { setTimeout as pause } from \"timers/promises\";\nimport url from \"node:url\";\n\nconst __dirname"
},
{
"path": "tests/api/clean-shutdown.js",
"chars": 1057,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\nconst __dirname = url.fileURLToPath(new URL(\".\", import.meta.url));\n\n//"
},
{
"path": "tests/api/floppy.js",
"chars": 8074,
"preview": "#!/usr/bin/env node\n\nimport { setTimeout as pause } from \"timers/promises\";\nimport url from \"node:url\";\nimport fs from \""
},
{
"path": "tests/api/pic.js",
"chars": 2427,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\nimport fs from \"node:fs\";\n\nconst __dirname = url.fileURLToPath(new URL("
},
{
"path": "tests/api/reboot.js",
"chars": 1571,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\n\nconst __dirname = url.fileURLToPath(new URL(\".\", import.meta.url));\n\nc"
},
{
"path": "tests/api/reset.js",
"chars": 1316,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\n\nconst __dirname = url.fileURLToPath(new URL(\".\", import.meta.url));\n\n/"
},
{
"path": "tests/api/serial.js",
"chars": 1609,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\nimport assert from \"node:assert/strict\";\nimport crypto from \"node:crypt"
},
{
"path": "tests/api/state.js",
"chars": 3083,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\n\nconst __dirname = url.fileURLToPath(new URL(\".\", import.meta.url));\n\np"
},
{
"path": "tests/api/test.js",
"chars": 828,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\n\nconst __dirname = url.fileURLToPath(new URL(\".\", import.meta.url));\n\nc"
},
{
"path": "tests/benchmark/arch-bytemark.js",
"chars": 2189,
"preview": "#!/usr/bin/env node\n\nimport path from \"node:path\";\nimport url from \"node:url\";\nconst __dirname = url.fileURLToPath(new U"
},
{
"path": "tests/benchmark/arch-python.js",
"chars": 1855,
"preview": "#!/usr/bin/env node\n\nimport path from \"node:path\";\nimport url from \"node:url\";\n\nconst __dirname = url.fileURLToPath(new "
},
{
"path": "tests/benchmark/fetch-download.js",
"chars": 3118,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\nimport { createServer } from \"node:http\";\nimport { Worker, isMainThread"
},
{
"path": "tests/benchmark/linux-boot.js",
"chars": 2412,
"preview": "#!/usr/bin/env node\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport url from \"node:url\";\n\nconst __dirnam"
},
{
"path": "tests/benchmark/snapshot.js",
"chars": 1670,
"preview": "#!/usr/bin/env node\n\nimport path from \"node:path\";\nimport url from \"node:url\";\n\nconst BENCH_COLLECT_STATS = +process.env"
},
{
"path": "tests/devices/fetch_network.js",
"chars": 13929,
"preview": "#!/usr/bin/env node\n\nimport assert from \"assert/strict\";\nimport url from \"node:url\";\nimport { Worker, isMainThread, pare"
},
{
"path": "tests/devices/testfs/5d70f436aa013f4f1d5af4a5e8149b479c813ab4ceea0bcf8b01f78eac84fd25",
"chars": 7,
"preview": "foobaz\n"
},
{
"path": "tests/devices/testfs/7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730",
"chars": 4,
"preview": "bar\n"
},
{
"path": "tests/devices/testfs.json",
"chars": 287,
"preview": "{\"fsroot\":[[\"foo\",4,1531432001,33188,1000,1000,\"7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730\"],[\"dir"
},
{
"path": "tests/devices/virtio_9p.js",
"chars": 48849,
"preview": "#!/usr/bin/env node\n\nimport url from \"node:url\";\nimport fs from \"node:fs\";\n\nprocess.on(\"unhandledRejection\", exn => { th"
},
{
"path": "tests/devices/virtio_balloon.js",
"chars": 5596,
"preview": "#!/usr/bin/env node\n\nimport assert from \"assert/strict\";\nimport url from \"node:url\";\n\nconst __dirname = url.fileURLToPat"
},
{
"path": "tests/devices/virtio_console.js",
"chars": 1979,
"preview": "#!/usr/bin/env node\n\nimport assert from \"assert/strict\";\nimport fs from \"node:fs\";\nimport url from \"node:url\";\n\nconst __"
},
{
"path": "tests/devices/wisp_network.js",
"chars": 4705,
"preview": "#!/usr/bin/env -S node --experimental-websocket\n\nimport assert from \"assert/strict\";\nimport url from \"node:url\";\n\nconst "
},
{
"path": "tests/expect/readme.md",
"chars": 836,
"preview": "Expect tests\n------------\n\nThese so-called \"expect tests\" test the code generation, i.e. the translation\nof x86 assembly"
},
{
"path": "tests/expect/run.js",
"chars": 6198,
"preview": "#!/usr/bin/env node\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport assert from \"node:assert/strict\";\nim"
},
{
"path": "tests/expect/tests/Makefile",
"chars": 288,
"preview": "build_dir := build\nsource_files := $(wildcard *.asm)\nexecutable_files := $(patsubst %.asm,$(build_dir)/%.bin,$(source_fi"
},
{
"path": "tests/expect/tests/add.asm",
"chars": 33,
"preview": "BITS 32\n add ebx, eax\n hlt\n"
},
{
"path": "tests/expect/tests/add.wast",
"chars": 5692,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/call-ret.asm",
"chars": 57,
"preview": "BITS 32\n call test\n hlt\n\ntest:\n inc eax\n ret\n"
},
{
"path": "tests/expect/tests/call-ret.wast",
"chars": 11243,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/do-while.asm",
"chars": 67,
"preview": "BITS 32\n\nstart:\n inc ebx\n cmp eax, 10\n jnz start\n\n hlt\n"
},
{
"path": "tests/expect/tests/do-while.wast",
"chars": 8035,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/if.asm",
"chars": 74,
"preview": "BITS 32\n cmp eax, 5\n jg else\n inc ecx\n\nelse:\n inc ebx\n hlt\n"
},
{
"path": "tests/expect/tests/if.wast",
"chars": 9058,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/inc.asm",
"chars": 28,
"preview": "BITS 32\n inc eax\n hlt\n"
},
{
"path": "tests/expect/tests/inc.wast",
"chars": 6783,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/indirect-call.asm",
"chars": 31,
"preview": "BITS 32\n call [eax]\n hlt\n"
},
{
"path": "tests/expect/tests/indirect-call.wast",
"chars": 9963,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/loop.asm",
"chars": 40,
"preview": "BITS 32\n\nstart:\n loop start\n hlt\n\n"
},
{
"path": "tests/expect/tests/loop.wast",
"chars": 6084,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/mem32r.asm",
"chars": 47,
"preview": "BITS 32\n mov eax, [ebx + 123456789]\n hlt\n"
},
{
"path": "tests/expect/tests/mem32r.wast",
"chars": 7079,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/mem32rmw.asm",
"chars": 48,
"preview": "BITS 32\n inc dword [eax + 123456789]\n hlt\n"
},
{
"path": "tests/expect/tests/mem32rmw.wast",
"chars": 9581,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/mem32w.asm",
"chars": 47,
"preview": "BITS 32\n mov [ebx + 123456789], eax\n hlt\n"
},
{
"path": "tests/expect/tests/mem32w.wast",
"chars": 7109,
"preview": "(module\n (type $t0 (func))\n (type $t1 (func (param i32)))\n (type $t2 (func (param i32 i32)))\n (type $t3 (func (param"
},
{
"path": "tests/expect/tests/mov-immoffs.asm",
"chars": 38,
"preview": "BITS 32\n mov eax, [0xcafe]\n hlt\n"
}
]
// ... and 177 more files (download for full content)
About this extraction
This page contains the full source code of the copy/v86 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 377 files (4.9 MB), approximately 1.3M tokens, and a symbol index with 7101 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.