commit d86f6f86d2eef472b90b0af22f14fedaa5d5d1dd from: Benjamin Stürz date: Sat Apr 06 22:33:22 2024 UTC More fixed for FreeBSD commit - ced16aa55e52023a094d3d6a2e81fea56f8581ca commit + d86f6f86d2eef472b90b0af22f14fedaa5d5d1dd blob - 4b63d49e1e5befeeb826ae9072beb5b17c037060 blob + 70acdc8191b7256df605aae4d6f6ac74fa4f4533 --- Makefile +++ Makefile @@ -3,7 +3,7 @@ PREFIX = /usr/local TARGET = riscv64-unknown-linux-musl -HOSTOS != uname +HOSTOS != if test -e 'config.mk.local'; then echo 'local'; else uname; fi CROSS = ./tools/bin/${TARGET} CONFIG = config.mk.${HOSTOS} @@ -31,7 +31,7 @@ run: rvemu ${PROGS} cp -f rvemu rootfs/bin cp -f ${PROGS} rootfs/bin cp -f test.txt rootfs/ - ${SUDO} chroot rootfs /bin/rvemu /bin/$T.elf + ${CHROOT} rootfs /bin/rvemu /bin/$T.elf distclean: clean (cd tools; ${MAKE} distclean) blob - b1b92eef4c8ca5b2367f60027a2e806d3c5afd3f blob + 3638b0aa96da0d0ecade59d2ffcc1ea4c8370468 --- config.mk.FreeBSD +++ config.mk.FreeBSD @@ -1,3 +1,4 @@ SUDO = sudo CFLAGS_OS = LDFLAGS_OS = -static +CHROOT = chroot -n blob - fe3046e7f083f5a16ad5a213697b4accf19607bd blob + 0b125230da6106a01d68309ff67be182912064e8 --- config.mk.OpenBSD +++ config.mk.OpenBSD @@ -1,3 +1,4 @@ SUDO = doas CFLAGS_OS = -fPIC LDFLAGS_OS = -pie -static +CHROOT = ${SUDO} chroot blob - 5854ca099f96147330e611adc8d81f8150914174 blob + b2820cb92338ed9fca5224d5a138323dc27d6cf7 --- src/rvemu.c +++ src/rvemu.c @@ -29,7 +29,7 @@ static void load_segment (int fd, Elf64_Phdr phdr) addr, len, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON, + MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0 ); @@ -121,7 +121,7 @@ static void setup_stack ( stack_bottom, stack_size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON | MAP_STACK, + MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0 );