VirtualBox

Ignore:
Timestamp:
Jul 10, 2008 7:08:24 AM (16 years ago)
Author:
vboxsync
Message:

Solaris/r0drv: fixed lockkernel.
Found this while exploring vboxvfs mapping, though currently unused.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c

    r8528 r10457  
    114114        {
    115115            struct as *addrSpace;
    116             if (pMemSolaris->Core.u.Lock.R0Process == NIL_RTR0PROCESS)
    117                 addrSpace = &kas;
    118             else
     116            if (pMemSolaris->Core.u.Lock.R0Process != NIL_RTR0PROCESS)
     117            {
    119118                addrSpace = ((proc_t *)pMemSolaris->Core.u.Lock.R0Process)->p_as;
    120 
    121             as_pageunlock(addrSpace, pMemSolaris->ppShadowPages, pMemSolaris->Core.pv, pMemSolaris->Core.cb, S_WRITE);
     119                as_pageunlock(addrSpace, pMemSolaris->ppShadowPages, pMemSolaris->Core.pv, pMemSolaris->Core.cb, S_WRITE);
     120            }
     121            /* Nothing to unlock for kernel addresses. */
    122122            break;
    123123        }
     
    300300        return VERR_NO_MEMORY;
    301301
    302     caddr_t virtAddr = (caddr_t)((uintptr_t)pv & (uintptr_t)PAGEMASK);
    303     page_t **ppl;
    304 
    305     /* Lock down kernel pages */
    306     int rc = as_pagelock(&kas, &ppl, virtAddr, cb, S_WRITE);
    307     if (!rc)
    308     {
    309         if (ppl)
    310         {
    311             pMemSolaris->Core.u.Lock.R0Process = NIL_RTR0PROCESS;   /* means kernel, see rtR0MemObjNativeFree() */
    312             pMemSolaris->ppShadowPages = ppl;
    313             *ppMem = &pMemSolaris->Core;
    314             return VINF_SUCCESS;
    315         }
    316 
    317         as_pageunlock(&kas, ppl, virtAddr, cb, S_WRITE);
    318         cmn_err(CE_NOTE, "rtR0MemObjNativeLockKernel: failed to get shadow pages\n");
    319     }
    320     else
    321         cmn_err(CE_NOTE,"rtR0MemObjNativeLockKernel: as_pagelock failed rc=%d\n", rc);
    322     rtR0MemObjDelete(&pMemSolaris->Core);
    323     return VERR_LOCK_FAILED;
     302    /* Nothing to do here for kernel addresses. */
     303
     304    pMemSolaris->Core.u.Lock.R0Process = RTR0ProcHandleSelf();
     305    pMemSolaris->ppShadowPages = NULL;
     306    *ppMem = &pMemSolaris->Core;
     307    return VINF_SUCCESS;   
    324308}
    325309
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