VirtualBox

Ignore:
Timestamp:
Aug 2, 2007 12:37:43 AM (17 years ago)
Author:
vboxsync
Message:

Implemented the timer and time apis for freebsd, stubbed the memobj ones.

File:
1 copied

Legend:

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

    r3911 r3977  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Ring-0 Memory Objects, OS/2.
     3 * innotek Portable Runtime - Ring-0 Memory Objects, FreeBSD.
    44 */
    55
     
    3333*   Header Files                                                               *
    3434*******************************************************************************/
    35 #include "the-os2-kernel.h"
     35#include "the-freebsd-kernel.h"
    3636
    3737#include <iprt/memobj.h>
     
    4949*******************************************************************************/
    5050/**
    51  * The OS/2 version of the memory object structure.
     51 * The FreeBSD version of the memory object structure.
    5252 */
    53 typedef struct RTR0MEMOBJDARWIN
     53typedef struct RTR0MEMOBJFREEBSD
    5454{
    5555    /** The core structure. */
    5656    RTR0MEMOBJINTERNAL  Core;
     57#if 0
    5758    /** Lock for the ring-3 / ring-0 pinned objectes.
    5859     * This member might not be allocated for some object types. */
     
    6162     * This array can be 0 in length for some object types. */
    6263    KernPageList_t      aPages[1];
    63 } RTR0MEMOBJOS2, *PRTR0MEMOBJOS2;
     64#endif
     65} RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD;
    6466
    6567
     
    6769*   Internal Functions                                                         *
    6870*******************************************************************************/
    69 static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet);
    7071
    7172
    7273int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
    7374{
    74     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;
    75     int rc;
    76 
    77     switch (pMemOs2->Core.enmType)
     75    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
     76//    int rc;
     77
     78    switch (pMemFreeBSD->Core.enmType)
    7879    {
    7980        case RTR0MEMOBJTYPE_PHYS:
    80             if (!pMemOs2->Core.pv)
     81            if (!pMemFreeBSD->Core.pv)
    8182                break;
    8283
    8384        case RTR0MEMOBJTYPE_MAPPING:
    84             if (pMemOs2->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)
     85            if (pMemFreeBSD->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)
    8586                break;
    8687
     
    8990        case RTR0MEMOBJTYPE_LOW:
    9091        case RTR0MEMOBJTYPE_CONT:
    91             rc = KernVMFree(pMemOs2->Core.pv);
    92             AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemOs2->Core.enmType, pMemOs2->Core.pv, pMemOs2->Core.cb));
     92            //rc = KernVMFree(pMemFreeBSD->Core.pv);
     93            //AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemFreeBSD->Core.enmType, pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb));
    9394            break;
    9495
    9596        case RTR0MEMOBJTYPE_LOCK:
    96             rc = KernVMUnlock(&pMemOs2->Lock);
    97             AssertMsg(!rc, ("rc=%d\n", rc));
     97            //rc = KernVMUnlock(&pMemFreeBSD->Lock);
     98            //AssertMsg(!rc, ("rc=%d\n", rc));
    9899            break;
    99100
    100101        case RTR0MEMOBJTYPE_RES_VIRT:
    101102        default:
    102             AssertMsgFailed(("enmType=%d\n", pMemOs2->Core.enmType));
     103            AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType));
    103104            return VERR_INTERNAL_ERROR;
    104105    }
     
    112113    NOREF(fExecutable);
    113114
     115#if 0
    114116    /* create the object. */
    115117    const ULONG cPages = cb >> PAGE_SHIFT;
    116     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_PAGE, NULL, cb);
    117     if (!pMemOs2)
     118    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_PAGE, NULL, cb);
     119    if (!pMemFreeBSD)
    118120        return VERR_NO_MEMORY;
    119121
    120122    /* do the allocation. */
    121     int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
     123    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL);
    122124    if (!rc)
    123125    {
    124126        ULONG cPagesRet = cPages;
    125         rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
     127        rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet);
    126128        if (!rc)
    127129        {
    128             rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
    129             *ppMem = &pMemOs2->Core;
     130            rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
     131            *ppMem = &pMemFreeBSD->Core;
    130132            return VINF_SUCCESS;
    131133        }
    132         KernVMFree(pMemOs2->Core.pv);
    133     }
    134     rtR0MemObjDelete(&pMemOs2->Core);
    135     return RTErrConvertFromOS2(rc);
     134        KernVMFree(pMemFreeBSD->Core.pv);
     135    }
     136    rtR0MemObjDelete(&pMemFreeBSD->Core);
     137    return RTErrConvertFromOS2(rc);
     138#endif
     139    return VERR_NOT_IMPLEMENTED;
    136140}
    137141
     
    141145    NOREF(fExecutable);
    142146
    143     /* create the object. */
     147#if 0
     148  /* create the object. */
    144149    const ULONG cPages = cb >> PAGE_SHIFT;
    145     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb);
    146     if (!pMemOs2)
     150    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb);
     151    if (!pMemFreeBSD)
    147152        return VERR_NO_MEMORY;
    148153
    149154    /* do the allocation. */
    150     int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemOs2->Core.pv, (PPVOID)-1, NULL);
     155    int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL);
    151156    if (!rc)
    152157    {
    153158        ULONG cPagesRet = cPages;
    154         rc = KernLinToPageList(pMemOs2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);
     159        rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet);
    155160        if (!rc)
    156161        {
    157             rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
    158             *ppMem = &pMemOs2->Core;
     162            rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
     163            *ppMem = &pMemFreeBSD->Core;
    159164            return VINF_SUCCESS;
    160165        }
    161         KernVMFree(pMemOs2->Core.pv);
    162     }
    163     rtR0MemObjDelete(&pMemOs2->Core);
    164     return RTErrConvertFromOS2(rc);
     166        KernVMFree(pMemFreeBSD->Core.pv);
     167    }
     168    rtR0MemObjDelete(&pMemFreeBSD->Core);
     169    return RTErrConvertFromOS2(rc);
     170#endif
     171    return VERR_NOT_IMPLEMENTED;
    165172}
    166173
     
    170177    NOREF(fExecutable);
    171178
    172     /* create the object. */
    173     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT, NULL, cb);
    174     if (!pMemOs2)
     179#if 0
     180    /* create the object. */
     181    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT, NULL, cb);
     182    if (!pMemFreeBSD)
    175183        return VERR_NO_MEMORY;
    176184
    177185    /* do the allocation. */
    178186    ULONG ulPhys = ~0UL;
    179     int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
     187    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL);
    180188    if (!rc)
    181189    {
    182190        Assert(ulPhys != ~0UL);
    183         pMemOs2->Core.u.Cont.Phys = ulPhys;
    184         *ppMem = &pMemOs2->Core;
    185         return VINF_SUCCESS;
    186     }
    187     rtR0MemObjDelete(&pMemOs2->Core);
    188     return RTErrConvertFromOS2(rc);
     191        pMemFreeBSD->Core.u.Cont.Phys = ulPhys;
     192        *ppMem = &pMemFreeBSD->Core;
     193        return VINF_SUCCESS;
     194    }
     195    rtR0MemObjDelete(&pMemFreeBSD->Core);
     196    return RTErrConvertFromOS2(rc);
     197#endif
     198    return VERR_NOT_IMPLEMENTED;
    189199}
    190200
     
    193203{
    194204    AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%VHp\n", PhysHighest), VERR_NOT_IMPLEMENTED);
    195 
    196     /* create the object. */
    197     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
    198     if (!pMemOs2)
     205   
     206#if 0
     207    /* create the object. */
     208    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
     209    if (!pMemFreeBSD)
    199210        return VERR_NO_MEMORY;
    200211
    201212    /* do the allocation. */
    202213    ULONG ulPhys = ~0UL;
    203     int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
     214    int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL);
    204215    if (!rc)
    205216    {
    206217        Assert(ulPhys != ~0UL);
    207         pMemOs2->Core.u.Phys.fAllocated = true;
    208         pMemOs2->Core.u.Phys.PhysBase = ulPhys;
    209         *ppMem = &pMemOs2->Core;
    210         return VINF_SUCCESS;
    211     }
    212     rtR0MemObjDelete(&pMemOs2->Core);
    213     return RTErrConvertFromOS2(rc);
     218        pMemFreeBSD->Core.u.Phys.fAllocated = true;
     219        pMemFreeBSD->Core.u.Phys.PhysBase = ulPhys;
     220        *ppMem = &pMemFreeBSD->Core;
     221        return VINF_SUCCESS;
     222    }
     223    rtR0MemObjDelete(&pMemFreeBSD->Core);
     224    return RTErrConvertFromOS2(rc);
     225#endif
     226    return VERR_NOT_IMPLEMENTED;
    214227}
    215228
     
    217230int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb)
    218231{
    219     /* create the object. */
    220     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
    221     if (!pMemOs2)
     232#if 0   
     233    /* create the object. */
     234    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);
     235    if (!pMemFreeBSD)
    222236        return VERR_NO_MEMORY;
    223237
    224238    /* there is no allocation here, right? it needs to be mapped somewhere first. */
    225     pMemOs2->Core.u.Phys.fAllocated = false;
    226     pMemOs2->Core.u.Phys.PhysBase = Phys;
    227     *ppMem = &pMemOs2->Core;
     239    pMemFreeBSD->Core.u.Phys.fAllocated = false;
     240    pMemFreeBSD->Core.u.Phys.PhysBase = Phys;
     241    *ppMem = &pMemFreeBSD->Core;
    228242    return VINF_SUCCESS;
     243#endif
     244    return VERR_NOT_IMPLEMENTED;   
    229245}
    230246
     
    232248int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process)
    233249{
     250#if 0
    234251    AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
    235252
    236253    /* create the object. */
    237254    const ULONG cPages = cb >> PAGE_SHIFT;
    238     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
    239     if (!pMemOs2)
     255    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
     256    if (!pMemFreeBSD)
    240257        return VERR_NO_MEMORY;
    241258
    242259    /* lock it. */
    243260    ULONG cPagesRet = cPages;
    244     int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet);
    245     if (!rc)
    246     {
    247         rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
    248         Assert(cb == pMemOs2->Core.cb);
    249         Assert(pv == pMemOs2->Core.pv);
    250         pMemOs2->Core.u.Lock.R0Process = R0Process;
    251         *ppMem = &pMemOs2->Core;
    252         return VINF_SUCCESS;
    253     }
    254     rtR0MemObjDelete(&pMemOs2->Core);
    255     return RTErrConvertFromOS2(rc);
     261    int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet);
     262    if (!rc)
     263    {
     264        rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
     265        Assert(cb == pMemFreeBSD->Core.cb);
     266        Assert(pv == pMemFreeBSD->Core.pv);
     267        pMemFreeBSD->Core.u.Lock.R0Process = R0Process;
     268        *ppMem = &pMemFreeBSD->Core;
     269        return VINF_SUCCESS;
     270    }
     271    rtR0MemObjDelete(&pMemFreeBSD->Core);
     272    return RTErrConvertFromOS2(rc);
     273#endif
     274    return VERR_NOT_IMPLEMENTED;
    256275}
    257276
     
    259278int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb)
    260279{
     280#if 0
    261281    /* create the object. */
    262282    const ULONG cPages = cb >> PAGE_SHIFT;
    263     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
    264     if (!pMemOs2)
     283    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
     284    if (!pMemFreeBSD)
    265285        return VERR_NO_MEMORY;
    266286
    267287    /* lock it. */
    268288    ULONG cPagesRet = cPages;
    269     int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet);
    270     if (!rc)
    271     {
    272         rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet);
    273         pMemOs2->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
    274         *ppMem = &pMemOs2->Core;
    275         return VINF_SUCCESS;
    276     }
    277     rtR0MemObjDelete(&pMemOs2->Core);
    278     return RTErrConvertFromOS2(rc);
     289    int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet);
     290    if (!rc)
     291    {
     292        rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet);
     293        pMemFreeBSD->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
     294        *ppMem = &pMemFreeBSD->Core;
     295        return VINF_SUCCESS;
     296    }
     297    rtR0MemObjDelete(&pMemFreeBSD->Core);
     298    return RTErrConvertFromOS2(rc);
     299#endif
     300    return VERR_NOT_IMPLEMENTED;
    279301}
    280302
     
    296318    AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
    297319
     320#if 0
    298321/** @todo finish the implementation. */
    299322
    300323    int rc;
    301324    void *pvR0 = NULL;
    302     PRTR0MEMOBJOS2 pMemToMapOs2 = (PRTR0MEMOBJOS2)pMemToMap;
     325    PRTR0MEMOBJFREEBSD pMemToMapOs2 = (PRTR0MEMOBJFREEBSD)pMemToMap;
    303326    switch (pMemToMapOs2->Core.enmType)
    304327    {
     
    349372     * (reference counting).
    350373     */
    351     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR0, pMemToMapOs2->Core.cb);
    352     if (pMemOs2)
    353     {
    354         pMemOs2->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
    355         *ppMem = &pMemOs2->Core;
     374    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR0, pMemToMapOs2->Core.cb);
     375    if (pMemFreeBSD)
     376    {
     377        pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
     378        *ppMem = &pMemFreeBSD->Core;
    356379        return VINF_SUCCESS;
    357380    }
    358381    return VERR_NO_MEMORY;
     382#endif
     383    return VERR_NOT_IMPLEMENTED;
    359384}
    360385
     
    365390    AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
    366391
     392#if 0
    367393    int rc;
    368394    void *pvR0;
    369395    void *pvR3 = NULL;
    370     PRTR0MEMOBJOS2 pMemToMapOs2 = (PRTR0MEMOBJOS2)pMemToMap;
     396    PRTR0MEMOBJFREEBSD pMemToMapOs2 = (PRTR0MEMOBJFREEBSD)pMemToMap;
    371397    switch (pMemToMapOs2->Core.enmType)
    372398    {
     
    431457     * Create a mapping object for it.
    432458     */
    433     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR3, pMemToMapOs2->Core.cb);
    434     if (pMemOs2)
    435     {
    436         Assert(pMemOs2->Core.pv == pvR3);
    437         pMemOs2->Core.u.Mapping.R0Process = R0Process;
    438         *ppMem = &pMemOs2->Core;
     459    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR3, pMemToMapOs2->Core.cb);
     460    if (pMemFreeBSD)
     461    {
     462        Assert(pMemFreeBSD->Core.pv == pvR3);
     463        pMemFreeBSD->Core.u.Mapping.R0Process = R0Process;
     464        *ppMem = &pMemFreeBSD->Core;
    439465        return VINF_SUCCESS;
    440466    }
    441467    KernVMFree(pvR3);
    442468    return VERR_NO_MEMORY;
     469#endif
     470    return VERR_NOT_IMPLEMENTED;
    443471}
    444472
     
    446474RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, unsigned iPage)
    447475{
    448     PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;
    449 
    450     switch (pMemOs2->Core.enmType)
     476    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
     477
     478    switch (pMemFreeBSD->Core.enmType)
    451479    {
    452480        case RTR0MEMOBJTYPE_PAGE:
    453481        case RTR0MEMOBJTYPE_LOW:
    454482        case RTR0MEMOBJTYPE_LOCK:
    455             return pMemOs2->aPages[iPage].Addr;
     483//            return pMemFreeBSD->aPages[iPage].Addr;
     484return NIL_RTHCPHYS;
    456485
    457486        case RTR0MEMOBJTYPE_CONT:
    458             return pMemOs2->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
     487            return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
    459488
    460489        case RTR0MEMOBJTYPE_PHYS:
    461             return pMemOs2->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);
     490            return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);
    462491
    463492        case RTR0MEMOBJTYPE_RES_VIRT:
     
    467496    }
    468497}
    469 
    470 
    471 /**
    472  * Expands the page list so we can index pages directly.
    473  *
    474  * @param   paPages         The page list array to fix.
    475  * @param   cPages          The number of pages that's supposed to go into the list.
    476  * @param   cPagesRet       The actual number of pages in the list.
    477  */
    478 static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet)
    479 {
    480     Assert(cPages >= cPagesRet);
    481     if (cPages != cPagesRet)
    482     {
    483         ULONG iIn = cPagesRet;
    484         ULONG iOut = cPages;
    485         do
    486         {
    487             iIn--;
    488             iOut--;
    489             Assert(iIn <= iOut);
    490 
    491             KernPageList_t Page = paPages[iIn];
    492             Assert(!(Page.Addr & PAGE_OFFSET_MASK));
    493             Assert(Page.Size == RT_ALIGN_Z(Page.Size, PAGE_SIZE));
    494 
    495             if (Page.Size > PAGE_SIZE)
    496             {
    497                 do
    498                 {
    499                     Page.Size -= PAGE_SIZE;
    500                     paPages[iOut].Addr = Page.Addr + Page.Size;
    501                     paPages[iOut].Size = PAGE_SIZE;
    502                     iOut--;
    503                 } while (Page.Size > PAGE_SIZE);
    504             }
    505 
    506             paPages[iOut].Addr = Page.Addr;
    507             paPages[iOut].Size = PAGE_SIZE;
    508         } while (   iIn != iOut
    509                  && iIn > 0);
    510     }
    511 }
    512 
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