VirtualBox

Ignore:
Timestamp:
Sep 14, 2007 2:59:15 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
24502
Message:

Redid the supdrv interface. works on windows and linux while the other OSes still needs some adjusting/testing. internal networking is temporarily broken as the SUPCallVMMR0Ex interface is being reworked (this is what all this is really about).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp

    r4071 r4800  
    9696
    9797
    98 /**
    99  * Installs anything required by the support library.
    100  *
    101  * @returns 0 on success.
    102  * @returns error code on failure.
    103  */
    10498int suplibOsInstall(void)
    10599{
    106 //    int rc = mknod(DEVICE_NAME, S_IFCHR, );
    107 
    108100    return VERR_NOT_IMPLEMENTED;
    109101}
    110102
    111103
    112 /**
    113  * Installs anything required by the support library.
    114  *
    115  * @returns 0 on success.
    116  * @returns error code on failure.
    117  */
    118104int suplibOsUninstall(void)
    119105{
    120 //    int rc = unlink(DEVICE_NAME);
    121 
    122106    return VERR_NOT_IMPLEMENTED;
    123107}
    124108
    125109
    126 /**
    127  * Send a I/O Control request to the device.
    128  *
    129  * @returns 0 on success.
    130  * @returns VBOX error code on failure.
    131  * @param   uFunction   IO Control function.
    132  * @param   pvIn        Input data buffer.
    133  * @param   cbIn        Size of input data.
    134  * @param   pvOut       Output data buffer.
    135  * @param   cbOut       Size of output data.
    136  */
    137 int suplibOsIOCtl(unsigned uFunction, void *pvIn, size_t cbIn, void *pvOut, size_t cbOut)
     110int suplibOsIOCtl(uintptr_t uFunction, void *pvReq, size_t cbReq)
    138111{
    139112    AssertMsg(g_hDevice != -1, ("SUPLIB not initiated successfully!\n"));
    140     /*
    141      * Issue device iocontrol.
    142      */
    143     SUPDRVIOCTLDATA Args;
    144     Args.pvIn = pvIn;
    145     Args.cbIn = cbIn;
    146     Args.pvOut = pvOut;
    147     Args.cbOut = cbOut;
    148113
    149     if (ioctl(g_hDevice, uFunction, &Args) >= 0)
    150         return 0;
    151     /* This is the reverse operation of the one found in SUPDrv-linux.c */
    152     switch (errno)
    153     {
    154         case EACCES: return VERR_GENERAL_FAILURE;
    155         case EINVAL: return VERR_INVALID_PARAMETER;
    156         case ENOSYS: return VERR_INVALID_MAGIC;
    157         case ENXIO:  return VERR_INVALID_HANDLE;
    158         case EFAULT: return VERR_INVALID_POINTER;
    159         case ENOLCK: return VERR_LOCK_FAILED;
    160         case EEXIST: return VERR_ALREADY_LOADED;
    161     }
    162 
     114    if (RT_LIKELY(ioctl((g_hDevice, uFunction, pvReq) >= 0))
     115        return VINF_SUCCESS;
    163116    return RTErrConvertFromErrno(errno);
    164117}
    165118
    166119#ifdef VBOX_WITHOUT_IDT_PATCHING
    167 int suplibOSIOCtlFast(unsigned uFunction)
     120int suplibOSIOCtlFast(uintptr_t uFunction)
    168121{
    169122    int rc = ioctl(g_hDevice, uFunction, NULL);
     
    175128
    176129
    177 /**
    178  * Allocate a number of zero-filled pages in user space.
    179  *
    180  * @returns VBox status code.
    181  * @param   cPages      Number of pages to allocate.
    182  * @param   ppvPages    Where to return the base pointer.
    183  */
    184130int suplibOsPageAlloc(size_t cPages, void **ppvPages)
    185131{
     
    191137
    192138
    193 /**
    194  * Frees pages allocated by suplibOsPageAlloc().
    195  *
    196  * @returns VBox status code.
    197  * @param   pvPages     Pointer to pages.
    198  */
    199139int suplibOsPageFree(void *pvPages, size_t /* cPages */)
    200140{
Note: See TracChangeset for help on using the changeset viewer.

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