VirtualBox

Changeset 24425 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Nov 6, 2009 7:36:50 AM (15 years ago)
Author:
vboxsync
Message:

Solaris/r0drv: fix as_pagelock access error (host/guest common IPRT now).

Location:
trunk/src/VBox/Runtime/r0drv/solaris/vbi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c

    r24386 r24425  
    667667
    668668int
    669 vbi_lock_va(void *addr, size_t len, void **handle)
     669vbi_lock_va(void *addr, size_t len, int access, void **handle)
    670670{
    671671        faultcode_t err;
     
    677677        if (!IS_KERNEL(addr)) {
    678678                err = as_fault(VBIPROC()->p_as->a_hat, VBIPROC()->p_as,
    679                     (caddr_t)addr, len, F_SOFTLOCK, S_WRITE);
     679                    (caddr_t)addr, len, F_SOFTLOCK, access);
    680680                if (err != 0) {
    681681                        VBI_VERBOSE("vbi_lock_va() failed to lock");
     
    688688/*ARGSUSED*/
    689689void
    690 vbi_unlock_va(void *addr, size_t len, void *handle)
     690vbi_unlock_va(void *addr, size_t len, int access, void *handle)
    691691{
    692692        if (!IS_KERNEL(addr))
    693693                as_fault(VBIPROC()->p_as->a_hat, VBIPROC()->p_as,
    694                     (caddr_t)addr, len, F_SOFTUNLOCK, S_WRITE);
     694                    (caddr_t)addr, len, F_SOFTUNLOCK, access);
    695695}
    696696
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h

    r21452 r24425  
    210210 * returns 0 for success, non-zero errno on failure
    211211 */
    212 extern int vbi_lock_va(void *addr, size_t len, void **handle);
    213 extern void vbi_unlock_va(void *addr, size_t len, void *handle);
     212extern int vbi_lock_va(void *addr, size_t len, int access, void **handle);
     213extern void vbi_unlock_va(void *addr, size_t len, int access, void *handle);
    214214
    215215/*
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c

    r24386 r24425  
    5959    ddi_umem_cookie_t   Cookie;
    6060    /** Shadow locked pages. */
    61     void              *handle;
     61    void               *pvHandle;
     62    /** Access during locking. */
     63    int                 fAccess;
    6264} RTR0MEMOBJSOLARIS, *PRTR0MEMOBJSOLARIS;
    6365
     
    8385
    8486        case RTR0MEMOBJTYPE_LOCK:
    85             vbi_unlock_va(pMemSolaris->Core.pv, pMemSolaris->Core.cb, pMemSolaris->handle);
     87            vbi_unlock_va(pMemSolaris->Core.pv, pMemSolaris->Core.cb, pMemSolaris->fAccess, pMemSolaris->pvHandle);
    8688            break;
    8789
     
    125127
    126128    pMemSolaris->Core.pv = virtAddr;
    127     pMemSolaris->handle = NULL;
     129    pMemSolaris->pvHandle = NULL;
    128130    *ppMem = &pMemSolaris->Core;
    129131    return VINF_SUCCESS;
     
    150152    }
    151153    pMemSolaris->Core.pv = virtAddr;
    152     pMemSolaris->handle = NULL;
     154    pMemSolaris->pvHandle = NULL;
    153155    *ppMem = &pMemSolaris->Core;
    154156    return VINF_SUCCESS;
     
    177179    pMemSolaris->Core.pv = virtAddr;
    178180    pMemSolaris->Core.u.Cont.Phys = phys;
    179     pMemSolaris->handle = NULL;
     181    pMemSolaris->pvHandle = NULL;
    180182    *ppMem = &pMemSolaris->Core;
    181183    return VINF_SUCCESS;
     
    223225        return VERR_NO_MEMORY;
    224226
    225     void *ppl;
     227    int fPageAccess = S_READ;
     228    if (fPageAccess & RTMEM_PROT_WRITE)
     229        fPageAccess = S_WRITE;
     230    if (fPageAccess & RTMEM_PROT_EXEC)
     231        fPageAccess = S_EXEC;
     232    void *pvPageList = NULL;
    226233
    227234    /* Lock down user pages */
    228     int rc = vbi_lock_va((caddr_t)R3Ptr, cb, &ppl);
     235    int rc = vbi_lock_va((caddr_t)R3Ptr, cb, fPageAccess, &pvPageList);
    229236    if (rc != 0)
    230237    {
     
    235242
    236243    pMemSolaris->Core.u.Lock.R0Process = (RTR0PROCESS)vbi_proc();
    237     pMemSolaris->handle = ppl;
     244    pMemSolaris->pvHandle = pvPageList;
     245    pMemSolaris->fAccess = fPageAccess;
    238246    *ppMem = &pMemSolaris->Core;
    239247    return VINF_SUCCESS;
     
    249257        return VERR_NO_MEMORY;
    250258
    251     void *ppl;
    252     int rc = vbi_lock_va((caddr_t)pv, cb, &ppl);
     259    int fPageAccess = S_READ;
     260    if (fPageAccess & RTMEM_PROT_WRITE)
     261        fPageAccess = S_WRITE;
     262    if (fPageAccess & RTMEM_PROT_EXEC)
     263        fPageAccess = S_EXEC;
     264    void *pvPageList = NULL;
     265    int rc = vbi_lock_va((caddr_t)pv, cb, fPageAccess, &pvPageList);
    253266    if (rc != 0)
    254267    {
     
    259272
    260273    pMemSolaris->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
    261     pMemSolaris->handle = ppl;
     274    pMemSolaris->pvHandle = pvPageList;
     275    pMemSolaris->fAccess = fPageAccess;
    262276    *ppMem = &pMemSolaris->Core;
    263277    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