VirtualBox

Changeset 68570 in vbox


Ignore:
Timestamp:
Aug 31, 2017 12:10:39 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
117787
Message:

merging vbglioc r117736: OS/2 adjustments.

Location:
trunk
Files:
5 edited

Legend:

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

    r68565 r68570  
    131131# define VBGL_IOCTL_CATEGORY                        0xc2
    132132# define VBGL_IOCTL_CODE_SIZE(Function, Size)       ((unsigned char)(Function))
     133# define VBGL_IOCTL_CODE_BIG(Function)              ((unsigned char)(Function))
    133134# define VBGL_IOCTL_CATEGORY_FAST                   0xc3 /**< Also defined in VBoxGuestA-os2.asm. */
    134135# define VBGL_IOCTL_CODE_FAST(Function)             ((unsigned char)(Function))
     
    318319} VBGLIOCDRIVERVERSIONINFO, *PVBGLIOCDRIVERVERSIONINFO;
    319320AssertCompileSize(VBGLIOCDRIVERVERSIONINFO, 24 + 20);
     321#ifndef RT_OS_OS2 /* figure this one out... */
    320322AssertCompile(VBGL_IOCTL_DRIVER_VERSION_INFO_SIZE_IN == 24 + 16);
     323#endif
    321324/** @} */
    322325
     
    393396} VBGLIOCHGCMCONNECT, *PVBGLIOCHGCMCONNECT;
    394397AssertCompileSize(VBGLIOCHGCMCONNECT, 24 + 132);
     398#ifndef RT_OS_OS2 /* figure this one out... */
    395399AssertCompile(VBGL_IOCTL_HGCM_CONNECT_SIZE_OUT == 24 + 4);
     400#endif
    396401/** @} */
    397402
     
    906911typedef struct VBOXGUESTOS2IDCCONNECT
    907912{
    908     /** VMMDEV_VERSION. */
     913    /** VBGL_IOC_VERSION. */
    909914    uint32_t u32Version;
    910915    /** Opaque session handle. */
     
    915920     *
    916921     * @returns VBox status code.
    917      * @param   u32Session          The above session handle.
     922     * @param   u32Session          The session handle (PVBOXGUESTSESSION).
    918923     * @param   iFunction           The requested function.
    919      * @param   pvData              The input/output data buffer. The caller ensures that this
    920      *                              cannot be swapped out, or that it's acceptable to take a
    921      *                              page in fault in the current context. If the request doesn't
    922      *                              take input or produces output, apssing NULL is okay.
    923      * @param   cbData              The size of the data buffer.
    924      * @param   pcbDataReturned     Where to store the amount of data that's returned.
    925      *                              This can be NULL if pvData is NULL.
    926      * @todo fix parameters
     924     * @param   pReqHdr             The input/output data buffer.  The caller
     925     *                              ensures that this cannot be swapped out, or that
     926     *                              it's acceptable to take a page in fault in the
     927     *                              current context.  If the request doesn't take
     928     *                              input or produces output, apssing NULL is okay.
     929     * @param   cbReq               The size of the data buffer.
    927930     */
    928     DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
     931    DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, PVBGLREQHDR pReqHdr, size_t cbReq);
    929932
    930933    /** The 16-bit service entry point for C code (cdecl).
     
    936939     * int far cdecl
    937940     * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
    938      *                          void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
     941     *                          PVBGLREQHDR fpvData, uint16_t cbData);
    939942     * @endcode
    940943     */
     
    10101013} VBGLIOCIDCCONNECT, *PVBGLIOCIDCCONNECT;
    10111014AssertCompileSize(VBGLIOCIDCCONNECT, 24 + 16 + ARCH_BITS / 8 * 2);
     1015#ifndef RT_OS_OS2 /* figure this one out... */
    10121016AssertCompile(VBGL_IOCTL_IDC_CONNECT_SIZE_IN == 24 + 16);
     1017#endif
    10131018#define VBGL_IOCTL_IDC_CONNECT_MAGIC_COOKIE         UINT32_C(0x55aa4d5a) /**< Magic value for doing an IDC connect. */
    10141019/** @} */
  • trunk/include/VBox/VBoxGuest.mac

    r62476 r68570  
    4242%endif ; RT_OS_OS2
    4343
     44struc VBGLREQHDR
     45    .cbIn               resd 1
     46    .uVersion           resd 1
     47    .uType              resd 1
     48    .rc                 resd 1
     49    .cbOut              resd 1
     50    .uReserved          resd 1
     51endstruc
     52
     53%define VBGL_IOC_VERSION        000010000h
     54
    4455; From VMMDev.h
    4556%define VMMDEV_VERSION_MAJOR    1
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp

    r68550 r68570  
    5252#include "VBoxGuestInternal.h"
    5353#include <VBox/version.h>
     54#include <iprt/assert.h>
    5455#include <iprt/initterm.h>
    55 #include <iprt/string.h>
    56 #include <iprt/spinlock.h>
    57 #include <iprt/process.h>
    58 #include <iprt/assert.h>
    5956#include <iprt/log.h>
    6057#include <iprt/memobj.h>
    6158#include <iprt/mem.h>
    6259#include <iprt/param.h>
     60#include <iprt/process.h>
     61#include <iprt/spinlock.h>
     62#include <iprt/string.h>
    6363
    6464
     
    466466 * @param   u32Session          The session handle (PVBOXGUESTSESSION).
    467467 * @param   iFunction           The requested function.
    468  * @param   pvData              The input/output data buffer. The caller ensures that this
    469  *                              cannot be swapped out, or that it's acceptable to take a
    470  *                              page in fault in the current context. If the request doesn't
    471  *                              take input or produces output, apssing NULL is okay.
    472  * @param   cbData              The size of the data buffer.
    473  * @param   pcbDataReturned     Where to store the amount of data that's returned.
    474  *                              This can be NULL if pvData is NULL.
     468 * @param   pReqHdr             The input/output data buffer.  The caller
     469 *                              ensures that this cannot be swapped out, or that
     470 *                              it's acceptable to take a page in fault in the
     471 *                              current context.  If the request doesn't take
     472 *                              input or produces output, apssing NULL is okay.
     473 * @param   cbReq               The size of the data buffer.
    475474 *
    476475 * @remark  This is called from the 16-bit thunker as well as directly from the 32-bit clients.
    477476 */
    478 DECLASM(int) VGDrvOS2IDCService(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned)
     477DECLASM(int) VGDrvOS2IDCService(uint32_t u32Session, unsigned iFunction, PVBGLREQHDR pReqHdr, size_t cbReq)
    479478{
    480479    PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)u32Session;
     
    483482    AssertMsgReturn(pSession->pDevExt == &g_DevExt, ("%p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
    484483
    485     int rc;
    486     switch (iFunction)
    487     {
    488         default:
    489             rc = VGDrvCommonIoCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
    490             break;
    491 
    492         case VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT:
    493             pSession->sfn = 0;
    494             VGDrvCommonCloseSession(&g_DevExt, pSession);
    495             rc = VINF_SUCCESS;
    496             break;
    497     }
    498     return rc;
     484    return VGDrvCommonIoCtl(iFunction, &g_DevExt, pSession, pReqHdr, cbReq);
    499485}
    500486
     
    569555                 */
    570556                PVBGLREQHDR pReqHdr = (PVBGLREQHDR)pvParm;
    571                 rc = VGDrvCommonIoCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm);
     557                rc = VGDrvCommonIoCtl(iFunction, &g_DevExt, pSession, pReqHdr, *pcbParm);
    572558
    573559                /*
     
    581567                return rc;
    582568            }
    583             AssertFailedMsg(("KernVMLock(VMDHL_WRITE, %p, %#x, &p, NULL, NULL) -> %d\n", pvParm,*pcbParm,&ParmLock, rc));
     569            AssertMsgFailed(("KernVMLock(VMDHL_WRITE, %p, %#x, &p, NULL, NULL) -> %d\n", pvParm, *pcbParm, &ParmLock, rc));
    584570            return VERR_LOCK_FAILED;
    585571        }
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm

    r68550 r68570  
    826826    movzx   ebx, word [ebp + 08h]
    827827
    828     mov     dword [ebx + VBGOS2IDC.u32Version       ], VMMDEV_VERSION
     828    mov     dword [ebx + VBGOS2IDC.u32Version       ], VBGL_IOC_VERSION
    829829    mov     dword [ebx + VBGOS2IDC.u32Session       ], eax
    830830    mov     dword [ebx + VBGOS2IDC.pfnServiceEP     ], NAME(VGDrvOS2IDCService)
     
    867867; @param   u32Session          bp +  8h - The above session handle.
    868868; @param   iFunction           bp + 0ch - The requested function.
    869 ; @param   pvData              bp + 0eh - The input/output data buffer. The caller ensures that this
     869; @param   fpReqHdr            bp + 0eh - The input/output data buffer. The caller ensures that this
    870870;                                         cannot be swapped out, or that it's acceptable to take a
    871871;                                         page in fault in the current context. If the request doesn't
    872872;                                         take input or produces output, passing NULL is okay.
    873 ; @param   cbData              bp + 12h - The size of the data buffer.
    874 ; @param   pcbDataReturned     bp + 14h - Where to store the amount of data that's returned.
    875 ;                                         This can be NULL if pvData is NULL.
    876 ;
    877 ; @cproto long far __cdecl VGDrvOS2IDCService16(uint32_t u32Session, uint16_t iFunction, void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
     873; @param   cbReq               bp + 12h - The size of the data buffer.
     874;
     875; @cproto long far __cdecl VGDrvOS2IDCService16(uint32_t u32Session, uint16_t iFunction, void far *fpReqHdr, uint16_t cbReq);
    878876;
    879877GLOBALNAME VGDrvOS2IDCService16
     
    897895    ; Create the call frame before switching.
    898896    ;
    899     push    dword 0                     ; esp + 14h:    &cbDataReturned (filled in after stack switch)
    900897    movzx   ecx, word [bp + 12h]         
    901898    push    ecx                         ; esp + 10h:    cbData
     
    929926    call    KernThunkStackTo32
    930927
    931     ; update the cbDataReturned pointer
    932     lea     eax, [esp + 18h]
    933     mov     [esp + 14h], eax
    934 
    935928    ; call the C code (don't cleanup the stack).
    936929    call    NAME(VGDrvOS2IDCService)
     
    944937segment CODE16
    945938GLOBALNAME VGDrvOS2IDCService16_16
    946 
    947     ; Set *pcbDataReturned.
    948     cmp     word [bp + 14h + 2], 3
    949     jbe     .no_pcbDataReturned
    950     xchg    dx, bx
    951     mov     cx, [esp + 18h]
    952     les     bx, [bp + 14h]
    953     mov     word [es:bx], cx
    954     xchg    dx, bx
    955 .no_pcbDataReturned:
    956939
    957940VGDrvOS2IDCService16_Done:
     
    988971    mov     ebp, esp
    989972    push    edx                         ; bp - 4h
    990     lea     sp, [bp - 18h]              ; allocate the call frame.
    991 
    992                                         ; bp - 06h (dw): oops...
    993     mov     [bp - 08h], word 0          ; bp - 08h (dw): cbDataReturned
    994 
    995     mov     [bp - 0eh], cx              ; bp - 0eh (dw): cbData     (NOTE: out of order to free up CX)
    996     lea     cx, [bp - 08h]              ; bp - 0ch (dd): &cbDataReturned
    997     mov     [bp - 0ah], cx
    998     mov     cx, ss
    999     mov     [bp - 0ch], cx
    1000     mov     [bp - 10h], bx              ; bp - 10h (dd): pvData
    1001     mov     cx, es
    1002     mov     [bp - 12h], cx
    1003     mov     [bp - 14h], dl              ; bp - 14h (dw): iFunction
    1004     mov     [bp - 13h], byte 0
    1005     mov     [bp - 18h], eax             ; bp - 18h (dd): u32Session
    1006 
     973
     974    push    cx                          ; cbData
     975    push    es
     976    xor     dh, dh
     977    push    dx
     978    push    eax
    1007979    call    NAME(VGDrvOS2IDCService16)
    1008980
    1009     mov     cx, [bp - 08h]              ; cbDataReturned.
     981    mov     cx, [es:bx + VBGLREQHDR.cbOut]
    1010982
    1011983    mov     edx, [bp - 4]
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibIdc-os2.cpp

    r68561 r68570  
    4949     * Just check whether the connection was made or not.
    5050     */
    51     if (   g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
     51    if (   g_VBoxGuestIDC.u32Version == VBGL_IOC_VERSION
    5252        && RT_VALID_PTR(g_VBoxGuestIDC.u32Session)
    5353        && RT_VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
    54     {
    55         pHandle->s.pvSession = (void *)g_VBoxGuestIDC.u32Session;
    56         return vbglR0IdcNativeCall(pHandle, VBGL_IOCTL_IDC_CONNECT, pReq);
    57     }
    58     pHandle->s.pvSession = NULL;
     54        return g_VBoxGuestIDC.pfnServiceEP(g_VBoxGuestIDC.u32Session, VBGL_IOCTL_IDC_CONNECT, &pReq->Hdr, sizeof(*pReq));
    5955    Log(("vbglDriverOpen: failed\n"));
    6056    return VERR_FILE_NOT_FOUND;
     
    7975DECLR0VBGL(int) VbglR0IdcCallRaw(PVBGLIDCHANDLE pHandle, uintptr_t uReq, PVBGLREQHDR pReqHdr, uint32_t cbReq)
    8076{
    81     size_t cbRetIgn;
    82     return g_VBoxGuestIDC.pfnServiceEP((uintptr_t)pHandle->s.pvSession, uReq, pReqHdr, cbReq, &cbRetIgn);
     77    return g_VBoxGuestIDC.pfnServiceEP((uintptr_t)pHandle->s.pvSession, uReq, pReqHdr, cbReq);
    8378}
    8479
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