VirtualBox

Changeset 91785 in vbox for trunk


Ignore:
Timestamp:
Oct 17, 2021 1:35:07 PM (3 years ago)
Author:
vboxsync
Message:

SUPDrv: Added SUPR0HCPhysToVirt implementation for FreeBSD (untested). bugref:9627

Location:
trunk
Files:
3 edited

Legend:

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

    r91037 r91785  
    21452145SUPR0DECL(void) SUPR0BadContext(PSUPDRVSESSION pSession, const char *pszFile, uint32_t uLine, const char *pszExpr);
    21462146
    2147 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
     2147#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
    21482148/**
    21492149 * Translates a physical address to a virtual mapping (valid up to end of page).
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp

    r91783 r91785  
    238238    { STKBACK("SUPR0PageMapKernel"),                     (void *)(uintptr_t)SUPR0PageMapKernel },
    239239    { STKBACK("SUPR0PageProtect"),                       (void *)(uintptr_t)SUPR0PageProtect },
    240 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
    241     { STKBACK("SUPR0HCPhysToVirt"),                      (void *)(uintptr_t)SUPR0HCPhysToVirt },         /* only-linux, only solaris */
     240#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
     241    { STKOKAY("SUPR0HCPhysToVirt"),                      (void *)(uintptr_t)SUPR0HCPhysToVirt },         /* only-linux, only-solaris, only-freebsd */
    242242#endif
    243243    { STKBACK("SUPR0Printf"),                            (void *)(uintptr_t)SUPR0Printf },
  • trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c

    r90780 r91785  
    4545#include <sys/conf.h>
    4646#include <sys/uio.h>
     47#include <vm/pmap.h> /* for pmap_map() */
    4748
    4849#include "../SUPDrvInternal.h"
     
    638639
    639640
     641#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64)
     642SUPR0DECL(int) SUPR0HCPhysToVirt(RTHCPHYS HCPhys, void **ppv)
     643{
     644    AssertReturn(!(HCPhys & PAGE_OFFSET_MASK), VERR_INVALID_POINTER);
     645    AssertReturn(HCPhys != NIL_RTHCPHYS, VERR_INVALID_POINTER);
     646    *ppv = (void *)(uintptr_t)pmap_map(NULL, HCPhys, (HCPhys | PAGE_OFFSET_MASK) + 1, VM_PROT_WRITE | VM_PROT_READ);
     647    return VINF_SUCCESS;
     648}
     649#endif
     650
     651
    640652SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...)
    641653{
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