--- src/VBox/Runtime/Makefile.kmk.orig 2020-07-10 02:57:23.000000000 +1000 +++ src/VBox/Runtime/Makefile.kmk 2020-08-22 12:25:14.280571000 +1000 @@ -173,6 +173,12 @@ # +# Set the defines that utf8-posix.cpp needs. It's used by several targets. +# +r3/posix/utf8-posix.cpp_DEFS.bsdsunix = $(VBOX_ICONV_DEFS) NON_CONST_ICONV_INPUT +r3/posix/utf8-posix.cpp_DEFS.freebsd = $(VBOX_ICONV_DEFS) + +# # Unicode Specification reader used to regenerate unidata-*.cpp. # uniread_TEMPLATE = VBoxBldProg @@ -769,7 +775,7 @@ RuntimeR3_SOURCES += \ common/err/errmsgxpcom.cpp endif -if1of ($(KBUILD_TARGET),freebsd linux netbsd openbsd solaris) +if1of ($(KBUILD_TARGET),bsdsunix freebsd linux netbsd openbsd solaris) RuntimeR3_SOURCES += \ $(if $(VBOX_WITH_DBUS),VBox/dbus.cpp,) endif @@ -1127,6 +1133,86 @@ RuntimeR3_SOURCES.darwin.amd64 += common/string/memrchr.asm ## @todo Make BSD sched, implement RTMP*. +RuntimeR3_SOURCES.bsdsunix = \ + generic/cdrom-generic.cpp \ + generic/RTCrStoreCreateSnapshotById-generic.cpp \ + generic/RTDirQueryInfo-generic.cpp \ + generic/RTDirSetTimes-generic.cpp \ + generic/RTFileMove-generic.cpp \ + generic/RTFileSetAllocationSize-generic.cpp \ + generic/RTLogWriteDebugger-generic.cpp \ + generic/RTPathAbs-generic.cpp \ + generic/RTPathGetCurrentOnDrive-generic.cpp \ + generic/RTSemEventMultiWait-2-ex-generic.cpp \ + generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \ + generic/RTSystemQueryDmiString-generic.cpp \ + generic/RTSystemShutdown-generic.cpp \ + generic/RTThreadGetAffinity-stub-generic.cpp \ + generic/RTThreadSetAffinity-stub-generic.cpp \ + generic/RTThreadSetAffinityToCpu-generic.cpp \ + generic/RTTimeLocalNow-generic.cpp \ + generic/RTTimerCreate-generic.cpp \ + generic/RTUuidCreate-generic.cpp \ + generic/mppresent-generic.cpp \ + generic/sched-generic.cpp \ + generic/utf16locale-generic.cpp \ + generic/uuid-generic.cpp \ + generic/RTMpCpuId-generic.cpp \ + generic/RTMpGetCoreCount-generic.cpp \ + generic/RTMpGetOnlineCoreCount-generic.cpp \ + generic/RTProcDaemonize-generic.cpp \ + generic/RTProcIsRunningByName-generic.cpp \ + generic/RTThreadGetNativeState-generic.cpp \ + r3/bsdsunix/mp-bsdsunix.cpp \ + r3/bsdsunix/systemmem-bsdsunix.cpp \ + r3/bsdsunix/rtProcInitExePath-bsdsunix.cpp \ + r3/generic/allocex-r3-generic.cpp \ + r3/generic/RTLocaleQueryLocaleName-r3-generic.cpp \ + r3/generic/RTLocaleQueryNormalizedBaseLocaleName-r3-generic.cpp \ + r3/generic/RTLocaleQueryUserCountryCode-r3-generic.cpp \ + r3/generic/RTTimeZoneGetCurrent-generic.cpp \ + r3/generic/dirrel-r3-generic.cpp \ + r3/posix/RTFileQueryFsSizes-posix.cpp \ + r3/posix/RTHandleGetStandard-posix.cpp \ + r3/posix/RTMemProtect-posix.cpp \ + r3/posix/RTPathUserHome-posix.cpp \ + r3/posix/RTSystemQueryOSInfo-posix.cpp \ + r3/posix/RTTimeNow-posix.cpp \ + r3/posix/RTTimeSet-posix.cpp \ + r3/posix/dir-posix.cpp \ + r3/posix/env-posix.cpp \ + r3/posix/errvars-posix.cpp \ + r3/posix/fileio-posix.cpp \ + r3/posix/fileio2-posix.cpp \ + r3/posix/filelock-posix.cpp \ + r3/posix/fs-posix.cpp \ + r3/posix/fs2-posix.cpp \ + r3/posix/fs3-posix.cpp \ + r3/posix/ldrNative-posix.cpp \ + r3/posix/localipc-posix.cpp \ + r3/posix/rtmempage-exec-mmap-heap-posix.cpp \ + r3/posix/path-posix.cpp \ + r3/posix/path2-posix.cpp \ + r3/posix/pathhost-posix.cpp \ + r3/posix/RTPathUserDocuments-posix.cpp \ + r3/posix/pipe-posix.cpp \ + r3/posix/process-posix.cpp \ + r3/posix/process-creation-posix.cpp \ + r3/posix/rand-posix.cpp \ + r3/posix/semevent-posix.cpp \ + r3/posix/semeventmulti-posix.cpp \ + r3/posix/semmutex-posix.cpp \ + r3/posix/semrw-posix.cpp \ + r3/posix/symlink-posix.cpp \ + r3/posix/thread-posix.cpp \ + r3/posix/thread2-posix.cpp \ + r3/posix/time-posix.cpp \ + r3/posix/timelocal-posix.cpp \ + r3/posix/timer-posix.cpp \ + r3/posix/tls-posix.cpp \ + r3/posix/utf8-posix.cpp + +## @todo Make BSD sched, implement RTMP*. RuntimeR3_SOURCES.freebsd = \ generic/cdrom-generic.cpp \ generic/RTCrStoreCreateSnapshotById-generic.cpp \ @@ -1633,6 +1719,8 @@ r3/posix/fileaio-posix.cpp VBoxRT_SOURCES.freebsd += \ r3/freebsd/fileaio-freebsd.cpp +VBoxRT_SOURCES.bsdsunix += \ + r3/bsdsunix/fileaio-bsdsunix.cpp VBoxRT_INCS := $(RuntimeR3_INCS) VBoxRT_INCS.$(KBUILD_TARGET) := $(RuntimeR3_INCS.$(KBUILD_TARGET)) VBoxRT_INCS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) := $(RuntimeR3_INCS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) @@ -1664,6 +1752,9 @@ crypt VBoxRT_LIBS.darwin = \ iconv +VBoxRT_LIBS.bsdsunix = \ + iconv \ + rt VBoxRT_LIBS.freebsd = \ iconv \ rt @@ -1810,6 +1901,9 @@ crypt VBoxRT-x86_LIBS.darwin = \ iconv +VBoxRT-x86_LIBS.bsdsunix = \ + iconv \ + rt VBoxRT-x86_LIBS.freebsd = \ iconv \ rt @@ -2000,7 +2094,7 @@ \ $(RuntimeNoCrt_SOURCES) -if1of ($(KBUILD_TARGET), darwin solaris freebsd os2) +if1of ($(KBUILD_TARGET), darwin solaris bsdsunix freebsd os2) RuntimeR0_SOURCES += \ common/math/gcc/adddi3.c \ common/math/gcc/anddi3.c \ @@ -2094,6 +2188,8 @@ RuntimeR0Drv_DEFS.darwin= IN_SUP_R0 LDR_ONLY_MACHO IPRT_WITHOUT_DIGEST_MD4 IN_RING0_DRV_ON_DARWIN RuntimeR0Drv_INCS := $(PATH_SUB_CURRENT) include +RuntimeR0Drv_INCS.bsdsunix = \ + $(PATH_STAGE)/gen-sys-hdrs RuntimeR0Drv_INCS.freebsd = \ $(PATH_STAGE)/gen-sys-hdrs RuntimeR0Drv_INCS.solaris = \ @@ -2606,6 +2702,43 @@ common/math/gcc/umoddi3.c \ common/math/gcc/xordi3.c +RuntimeR0Drv_SOURCES.bsdsunix = \ + common/misc/thread.cpp \ + common/string/memchr.asm \ + common/string/memmove.asm \ + common/string/strpbrk.cpp \ + common/string/memcmp.asm \ + common/string/strchr.asm \ + generic/RTAssertShouldPanic-generic.cpp \ + generic/RTLogWriteDebugger-generic.cpp \ + generic/RTLogWriteStdOut-stub-generic.cpp \ + generic/RTMpOnPair-generic.cpp \ + generic/RTTimerCreate-generic.cpp \ + generic/mppresent-generic.cpp \ + generic/rtStrFormatKernelAddress-generic.cpp \ + r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp \ + r0drv/generic/mpnotification-r0drv-generic.cpp \ + r0drv/generic/threadctxhooks-r0drv-generic.cpp \ + r0drv/bsdsunix/alloc-r0drv-bsdsunix.c \ + r0drv/bsdsunix/assert-r0drv-bsdsunix.c \ + r0drv/bsdsunix/initterm-r0drv-bsdsunix.c \ + r0drv/bsdsunix/memobj-r0drv-bsdsunix.c \ + r0drv/bsdsunix/memuserkernel-r0drv-bsdsunix.c \ + r0drv/bsdsunix/process-r0drv-bsdsunix.c \ + r0drv/bsdsunix/semevent-r0drv-bsdsunix.c \ + r0drv/bsdsunix/semeventmulti-r0drv-bsdsunix.c \ + r0drv/bsdsunix/semfastmutex-r0drv-bsdsunix.c \ + r0drv/bsdsunix/semmutex-r0drv-bsdsunix.c \ + r0drv/bsdsunix/spinlock-r0drv-bsdsunix.c \ + r0drv/bsdsunix/thread-r0drv-bsdsunix.c \ + r0drv/bsdsunix/thread2-r0drv-bsdsunix.c \ + r0drv/bsdsunix/time-r0drv-bsdsunix.c \ + r0drv/bsdsunix/mp-r0drv-bsdsunix.c \ + generic/timer-generic.cpp \ + r0drv/alloc-ef-r0drv.cpp \ + r0drv/memobj-r0drv.cpp \ + r0drv/powernotification-r0drv.c + RuntimeR0Drv_SOURCES.freebsd = \ common/misc/thread.cpp \ common/string/memchr.asm \ @@ -2744,6 +2877,11 @@ ## PORTME: Porters create and add their selection of platform specific Ring-0 Driver files here. +RuntimeR0Drv_ORDERDEPS.bsdsunix = \ + $(PATH_STAGE)/gen-sys-hdrs/bus_if.h \ + $(PATH_STAGE)/gen-sys-hdrs/device_if.h + + RuntimeR0Drv_ORDERDEPS.freebsd = \ $(PATH_STAGE)/gen-sys-hdrs/bus_if.h \ $(PATH_STAGE)/gen-sys-hdrs/device_if.h @@ -2854,7 +2992,7 @@ RuntimeRC_SOURCES += os2/sys0.asm endif - if1of ($(KBUILD_TARGET), darwin solaris freebsd os2) + if1of ($(KBUILD_TARGET), darwin solaris bsdsunix freebsd os2) RuntimeRC_SOURCES += \ common/math/gcc/adddi3.c \ common/math/gcc/anddi3.c \ @@ -3030,6 +3168,46 @@ $(QUIET)$(CP) --changed -fv $(IPRT_OUT_DIR)/errmsgvboxcomdata.h.ts $(IPRT_OUT_DIR)/errmsgvboxcomdata.h +if "$(KBUILD_TARGET)" == "bsdsunix" +# +# BSDSUniXGeneratedKernelHeaders - Generate some kernel interface headers. +# +# These are used by: +# - The RTMp* API in IPRT. +# - VBoxGuest +# +# Note! We cannot give a output path to the awk program, it will always +# generate the header next to the source. So, we'll have to temporarily copy +# the source file to the destination directory to work. +# +VBOX_AWK := /usr/bin/awk +INSTALLS += BSDSUniXGeneratedKernelHeaders +BSDSUniXGeneratedKernelHeaders_INST = gen-sys-hdrs/ +BSDSUniXGeneratedKernelHeaders_SOURCES = \ + $(BSDSUniXGeneratedKernelHeaders_0_OUTDIR)/bus_if.h \ + $(BSDSUniXGeneratedKernelHeaders_0_OUTDIR)/device_if.h \ + $(BSDSUniXGeneratedKernelHeaders_0_OUTDIR)/pci_if.h +BSDSUniXGeneratedKernelHeaders_CLEAN = $(BSDSUniXGeneratedKernelHeaders_SOURCES) + +$$(BSDSUniXGeneratedKernelHeaders_0_OUTDIR)/bus_if.h: $(VBOX_BSDSUNIX_SRC)/kern/bus_if.m | $$(dir $$@) + $(call MSG_TOOL,awk,BSDSUniXGeneratedKernelHeaders,$<,$@) + $(QUIET)$(CP) -f $< $(@D)/bus_if.m + $(QUIET)$(VBOX_AWK) -f $(VBOX_BSDSUNIX_SRC)/tools/makeobjops.awk $(@D)/bus_if.m -h -p + $(QUIET)$(RM) $(@D)/bus_if.m + +$$(BSDSUniXGeneratedKernelHeaders_0_OUTDIR)/device_if.h: $(VBOX_BSDSUNIX_SRC)/kern/device_if.m | $$(dir $$@) + $(call MSG_TOOL,awk,BSDSUniXGeneratedKernelHeaders,$<,$@) + $(QUIET)$(CP) -f $< $(@D)/device_if.m + $(QUIET)$(VBOX_AWK) -f $(VBOX_BSDSUNIX_SRC)/tools/makeobjops.awk $(@D)/device_if.m -h -p + $(QUIET)$(RM) $(@D)/device_if.m + +$$(BSDSUniXGeneratedKernelHeaders_0_OUTDIR)/pci_if.h: $(VBOX_BSDSUNIX_SRC)/dev/pci/pci_if.m | $$(dir $$@) + $(call MSG_TOOL,awk,BSDSUniXGeneratedKernelHeaders,$<,$@) + $(QUIET)$(CP) -f $< $(@D)/pci_if.m + $(QUIET)$(VBOX_AWK) -f $(VBOX_BSDSUNIX_SRC)/tools/makeobjops.awk $(@D)/pci_if.m -h -p + $(QUIET)$(RM) $(@D)/pci_if.m +endif # BSDSUniX + if "$(KBUILD_TARGET)" == "freebsd" # # FreeBSDGeneratedKernelHeaders - Generate some kernel interface headers.