VirtualBox

Changeset 7517 in vbox


Ignore:
Timestamp:
Mar 22, 2008 11:15:44 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28986
Message:

Additions/FreeBSD: initial commit

Mostly tested on FreeBSD 7.0.

Working: the additions kernel module

VBoxService (working on FreeBSD 6.2 too)
vboxvideo

Partially working: vboxmouse - 100% CPU usage and clicking does not work yet
Not tested: xclient
TODO: shared folder module is currently a stub

Installer and startup scripts

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuest.h

    r7464 r7517  
    6767/** device name */
    6868# define VBOXGUEST_DEVICE_NAME_DOS    L"\\DosDevices\\VBoxGuest"
     69
     70#elif defined(RT_OS_FREEBSD)
     71/** The support device name. */
     72# define VBOXGUEST_DEVICE_NAME        "/dev/vboxguest"
    6973
    7074#else
     
    10151019# define VBOXGUEST_IOCTL_STRIP_SIZE(Code)       VBOXGUEST_IOCTL_CODE(_IOC_NR((Code)), 0)
    10161020
    1017 #elif 0 /* BSD style - needs some adjusting since _IORW takes a type and not a size. */
     1021#elif defined(RT_OS_FREEBSD)
    10181022# include <sys/ioccom.h>
    1019 # define VBOXGUEST_IOCTL_CODE(Function, Size)   _IORW('V', (Function) | VBOXGUEST_IOCTL_FLAG, (Size))
     1023
     1024# define VBOXGUEST_IOCTL_CODE(Function, Size)   _IOWR('V', (Function) | VBOXGUEST_IOCTL_FLAG, VBGLBIGREQ)
    10201025# define VBOXGUEST_IOCTL_CODE_FAST(Function)    _IO(  'V', (Function) | VBOXGUEST_IOCTL_FLAG)
    10211026# define VBOXGUEST_IOCTL_STRIP_SIZE(Code)       IOCBASECMD(Code)
  • trunk/src/VBox/Additions/Makefile.kmk

    r7229 r7517  
    5353 VBOX_WITH_ADDITIONS_ISO.solaris.x86 = 1
    5454endif
     55ifeq ($(BUILD_TARGET),freebsd)
     56 VBOX_WITH_ADDITIONS_ISO.freebsd.x86 = 1
     57endif
    5558
    5659# Include sub-makefiles.
     
    6770ifeq ($(BUILD_TARGET),solaris)
    6871 include $(PATH_SUB_CURRENT)/solaris/Makefile.kmk
     72endif
     73ifeq ($(BUILD_TARGET),freebsd)
     74 include $(PATH_SUB_CURRENT)/freebsd/Makefile.kmk
    6975endif
    7076
     
    170176endif
    171177
     178#
     179# The x86 FreeBSD .iso file spec.
     180#
     181ifdef VBOX_WITH_ADDITIONS_ISO.freebsd.x86
     182 ifdef VBOX_ONLY_ADDITIONS
     183  VBOX_PATH_ADDITIONS.freebsd.x86 = $(PATH_OUT_BASE)/freebsd.x86/$(BUILD_TYPE)/bin/additions
     184 else
     185  # 32-bit only hack
     186  VBOX_PATH_ADDITIONS.freebsd.x86 = $(VBOX_PATH_ADDITIONS)
     187 endif
     188 GUESTADDITIONS_FILESPEC.freebsd.x86 = \
     189        VBoxFreeBSDAdditions.tbz=$(VBOX_PATH_ADDITIONS.freebsd.x86)/VBoxFreeBSDAdditions.tbz
     190endif
    172191
    173192#
     
    192211                $(GUESTADDITIONS_FILESPEC.linux.x86) \
    193212                $(GUESTADDITIONS_FILESPEC.solaris.x86) \
    194                 $(GUESTADDITIONS_FILESPEC.os2.x86)
    195 endif
    196 
    197 
     213                $(GUESTADDITIONS_FILESPEC.os2.x86) \
     214                $(GUESTADDITIONS_FILESPEC.freebsd.x86)
     215endif
     216
     217
  • trunk/src/VBox/Additions/common/Makefile.kmk

    r6138 r7517  
    2222# Include sub-makefile.
    2323include $(PATH_SUB_CURRENT)/VBoxGuestLib/Makefile.kmk
    24 if1of ($(BUILD_TARGET),os2 solaris)
     24if1of ($(BUILD_TARGET),os2 solaris freebsd)
    2525include $(PATH_SUB_CURRENT)/VBoxGuest/Makefile.kmk
    2626include $(PATH_SUB_CURRENT)/VBoxService/Makefile.kmk
  • trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk

    r6711 r7517  
    8282        $(VBOX_LIB_VBGL_R0BASE) \
    8383        $(VBOX_LIB_IPRT_GUEST_R0)
    84  
     84
     85else if1of ($(BUILD_TARGET),freebsd)
     86 #
     87 # vboxguest - The Guest Additions Driver
     88 #
     89
     90 SYSMODS.freebsd        += vboxguest
     91 vboxguest_TEMPLATE      = VBOXGUESTR0
     92 vboxguest_DEFS          = VBGL_VBOXGUEST VBOX_HGCM
     93 vboxguest_INCS          = \
     94        $(PATH_SUB_CURRENT) \
     95        $(PATH_TARGET)
     96 vboxguest_DEPS          = \
     97        $(PATH_TARGET)/pci_if.h \
     98        $(PATH_TARGET)/bus_if.h \
     99        $(PATH_TARGET)/device_if.h
     100 vboxguest_SOURCES       = \
     101        VBoxGuest-$(BUILD_TARGET).c \
     102        VBoxGuest.cpp
     103 vboxguest_LIBS          = \
     104        $(VBOX_LIB_VBGL_R0BASE) \
     105        $(VBOX_LIB_IPRT_GUEST_R0)
     106 vboxguest_CLEAN        += \
     107        $(PATH_TARGET)/pci_if.h \
     108        $(PATH_TARGET)/bus_if.h \
     109        $(PATH_TARGET)/device_if.h
     110
     111 # We need to generate some headers with awk to make building work
     112 VBOX_AWKCMD := /usr/bin/awk
     113
     114 # We cannot give a path to the awk program where the header should be generated but can only
     115 # make it produce the header at the location of the source file rather than in the current directory.
     116 # Thatshwy we copy the source file to the destination of the header first and execute the program with the copied file
     117 # afterwards.
     118 $(PATH_TARGET)/bus_if.h: $(VBOX_FREEBSD_SRC)/kern/bus_if.m
     119        $(call MSG_TOOL,awk,VBoxGuest,$<,$@)
     120        $(QUIET)$(CP) -f $(VBOX_FREEBSD_SRC)/kern/bus_if.m $(PATH_TARGET)/bus_if.m
     121        $(QUIET)$(VBOX_AWKCMD) -f $(VBOX_FREEBSD_SRC)/tools/makeobjops.awk $(PATH_TARGET)/bus_if.m -h -p
     122        $(QUIET)$(RM) $(PATH_TARGET)/bus_if.m
     123
     124 $(PATH_TARGET)/device_if.h: $(VBOX_FREEBSD_SRC)/kern/device_if.m
     125        $(call MSG_TOOL,awk,VBoxGuest,$<,$@)
     126        $(QUIET)$(CP) -f $(VBOX_FREEBSD_SRC)/kern/device_if.m $(PATH_TARGET)/device_if.m
     127        $(QUIET)$(VBOX_AWKCMD) -f $(VBOX_FREEBSD_SRC)/tools/makeobjops.awk $(PATH_TARGET)/device_if.m -h -p
     128        $(QUIET)$(RM) $(PATH_TARGET)/device_if.m
     129
     130 $(PATH_TARGET)/pci_if.h: $(VBOX_FREEBSD_SRC)/dev/pci/pci_if.m
     131        $(call MSG_TOOL,awk,VBoxGuest,$<,$@)
     132        $(QUIET)$(CP) -f $(VBOX_FREEBSD_SRC)/dev/pci/pci_if.m $(PATH_TARGET)/pci_if.m
     133        $(QUIET)$(VBOX_AWKCMD) -f $(VBOX_FREEBSD_SRC)/tools/makeobjops.awk $(PATH_TARGET)/pci_if.m -h -p
     134        $(QUIET)$(RM) $(PATH_TARGET)/pci_if.m
     135
    85136endif
    86137
  • trunk/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp

    r6020 r7517  
    5858    }
    5959
    60 #elif defined(RT_OS_LINUX)
     60#elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
    6161    NOREF(ppvCtx);
    6262    NOREF(pv);
     
    9292    }
    9393
    94 #elif defined(RT_OS_LINUX)
     94#elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
    9595    NOREF(pvCtx);
    9696
     
    138138extern DECLVBGL(int) VBoxGuestSolarisServiceCall (void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
    139139__END_DECLS
     140
     141#elif defined (RT_OS_FREEBSD)
     142__BEGIN_DECLS
     143extern DECLVBGL(void *) VBoxGuestFreeBSDServiceOpen (uint32_t *pu32Version);
     144extern DECLVBGL(void) VBoxGuestFreeBSDServiceClose (void *pvOpaque);
     145extern DECLVBGL(int) VBoxGuestFreeBSDServiceCall (void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
     146__END_DECLS
     147
    140148#endif
    141149
     
    194202    if (    pDriver->pvOpaque
    195203        &&  u32VMMDevVersion == VMMDEV_VERSION)
     204        return VINF_SUCCESS;
     205
     206    Log(("vbglDriverOpen: failed\n"));
     207    return VERR_FILE_NOT_FOUND;
     208
     209#elif defined (RT_OS_FREEBSD)
     210    uint32_t u32VMMDevVersion;
     211    pDriver->pvOpaque = VBoxGuestFreeBSDServiceOpen(&u32VMMDevVersion);
     212    if (pDriver->pvOpaque && (u32VMMDevVersion == VMMDEV_VERSION))
    196213        return VINF_SUCCESS;
    197214
     
    260277    return VBoxGuestSolarisServiceCall(pDriver->pvOpaque, u32Function, pvData, cbData, NULL);
    261278
     279#elif defined (RT_OS_FREEBSD)
     280    return VBoxGuestFreeBSDServiceCall(pDriver->pvOpaque, u32Function, pvData, cbData, NULL);
     281
    262282#else
    263283# error "Port me"
     
    280300    VBoxGuestSolarisServiceClose (pDriver->pvOpaque);
    281301
     302#elif defined (RT_OS_FREEBSD)
     303    VBoxGuestFreeBSDServiceClose(pDriver->pvOpaque);
     304
    282305#else
    283306# error "Port me"
  • trunk/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h

    r6020 r7517  
    5757#elif defined (RT_OS_SOLARIS)
    5858    void *pvOpaque;
     59#elif defined (RT_OS_FREEBSD)
     60    void *pvOpaque;
    5961#else
    6062# error "Port me"
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp

    r6569 r7517  
    2424# define INCL_ERRORS
    2525# include <os2.h>
    26 #elif defined(RT_OS_SOLARIS)
     26#elif defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
    2727# include <sys/types.h>
    2828# include <sys/stat.h>
     
    226226    return RTErrConvertFromOS2(rc);
    227227
    228 #elif defined(RT_OS_SOLARIS)
     228#elif defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
    229229    VBGLBIGREQ Hdr;
    230230    Hdr.u32Magic = VBGLBIGREQ_MAGIC;
     
    244244    /* PORTME - This is preferred over the RTFileIOCtl variant below, just be careful with the (int). */
    245245/** @todo test status code passing! */
     246   
    246247    int rc = xf86ioctl(g_File, iFunction, pvData);
    247248    if (rc == -1)
  • trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk

    r6469 r7517  
    4343        $(VBOX_LIB_IPRT_GUEST_R3) \
    4444        $(VBOX_LIB_VBGL_R3)
    45 
     45VBoxService_LIBS.freebsd = \
     46        iconv
     47VBoxService_LIBPATH.freebsd = \
     48        /usr/local/lib
    4649include $(PATH_KBUILD)/subfooter.kmk
    4750
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h

    r6136 r7517  
    9393extern int VBoxServiceArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32, uint32_t u32Min, uint32_t u32Max);
    9494
    95 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
     95#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
    9696extern int daemon(int, int);
    9797#endif
  • trunk/src/VBox/Additions/x11/Makefile.kmk

    r6756 r7517  
    2020
    2121# Include sub-makefiles.
    22 if1of ($(BUILD_TARGET),l4 linux solaris)
     22if1of ($(BUILD_TARGET),l4 linux solaris freebsd)
    2323 include $(PATH_SUB_CURRENT)/xclient/Makefile.kmk
    2424 include $(PATH_SUB_CURRENT)/xgraphics/Makefile.kmk
  • trunk/src/VBox/Additions/x11/x11include/1.3/xorg/xf86Modes.h

    r6499 r7517  
    3030
    3131#include <stddef.h>
     32/* Including this header results in compiler errors on FreeBSD */
     33#ifndef RT_OS_FREEBSD
    3234#include <string.h>
     35#endif
    3336#include <stdio.h>
    3437
  • trunk/src/VBox/Additions/x11/x11include/1.4/xorg/xf86Modes.h

    r6499 r7517  
    3030
    3131#include <stddef.h>
     32/* Including this header results in compiler errors on FreeBSD */
     33#ifndef RT_OS_FREEBSD
    3234#include <string.h>
     35#endif
    3336#include <stdio.h>
    3437
  • trunk/src/VBox/Additions/x11/xclient/Makefile.kmk

    r7363 r7517  
    4040        X11 \
    4141        Xt
     42VBoxClient_LIBPATH.freebsd += \
     43        /usr/local/lib
     44VBoxClient_LIBS.freebsd += \
     45        iconv
    4246ifdef VBOX_X11_SEAMLESS_GUEST
    4347 VBoxClient_DEFS += SEAMLESS_GUEST DYNAMIC_RESIZE
  • trunk/src/VBox/Additions/x11/xclient/seamless-guest.h

    r6783 r7517  
    7979};
    8080
    81 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
     81#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
    8282# include "seamless-x11.h"  /* for VBoxGuestSeamlessGuestImpl */
    8383#else
  • trunk/src/VBox/Additions/x11/xmouse/xorg14/mouse.c

    r6202 r7517  
    10571057
    10581058#ifdef VBOX
     1059
     1060/* ImPS/2 is not supported on FreeBSD */
     1061# ifdef RT_OS_FREEBSD
     1062    protocol = "PS/2";
     1063# else
    10591064    protocol = "ImPS/2";
     1065# endif
    10601066    protocolFrom = X_CONFIG;
    10611067#else
  • trunk/src/VBox/Runtime/Makefile.kmk

    r7491 r7517  
    533533RuntimeGuestR3_INCS.$(BUILD_TARGET)     := $(RuntimeR3_INCS.$(BUILD_TARGET))
    534534RuntimeGuestR3_INCS.$(BUILD_PLATFORM)   := $(RuntimeR3_INCS.$(BUILD_PLATFORM))
     535RuntimeGuestR3_LIBS.freebsd             := \
     536    iconv
    535537RuntimeGuestR3_SOURCES                  := $(filter-out \
    536538        common/time/timesupref.cpp \
     
    590592        r3/posix/utf8-posix.cpp
    591593RuntimeGuestR3Mini_SOURCES.solaris = \
     594        r3/posix/fileio-posix.cpp \
     595        r3/posix/path-posix.cpp \
     596        r3/posix/utf8-posix.cpp
     597RuntimeGuestR3Mini_SOURCES.freebsd = \
    592598        r3/posix/fileio-posix.cpp \
    593599        r3/posix/path-posix.cpp \
     
    10241030        common/string/memmove.asm \
    10251031        common/string/strpbrk.cpp \
     1032        common/string/memcmp.asm \
     1033        common/string/strchr.asm \
    10261034        generic/RTAssertDoBreakpoint-generic.cpp \
    10271035        generic/RTLogWriteDebugger-generic.cpp \
     
    11051113        common/string/strlen.cpp
    11061114endif
     1115RuntimeGuestR0_SOURCES.freebsd += \
     1116        common/string/memset.cpp \
     1117        common/string/memcmp.cpp \
     1118        common/string/strchr.asm
    11071119
    11081120RuntimeOS2GuestR0_TEMPLATE      = VBOXOS2GUESTR0LIB
  • trunk/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c

    r3680 r7517  
    7070    }
    7171
     72#if __FreeBSD_version < 700000
    7273    /* Do like they're doing in subr_ntoskrnl.c... */
    7374    mtx_lock_spin(&sched_lock);
     75#else
     76    thread_lock(curthread);
     77#endif
    7478    sched_prio(curthread, iPriority);
    7579#if __FreeBSD_version < 600000
    7680    curthread->td_base_pri = iPriority;
    7781#endif
     82#if __FreeBSD_version < 700000
    7883    mtx_unlock_spin(&sched_lock);
     84#else
     85    thread_unlock(curthread);
     86#endif
    7987
    8088    return VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette