VirtualBox

Changeset 3306 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Jun 26, 2007 11:50:54 PM (18 years ago)
Author:
vboxsync
Message:

Added a IPRT base fallback implementation for locking and completed the OS/2 client code.

Location:
trunk/src/VBox/Additions/common/VBoxGuestLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp

    r3192 r3306  
    2727
    2828#include <iprt/assert.h>
     29#if !defined(__WIN__) && !defined(__LINUX__)
     30#include <iprt/memobj.h>
     31#endif
     32
    2933
    3034int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size)
     
    5559        }
    5660    }
    57 #else
     61
     62#elif defined(__LINUX__)
    5863    NOREF(ppvCtx);
    5964    NOREF(pv);
    6065    NOREF(u32Size);
    61 #endif /* __WIN__ */
     66
     67#else
     68    /* Default to IPRT - this ASSUMES that it is USER addresses we're locking. */
     69    RTR0MEMOBJ MemObj;
     70    rc = RTR0MemObjLockUser(&MemObj, pv, u32Size, NIL_RTR0PROCESS);
     71    if (RT_SUCCESS(rc))
     72        *ppvCtx = MemObj;
     73    else
     74        *ppvCtx = NIL_RTR0MEMOBJ;
     75
     76#endif
    6277   
    6378    return rc;
     
    7792        IoFreeMdl (pMdl);
    7893    }
    79 #else
     94
     95#elif defined(__LINUX__)
    8096    NOREF(pvCtx);
    81 #endif /* __WIN__ */
     97
     98#else
     99    /* default to IPRT */
     100    RTR0MEMOBJ MemObj = (RTR0MEMOBJ)pvCtx;
     101    int rc = RTR0MemObjFree(MemObj, false);
     102    AssertRC(rc);
     103
     104#endif
    82105}
    83106
     
    91114#endif
    92115
    93 #ifndef __WIN__
    94 # ifdef __cplusplus
    95 extern "C" {
    96 # endif
     116#ifdef __LINUX__
     117__BEGIN_DECLS
    97118extern DECLVBGL(void *) vboxadd_cmc_open (void);
    98119extern DECLVBGL(void) vboxadd_cmc_close (void *);
    99120extern DECLVBGL(int) vboxadd_cmc_call (void *opaque, uint32_t func, void *data);
    100 # ifdef __cplusplus
    101 }
    102 # endif
    103 #endif
     121__END_DECLS
     122#endif /* __LINUX__ */
     123
     124#ifdef __OS2__
     125__BEGIN_DECLS
     126/*
     127 * On OS/2 we'll do the connecting in the assembly code of the
     128 * client driver, exporting a g_VBoxGuestIDC symbol containing
     129 * the connection information obtained from the 16-bit IDC.
     130 */
     131extern VBOXGUESTOS2IDCCONNECT g_VBoxGuestIDC;
     132__END_DECLS
     133#endif
     134
    104135
    105136int vbglDriverOpen (VBGLDRIVER *pDriver)
     
    138169
    139170#elif defined (__OS2__)
    140     return VERR_NOT_IMPLEMENTED;
     171    /*
     172     * Just check whether the connection was made or not.
     173     */
     174    if (    g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
     175        &&  VALID_PTR(g_VBoxGuestIDC.u32Session)
     176        &&  VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
     177    {
     178        pDriver->u32Session = g_VBoxGuestIDC.u32Session;
     179        return VINF_SUCCESS;
     180    }
     181    pDriver->u32Session = UINT32_MAX;
     182    Log(("vbglDriverOpen: failed\n"));
     183    return VERR_FILE_NOT_FOUND;
    141184
    142185#else
     
    191234
    192235#elif defined (__OS2__)
    193     return VERR_NOT_IMPLEMENTED;
     236    if (    pDriver->u32Session
     237        &&  pDriver->u32Session == g_VBoxGuestIDC.u32Session)
     238        return g_VBoxGuestIDC.pfnServiceEP(pDriver->u32Session, u32Function, pvData, cbData, NULL);
     239
     240    Log(("vbglDriverIOCtl: No connection\n"));
     241    return VERR_WRONG_ORDER;
    194242
    195243#else
     
    208256
    209257#elif defined (__OS2__)
    210    
     258    pDriver->u32Session = 0;
    211259
    212260#else
  • trunk/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h

    r3192 r3306  
    5555    void *opaque;
    5656#elif defined (__OS2__)
    57     uint32_t placeholder;
     57    uint32_t u32Session; /**< just for sanity checking. */
    5858#else
    5959# error "Port me"
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