diff --git a/emulators/Makefile b/emulators/Makefile index 6e7629939545..e5a377684001 100644 --- a/emulators/Makefile +++ b/emulators/Makefile @@ -1,196 +1,197 @@ COMMENT = Emulators for other operating systems SUBDIR += 86Box SUBDIR += adamem SUBDIR += almostti SUBDIR += anese SUBDIR += aqemu SUBDIR += aranym SUBDIR += ares SUBDIR += atari800 SUBDIR += bfe SUBDIR += bochs SUBDIR += bsvc SUBDIR += cannonball SUBDIR += catapult SUBDIR += cemu SUBDIR += cingb SUBDIR += citra SUBDIR += citra-qt5 SUBDIR += cpmtools SUBDIR += cpmtools2 SUBDIR += darcnes SUBDIR += dgen-sdl SUBDIR += dolphin-emu SUBDIR += dosbox SUBDIR += dosbox-staging SUBDIR += dosbox-x SUBDIR += dps8m SUBDIR += dynamips-community SUBDIR += edumips64 SUBDIR += elliott-803 SUBDIR += emu64 SUBDIR += emulationstation SUBDIR += es-de SUBDIR += fbneo SUBDIR += fbsd-duckstation SUBDIR += fceux SUBDIR += flexemu SUBDIR += flycast SUBDIR += fmsx SUBDIR += frodo SUBDIR += fs-uae SUBDIR += fs-uae-launcher SUBDIR += fuse SUBDIR += fuse-roms SUBDIR += fuse-utils SUBDIR += gbe SUBDIR += gens SUBDIR += gngb SUBDIR += gxemul SUBDIR += hatari SUBDIR += hercules SUBDIR += higan SUBDIR += hv_kvp_cmd SUBDIR += javatari SUBDIR += joytran SUBDIR += jzintv SUBDIR += klh10 SUBDIR += lib765 SUBDIR += libc6-shim SUBDIR += libdsk SUBDIR += libretro-bsnes SUBDIR += libretro-flycast SUBDIR += libretro-kronos SUBDIR += libretro-mame SUBDIR += libretro-pcsx2 SUBDIR += libretro-ppsspp SUBDIR += libretro-reicast SUBDIR += libretro-vice SUBDIR += libspectrum SUBDIR += linux-c7 SUBDIR += linux-power10-functional-sim SUBDIR += linux-power9-functional-sim SUBDIR += linux-rl9 SUBDIR += linux_base-c7 SUBDIR += linux_base-rl9 SUBDIR += magia SUBDIR += mame SUBDIR += mastergear SUBDIR += mednafen SUBDIR += mesen SUBDIR += mgba SUBDIR += mupen64plus SUBDIR += mupen64plus-audio-sdl SUBDIR += mupen64plus-core SUBDIR += mupen64plus-input-sdl SUBDIR += mupen64plus-plugins SUBDIR += mupen64plus-qt SUBDIR += mupen64plus-rsp-cxd4 SUBDIR += mupen64plus-rsp-hle SUBDIR += mupen64plus-rsp-z64 SUBDIR += mupen64plus-ui-console SUBDIR += mupen64plus-video-arachnoid SUBDIR += mupen64plus-video-glide64 SUBDIR += mupen64plus-video-glide64mk2 SUBDIR += mupen64plus-video-rice SUBDIR += mupen64plus-video-z64 SUBDIR += nemu SUBDIR += nestopia SUBDIR += o2em SUBDIR += ods2reader SUBDIR += open-simh SUBDIR += open-vm-kmod SUBDIR += open-vm-tools SUBDIR += openmsx SUBDIR += p5-Acme-6502 SUBDIR += parallels-tools SUBDIR += pcem SUBDIR += pcemu SUBDIR += pcsx2 SUBDIR += playonbsd SUBDIR += ppsspp SUBDIR += ppsspp-qt5 SUBDIR += py-gns3-converter SUBDIR += py-m64py SUBDIR += py-unicorn SUBDIR += qemu SUBDIR += qemu-cheri SUBDIR += qemu-devel SUBDIR += qemu-powernv SUBDIR += qemu-user-static SUBDIR += qemu-user-static-devel SUBDIR += qemu8 SUBDIR += qmc2 SUBDIR += quasi88 SUBDIR += reicast SUBDIR += ripes SUBDIR += riscv-isa-sim SUBDIR += rpcs3 SUBDIR += rubygem-fission + SUBDIR += rvvm SUBDIR += sameboy SUBDIR += simh SUBDIR += simh-hp2100 SUBDIR += simh-hp3000 SUBDIR += simh-hpdoc SUBDIR += snes9x-gtk SUBDIR += spim SUBDIR += stella SUBDIR += stonx SUBDIR += teo SUBDIR += tic-80 SUBDIR += tiemu3 SUBDIR += tilem SUBDIR += tme SUBDIR += tnylpo SUBDIR += tpm-emulator SUBDIR += uae SUBDIR += ucon64 SUBDIR += uconvert SUBDIR += ukncbtl SUBDIR += unicorn SUBDIR += vba SUBDIR += vboxtool SUBDIR += vgb-bin SUBDIR += vgba-bin SUBDIR += vice SUBDIR += virtualbox-ose SUBDIR += virtualbox-ose-additions SUBDIR += virtualbox-ose-additions-legacy SUBDIR += virtualbox-ose-additions-nox11 SUBDIR += virtualbox-ose-additions-nox11-legacy SUBDIR += virtualbox-ose-kmod SUBDIR += virtualbox-ose-kmod-legacy SUBDIR += virtualbox-ose-legacy SUBDIR += virtualbox-ose-nox11 SUBDIR += virtualbox-ose-nox11-legacy SUBDIR += visualboyadvance-m SUBDIR += vmips SUBDIR += vmsbackup SUBDIR += vmw SUBDIR += vt100 SUBDIR += vxtools SUBDIR += wine SUBDIR += wine-devel SUBDIR += wine-gecko SUBDIR += wine-gecko-devel SUBDIR += wine-mono SUBDIR += wine-mono-devel SUBDIR += wine-proton SUBDIR += winetricks SUBDIR += x16-emulator SUBDIR += x16-rom SUBDIR += x48 SUBDIR += x49gp SUBDIR += xbraitenberg SUBDIR += xcpc SUBDIR += xen-kernel SUBDIR += xhomer SUBDIR += xsystem35 SUBDIR += xzx SUBDIR += yaze-ag SUBDIR += yuzu SUBDIR += z80pack SUBDIR += zsnes .include diff --git a/emulators/rvvm/Makefile b/emulators/rvvm/Makefile new file mode 100644 index 000000000000..452ca690a17d --- /dev/null +++ b/emulators/rvvm/Makefile @@ -0,0 +1,79 @@ +PORTNAME= RVVM +DISTVERSIONPREFIX= v +DISTVERSION= 0.6 +CATEGORIES= emulators +MASTER_SITES= https://github.com/LekKit/patches-misc/releases/download/rvvm-uboot-2024.7/:fw \ + https://github.com/LekKit/riscv-tests/releases/download/rvvm-tests/:tests +DISTFILES= ${FWFILES:.bin=.bin:fw} riscv-tests.tar.gz:tests +DIST_SUBDIR= rvvm-${DISTVERSION} +EXTRACT_ONLY= ${DISTFILE_DEFAULT} + +MAINTAINER= fuz@FreeBSD.org +COMMENT= RISC-V Virtual Machine + +LICENSE= GPLv2 GPLv3 MPL20 +LICENSE_COMB= multi +LICENSE_FILE_GPLv3= ${WRKSRC}/LICENSE-GPL +LICENSE_FILE_MPL20= ${WRKSRC}/LICENSE-MPL +LICENSE_DISTFILES_GPLv2= ${FWFILES} +LICENSE_DISTFILES_GPLv3= ${DISTFILE_DEFAULT} +LICENSE_DISTFILES_MPL20= ${DISTFILE_DEFAULT} + +FLAVORS= x11 nox11 +FLAVOR?= ${FLAVORS:[1]} +nox11_PKGNAMESUFFIX= -nox11 + +USES= gmake localbase:ldflags +USE_GITHUB= yes +GH_ACCOUNT= LekKit +USE_LDCONFIG= yes + +BUILDDIR= ${WRKDIR}/.build +MAKE_ENV+= BUILDDIR=${BUILDDIR} +TEST_TARGET= test +SUB_FILES= pkg-message + +OPTIONS_DEFINE= FDT FPU JIT JNI SPINLOCK_DEBUG NET PCI RV64 +OPTIONS_DEFAULT= FDT FPU JIT JNI SPINLOCK_DEBUG NET PCI RV64 +FDT_DESC= enable automatic FDT generation +FPU_DESC= enable floating point (F/D) CPU extension +JIT_DESC= enable RVJIT accelerator +JNI_DESC= include native JNI bindings in shared librvvm +NET_DESC= enable unprivileged userland networking stack +PCI_DESC= enable PCI support in ATA, etc devices +RV64_DESC= enable riscv64 CPU support +SPINLOCK_DEBUG_DESC= enable deadlock debugging (minimal runtime overhead) + +FWFILES= fw_jump.bin fw_payload.bin + +.for o in ${OPTIONS_DEFINE} +$o_MAKE_ENV= USE_$o=1 +$o_MAKE_ENV_OFF= USE_$o=0 +.endfor + +.if ${FLAVOR} == x11 +MAKE_ENV+= USE_FB=1 USE_XSHM=1 +USES+= xorg +USE_XORG+= x11 xext +.else +MAKE_ENV+= USE_FB=0 USE_XSHM=0 +.endif + +.include + +.if defined(WITH_DEBUG) +MAKE_ENV+= USE_DEBUG=1 +.endif + +post-install: + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/rvvm + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/librvvm.so + ${MKDIR} ${STAGEDIR}${DATADIR} +.for f in ${FWFILES} + ${INSTALL_DATA} ${_DISTDIR}/$f ${STAGEDIR}${DATADIR}/ +.endfor + +pre-test: + ${LN} -sf ${_DISTDIR}/riscv-tests.tar.gz ${BUILDDIR}/ + +.include diff --git a/emulators/rvvm/distinfo b/emulators/rvvm/distinfo new file mode 100644 index 000000000000..765e15982143 --- /dev/null +++ b/emulators/rvvm/distinfo @@ -0,0 +1,9 @@ +TIMESTAMP = 1737591303 +SHA256 (rvvm-0.6/fw_jump.bin) = 60f5aedaf90be271eef9e4f1a479171c183987f97f86208811e9212b121d5b45 +SIZE (rvvm-0.6/fw_jump.bin) = 136776 +SHA256 (rvvm-0.6/fw_payload.bin) = d97321ca71be85a98dcc1757b721616d6ed68304afe853336273cb19b424da6c +SIZE (rvvm-0.6/fw_payload.bin) = 2958016 +SHA256 (rvvm-0.6/riscv-tests.tar.gz) = f0e888a8db158b1e82ac09cebd01d8e1d5913477d1515c41286fae5e309e5322 +SIZE (rvvm-0.6/riscv-tests.tar.gz) = 87062 +SHA256 (rvvm-0.6/LekKit-RVVM-v0.6_GH0.tar.gz) = 97e98c95d8785438758b81fb5c695b8eafb564502c6af7f52555b056e3bb7d7a +SIZE (rvvm-0.6/LekKit-RVVM-v0.6_GH0.tar.gz) = 313342 diff --git a/emulators/rvvm/files/patch-Makefile b/emulators/rvvm/files/patch-Makefile new file mode 100644 index 000000000000..2962262b0bb5 --- /dev/null +++ b/emulators/rvvm/files/patch-Makefile @@ -0,0 +1,75 @@ +--- Makefile.orig 2024-03-18 16:11:18 UTC ++++ Makefile +@@ -33,7 +33,7 @@ BOLD := $(shell tput md $(NULL_STDERR) || tput bo + SPACE := + ifneq (,$(TERM)) + BOLD := $(shell tput md $(NULL_STDERR) || tput bold $(NULL_STDERR) || printf "\033[1m" $(NULL_STDERR)) +-RESET := $(shell tput me $(NULL_STDERR) || tput sgr0 $(NULL_STDERR) || printf "\033[0m" $(NULL_STDERR))$(BOLD) ++RESET := $(shell tput me $(NULL_STDERR) || tput sgr0 $(NULL_STDERR) || printf "\033[0m" $(NULL_STDERR)) + RED := $(shell tput AF 1 $(NULL_STDERR) || tput setaf 1 $(NULL_STDERR) || printf "\033[31m" $(NULL_STDERR))$(BOLD) + GREEN := $(shell tput AF 2 $(NULL_STDERR) || tput setaf 2 $(NULL_STDERR) || printf "\033[32m" $(NULL_STDERR))$(BOLD) + YELLOW := $(shell tput AF 3 $(NULL_STDERR) || tput setaf 3 $(NULL_STDERR) || printf "\033[33m" $(NULL_STDERR))$(BOLD) +@@ -231,8 +231,8 @@ endif + + # Warning options (Strict safety/portability, stack/object size limits) + # -Wbad-function-cast, -Wcast-align, -Wdouble-promotion need fixes in codebase +-WARN_OPTS := -Wall -Wextra -Wshadow -Wvla -Wpointer-arith -Walloca -Wduplicated-cond \ +--Wtrampolines -Wlarger-than=1048576 -Wframe-larger-than=32768 -Werror=return-type ++WARN_OPTS := -Wall -Wextra -Wshadow -Wvla -Wpointer-arith -Walloca \ ++-Wlarger-than=1048576 -Wframe-larger-than=32768 -Werror=return-type + + # Compiler-specific options + ifeq ($(CC_TYPE),gcc) +@@ -467,13 +467,11 @@ endif + endif + + # Do not pass lib-related flags for dev/cli/test builds (Faster) +-ifneq (,$(findstring lib, $(MAKECMDGOALS))$(findstring install, $(MAKECMDGOALS))) + override CFLAGS += -DUSE_LIB -fPIC -ffat-lto-objects + # Build JNI bindings inside librvvm dynlib + ifeq ($(USE_JNI),1) + SRC += $(SRCDIR)/bindings/jni/rvvm_jni.c + endif +-endif + + # CPU interpreter sources + SRC += $(wildcard $(SRCDIR)/cpu/riscv_*.c) +@@ -583,10 +581,10 @@ test: $(BINARY) + @echo + @echo "[$(YELLOW)INFO$(RESET)] Running RISC-V Tests (RV32)" + @echo +- @for file in $(BUILDDIR)/riscv-tests/rv32*.bin; do \ ++ @for file in $(BUILDDIR)/riscv-tests/rv32*; do \ + result=$$($(BINARY) $$file -nogui -rv32 | tr -d '\0'); \ + result="$${result##* }"; \ +- if [[ "$$result" == "0" ]]; then \ ++ if [ "$$result" -eq "0" ]; then \ + echo "[$(GREEN)PASS$(RESET)] $$file"; \ + else \ + echo "[$(RED)FAIL: $$result$(RESET)] $$file"; \ +@@ -596,10 +594,10 @@ ifeq ($(USE_RV64),1) + @echo + @echo "[$(YELLOW)INFO$(RESET)] Running RISC-V Tests (RV64)" + @echo +- @for file in $(BUILDDIR)/riscv-tests/rv64*.bin; do \ ++ @for file in $(BUILDDIR)/riscv-tests/rv64*; do \ + result=$$($(BINARY) $$file -nogui -rv64 | tr -d '\0'); \ + result="$${result##* }"; \ +- if [[ "$$result" == "0" ]]; then \ ++ if [ "$$result" -eq "0" ]; then \ + echo "[$(GREEN)PASS$(RESET)] $$file"; \ + else \ + echo "[$(RED)FAIL: $$result$(RESET)] $$file"; \ +@@ -647,11 +645,10 @@ ifeq ($(HOST_POSIX),1) + @install -Dm755 $(BINARY) $(DESTDIR)$(bindir)/rvvm + @install -Dm755 $(SHARED) $(DESTDIR)$(libdir)/librvvm$(LIB_EXT) + @install -Dm644 $(STATIC) $(DESTDIR)$(libdir)/librvvm_static.a ++ @install -d $(DESTDIR)$(includedir)/rvvm + @install -Dm644 $(SRCDIR)/rvvmlib.h $(DESTDIR)$(includedir)/rvvm/rvvmlib.h + @install -Dm644 $(SRCDIR)/fdtlib.h $(DESTDIR)$(includedir)/rvvm/fdtlib.h + @install -Dm644 $(SRCDIR)/devices/*.h $(DESTDIR)$(includedir)/rvvm/ +- @install -d $(DESTDIR)$(datadir)/licenses/rvvm/ +- @install -Dm644 LICENSE* $(DESTDIR)$(datadir)/licenses/rvvm/ + else + @echo "[$(RED)WARN$(RESET)] Unsupported on non-POSIX!" + endif diff --git a/emulators/rvvm/files/pkg-message.in b/emulators/rvvm/files/pkg-message.in new file mode 100644 index 000000000000..114244484781 --- /dev/null +++ b/emulators/rvvm/files/pkg-message.in @@ -0,0 +1,11 @@ +RVVM has been installed. + +To execute a disk image, run + + rvvm %%DATADIR%%/fw_payload.bin [flags] -i $disk.img + +To execute a custom kernel payload, run + + rvvm %%DATADIR%%/fw_jump.bin [flags] -k $kernel.bin + +For further details, execute rvvm --help. diff --git a/emulators/rvvm/pkg-descr b/emulators/rvvm/pkg-descr new file mode 100644 index 000000000000..735272afc3e3 --- /dev/null +++ b/emulators/rvvm/pkg-descr @@ -0,0 +1,5 @@ +RVVM is a virtual machine / emulator for RISC-V guests, which emphasizes +on performance, security, lean code and portability. It already runs a +lot of guest operating systems, including Linux, Haiku, FreeBSD, +OpenBSD, etc. It also aims to run RISC-V applications on a foreign-arch +host without full OS guest & isolation (Userland emulation). diff --git a/emulators/rvvm/pkg-plist b/emulators/rvvm/pkg-plist new file mode 100644 index 000000000000..a7c8a02ef60c --- /dev/null +++ b/emulators/rvvm/pkg-plist @@ -0,0 +1,30 @@ +bin/rvvm +include/rvvm/ata.h +include/rvvm/chardev.h +include/rvvm/clint.h +include/rvvm/eth-oc.h +include/rvvm/fb_window.h +include/rvvm/fdtlib.h +include/rvvm/framebuffer.h +include/rvvm/gpio-sifive.h +include/rvvm/gpio_api.h +include/rvvm/hid_api.h +include/rvvm/hid_dev.h +include/rvvm/i2c-hid.h +include/rvvm/i2c-oc.h +include/rvvm/mtd-physmap.h +include/rvvm/ns16550a.h +include/rvvm/nvme.h +include/rvvm/pci-bus.h +include/rvvm/plic.h +include/rvvm/ps2-altera.h +include/rvvm/rtc-ds1742.h +include/rvvm/rtc-goldfish.h +include/rvvm/rtl8169.h +include/rvvm/rvvmlib.h +include/rvvm/syscon.h +include/rvvm/tap_api.h +lib/librvvm.so +lib/librvvm_static.a +%%DATADIR%%/fw_jump.bin +%%DATADIR%%/fw_payload.bin