VirtualBox

Changeset 107227 in vbox


Ignore:
Timestamp:
Dec 4, 2024 3:20:14 PM (6 weeks ago)
Author:
vboxsync
Message:

VMM: Cleaning up ARMv8 / x86 split. jiraref:VBP-1470

Location:
trunk
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/dbgf.h

    r106362 r107227  
    18121812typedef enum DBGFREG
    18131813{
     1814    DBGFREG_X86_FIRST = 0,
    18141815    /* General purpose registers: */
    1815     DBGFREG_AL  = 0,
     1816    DBGFREG_AL  = DBGFREG_X86_FIRST,
    18161817    DBGFREG_AX  = DBGFREG_AL,
    18171818    DBGFREG_EAX = DBGFREG_AL,
     
    20552056    DBGFREG_IDTR,
    20562057
    2057     /** The end of the x86 registers. */
    2058     DBGFREG_X86_END = DBGFREG_IDTR,
     2058    /** The last of the x86 registers. */
     2059    DBGFREG_X86_LAST = DBGFREG_IDTR,
     2060    /* Misnomer. */
     2061    DBGFREG_X86_END = DBGFREG_X86_LAST,
    20592062
    20602063    /** @name ARMv8 register identifiers.
  • trunk/include/VBox/vmm/pgm.h

    r106061 r107227  
    13281328                                         const void *pvBinary, uint32_t cbBinary, uint8_t fFlags, const char *pszDesc);
    13291329VMMR3DECL(int)      PGMR3PhysRomProtect(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMROMPROT enmProt);
     1330# if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)
    13301331VMMDECL(void)       PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
     1332# endif
    13311333
    13321334VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
  • trunk/include/VBox/vmm/tm.h

    r106061 r107227  
    172172VMM_INT_DECL(bool)      TMCpuTickIsTicking(PVMCPUCC pVCpu);
    173173
    174 #if defined(VBOX_VMM_TARGET_ARMV8)
     174#ifdef VBOX_VMM_TARGET_ARMV8
    175175VMM_INT_DECL(void)      TMCpuSetVTimerNextActivation(PVMCPUCC pVCpu, uint64_t cNanoSecs);
    176176VMM_INT_DECL(uint64_t)  TMCpuGetVTimerActivationNano(PVMCPUCC pVCpu);
  • trunk/include/VBox/vmm/vm.h

    r107113 r107227  
    5656# pragma D depends_on library CPUMInternal.d
    5757# define VMM_INCLUDED_SRC_include_CPUMInternal_h
     58# define VBOX_VMM_TARGET_AGNOSTIC
     59#endif
     60
     61#if !defined(VBOX_VMM_TARGET_AGNOSTIC) \
     62 && !defined(VBOX_VMM_TARGET_X86) \
     63 && !defined(VBOX_VMM_TARGET_ARMV8)
     64# error "VMM target not defined"
    5865#endif
    5966
     
    130137    VMCPUSTATE volatile     enmState;
    131138
    132 #if defined(VBOX_VMM_TARGET_ARMV8)
     139#ifdef VBOX_VMM_TARGET_ARMV8
    133140    uint32_t                u32Alignment0;
    134141    /** The number of nano seconds when the vTimer of the associated vCPU is supposed to activate
     
    288295    } gim;
    289296
    290 #if defined(VBOX_VMM_TARGET_ARMV8)
    291     /** GIC part. */
    292     union VMCPUUNIONGIC
    293     {
     297    /* Interrupt controller, target specific. */
     298    RT_GCC_EXTENSION
     299    union
     300    {
     301#if defined(VBOX_VMM_TARGET_ARMV8) || defined(VBOX_VMM_TARGET_AGNOSTIC)
     302        /** GIC part. */
     303        union
     304        {
    294305# ifdef VMM_INCLUDED_SRC_include_GICInternal_h
    295         struct GICCPU       s;
     306            struct GICCPU       s;
    296307# endif
    297         uint8_t             padding[3840];      /* multiple of 64 */
    298     } gic;
    299 #else
    300     /** APIC part. */
    301     union VMCPUUNIONAPIC
    302     {
     308            uint8_t             padding[3840];      /* multiple of 64 */
     309        } gic;
     310#endif
     311#if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)
     312        /** APIC part. */
     313        union
     314        {
    303315# ifdef VMM_INCLUDED_SRC_include_APICInternal_h
    304         struct APICCPU      s;
     316            struct APICCPU      s;
    305317# endif
    306         uint8_t             padding[3840];      /* multiple of 64 */
    307     } apic;
    308 #endif
     318            uint8_t             padding[3840];      /* multiple of 64 */
     319        } apic;
     320#endif
     321    };
    309322
    310323    /*
     
    483496
    484497
    485 #if defined(VBOX_VMM_TARGET_ARMV8)
     498#if defined(VBOX_VMM_TARGET_ARMV8) || defined(VBOX_VMM_TARGET_AGNOSTIC)
    486499/** This action forces the VM to inject an IRQ into the guest. */
    487500# define VMCPU_FF_INTERRUPT_IRQ             RT_BIT_64(VMCPU_FF_INTERRUPT_IRQ_BIT)
     
    490503# define VMCPU_FF_INTERRUPT_FIQ             RT_BIT_64(VMCPU_FF_INTERRUPT_FIQ_BIT)
    491504# define VMCPU_FF_INTERRUPT_FIQ_BIT         1
    492 #else
     505#endif
     506#if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)
    493507/** This action forces the VM to check any pending interrupts on the APIC. */
    494508# define VMCPU_FF_INTERRUPT_APIC            RT_BIT_64(VMCPU_FF_INTERRUPT_APIC_BIT)
     
    541555#define VMCPU_FF_HM_UPDATE_CR3              RT_BIT_64(VMCPU_FF_HM_UPDATE_CR3_BIT)
    542556#define VMCPU_FF_HM_UPDATE_CR3_BIT          12
    543 #if defined(VBOX_VMM_TARGET_ARMV8)
     557#if defined(VBOX_VMM_TARGET_ARMV8) || defined(VBOX_VMM_TARGET_AGNOSTIC)
    544558# define VMCPU_FF_VTIMER_ACTIVATED          RT_BIT_64(VMCPU_FF_VTIMER_ACTIVATED_BIT)
    545559# define VMCPU_FF_VTIMER_ACTIVATED_BIT      13
    546 #else
     560#endif
     561#if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)
    547562/* Bit 13 used to be VMCPU_FF_HM_UPDATE_PAE_PDPES. */
    548563#endif
     
    618633#define VM_FF_EXTERNAL_HALTED_MASK              (  VM_FF_CHECK_VM_STATE | VM_FF_DBGF    | VM_FF_REQUEST \
    619634                                                 | VM_FF_PDM_QUEUES     | VM_FF_PDM_DMA | VM_FF_EMT_RENDEZVOUS )
     635
     636#ifndef VBOX_VMM_TARGET_AGNOSTIC
    620637/** Externally forced VMCPU actions. Used to quit the idle/wait loop. */
    621 #if defined(VBOX_VMM_TARGET_ARMV8)
    622 # define VMCPU_FF_EXTERNAL_HALTED_MASK          (  VMCPU_FF_INTERRUPT_IRQ | VMCPU_FF_INTERRUPT_FIQ \
     638# if defined(VBOX_VMM_TARGET_ARMV8)
     639#  define VMCPU_FF_EXTERNAL_HALTED_MASK         (  VMCPU_FF_INTERRUPT_IRQ | VMCPU_FF_INTERRUPT_FIQ \
    623640                                                 | VMCPU_FF_REQUEST       | VMCPU_FF_INTERRUPT_NMI  | VMCPU_FF_INTERRUPT_SMI \
    624641                                                 | VMCPU_FF_UNHALT        | VMCPU_FF_TIMER          | VMCPU_FF_DBGF \
    625642                                                 | VMCPU_FF_VTIMER_ACTIVATED)
    626 #else
    627 # define VMCPU_FF_EXTERNAL_HALTED_MASK          (  VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC \
     643# else
     644#  define VMCPU_FF_EXTERNAL_HALTED_MASK         (  VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC \
    628645                                                 | VMCPU_FF_REQUEST     | VMCPU_FF_INTERRUPT_NMI  | VMCPU_FF_INTERRUPT_SMI \
    629646                                                 | VMCPU_FF_UNHALT      | VMCPU_FF_TIMER          | VMCPU_FF_DBGF \
    630647                                                 | VMCPU_FF_INTERRUPT_NESTED_GUEST)
     648# endif
    631649#endif
    632650
     
    635653                                                 | VM_FF_DEBUG_SUSPEND  | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY \
    636654                                                 | VM_FF_EMT_RENDEZVOUS )
     655#ifndef VBOX_VMM_TARGET_AGNOSTIC
    637656/** High priority VMCPU pre-execution actions. */
    638 #if defined(VBOX_VMM_TARGET_ARMV8)
    639 # define VMCPU_FF_HIGH_PRIORITY_PRE_MASK        (  VMCPU_FF_TIMER        | VMCPU_FF_INTERRUPT_IRQ     | VMCPU_FF_INTERRUPT_FIQ \
     657# if defined(VBOX_VMM_TARGET_ARMV8)
     658#  define VMCPU_FF_HIGH_PRIORITY_PRE_MASK       (  VMCPU_FF_TIMER        | VMCPU_FF_INTERRUPT_IRQ     | VMCPU_FF_INTERRUPT_FIQ \
    640659                                                 | VMCPU_FF_DBGF )
    641 #else
    642 # define VMCPU_FF_HIGH_PRIORITY_PRE_MASK        (  VMCPU_FF_TIMER        | VMCPU_FF_INTERRUPT_APIC     | VMCPU_FF_INTERRUPT_PIC \
     660# else
     661#  define VMCPU_FF_HIGH_PRIORITY_PRE_MASK       (  VMCPU_FF_TIMER        | VMCPU_FF_INTERRUPT_APIC     | VMCPU_FF_INTERRUPT_PIC \
    643662                                                 | VMCPU_FF_UPDATE_APIC  | VMCPU_FF_DBGF \
    644663                                                 | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL \
    645664                                                 | VMCPU_FF_INTERRUPT_NESTED_GUEST | VMCPU_FF_VMX_MTF  | VMCPU_FF_VMX_APIC_WRITE \
    646665                                                 | VMCPU_FF_VMX_PREEMPT_TIMER | VMCPU_FF_VMX_NMI_WINDOW | VMCPU_FF_VMX_INT_WINDOW )
     666# endif
    647667#endif
    648668
     
    685705#endif
    686706
    687 #if !defined(VBOX_VMM_TARGET_ARMV8)
     707#if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)
    688708/** VMCPU flags that cause the REP[|NE|E] STRINS loops to yield, interrupts
    689709 *  enabled. */
     
    15041524    } gim;
    15051525
    1506 #if defined(VBOX_VMM_TARGET_ARMV8)
    1507     union
    1508     {
     1526    /** Interrupt controller, target specific. */
     1527    RT_GCC_EXTENSION
     1528    union
     1529    {
     1530#if defined(VBOX_VMM_TARGET_ARMV8) || defined(VBOX_VMM_TARGET_AGNOSTIC)
     1531        union
     1532        {
    15091533# ifdef VMM_INCLUDED_SRC_include_GICInternal_h
    1510         struct GIC  s;
     1534            struct GIC  s;
    15111535# endif
    1512         uint8_t     padding[128];       /* multiple of 8 */
    1513     } gic;
    1514 #else
    1515     union
    1516     {
     1536            uint8_t     padding[128];   /* multiple of 8 */
     1537        } gic;
     1538#endif
     1539#if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)
     1540        union
     1541        {
    15171542# ifdef VMM_INCLUDED_SRC_include_APICInternal_h
    1518         struct APIC s;
     1543            struct APIC s;
    15191544# endif
    1520         uint8_t     padding[128];       /* multiple of 8 */
    1521     } apic;
    1522 #endif
     1545            uint8_t     padding[128];   /* multiple of 8 */
     1546        } apic;
     1547#endif
     1548    };
    15231549
    15241550    /* ---- begin small stuff ---- */
  • trunk/src/VBox/HostDrivers/Support/testcase/Makefile.kmk

    r106945 r107227  
    8383
    8484tstInt_TEMPLATE       = VBoxR3SignedExe
    85 tstInt_DEFS           = $(VMM_COMMON_DEFS)
     85tstInt_DEFS           = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    8686tstInt_SOURCES        = tstInt.cpp
    8787tstInt_LIBS           = $(LIB_RUNTIME)
  • trunk/src/VBox/HostDrivers/Support/testcase/tstInt.cpp

    r106061 r107227  
    106106            if (RT_SUCCESS(rc))
    107107            {
    108                 PVM pVM = CreateVMReq.pVMR3;
     108                PVM const pVM = CreateVMReq.pVMR3;
    109109                AssertRelease(RT_VALID_PTR(pVM));
    110110                AssertRelease(pVM->pVMR0ForCall == CreateVMReq.pVMR0);
  • trunk/src/VBox/VMM/Makefile.kmk

    r107194 r107227  
    6262VBoxVMM_SONAME.linux = VBoxVMM.so
    6363
    64 VBoxVMM_DEFS     = VBOX_IN_VMM IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG $(VMM_COMMON_DEFS)
     64VBoxVMM_DEFS     = VBOX_VMM_TARGET_X86 VBOX_IN_VMM IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG $(VMM_COMMON_DEFS)
    6565## @todo eliminate IN_GMM_R3
    6666ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
     
    835835 VMMR0_SYSSUFF   = .r0
    836836
    837  VMMR0_DEFS      = VBOX_IN_VMM IN_VMM_R0 IN_RT_R0 IN_DIS DIS_CORE_ONLY IN_GVMM_R0 IN_GMM_R0 IN_INTNET_R0 \
     837 VMMR0_DEFS      = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_R0 IN_RT_R0 IN_DIS DIS_CORE_ONLY IN_GVMM_R0 IN_GMM_R0 IN_INTNET_R0 \
    838838        $(VMM_COMMON_DEFS) RTASSERT_HAVE_SHOULD_PANIC
    839839 ## @todo eliminate IN_GVMM_R0 IN_GMM_R0
     
    10431043 LIBRARIES += SSMStandalone
    10441044 SSMStandalone_TEMPLATE = VBoxR3Exe
    1045  SSMStandalone_DEFS    = VBOX_IN_VMM IN_VMM_R3 IN_VMM_STATIC SSM_STANDALONE CPUM_DB_STANDALONE $(VMM_COMMON_DEFS)
     1045 SSMStandalone_DEFS    = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_R3 IN_VMM_STATIC SSM_STANDALONE CPUM_DB_STANDALONE $(VMM_COMMON_DEFS)
    10461046 SSMStandalone_INCS    = include
    10471047 SSMStandalone_SOURCES = \
  • trunk/src/VBox/VMM/VMMAll/TMAllCpu.cpp

    r106061 r107227  
    661661
    662662
    663 #if defined(VBOX_VMM_TARGET_ARMV8)
     663#ifdef VBOX_VMM_TARGET_ARMV8
     664
    664665/**
    665666 * Sets the number of nanoseconds from now when the vTiemr is supposed to expire next.
     
    688689    return pVCpu->cNsVTimerActivate;
    689690}
    690 #endif
     691
     692#endif /* VBOX_VMM_TARGET_ARMV8 */
  • trunk/src/VBox/VMM/VMMR3/DBGF.cpp

    r107030 r107227  
    15981598         * Do minimal parsing.  No real need to involve the disassembler here.
    15991599         */
    1600         if (   (u32Insn & 0xfffffc1f) == 0xd65f0000 /* RET */
    1601             || (u32Insn & 0xfffffc1f) == 0xd65f081f /* RETAA */
    1602             || (u32Insn & 0xfffffc1f) == 0xd65f0c1f /* RETAB */
    1603             || (u32Insn & 0xffffffff) == 0xd69f03e0 /* ERET */
    1604             || (u32Insn & 0xffffffff) == 0xd69f0bff /* ERETAA */
    1605             || (u32Insn & 0xffffffff) == 0xd69f0fff /* ERETAB */)
     1600        if (   (u32Insn & UINT32_C(0xfffffc1f)) == UINT32_C(0xd65f0000) /* RET */
     1601            || (u32Insn & UINT32_C(0xfffffc1f)) == UINT32_C(0xd65f081f) /* RETAA */
     1602            || (u32Insn & UINT32_C(0xfffffc1f)) == UINT32_C(0xd65f0c1f) /* RETAB */
     1603            || (u32Insn & UINT32_C(0xffffffff)) == UINT32_C(0xd69f03e0) /* ERET */
     1604            || (u32Insn & UINT32_C(0xffffffff)) == UINT32_C(0xd69f0bff) /* ERETAA */
     1605            || (u32Insn & UINT32_C(0xffffffff)) == UINT32_C(0xd69f0fff) /* ERETAB */)
    16061606            return DBGFSTEPINSTRTYPE_RET;
    1607         else if (   (u32Insn & 0xfffffc1f) == 0xd63f0000 /* BLR */
    1608                  || (u32Insn & 0xfffffc1f) == 0xd63f081f /* BLRAAZ */
    1609                  || (u32Insn & 0xfffffc1f) == 0xd63f0c1f /* BLRABZ */
    1610                  || (u32Insn & 0xfffffc00) == 0xd73f0800 /* BLRAA */
    1611                  || (u32Insn & 0xfffffc00) == 0xd73f0c00 /* BLRAB */
    1612                  || (u32Insn & 0xfc000000) == 0x14000000 /* BL */
    1613                  || (u32Insn & 0xffe0001f) == 0xd4000001 /* SVC */
    1614                  || (u32Insn & 0xffe0001f) == 0xd4000002 /* HVC */
    1615                  || (u32Insn & 0xffe0001f) == 0xd4000003 /* SMC */
    1616                  || (u32Insn & 0xffe0001f) == 0xd4200000 /* BRK */
    1617                  || (u32Insn & 0xffe0001f) == 0xd4400000 /* HLT */)
     1607        if (   (u32Insn & UINT32_C(0xfffffc1f)) == UINT32_C(0xd63f0000) /* BLR */
     1608            || (u32Insn & UINT32_C(0xfffffc1f)) == UINT32_C(0xd63f081f) /* BLRAAZ */
     1609            || (u32Insn & UINT32_C(0xfffffc1f)) == UINT32_C(0xd63f0c1f) /* BLRABZ */
     1610            || (u32Insn & UINT32_C(0xfffffc00)) == UINT32_C(0xd73f0800) /* BLRAA */
     1611            || (u32Insn & UINT32_C(0xfffffc00)) == UINT32_C(0xd73f0c00) /* BLRAB */
     1612            || (u32Insn & UINT32_C(0xfc000000)) == UINT32_C(0x14000000) /* BL */
     1613            || (u32Insn & UINT32_C(0xffe0001f)) == UINT32_C(0xd4000001) /* SVC */
     1614            || (u32Insn & UINT32_C(0xffe0001f)) == UINT32_C(0xd4000002) /* HVC */
     1615            || (u32Insn & UINT32_C(0xffe0001f)) == UINT32_C(0xd4000003) /* SMC */
     1616            || (u32Insn & UINT32_C(0xffe0001f)) == UINT32_C(0xd4200000) /* BRK */
     1617            || (u32Insn & UINT32_C(0xffe0001f)) == UINT32_C(0xd4400000) /* HLT */)
    16181618            return DBGFSTEPINSTRTYPE_CALL;
    1619         else
    1620             return DBGFSTEPINSTRTYPE_OTHER;
    1621     }
    1622 #else
     1619        return DBGFSTEPINSTRTYPE_OTHER;
     1620    }
     1621
     1622#elif defined(VBOX_VMM_TARGET_X86)
    16231623    /*
    16241624     * Read the instruction.
     
    16941694        }
    16951695    }
     1696
     1697#else
     1698# error "port me"
    16961699#endif
    16971700
  • trunk/src/VBox/VMM/VMMR3/DBGFCoreWrite.cpp

    r107113 r107227  
    329329static void dbgfR3GetCoreCpu(PVMCPU pVCpu, PDBGFCORECPU pDbgfCpu)
    330330{
    331 #define DBGFCOPYSEL(a_dbgfsel, a_cpumselreg) \
     331    PCCPUMCTX const pCtx = CPUMQueryGuestCtxPtr(pVCpu);
     332
     333#ifdef VBOX_VMM_TARGET_X86
     334# define DBGFCOPYSEL(a_dbgfsel, a_cpumselreg) \
    332335    do { \
    333336        (a_dbgfsel).uBase  = (a_cpumselreg).u64Base; \
     
    337340    } while (0)
    338341
    339 #if defined(VBOX_VMM_TARGET_ARMV8)
    340     AssertReleaseFailed();
    341     RT_NOREF(pVCpu, pDbgfCpu);
    342 #else
    343     PVM       pVM  = pVCpu->CTX_SUFF(pVM);
    344     PCCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
    345342    pDbgfCpu->rax             = pCtx->rax;
    346343    pDbgfCpu->rbx             = pCtx->rbx;
     
    395392    pDbgfCpu->aXcr[1]         = pCtx->aXcr[1];
    396393    AssertCompile(sizeof(pDbgfCpu->ext) == sizeof(pCtx->XState));
     394
     395    PVM const pVM  = pVCpu->CTX_SUFF(pVM);
    397396    pDbgfCpu->cbExt = pVM->cpum.ro.GuestFeatures.cbMaxExtendedState;
    398397    if (RT_LIKELY(pDbgfCpu->cbExt))
    399398        memcpy(&pDbgfCpu->ext, &pCtx->XState, pDbgfCpu->cbExt);
     399
     400# undef DBGFCOPYSEL
     401
     402#elif defined(VBOX_VMM_TARGET_ARMV8)
     403    RT_NOREF(pCtx, pDbgfCpu);
     404    AssertReleaseFailed();
     405
     406#else
     407# error "port me"
    400408#endif
    401 
    402 #undef DBGFCOPYSEL
    403409}
    404410
  • trunk/src/VBox/VMM/VMMR3/DBGFCpu.cpp

    r106061 r107227  
    5555    Assert(idCpu == VMMGetCpuId(pVM));
    5656    PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu);
    57 #if defined(VBOX_VMM_TARGET_ARMV8)
     57#ifdef VBOX_VMM_TARGET_ARMV8
    5858    CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_PSTATE);
     59#elif defined(VBOX_VMM_TARGET_X86)
     60    CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_EFER);
    5961#else
    60     CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_EFER);
     62# error "port me"
    6163#endif
    6264    *penmMode = CPUMGetGuestMode(pVCpu);
     
    98100    Assert(idCpu == VMMGetCpuId(pVM));
    99101    PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu);
    100 #if defined(VBOX_VMM_TARGET_ARMV8)
     102#ifdef VBOX_VMM_TARGET_ARMV8
    101103    CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_PSTATE);
     104#elif defined(VBOX_VMM_TARGET_X86)
     105    CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_EFER);
    102106#else
    103     CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_EFER);
     107# error "port me"
    104108#endif
    105109    *pfIn64BitCode = CPUMIsGuestIn64BitCode(pVCpu);
     
    129133
    130134
    131 #if !defined(VBOX_VMM_TARGET_ARMV8)
     135#ifdef VBOX_VMM_TARGET_X86
    132136/**
    133137 * Wrapper around CPUMIsGuestInV86Code.
     
    162166    AssertReturn(idCpu < pUVM->pVM->cCpus, false);
    163167
    164 #if defined(VBOX_VMM_TARGET_ARMV8)
    165     /* This is a public visible API, so we need to fill in a stub. */
    166     return false;
    167 #else
     168#ifdef VBOX_VMM_TARGET_X86
    168169    bool fInV86Code;
    169170    int rc = VMR3ReqPriorityCallWaitU(pUVM, idCpu, (PFNRT)dbgfR3CpuInV86Code, 3, pUVM->pVM, idCpu, &fInV86Code);
     
    171172        return false;
    172173    return fInV86Code;
     174#else
     175    return false;
    173176#endif
    174177}
  • trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp

    r106743 r107227  
    6868    /** The address space for resolving symbol. */
    6969    RTDBGAS         hDbgAs;
    70 #if !defined(VBOX_VMM_TARGET_ARMV8)
     70#ifdef VBOX_VMM_TARGET_X86
    7171    /** Pointer to the first byte in the segment. */
    7272    RTGCUINTPTR     GCPtrSegBase;
     
    115115                                 RTGCPTR GCPtr, uint32_t fFlags, PDBGFDISASSTATE pState)
    116116{
    117 #if !defined(VBOX_VMM_TARGET_ARMV8)
     117#ifndef VBOX_VMM_TARGET_X86
     118    RT_NOREF_PV(pSelInfo);
     119    pState->f64Bits         = CPUMIsGuestIn64BitCode(pVCpu);
     120#else
    118121    pState->GCPtrSegBase    = pSelInfo->GCPtrBase;
    119122    pState->GCPtrSegEnd     = pSelInfo->cbLimit + 1 + (RTGCUINTPTR)pSelInfo->GCPtrBase;
    120123    pState->cbSegLimit      = pSelInfo->cbLimit;
    121124    pState->f64Bits         = enmMode >= PGMMODE_AMD64 && pSelInfo->u.Raw.Gen.u1Long;
    122 #else
    123     RT_NOREF(pSelInfo);
    124 
    125     pState->f64Bits         = CPUMGetGuestCodeBits(pVCpu) == 64;
    126125#endif
    127126    pState->enmMode         = enmMode;
     
    142141            enmCpuMode = CPUMGetGuestDisMode(pVCpu);
    143142            break;
    144 #if !defined(VBOX_VMM_TARGET_ARMV8)
     143#ifdef VBOX_VMM_TARGET_X86
    145144        case DBGF_DISAS_FLAGS_16BIT_MODE:
    146145        case DBGF_DISAS_FLAGS_16BIT_REAL_MODE:
     
    153152            enmCpuMode = DISCPUMODE_64BIT;
    154153            break;
    155 #else
     154#elif defined(VBOX_VMM_TARGET_ARMV8)
    156155        case DBGF_DISAS_FLAGS_16BIT_MODE: /** @todo r=aeichner This is a bit abusive... */
    157156        case DBGF_DISAS_FLAGS_16BIT_REAL_MODE:
     
    164163            enmCpuMode = DISCPUMODE_ARMV8_A64;
    165164            break;
     165#else
     166# error "port me"
    166167#endif
    167168    }
     
    237238    for (;;)
    238239    {
    239 #if !defined(VBOX_VMM_TARGET_ARMV8)
     240#ifdef VBOX_VMM_TARGET_X86
    240241        RTGCUINTPTR GCPtr = pDis->uInstrAddr + offInstr + pState->GCPtrSegBase;
    241242#else
     
    269270        }
    270271
    271         uint32_t cb = GUEST_PAGE_SIZE - (GCPtr & GUEST_PAGE_OFFSET_MASK);
    272 #if !defined(VBOX_VMM_TARGET_ARMV8)
     272#ifdef VBOX_VMM_TARGET_X86
    273273        /*
    274274         * Check the segment limit.
     
    276276        if (!pState->f64Bits && pDis->uInstrAddr + offInstr > pState->cbSegLimit)
    277277            return VERR_OUT_OF_SELECTOR_BOUNDS;
     278#endif
    278279
    279280        /*
    280281         * Calc how much we can read, maxing out the read.
    281282         */
     283        uint32_t cb = GUEST_PAGE_SIZE - (GCPtr & GUEST_PAGE_OFFSET_MASK);
     284#ifdef VBOX_VMM_TARGET_X86
    282285        if (!pState->f64Bits)
    283286        {
     
    313316{
    314317    PDBGFDISASSTATE pState   = (PDBGFDISASSTATE)pDis;
    315     PCDBGFSELINFO   pSelInfo = (PCDBGFSELINFO)pvUser;
    316318
    317319    /*
     
    320322    DBGFADDRESS     Addr;
    321323    int             rc;
    322 #if !defined(VBOX_VMM_TARGET_ARMV8)
     324#ifdef VBOX_VMM_TARGET_X86
     325    PCDBGFSELINFO   pSelInfo = (PCDBGFSELINFO)pvUser;
     326
    323327    /* Start with CS. */
    324328    if (   DIS_FMT_SEL_IS_REG(u32Sel)
     
    349353        rc = VERR_SYMBOL_NOT_FOUND;
    350354    }
     355
    351356#else
    352     RT_NOREF(pSelInfo, u32Sel);
    353 
     357    RT_NOREF(pvUser, u32Sel);
    354358    DBGFR3AddrFromFlat(pState->pVM->pUVM, &Addr, uAddress);
    355359    rc = VINF_SUCCESS;
     
    410414    int     rc;
    411415
    412 #if defined(VBOX_VMM_TARGET_ARMV8)
    413     DBGFSELINFO     SelInfo; RT_ZERO(SelInfo);
    414     const PGMMODE   enmMode = PGMGetGuestMode(pVCpu);
    415     const bool      fRealModeAddress = false;
    416     if (fFlags & DBGF_DISAS_FLAGS_CURRENT_GUEST)
    417         GCPtr = CPUMGetGuestFlatPC(pVCpu);
    418 #else
     416#ifdef VBOX_VMM_TARGET_X86
    419417    /*
    420418     * Get the Sel and GCPtr if fFlags requests that.
     
    542540        }
    543541    }
    544 #endif
     542
     543#else  /* !VBOX_VMM_TARGET_X86 */
     544    const PGMMODE   enmMode = PGMGetGuestMode(pVCpu);
     545    const bool      fRealModeAddress = false;
     546    if (fFlags & DBGF_DISAS_FLAGS_CURRENT_GUEST)
     547        GCPtr = CPUMGetGuestFlatPC(pVCpu);
     548#endif /* !VBOX_VMM_TARGET_X86 */
    545549
    546550    /*
     
    548552     */
    549553    DBGFDISASSTATE State;
     554#ifdef VBOX_VMM_TARGET_X86
    550555    rc = dbgfR3DisasInstrFirst(pVM, pVCpu, &SelInfo, enmMode, GCPtr, fFlags, &State);
     556#else
     557    rc = dbgfR3DisasInstrFirst(pVM, pVCpu, NULL, enmMode, GCPtr, fFlags, &State);
     558#endif
    551559    if (RT_FAILURE(rc))
    552560    {
     
    562570     */
    563571    char szBuf[512];
    564 #if defined(VBOX_VMM_TARGET_ARMV8)
     572#ifdef VBOX_VMM_TARGET_ARMV8
    565573    DISFormatArmV8Ex(&State.Dis, szBuf, sizeof(szBuf),
    566574                     DIS_FMT_FLAGS_RELATIVE_BRANCH,
    567575                     fFlags & DBGF_DISAS_FLAGS_NO_SYMBOLS ? NULL : dbgfR3DisasGetSymbol,
    568576                     NULL);
    569 #else
     577#elif defined(VBOX_VMM_TARGET_X86)
    570578    DISFormatYasmEx(&State.Dis, szBuf, sizeof(szBuf),
    571579                    DIS_FMT_FLAGS_RELATIVE_BRANCH,
    572580                    fFlags & DBGF_DISAS_FLAGS_NO_SYMBOLS ? NULL : dbgfR3DisasGetSymbol,
    573581                    &SelInfo);
     582#else
     583# error "port me"
    574584#endif
    575585
     
    651661        pDisState->Param3    = State.Dis.aParams[2];
    652662        pDisState->Param4    = State.Dis.aParams[3];
    653 #if defined(VBOX_VMM_TARGET_ARMV8)
     663#ifdef VBOX_VMM_TARGET_ARMV8
    654664        memcpy(&pDisState->armv8, &State.Dis.armv8, sizeof(State.Dis.armv8));
     665#elif defined(VBOX_VMM_TARGET_X86)
     666        memcpy(&pDisState->x86, &State.Dis.x86, sizeof(State.Dis.x86));
    655667#else
    656         memcpy(&pDisState->x86, &State.Dis.x86, sizeof(State.Dis.x86));
     668# error "port me"
    657669#endif
    658670    }
  • trunk/src/VBox/VMM/VMMR3/DBGFMem.cpp

    r106061 r107227  
    359359
    360360
    361 #if !defined(VBOX_VMM_TARGET_ARMV8)
     361#ifdef VBOX_VMM_TARGET_X86
    362362/**
    363363 * Worker for DBGFR3SelQueryInfo that calls into SELM.
     
    409409    return rc;
    410410}
    411 #endif
     411#endif /* VBOX_VMM_TARGET_X86 */
    412412
    413413
     
    447447    memset(pSelInfo, 0, sizeof(*pSelInfo));
    448448
    449 #if defined(VBOX_VMM_TARGET_ARMV8)
     449#ifdef VBOX_VMM_TARGET_X86
     450    /*
     451     * Dispatch the request to a worker running on the target CPU.
     452     */
     453    return VMR3ReqPriorityCallWaitU(pUVM, idCpu, (PFNRT)dbgfR3SelQueryInfo, 5, pUVM, idCpu, Sel, fFlags, pSelInfo);
     454#else
    450455    RT_NOREF(Sel);
    451456    return VERR_NOT_SUPPORTED;
    452 #else
    453     /*
    454      * Dispatch the request to a worker running on the target CPU.
    455      */
    456     return VMR3ReqPriorityCallWaitU(pUVM, idCpu, (PFNRT)dbgfR3SelQueryInfo, 5, pUVM, idCpu, Sel, fFlags, pSelInfo);
    457457#endif
    458458}
     
    496496
    497497
     498#ifdef VBOX_WITH_HWVIRT
    498499/**
    499500 * Converts a PGM paging mode to a set of DBGFPGDMP_XXX flags.
     
    506507    switch (enmMode)
    507508    {
    508 #if !defined(VBOX_VMM_TARGET_ARMV8)
     509# ifdef VBOX_VMM_TARGET_X86
    509510        case PGMMODE_32_BIT:
    510511            return DBGFPGDMP_FLAGS_PSE;
     
    525526        case PGMMODE_EPT:
    526527            return DBGFPGDMP_FLAGS_EPT;
     528
     529# elif defined(VBOX_VMM_TARGET_ARM64)
     530       /** @todo arm64: dumping page tables. */
     531# else
     532#  error "port me"
     533# endif
    527534        case PGMMODE_NONE:
    528535            return 0;
    529536        default:
    530537            AssertFailedReturn(UINT32_MAX);
    531 #else
    532         case PGMMODE_NONE:
    533             return 0;
    534         default:
    535             AssertFailedReturn(UINT32_MAX);
    536 #endif
    537     }
    538 }
     538    }
     539}
     540#endif /* VBOX_WITH_HWVIRT */
    539541
    540542
     
    586588                return VINF_SUCCESS;
    587589            }
    588 
    589 #if !defined(VBOX_VMM_TARGET_ARMV8)
     590#if defined(VBOX_WITH_HWVIRT)
    590591            if (fFlags & DBGFPGDMP_FLAGS_CURRENT_CR3)
    591592                cr3 = PGMGetHyperCR3(pVCpu);
    592 #endif
    593593            if (fFlags & DBGFPGDMP_FLAGS_CURRENT_MODE)
    594594                fFlags |= dbgfR3PagingDumpModeToFlags(PGMGetShadowMode(pVCpu));
     595#else
     596            pHlp->pfnPrintf(pHlp, "Expected shadowing mode PGMMODE_NONE, found %d!\n", PGMGetShadowMode(pVCpu));
     597            return VINF_SUCCESS;
     598#endif
    595599        }
    596600        else
    597601        {
    598 #if defined(VBOX_VMM_TARGET_ARMV8)
    599             AssertReleaseFailed();
    600 #else
     602#ifdef VBOX_VMM_TARGET_X86
    601603            if (fFlags & DBGFPGDMP_FLAGS_CURRENT_CR3)
    602604                cr3 = CPUMGetGuestCR3(pVCpu);
     
    608610                fFlags |= CPUMGetGuestEFER(pVCpu) & (MSR_K6_EFER_LME | MSR_K6_EFER_NXE);
    609611            }
     612#elif defined(VBOX_VMM_TARGET_ARMV8)
     613            /** @todo arm64: port me   */
     614            AssertReleaseFailed();
     615            return VERR_NOT_IMPLEMENTED;
     616#else
     617# error "port me"
    610618#endif
    611619        }
     
    645653                                uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp)
    646654{
     655/** @todo adjust this for ARMv8. Probably need two root parameters (instead of
     656 * cr3) as well as a bunch new flags. */
    647657    /*
    648658     * Input validation.
  • trunk/src/VBox/VMM/VMMR3/DBGFR3Bp.cpp

    r107194 r107227  
    177177#include <iprt/assert.h>
    178178#include <iprt/mem.h>
    179 #if defined(VBOX_VMM_TARGET_ARMV8)
     179#ifdef VBOX_VMM_TARGET_ARMV8
    180180# include <iprt/armv8.h>
    181181#endif
     
    17861786    RT_NOREF(pvUser);
    17871787
    1788 #if defined(VBOX_VMM_TARGET_ARMV8)
    1789     RT_NOREF(pVM, pVCpu);
    1790     AssertReleaseFailed();
    1791     return VERR_NOT_IMPLEMENTED;
    1792 #else
     1788#ifdef VBOX_VMM_TARGET_X86
    17931789    /*
    17941790     * CPU 0 updates the enabled hardware breakpoint counts.
     
    18101806
    18111807    return CPUMRecalcHyperDRx(pVCpu, UINT8_MAX);
     1808
     1809#else
     1810    /** @todo arm64: hardware breakpoints. */
     1811    RT_NOREF(pVM, pVCpu);
     1812    AssertReleaseFailed();
     1813    return VERR_NOT_IMPLEMENTED;
    18121814#endif
    18131815}
     
    18551857             * as the VMX code intercepts #BP only when at least one int3 breakpoint is enabled.
    18561858             * A racing vCPU might trigger it and forward it to the guest causing panics/crashes/havoc. */
     1859            /*
     1860             * Save original instruction and replace a breakpoint instruction.
     1861             */
    18571862#ifdef VBOX_VMM_TARGET_ARMV8
    1858             /*
    1859              * Save original instruction and replace with brk
    1860              */
    1861             rc = PGMPhysSimpleReadGCPhys(pVM, &pBp->Pub.u.Sw.Arch.armv8.u32Org, pBp->Pub.u.Sw.PhysAddr, sizeof(pBp->Pub.u.Sw.Arch.armv8.u32Org));
    1862             if (RT_SUCCESS(rc))
    1863             {
    1864                 static const uint32_t s_u32Brk = Armv8A64MkInstrBrk(0xc0de);
    1865                 rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &s_u32Brk, sizeof(s_u32Brk));
    1866             }
     1863            static const uint32_t s_BreakpointInstr = Armv8A64MkInstrBrk(0xc0de);
     1864            rc = PGMPhysSimpleReadGCPhys(pVM, &pBp->Pub.u.Sw.Arch.armv8.u32Org, pBp->Pub.u.Sw.PhysAddr,
     1865                                         sizeof(pBp->Pub.u.Sw.Arch.armv8.u32Org));
     1866#elif defined(VBOX_VMM_TARGET_X86)
     1867            static const uint8_t  s_BreakpointInstr = 0xcc;
     1868            rc = PGMPhysSimpleReadGCPhys(pVM, &pBp->Pub.u.Sw.Arch.x86.bOrg, pBp->Pub.u.Sw.PhysAddr,
     1869                                         sizeof(pBp->Pub.u.Sw.Arch.x86.bOrg));
    18671870#else
    1868             /*
    1869              * Save current byte and write the int3 instruction byte.
    1870              */
    1871             rc = PGMPhysSimpleReadGCPhys(pVM, &pBp->Pub.u.Sw.Arch.x86.bOrg, pBp->Pub.u.Sw.PhysAddr, sizeof(pBp->Pub.u.Sw.Arch.x86.bOrg));
    1872             if (RT_SUCCESS(rc))
    1873             {
    1874                 static const uint8_t s_bInt3 = 0xcc;
    1875                 rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &s_bInt3, sizeof(s_bInt3));
    1876             }
     1871# error "port me"
    18771872#endif
    18781873            if (RT_SUCCESS(rc))
    18791874            {
    1880                 ASMAtomicIncU32(&pVM->dbgf.s.cEnabledSwBreakpoints);
    1881                 Log(("DBGF: Set breakpoint at %RGv (Phys %RGp)\n", pBp->Pub.u.Sw.GCPtr, pBp->Pub.u.Sw.PhysAddr));
    1882             }
    1883 
    1884             if (RT_FAILURE(rc))
    1885                 dbgfR3BpSetEnabled(pBp, false /*fEnabled*/);
    1886 
     1875                rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &s_BreakpointInstr, sizeof(s_BreakpointInstr));
     1876                if (RT_SUCCESS(rc))
     1877                {
     1878                    ASMAtomicIncU32(&pVM->dbgf.s.cEnabledSwBreakpoints);
     1879                    Log(("DBGF: Set breakpoint at %RGv (Phys %RGp)\n", pBp->Pub.u.Sw.GCPtr, pBp->Pub.u.Sw.PhysAddr));
     1880                    break;
     1881                }
     1882            }
     1883            dbgfR3BpSetEnabled(pBp, false /*fEnabled*/);
    18871884            break;
    18881885        }
     
    19521949            if (   RT_SUCCESS(rc)
    19531950                && u32Current == Armv8A64MkInstrBrk(0xc0de))
    1954                 rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &pBp->Pub.u.Sw.Arch.armv8.u32Org, sizeof(pBp->Pub.u.Sw.Arch.armv8.u32Org));
     1951                rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &pBp->Pub.u.Sw.Arch.armv8.u32Org,
     1952                                              sizeof(pBp->Pub.u.Sw.Arch.armv8.u32Org));
    19551953#else
    19561954            uint8_t bCurrent = 0;
     
    19581956            if (   RT_SUCCESS(rc)
    19591957                && bCurrent == 0xcc)
    1960                 rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &pBp->Pub.u.Sw.Arch.x86.bOrg, sizeof(pBp->Pub.u.Sw.Arch.x86.bOrg));
     1958                rc = PGMPhysSimpleWriteGCPhys(pVM, pBp->Pub.u.Sw.PhysAddr, &pBp->Pub.u.Sw.Arch.x86.bOrg,
     1959                                              sizeof(pBp->Pub.u.Sw.Arch.x86.bOrg));
    19611960#endif
    1962 
    19631961            if (RT_SUCCESS(rc))
    19641962            {
     
    19911989
    19921990/**
    1993  * Worker for DBGFR3BpHit() differnetiating on the breakpoint type.
     1991 * Worker for DBGFR3BpHit() differentiating on the breakpoint type.
    19941992 *
    19951993 * @returns Strict VBox status code.
     
    20152013            if (rcStrict == VINF_SUCCESS)
    20162014            {
     2015                /** @todo Need to take more care with the reading there if the breakpoint is
     2016                 *        on the edge of a page. */
    20172017                uint8_t abInstr[DBGF_BP_INSN_MAX];
    20182018                RTGCPTR const GCPtrInstr = CPUMGetGuestFlatPC(pVCpu);
     
    20202020                if (rcStrict == VINF_SUCCESS)
    20212021                {
    2022 #ifdef VBOX_VMM_TARGET_ARMV8
    2023                     AssertFailed();
    2024                     rcStrict = VERR_NOT_IMPLEMENTED;
    2025 #else
     2022#ifdef VBOX_VMM_TARGET_X86
    20262023                    /* Replace the int3 with the original instruction byte. */
    20272024                    abInstr[0] = pBp->Pub.u.Sw.Arch.x86.bOrg;
    20282025                    rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, GCPtrInstr, &abInstr[0], sizeof(abInstr));
     2026#else
     2027                    /** @todo arm64: implement stepping over breakpoint. Fix unnecessary opcode reading. */
     2028                    AssertFailed();
     2029                    rcStrict = VERR_NOT_IMPLEMENTED;
    20292030#endif
    20302031                    if (   rcStrict == VINF_SUCCESS
  • trunk/src/VBox/VMM/VMMR3/DBGFR3Flow.cpp

    r106784 r107227  
    232232    if (   uOpc == OP_ARMV8_A64_B
    233233        || uOpc == OP_ARMV8_A64_BC)
    234     {
    235         return    pDis->armv8.enmCond == kDisArmv8InstrCond_Al
    236                || pDis->armv8.enmCond == kDisArmv8InstrCond_Al1;
    237     }
     234        return pDis->armv8.enmCond == kDisArmv8InstrCond_Al
     235            || pDis->armv8.enmCond == kDisArmv8InstrCond_Al1;
    238236
    239237    return false;
     238
     239#elif defined(VBOX_VMM_TARGET_X86)
     240    RT_NOREF_PV(pDis);
     241    return uOpc == OP_JMP;
     242
    240243#else
    241     RT_NOREF(pDis);
    242 
    243     return uOpc == OP_JMP;
     244# error "port me"
    244245#endif
    245246}
     
    269270
    270271    return false;
     272
     273#elif defined(VBOX_VMM_TARGET_X86)
     274    RT_NOREF_PV(fOpType);
     275    return uOpc == OP_CALL;
     276
    271277#else
    272     RT_NOREF(fOpType);
    273     return uOpc == OP_CALL;
     278# error "port me"
    274279#endif
    275280}
     
    285290{
    286291#ifdef VBOX_VMM_TARGET_ARMV8
    287     if (  uOpc == OP_ARMV8_A64_RET
     292    return uOpc == OP_ARMV8_A64_RET
    288293        || uOpc == OP_ARMV8_A64_RETAA
    289294        || uOpc == OP_ARMV8_A64_RETAB
    290295        || uOpc == OP_ARMV8_A64_ERET
    291296        || uOpc == OP_ARMV8_A64_ERETAA
    292         || uOpc == OP_ARMV8_A64_ERETAB)
    293         return true;
    294 
    295     return false;
    296 #else
    297     if (   uOpc == OP_RETN
     297        || uOpc == OP_ARMV8_A64_ERETAB;
     298
     299#elif defined(VBOX_VMM_TARGET_X86)
     300    return uOpc == OP_RETN
    298301        || uOpc == OP_RETF
    299302        || uOpc == OP_IRET
    300303        || uOpc == OP_SYSEXIT
    301         || uOpc == OP_SYSRET)
    302         return true;
    303 
    304     return false;
     304        || uOpc == OP_SYSRET;
     305
     306#else
     307# error "port me"
    305308#endif
    306309}
     
    316319static bool dbgfR3FlowAddrEqual(PDBGFADDRESS pAddr1, PDBGFADDRESS pAddr2)
    317320{
    318     return    pAddr1->Sel == pAddr2->Sel
    319            && pAddr1->off == pAddr2->off;
     321    return pAddr1->Sel == pAddr2->Sel
     322        && pAddr1->off == pAddr2->off;
    320323}
    321324
     
    330333static bool dbgfR3FlowAddrLower(PDBGFADDRESS pAddr1, PDBGFADDRESS pAddr2)
    331334{
    332     return    pAddr1->Sel == pAddr2->Sel
    333            && pAddr1->off < pAddr2->off;
     335    return pAddr1->Sel == pAddr2->Sel
     336        && pAddr1->off < pAddr2->off;
    334337}
    335338
     
    344347static bool dbgfR3FlowAddrIntersect(PDBGFFLOWBBINT pFlowBb, PDBGFADDRESS pAddr)
    345348{
    346     return    (pFlowBb->AddrStart.Sel == pAddr->Sel)
    347            && (pFlowBb->AddrStart.off <= pAddr->off)
    348            && (pFlowBb->AddrEnd.off >= pAddr->off);
     349    return pFlowBb->AddrStart.Sel == pAddr->Sel
     350        && pFlowBb->AddrStart.off <= pAddr->off
     351        && pFlowBb->AddrEnd.off   >= pAddr->off;
    349352}
    350353
     
    363366        if (pAddr1->off >= pAddr2->off)
    364367            return pAddr1->off - pAddr2->off;
    365         else
    366             return pAddr2->off - pAddr1->off;
    367     }
    368     else
    369         AssertFailed();
    370 
     368        return pAddr2->off - pAddr1->off;
     369    }
     370    AssertFailed();
    371371    return 0;
    372372}
     
    774774                                             uint32_t cbInstr, bool fRelJmp, PDBGFADDRESS pAddrJmpTarget)
    775775{
    776     int rc = VINF_SUCCESS;
    777 
    778776    Assert(!dbgfR3FlowBranchTargetIsIndirect(pDisParam));
    779777
    780     /* Relative jumps are always from the beginning of the next instruction. */
    781778    *pAddrJmpTarget = *pAddrInstr;
    782 #ifdef VBOX_VMM_TARGET_ARMV8
    783     /* On ARM relative jumps are always from the beginning of the curent instruction (b #0 will jump to itself for instance). */
     779#ifdef VBOX_VMM_TARGET_X86
     780    /* Relative to the next instruction. */
     781    DBGFR3AddrAdd(pAddrJmpTarget, cbInstr);
     782#elif defined(VBOX_VMM_TARGET_ARMV8)
     783    /* Relative to the start of the instruction. */
    784784    RT_NOREF(cbInstr);
    785785#else
    786     DBGFR3AddrAdd(pAddrJmpTarget, cbInstr);
     786# error "port me"
    787787#endif
    788788
     
    799799            iRel = (int64_t)pDisParam->uValue;
    800800        else
    801             AssertFailedStmt(rc = VERR_NOT_SUPPORTED);
     801            AssertFailedReturn(VERR_NOT_SUPPORTED);
    802802
    803803        if (iRel < 0)
     
    816816        }
    817817        else
    818             AssertFailedStmt(rc = VERR_INVALID_STATE);
    819     }
    820 
    821     return rc;
     818            AssertFailedReturn(VERR_INVALID_STATE);
     819    }
     820
     821    return VINF_SUCCESS;
    822822}
    823823
     
    13861386
    13871387#ifdef VBOX_VMM_TARGET_ARMV8
    1388                         PDISOPPARAM pParam =   uOpc == OP_ARMV8_A64_B || uOpc == OP_ARMV8_A64_BC
    1389                                              ? &DisState.Param1
    1390                                              : uOpc == OP_ARMV8_A64_CBZ || uOpc == OP_ARMV8_A64_CBNZ
    1391                                              ? &DisState.Param2  /* cbz/cbnz. */
    1392                                              : &DisState.Param3; /* tbz/tbnz. */
     1388                        PDISOPPARAM pParam = uOpc == OP_ARMV8_A64_B || uOpc == OP_ARMV8_A64_BC
     1389                                           ? &DisState.Param1
     1390                                           : uOpc == OP_ARMV8_A64_CBZ || uOpc == OP_ARMV8_A64_CBNZ
     1391                                           ? &DisState.Param2  /* cbz/cbnz. */
     1392                                           : &DisState.Param3; /* tbz/tbnz. */
    13931393#else
    13941394                        PDISOPPARAM pParam = &DisState.Param1;
     
    14661466static int dbgfR3FlowPopulate(PUVM pUVM, VMCPUID idCpu, PDBGFFLOWINT pThis, uint32_t cbDisasmMax, uint32_t fFlags)
    14671467{
    1468     int rc = VINF_SUCCESS;
    14691468    PDBGFFLOWBBINT pFlowBb = dbgfR3FlowGetUnpopulatedBb(pThis);
    1470 
    14711469    while (pFlowBb != NULL)
    14721470    {
    1473         rc = dbgfR3FlowBbProcess(pUVM, idCpu, pThis, pFlowBb, cbDisasmMax, fFlags);
    1474         if (RT_FAILURE(rc))
    1475             break;
    1476 
    1477         pFlowBb = dbgfR3FlowGetUnpopulatedBb(pThis);
    1478     }
    1479 
    1480     return rc;
     1471        int rc = dbgfR3FlowBbProcess(pUVM, idCpu, pThis, pFlowBb, cbDisasmMax, fFlags);
     1472        if (RT_SUCCESS(rc))
     1473            pFlowBb = dbgfR3FlowGetUnpopulatedBb(pThis);
     1474        else
     1475            return rc;
     1476    }
     1477
     1478    return VINF_SUCCESS;
    14811479}
    14821480
     
    15061504
    15071505    /* Create the control flow graph container. */
    1508     int rc = VINF_SUCCESS;
     1506    int rc;
    15091507    PDBGFFLOWINT pThis = (PDBGFFLOWINT)RTMemAllocZ(sizeof(DBGFFLOWINT));
    15101508    if (RT_LIKELY(pThis))
  • trunk/src/VBox/VMM/VMMR3/DBGFReg.cpp

    r106365 r107227  
    298298
    299299    /* The descriptors. */
    300     uint32_t cLookupRecs = 0;
    301     uint32_t iDesc;
     300#ifdef VBOX_VMM_TARGET_X86
     301    DBGFREG const  enmCpuFirst = DBGFREG_X86_FIRST;
     302    DBGFREG const  enmCpuLast  = DBGFREG_X86_LAST;
     303#elif defined(VBOX_VMM_TARGET_ARMV8)
     304    DBGFREG const  enmCpuFirst = DBGFREG_ARMV8_FIRST;
     305    DBGFREG const  enmCpuLast  = DBGFREG_ARMV8_LAST;
     306#else
     307# error "port me"
     308#endif
     309    unsigned const cCpuDescs   = (unsigned)enmCpuLast - (unsigned)enmCpuFirst + 1;
     310    uint32_t       cLookupRecs = 0;
     311    uint32_t       iDesc;
    302312    for (iDesc = 0; paRegisters[iDesc].pszName != NULL; iDesc++)
    303313    {
    304314        AssertMsgReturn(dbgfR3RegIsNameValid(paRegisters[iDesc].pszName, 0), ("%s (#%u)\n", paRegisters[iDesc].pszName, iDesc), VERR_INVALID_NAME);
    305315
    306         if (enmType == DBGFREGSETTYPE_CPU)
    307 #if defined(VBOX_VMM_TARGET_ARMV8)
    308             /** @todo This needs a general solution to avoid architecture dependent stuff here. */
    309             AssertMsgReturn(iDesc < (unsigned)DBGFREG_END,
    310                             ("%d iDesc=%d\n", paRegisters[iDesc].enmReg, iDesc),
     316        if (enmType == DBGFREGSETTYPE_CPU) /* The CPU descriptors must be in enum order. */
     317            AssertMsgReturn(iDesc < cCpuDescs && (unsigned)paRegisters[iDesc].enmReg == iDesc + (unsigned)enmCpuFirst,
     318                            ("%d iDesc=%u+%d=%u\n", paRegisters[iDesc].enmReg, iDesc, enmCpuFirst, iDesc + (unsigned)enmCpuFirst),
    311319                            VERR_INVALID_PARAMETER);
    312 #else
    313             AssertMsgReturn(iDesc < (unsigned)DBGFREG_END && (unsigned)paRegisters[iDesc].enmReg == iDesc,
    314                             ("%d iDesc=%d\n", paRegisters[iDesc].enmReg, iDesc),
    315                             VERR_INVALID_PARAMETER);
    316 #endif
    317320        else
    318321            AssertReturn(paRegisters[iDesc].enmReg == DBGFREG_END, VERR_INVALID_PARAMETER);
     
    906909         * Look up the register and get the register value.
    907910         */
    908 #ifndef VBOX_VMM_TARGET_ARMV8
    909         if (RT_LIKELY(pSet->cDescs > (size_t)enmReg))
     911#ifdef VBOX_VMM_TARGET_X86
     912        DBGFREG const  enmCpuFirst = DBGFREG_X86_FIRST;
     913#elif defined(VBOX_VMM_TARGET_ARMV8)
     914        DBGFREG const  enmCpuFirst = DBGFREG_ARMV8_FIRST;
     915#else
     916# error "port me"
     917#endif
     918        uint32_t const idxDesc = (uint32_t)enmReg - (uint32_t)enmCpuFirst;
     919        if (RT_LIKELY(idxDesc < pSet->cDescs))
    910920        {
    911             PCDBGFREGDESC pDesc = &pSet->paDescs[enmReg];
    912 #else
    913         if (RT_LIKELY(pSet->cDescs > (size_t)(enmReg - DBGFREG_ARMV8_FIRST)))
    914         {
    915             PCDBGFREGDESC pDesc = &pSet->paDescs[enmReg - DBGFREG_ARMV8_FIRST];
    916 #endif
     921            PCDBGFREGDESC const pDesc = &pSet->paDescs[idxDesc];
    917922
    918923            pValue->au64[0] = pValue->au64[1] = 0;
  • trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp

    r106383 r107227  
    7676    {
    7777        m_State.u32Magic     = RTDBGUNWINDSTATE_MAGIC;
    78 #if defined(VBOX_VMM_TARGET_ARMV8)
     78#ifdef VBOX_VMM_TARGET_ARMV8
    7979        m_State.enmArch      = RTLDRARCH_ARM64;
     80#elif defined(VBOX_VMM_TARGET_X86)
     81        m_State.enmArch      = RTLDRARCH_AMD64;
    8082#else
    81         m_State.enmArch      = RTLDRARCH_AMD64;
     83# error "port me"
    8284#endif
    8385        m_State.pfnReadStack = dbgfR3StackReadCallback;
     
    8688        if (pInitialCtx)
    8789        {
    88 #if defined(VBOX_VMM_TARGET_ARMV8)
     90#ifdef VBOX_VMM_TARGET_ARMV8
    8991            AssertCompile(RT_ELEMENTS(m_State.u.armv8.auGprs) == RT_ELEMENTS(pInitialCtx->aGRegs));
    9092
     
    9597            for (uint32_t i = 0; i < RT_ELEMENTS(m_State.u.armv8.auGprs); i++)
    9698                m_State.u.armv8.auGprs[i] = pInitialCtx->aGRegs[i].x;
    97 #else
     99
     100#elif defined(VBOX_VMM_TARGET_X86)
    98101            m_State.u.x86.auRegs[X86_GREG_xAX] = pInitialCtx->rax;
    99102            m_State.u.x86.auRegs[X86_GREG_xCX] = pInitialCtx->rcx;
     
    174177static DECLCALLBACK(int) dbgfR3StackReadCallback(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst)
    175178{
    176 #if defined(VBOX_VMM_TARGET_ARMV8)
     179#ifdef VBOX_VMM_TARGET_ARMV8
    177180    Assert(pThis->enmArch == RTLDRARCH_ARM64);
    178 #else
     181#elif defined(VBOX_VMM_TARGET_X86)
    179182    Assert(   pThis->enmArch == RTLDRARCH_AMD64
    180183           || pThis->enmArch == RTLDRARCH_X86_32);
     184#else
     185# error "port me"
    181186#endif
    182187
     
    188193    else
    189194    {
    190 #if defined(VBOX_VMM_TARGET_ARMV8)
    191         DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp);
    192 #else
     195#ifdef VBOX_VMM_TARGET_X86
    193196        if (   pThis->enmArch == RTLDRARCH_X86_32
    194197            || pThis->enmArch == RTLDRARCH_X86_16)
     
    201204        else
    202205            DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp);
     206#else
     207        DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp);
    203208#endif
    204209    }
     
    221226static bool dbgfR3UnwindCtxSetPcAndSp(PDBGFUNWINDCTX pUnwindCtx, PCDBGFADDRESS pAddrPC, PCDBGFADDRESS pAddrStack)
    222227{
    223 #if defined(VBOX_VMM_TARGET_ARMV8)
     228#ifdef VBOX_VMM_TARGET_ARMV8
    224229    Assert(pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64);
    225230
     
    228233    Assert(!DBGFADDRESS_IS_FAR(pAddrStack));
    229234    pUnwindCtx->m_State.u.armv8.uSpEl1 = pAddrStack->FlatPtr; /** @todo EL0 stack pointer. */
    230 #else
     235
     236#elif defined(VBOX_VMM_TARGET_X86)
    231237    Assert(   pUnwindCtx->m_State.enmArch == RTLDRARCH_AMD64
    232238           || pUnwindCtx->m_State.enmArch == RTLDRARCH_X86_32);
     
    246252        pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS]  = pAddrStack->Sel;
    247253    }
     254
     255#else
     256# error "port me"
    248257#endif
    249258
     
    502511
    503512
    504 #if defined(VBOX_VMM_TARGET_ARMV8)
    505513/**
    506514 * Internal worker routine.
     
    510518 *      4  return address
    511519 *      0  old fp; current fp points here
     520 *
     521 * On x86 the typical stack frame layout is like this:
     522 *     ..  ..
     523 *     16  parameter 2
     524 *     12  parameter 1
     525 *      8  parameter 0
     526 *      4  return address
     527 *      0  old ebp; current ebp points here
    512528 */
    513529DECL_NO_INLINE(static, int) dbgfR3StackWalk(PDBGFUNWINDCTX pUnwindCtx, PDBGFSTACKFRAME pFrame, bool fFirst)
     
    552568     * Figure the return address size and use the old PC to guess stack item size.
    553569     */
     570#ifdef VBOX_VMM_TARGET_ARMV8
    554571    unsigned const cbRetAddr   = 8;
    555572    unsigned const cbStackItem = 8; /** @todo AARCH32. */
    556573    PVMCPUCC const pVCpu = pUnwindCtx->m_pUVM->pVM->apCpusR3[pUnwindCtx->m_idCpu];
    557574
    558     /*
    559      * Read the raw frame data.
    560      * We double cbRetAddr in case we have a far return.
    561      */
    562     union
    563     {
    564         uint64_t *pu64;
    565         uint32_t *pu32;
    566         uint8_t  *pb;
    567         void     *pv;
    568     } u, uRet, uArgs, uBp;
    569     size_t cbRead = cbRetAddr * 2 + cbStackItem + sizeof(pFrame->Args);
    570     u.pv = alloca(cbRead);
    571     uBp = u;
    572     uRet.pb = u.pb + cbStackItem;
    573     uArgs.pb = u.pb + cbStackItem + cbRetAddr;
    574 
    575     Assert(DBGFADDRESS_IS_VALID(&pFrame->AddrFrame));
    576     int rc = dbgfR3StackRead(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, u.pv, &pFrame->AddrFrame, cbRead, &cbRead);
    577     if (   RT_FAILURE(rc)
    578         || cbRead < cbRetAddr + cbStackItem)
    579         pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_LAST;
    580 
    581     /*
    582      * Return Frame address.
    583      *
    584      * If we used unwind info to get here, the unwind register context will be
    585      * positioned after the return instruction has been executed.  We start by
    586      * picking up the rBP register here for return frame and will try improve
    587      * on it further down by using unwind info.
    588      */
    589     pFrame->AddrReturnFrame = pFrame->AddrFrame;
    590     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    591     {
    592         AssertFailed(); /** @todo */
    593     }
    594     else
    595     {
    596         switch (cbStackItem)
    597         {
    598             case 4:     pFrame->AddrReturnFrame.off = *uBp.pu32; break;
    599             case 8:     pFrame->AddrReturnFrame.off = CPUMGetGCPtrPacStripped(pVCpu, *uBp.pu64); break;
    600             default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_1);
    601         }
    602 
    603         pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off;
    604     }
    605 
    606     /*
    607      * Return Stack Address.
    608      */
    609     pFrame->AddrReturnStack = pFrame->AddrReturnFrame;
    610     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    611     {
    612         AssertFailed();
    613     }
    614     else
    615     {
    616         pFrame->AddrReturnStack.off     += cbStackItem + cbRetAddr;
    617         pFrame->AddrReturnStack.FlatPtr += cbStackItem + cbRetAddr;
    618     }
    619 
    620     /*
    621      * Return PC.
    622      */
    623     pFrame->AddrReturnPC = pFrame->AddrPC;
    624     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    625     {
    626         AssertFailed();
    627     }
    628     else
    629     {
    630         switch (pFrame->enmReturnType)
    631         {
    632             case RTDBGRETURNTYPE_NEAR64:
    633                 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC))
    634                 {
    635                     pFrame->AddrReturnPC.FlatPtr += CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64) - pFrame->AddrReturnPC.off;
    636                     pFrame->AddrReturnPC.off      = CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64);
    637                 }
    638                 else
    639                     DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64));
    640                 break;
    641             default:
    642                 AssertMsgFailed(("enmReturnType=%d\n", pFrame->enmReturnType));
    643                 return VERR_INVALID_PARAMETER;
    644         }
    645     }
    646 
    647 
    648     pFrame->pSymReturnPC  = DBGFR3AsSymbolByAddrA(pUnwindCtx->m_pUVM, pUnwindCtx->m_hAs, &pFrame->AddrReturnPC,
    649                                                   RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL | RTDBGSYMADDR_FLAGS_SKIP_ABS_IN_DEFERRED,
    650                                                   NULL /*poffDisp*/, NULL /*phMod*/);
    651     pFrame->pLineReturnPC = DBGFR3AsLineByAddrA(pUnwindCtx->m_pUVM, pUnwindCtx->m_hAs, &pFrame->AddrReturnPC,
    652                                                 NULL /*poffDisp*/, NULL /*phMod*/);
    653 
    654     /*
    655      * Frame bitness flag.
    656      */
    657     /** @todo use previous return type for this? */
    658     pFrame->fFlags &= ~(DBGFSTACKFRAME_FLAGS_32BIT | DBGFSTACKFRAME_FLAGS_64BIT);
    659     switch (cbStackItem)
    660     {
    661         case 4: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_32BIT; break;
    662         case 8: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_64BIT; break;
    663         default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_2);
    664     }
    665 
    666     /*
    667      * The arguments.
    668      */
    669     memcpy(&pFrame->Args, uArgs.pv, sizeof(pFrame->Args));
    670 
    671     /*
    672      * Collect register changes.
    673      * Then call the OS layer to assist us (e.g. NT trap frames).
    674      */
    675     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    676     {
    677         AssertFailed();
    678     }
    679 
    680     /*
    681      * Try use unwind information to locate the return frame pointer (for the
    682      * next loop iteration).
    683      */
    684     Assert(!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET));
    685     pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID;
    686     if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST))
    687     {
    688         /* Set PC and SP if we didn't unwind our way here (context will then point
    689            and the return PC and SP already). */
    690         if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO))
    691         {
    692             dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack);
    693             pUnwindCtx->m_State.u.armv8.auGprs[ARMV8_A64_REG_BP] = pFrame->AddrReturnFrame.off;
    694         }
    695         if (pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64)
    696             pUnwindCtx->m_State.u.armv8.Loaded.fAll = 0;
    697         else
    698             AssertFailed();
    699         if (dbgfR3UnwindCtxDoOneFrame(pUnwindCtx))
    700         {
    701             Assert(!pUnwindCtx->m_fIsHostRing0);
    702 
    703             DBGFADDRESS AddrReturnFrame = pFrame->AddrReturnFrame;
    704             DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &AddrReturnFrame, pUnwindCtx->m_State.u.armv8.FrameAddr);
    705             pFrame->AddrReturnFrame = AddrReturnFrame;
    706 
    707             pFrame->enmReturnFrameReturnType = pUnwindCtx->m_State.enmRetType;
    708             pFrame->fFlags                  |= DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET;
    709         }
    710     }
    711 
    712     return VINF_SUCCESS;
    713 }
    714 #else
    715 /**
    716  * Internal worker routine.
    717  *
    718  * On x86 the typical stack frame layout is like this:
    719  *     ..  ..
    720  *     16  parameter 2
    721  *     12  parameter 1
    722  *      8  parameter 0
    723  *      4  return address
    724  *      0  old ebp; current ebp points here
    725  */
    726 DECL_NO_INLINE(static, int) dbgfR3StackWalk(PDBGFUNWINDCTX pUnwindCtx, PDBGFSTACKFRAME pFrame, bool fFirst)
    727 {
    728     /*
    729      * Stop if we got a read error in the previous run.
    730      */
    731     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST)
    732         return VERR_NO_MORE_FILES;
    733 
    734     /*
    735      * Advance the frame (except for the first).
    736      */
    737     if (!fFirst) /** @todo we can probably eliminate this fFirst business... */
    738     {
    739         /* frame, pc and stack is taken from the existing frames return members. */
    740         pFrame->AddrFrame = pFrame->AddrReturnFrame;
    741         pFrame->AddrPC    = pFrame->AddrReturnPC;
    742         pFrame->pSymPC    = pFrame->pSymReturnPC;
    743         pFrame->pLinePC   = pFrame->pLineReturnPC;
    744 
    745         /* increment the frame number. */
    746         pFrame->iFrame++;
    747 
    748         /* UNWIND_INFO_RET -> USED_UNWIND; return type */
    749         if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET))
    750             pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO;
    751         else
    752         {
    753             pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO;
    754             pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET;
    755             if (pFrame->enmReturnFrameReturnType != RTDBGRETURNTYPE_INVALID)
    756             {
    757                 pFrame->enmReturnType = pFrame->enmReturnFrameReturnType;
    758                 pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID;
    759             }
    760         }
    761         pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_TRAP_FRAME;
    762     }
    763 
    764     /*
    765      * Figure the return address size and use the old PC to guess stack item size.
    766      */
     575#elif defined(VBOX_VMM_TARGET_X86)
    767576    /** @todo this is bogus... */
    768577    unsigned cbRetAddr = RTDbgReturnTypeSize(pFrame->enmReturnType);
     
    797606            }
    798607    }
     608#endif
    799609
    800610    /*
     
    810620        void     *pv;
    811621    } u, uRet, uArgs, uBp;
    812     size_t cbRead = cbRetAddr*2 + cbStackItem + sizeof(pFrame->Args);
     622    size_t cbRead = cbRetAddr * 2 + cbStackItem + sizeof(pFrame->Args);
    813623    u.pv = alloca(cbRead);
    814624    uBp = u;
     
    833643    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    834644    {
     645#ifdef VBOX_VMM_TARGET_ARMV8
     646        AssertFailed(); /** @todo */
     647
     648#elif defined(VBOX_VMM_TARGET_X86)
    835649        if (   pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV
    836650            || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64)
     
    846660            pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off;
    847661        }
     662#endif /* VBOX_VMM_TARGET_X86 */
    848663    }
    849664    else
     
    851666        switch (cbStackItem)
    852667        {
     668#ifdef VBOX_VMM_TARGET_ARMV8
     669            case 8:     pFrame->AddrReturnFrame.off = CPUMGetGCPtrPacStripped(pVCpu, *uBp.pu64); break;
     670#else
     671            case 8:     pFrame->AddrReturnFrame.off = *uBp.pu64; break;
     672#endif
     673            case 4:     pFrame->AddrReturnFrame.off = *uBp.pu32; break;
     674#ifdef VBOX_VMM_TARGET_X86
    853675            case 2:     pFrame->AddrReturnFrame.off = *uBp.pu16; break;
    854             case 4:     pFrame->AddrReturnFrame.off = *uBp.pu32; break;
    855             case 8:     pFrame->AddrReturnFrame.off = *uBp.pu64; break;
     676#endif
    856677            default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_1);
    857678        }
    858679
     680#ifdef VBOX_VMM_TARGET_X86
    859681        /* Watcom tries to keep the frame pointer odd for far returns. */
    860682        if (   cbStackItem <= 4
     
    872694                else if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR32)
    873695                {
    874 #if 1
     696# if 1
    875697                    /* Assumes returning 32-bit code. */
    876698                    pFrame->fFlags       |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN;
    877699                    pFrame->enmReturnType = RTDBGRETURNTYPE_FAR32;
    878700                    cbRetAddr = 8;
    879 #else
     701# else
    880702                    /* Assumes returning 16-bit code. */
    881703                    pFrame->fFlags       |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN;
    882704                    pFrame->enmReturnType = RTDBGRETURNTYPE_FAR16;
    883705                    cbRetAddr = 4;
    884 #endif
     706# endif
    885707                }
    886708            }
     
    901723            uArgs.pb = u.pb + cbStackItem + cbRetAddr;
    902724        }
     725#endif /* VBOX_VMM_TARGET_X86 */
    903726
    904727        pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off;
     
    911734    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    912735    {
     736#ifdef VBOX_VMM_TARGET_ARMV8
     737        AssertFailed();
     738
     739#elif defined(VBOX_VMM_TARGET_X86)
    913740        if (   pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV
    914741            || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64)
     
    924751            pFrame->AddrReturnStack.FlatPtr += pFrame->AddrReturnStack.off - pFrame->AddrStack.off;
    925752        }
     753#endif /* VBOX_VMM_TARGET_X86 */
    926754    }
    927755    else
     
    937765    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    938766    {
     767#ifdef VBOX_VMM_TARGET_ARMV8
     768        AssertFailed();
     769
     770#elif defined(VBOX_VMM_TARGET_X86)
    939771        if (RTDbgReturnTypeIsNear(pFrame->enmReturnType))
    940772        {
     
    945777            DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC,
    946778                                 pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_CS], pUnwindCtx->m_State.uPc);
     779#endif
    947780    }
    948781    else
    949782    {
     783#ifdef VBOX_VMM_TARGET_ARMV8
     784        switch (pFrame->enmReturnType)
     785        {
     786            case RTDBGRETURNTYPE_NEAR64:
     787                if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC))
     788                {
     789                    pFrame->AddrReturnPC.FlatPtr += CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64) - pFrame->AddrReturnPC.off;
     790                    pFrame->AddrReturnPC.off      = CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64);
     791                }
     792                else
     793                    DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64));
     794                break;
     795            default:
     796                AssertMsgFailed(("enmReturnType=%d\n", pFrame->enmReturnType));
     797                return VERR_INVALID_PARAMETER;
     798        }
     799
     800#elif defined(VBOX_VMM_TARGET_X86)
    950801        int rc2;
    951802        switch (pFrame->enmReturnType)
     
    1020871                return VERR_INVALID_PARAMETER;
    1021872        }
     873#endif /* VBOX_VMM_TARGET_X86 */
    1022874    }
    1023875
     
    1036888    switch (cbStackItem)
    1037889    {
    1038         case 2: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_16BIT; break;
    1039890        case 4: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_32BIT; break;
    1040891        case 8: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_64BIT; break;
     892#ifdef VBOX_VMM_TARGET_X86
     893        case 2: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_16BIT; break;
     894#endif
    1041895        default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_2);
    1042896    }
     
    1053907    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    1054908    {
     909#if defined(VBOX_VMM_TARGET_X86)
    1055910        rc = dbgfR3StackWalkCollectRegisterChanges(pUnwindCtx->m_pUVM, pFrame, &pUnwindCtx->m_State);
    1056911        if (RT_FAILURE(rc))
     
    1065920                return rc;
    1066921        }
     922#else
     923        AssertFailed();
     924#endif
    1067925    }
    1068926
     
    1080938        {
    1081939            dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack);
     940#ifdef VBOX_VMM_TARGET_ARMV8
     941            pUnwindCtx->m_State.u.armv8.auGprs[ARMV8_A64_REG_BP] = pFrame->AddrReturnFrame.off;
     942#elif defined(VBOX_VMM_TARGET_X86)
    1082943            pUnwindCtx->m_State.u.x86.auRegs[X86_GREG_xBP] = pFrame->AddrReturnFrame.off;
    1083         }
     944#endif
     945        }
     946
     947#ifdef VBOX_VMM_TARGET_ARMV8
     948        if (pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64)
     949            pUnwindCtx->m_State.u.armv8.Loaded.fAll = 0;
     950        else
     951            AssertFailed();
     952
     953#elif defined(VBOX_VMM_TARGET_X86)
    1084954        /** @todo Reevaluate CS if the previous frame return type isn't near. */
    1085955        if (   pUnwindCtx->m_State.enmArch == RTLDRARCH_AMD64
     
    1089959        else
    1090960            AssertFailed();
     961#endif
     962
    1091963        if (dbgfR3UnwindCtxDoOneFrame(pUnwindCtx))
    1092964        {
     965#ifdef VBOX_VMM_TARGET_ARMV8
     966            Assert(!pUnwindCtx->m_fIsHostRing0);
     967#elif defined(VBOX_VMM_TARGET_X86)
    1093968            if (pUnwindCtx->m_fIsHostRing0)
    1094969                DBGFR3AddrFromHostR0(&pFrame->AddrReturnFrame, pUnwindCtx->m_State.u.x86.FrameAddr.off);
    1095970            else
     971#endif
    1096972            {
    1097973                DBGFADDRESS AddrReturnFrame = pFrame->AddrReturnFrame;
     974#ifdef VBOX_VMM_TARGET_ARMV8
     975                DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &AddrReturnFrame, pUnwindCtx->m_State.u.armv8.FrameAddr);
     976#elif defined(VBOX_VMM_TARGET_X86)
    1098977                rc = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &AddrReturnFrame,
    1099978                                          pUnwindCtx->m_State.u.x86.FrameAddr.sel, pUnwindCtx->m_State.u.x86.FrameAddr.off);
    1100979                if (RT_SUCCESS(rc))
     980#endif
    1101981                    pFrame->AddrReturnFrame = AddrReturnFrame;
    1102982            }
     
    1108988    return VINF_SUCCESS;
    1109989}
    1110 #endif
    1111990
    1112991
     
    11371016
    11381017    int rc = VINF_SUCCESS;
    1139 #if defined(VBOX_VMM_TARGET_ARMV8)
    11401018    if (pAddrPC)
    11411019        pCur->AddrPC = *pAddrPC;
     1020#ifdef VBOX_VMM_TARGET_ARMV8
    11421021    else
    11431022        DBGFR3AddrFromFlat(pUVM, &pCur->AddrPC, pCtx->Pc.u64);
    1144 #else
    1145     if (pAddrPC)
    1146         pCur->AddrPC = *pAddrPC;
     1023#elif defined(VBOX_VMM_TARGET_X86)
    11471024    else if (enmCodeType != DBGFCODETYPE_GUEST)
    11481025        DBGFR3AddrFromFlat(pUVM, &pCur->AddrPC, pCtx->rip);
     
    11671044            PVMCPU const   pVCpu      = pUVM->pVM->apCpusR3[idCpu];
    11681045            CPUMMODE const enmCpuMode = CPUMGetGuestMode(pVCpu);
    1169 #if defined(VBOX_VMM_TARGET_ARMV8)
     1046
     1047#ifdef VBOX_VMM_TARGET_ARMV8
    11701048            /** @todo */
    11711049            Assert(enmCpuMode == CPUMMODE_ARMV8_AARCH64); RT_NOREF(enmCpuMode);
     
    11731051            if (enmReturnType == RTDBGRETURNTYPE_INVALID)
    11741052                pCur->enmReturnType = RTDBGRETURNTYPE_NEAR64;
    1175 #else
     1053
     1054#elif defined(VBOX_VMM_TARGET_X86)
    11761055            if (enmCpuMode == CPUMMODE_REAL)
    11771056            {
     
    11961075        }
    11971076
    1198 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1077#ifdef VBOX_VMM_TARGET_X86
    11991078        if (enmReturnType == RTDBGRETURNTYPE_INVALID)
    12001079            switch (pCur->AddrPC.fFlags & DBGFADDRESS_FLAGS_TYPE_MASK)
     
    12131092
    12141093
    1215 #if defined(VBOX_VMM_TARGET_ARMV8)
    12161094        if (pAddrStack)
    12171095            pCur->AddrStack = *pAddrStack;
     1096#ifdef VBOX_VMM_TARGET_ARMV8
    12181097        else
    12191098            DBGFR3AddrFromFlat(pUVM, &pCur->AddrStack, pCtx->aSpReg[1].u64 & fAddrMask); /** @todo EL0 stack. */
    1220 
    1221         Assert(!(pCur->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO));
    1222         if (pAddrFrame)
    1223             pCur->AddrFrame = *pAddrFrame;
    1224         else
    1225             DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->aGRegs[ARMV8_A64_REG_BP].x & fAddrMask);
    1226 #else
    1227         if (pAddrStack)
    1228             pCur->AddrStack = *pAddrStack;
     1099#elif defined(VBOX_VMM_TARGET_X86)
    12291100        else if (enmCodeType != DBGFCODETYPE_GUEST)
    12301101            DBGFR3AddrFromFlat(pUVM, &pCur->AddrStack, pCtx->rsp & fAddrMask);
    12311102        else
    12321103            rc = DBGFR3AddrFromSelOff(pUVM, idCpu, &pCur->AddrStack, pCtx->ss.Sel, pCtx->rsp & fAddrMask);
     1104#endif
    12331105
    12341106        Assert(!(pCur->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO));
    12351107        if (pAddrFrame)
    12361108            pCur->AddrFrame = *pAddrFrame;
     1109#ifdef VBOX_VMM_TARGET_ARMV8
     1110        else
     1111            DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->aGRegs[ARMV8_A64_REG_BP].x & fAddrMask);
     1112#elif defined(VBOX_VMM_TARGET_X86)
    12371113        else if (enmCodeType != DBGFCODETYPE_GUEST)
    12381114            DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->rbp & fAddrMask);
     
    12501126            pCur->enmReturnType = UnwindCtx.m_State.enmRetType;
    12511127            pCur->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO;
    1252 #if defined(VBOX_VMM_TARGET_ARMV8)
     1128#ifdef VBOX_VMM_TARGET_ARMV8
    12531129            DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, UnwindCtx.m_State.u.armv8.FrameAddr);
    1254 #else
     1130#elif defined(VBOX_VMM_TARGET_X86)
    12551131            if (!UnwindCtx.m_fIsHostRing0)
    12561132                rc = DBGFR3AddrFromSelOff(UnwindCtx.m_pUVM, UnwindCtx.m_idCpu, &pCur->AddrFrame,
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r107194 r107227  
    116116
    117117    int rc = CFGMR3QueryBoolDef(pCfgEM, "IemExecutesAll", &pVM->em.s.fIemExecutesAll,
    118 #if defined(RT_ARCH_ARM64) && defined(RT_OS_DARWIN) && !defined(VBOX_VMM_TARGET_ARMV8)
     118#if (defined(VBOX_VMM_TARGET_X86)   && !defined(RT_ARCH_X86) && !defined(RT_ARCH_AMD64)) \
     119 || (defined(VBOX_VMM_TARGET_ARMV8) && !defined(RT_ARCH_ARM64)) /** @todo not main exec engine = iem/recomp would be better... */
    119120                                true
    120121#else
     
    706707#endif /* LOG_ENABLED || VBOX_STRICT */
    707708
    708 #if !defined(VBOX_VMM_TARGET_ARMV8)
     709#ifdef VBOX_VMM_TARGET_X86
    709710
    710711/**
     
    852853}
    853854
    854 #endif /* VBOX_VMM_TARGET_ARMV8 */
     855#endif /* VBOX_VMM_TARGET_X86 */
    855856
    856857/**
     
    885886                    rc = EMR3HmSingleInstruction(pVM, pVCpu, 0 /*fFlags*/);
    886887#endif
    887 #if !defined(VBOX_VMM_TARGET_ARMV8)
    888888                else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_NEM)
    889889                    rc = VBOXSTRICTRC_TODO(emR3NemSingleInstruction(pVM, pVCpu, 0 /*fFlags*/));
    890890                else
    891891                {
     892#if defined(VBOX_VMM_TARGET_X86) /** @todo IEM/arm64 */
    892893                    rc = IEMExecOne(pVCpu); /** @todo add dedicated interface... */
    893894                    if (rc == VINF_SUCCESS || rc == VINF_EM_RESCHEDULE)
    894895                        rc = VINF_EM_DBG_STEPPED;
     896#else
     897                    AssertFailed();
     898                    rc = VBOXSTRICTRC_TODO(emR3NemSingleInstruction(pVM, pVCpu, 0 /*fFlags*/));
     899#endif
    895900                }
    896901
     902#ifdef VBOX_VMM_TARGET_X86
    897903                if (rc != VINF_EM_EMULATE_SPLIT_LOCK)
    898904                { /* likely */ }
     
    903909                        rc = VINF_EM_DBG_STEPPED;
    904910                }
    905 #else
    906                 AssertMsg(pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_NEM,
    907                           ("%u\n", pVCpu->em.s.enmState));
    908                 rc = VBOXSTRICTRC_TODO(emR3NemSingleInstruction(pVM, pVCpu, 0 /*fFlags*/));
    909911#endif
    910912                break;
     
    10721074#ifdef VBOX_VMM_TARGET_ARMV8
    10731075    LogFlow(("emR3RecompilerExecute/%u: (pc=%RGv)\n", pVCpu->idCpu, (RTGCPTR)pVCpu->cpum.GstCtx.Pc.u64));
     1076#elif defined(VBOX_VMM_TARGET_X86)
     1077    LogFlow(("emR3RecompilerExecute/%u: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.cs.Sel, (RTGCPTR)pVCpu->cpum.GstCtx.rip));
    10741078#else
    1075     LogFlow(("emR3RecompilerExecute/%u: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.cs.Sel, (RTGCPTR)pVCpu->cpum.GstCtx.rip));
     1079# error "port me"
    10761080#endif
    10771081
     
    10851089#ifdef LOG_ENABLED
    10861090# if defined(VBOX_VMM_TARGET_ARMV8)
    1087         Log3(("EM: pc=%08x\n", CPUMGetGuestFlatPC(pVCpu)));
    1088 # else
     1091        Log3(("EM: pc=%08RX64\n", CPUMGetGuestFlatPC(pVCpu)));
     1092# elif defined(VBOX_VMM_TARGET_X86)
    10891093        if (!pVCpu->cpum.GstCtx.eflags.Bits.u1VM)
    10901094            Log(("EMR%d: %04X:%08RX64 RSP=%08RX64 IF=%d CR0=%x eflags=%x\n", CPUMGetGuestCPL(pVCpu), pVCpu->cpum.GstCtx.cs.Sel,
     
    10931097        else
    10941098            Log(("EMV86: %04X:%08X IF=%d\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.eip, pVCpu->cpum.GstCtx.eflags.Bits.u1IF));
     1099# else
     1100#  error "port me"
    10951101# endif
    10961102#endif
     
    11741180         * Check if we can switch back to the main execution engine now.
    11751181         */
    1176 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1182#ifdef VBOX_WITH_HWVIRT
    11771183        if (VM_IS_HM_ENABLED(pVM))
    11781184        {
     
    12741280        PDMCritSectBothFF(pVM, pVCpu);
    12751281
    1276 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1282#ifdef VBOX_VMM_TARGET_X86
    12771283    /* Update CR3 (Nested Paging case for HM). */
    12781284    if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_HM_UPDATE_CR3))
     
    13121318}
    13131319
    1314 
    1315 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1320#ifdef VBOX_VMM_TARGET_X86
     1321
    13161322/**
    13171323 * Helper for emR3ForcedActions() for VMX external interrupt VM-exit.
     
    13231329static int emR3VmxNstGstIntrIntercept(PVMCPU pVCpu)
    13241330{
    1325 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     1331# ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    13261332    /* Handle the "external interrupt" VM-exit intercept. */
    13271333    if (    CPUMIsGuestVmxPinCtlsSet(&pVCpu->cpum.GstCtx, VMX_PIN_CTLS_EXT_INT_EXIT)
     
    13341340        return VBOXSTRICTRC_VAL(rcStrict);
    13351341    }
    1336 #else
     1342# else
    13371343    RT_NOREF(pVCpu);
    1338 #endif
     1344# endif
    13391345    return VINF_NO_CHANGE;
    13401346}
     
    13501356static int emR3SvmNstGstIntrIntercept(PVMCPU pVCpu)
    13511357{
    1352 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     1358# ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    13531359    /* Handle the physical interrupt intercept (can be masked by the nested hypervisor). */
    13541360    if (CPUMIsGuestSvmCtrlInterceptSet(pVCpu, &pVCpu->cpum.GstCtx, SVM_CTRL_INTERCEPT_INTR))
     
    13661372        return VINF_EM_TRIPLE_FAULT;
    13671373    }
    1368 #else
     1374# else
    13691375    NOREF(pVCpu);
    1370 #endif
     1376# endif
    13711377    return VINF_NO_CHANGE;
    13721378}
     
    13821388static int emR3SvmNstGstVirtIntrIntercept(PVMCPU pVCpu)
    13831389{
    1384 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     1390# ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    13851391    if (CPUMIsGuestSvmCtrlInterceptSet(pVCpu, &pVCpu->cpum.GstCtx, SVM_CTRL_INTERCEPT_VINTR))
    13861392    {
     
    13951401        return VINF_EM_TRIPLE_FAULT;
    13961402    }
    1397 #else
     1403# else
    13981404    NOREF(pVCpu);
    1399 #endif
     1405# endif
    14001406    return VINF_NO_CHANGE;
    14011407}
    1402 #endif
    1403 
     1408
     1409#endif /* VBOX_VMM_TARGET_X86 */
    14041410
    14051411/**
     
    16581664            TMR3TimerQueuesDo(pVM);
    16591665
    1660 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1666#ifdef VBOX_VMM_TARGET_X86
    16611667        /*
    16621668         * Pick up asynchronously posted interrupts into the APIC.
     
    18031809            Assert(!VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_VMX_APIC_WRITE | VMCPU_FF_VMX_MTF | VMCPU_FF_VMX_PREEMPT_TIMER));
    18041810        }
    1805 # endif
     1811# endif /* VBOX_WITH_NESTED_HWVIRT_VMX */
    18061812
    18071813        /*
     
    19591965        }
    19601966
    1961 #else /* VBOX_VMM_TARGET_ARMV8 */
     1967#else  /* VBOX_VMM_TARGET_ARMV8 */
    19621968        bool fWakeupPending = false;
    1963 
    19641969        if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_VTIMER_ACTIVATED))
    19651970        {
     
    20812086        /* check that we got them all  */
    20822087        AssertCompile(VM_FF_HIGH_PRIORITY_PRE_MASK == (VM_FF_TM_VIRTUAL_SYNC | VM_FF_DBGF | VM_FF_CHECK_VM_STATE | VM_FF_DEBUG_SUSPEND | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_EMT_RENDEZVOUS));
    2083 #if defined(VBOX_VMM_TARGET_ARMV8)
     2088#ifdef VBOX_VMM_TARGET_ARMV8
    20842089        AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_IRQ | VMCPU_FF_INTERRUPT_FIQ | VMCPU_FF_DBGF));
     2090#elif defined(VBOX_VMM_TARGET_X86)
     2091        AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_DBGF | VMCPU_FF_INTERRUPT_NESTED_GUEST | VMCPU_FF_VMX_MTF | VMCPU_FF_VMX_APIC_WRITE | VMCPU_FF_VMX_PREEMPT_TIMER | VMCPU_FF_VMX_INT_WINDOW | VMCPU_FF_VMX_NMI_WINDOW));
    20852092#else
    2086         AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_DBGF | VMCPU_FF_INTERRUPT_NESTED_GUEST | VMCPU_FF_VMX_MTF | VMCPU_FF_VMX_APIC_WRITE | VMCPU_FF_VMX_PREEMPT_TIMER | VMCPU_FF_VMX_INT_WINDOW | VMCPU_FF_VMX_NMI_WINDOW));
     2093# error "port me"
    20872094#endif
    20882095    }
     
    22092216                fFFDone = false;
    22102217
    2211 #if defined(VBOX_STRICT) && !defined(VBOX_VMM_TARGET_ARMV8)
     2218#if defined(VBOX_STRICT) && defined(VBOX_VMM_TARGET_X86)
    22122219            CPUMAssertGuestRFlagsCookie(pVM, pVCpu);
    22132220#endif
     
    22332240                    if (!pVM->em.s.fIemExecutesAll)
    22342241                    {
    2235 #if !defined(VBOX_VMM_TARGET_ARMV8)
     2242#ifdef VBOX_WITH_HWVIRT
    22362243                        if (VM_IS_HM_ENABLED(pVM))
    22372244                        {
     
    25972604                    else if (rc == VINF_SUCCESS)
    25982605                        rc = VINF_EM_RESCHEDULE; /* Need to check whether we can run in HM or NEM again. */
    2599 #ifndef VBOX_VMM_TARGET_ARMV8
     2606#ifdef VBOX_VMM_TARGET_X86
    26002607                    if (rc != VINF_EM_EMULATE_SPLIT_LOCK)
    26012608                    { /* likely */ }
     
    26242631                    if (TRPMHasTrap(pVCpu))
    26252632                        rc = VINF_EM_RESCHEDULE;
    2626 #if !defined(VBOX_VMM_TARGET_ARMV8)
     2633#ifdef VBOX_VMM_TARGET_X86
    26272634                    /* MWAIT has a special extension where it's woken up when
    26282635                       an interrupt is pending even when IF=0. */
     
    26492656                    else
    26502657                    {
    2651 #if defined(VBOX_VMM_TARGET_ARMV8)
     2658#ifdef VBOX_VMM_TARGET_ARMV8
    26522659                        const uint32_t fWaitHalted = 0; /* WFI/WFE always return when an interrupt happens. */
    2653 #else
     2660#elif defined(VBOX_VMM_TARGET_X86)
    26542661                        const uint32_t fWaitHalted = (CPUMGetGuestEFlags(pVCpu) & X86_EFL_IF) ? 0 : VMWAITHALTED_F_IGNORE_IRQS;
    26552662#endif
    26562663                        rc = VMR3WaitHalted(pVM, pVCpu, fWaitHalted);
     2664
    26572665                        /* We're only interested in NMI/SMIs here which have their own FFs, so we don't need to
    26582666                           check VMCPU_FF_UPDATE_APIC here. */
    26592667                        if (   rc == VINF_SUCCESS
    2660 #if defined(VBOX_VMM_TARGET_ARMV8)
    2661                             && VMCPU_FF_IS_ANY_SET(pVCpu,   VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_VTIMER_ACTIVATED
    2662                                                           | VMCPU_FF_INTERRUPT_FIQ | VMCPU_FF_INTERRUPT_IRQ)
     2668#ifdef VBOX_VMM_TARGET_ARMV8
     2669                            && VMCPU_FF_IS_ANY_SET(pVCpu,   VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI
     2670                                                          | VMCPU_FF_INTERRUPT_FIQ | VMCPU_FF_INTERRUPT_IRQ
     2671                                                          | VMCPU_FF_VTIMER_ACTIVATED)
     2672#elif defined(VBOX_VMM_TARGET_X86)
     2673                            && VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_UNHALT)
    26632674#else
    2664                             && VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_UNHALT)
     2675# error "port me"
    26652676#endif
    26662677                            )
  • trunk/src/VBox/VMM/VMMR3/EMR3Dbg.cpp

    r106895 r107227  
    169169            break;
    170170
    171 #if !defined(VBOX_VMM_TARGET_ARMV8)
     171#if defined(VBOX_VMM_TARGET_X86) && defined(VBOX_WITH_HWVIRT)
    172172        case EMEXIT_F_KIND_VMX:
    173173            pszExitName = HMGetVmxExitName(uFlagsAndType & EMEXIT_F_TYPE_MASK);
     
    187187            break;
    188188
     189#ifdef VBOX_VMM_TARGET_X86
    189190        case EMEXIT_F_KIND_XCPT:
    190 #if defined(VBOX_VMM_TARGET_ARMV8)
    191             pszExitName = NULL;
    192             AssertReleaseFailed();
    193 #else
    194191            switch (uFlagsAndType & EMEXIT_F_TYPE_MASK)
    195192            {
     
    232229                    break;
    233230            }
     231            break;
    234232#endif
    235             break;
    236233
    237234        default:
  • trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp

    r107194 r107227  
    9797        return VINF_EM_RESCHEDULE;
    9898
    99 #if defined(VBOX_VMM_TARGET_ARMV8)
    100     uint64_t const uOldPc = pVCpu->cpum.GstCtx.Pc.u64;
     99#ifdef VBOX_VMM_TARGET_ARMV8
     100    uint64_t const uOldPc  = pVCpu->cpum.GstCtx.Pc.u64;
     101#elif defined(VBOX_VMM_TARGET_X86)
     102    uint64_t const uOldRip = pVCpu->cpum.GstCtx.rip;
    101103#else
    102     uint64_t const uOldRip = pVCpu->cpum.GstCtx.rip;
     104# error "port me"
    103105#endif
    104106    for (;;)
     
    147149         * Done?
    148150         */
    149 #if defined(VBOX_VMM_TARGET_ARMV8)
     151#ifdef VBOX_VMM_TARGET_ARMV8
    150152        CPUM_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_PC);
    151153        if (   (rcStrict != VINF_SUCCESS && rcStrict != VINF_EM_DBG_STEPPED)
     
    160162            return rcStrict;
    161163        }
    162 #else
     164
     165#elif defined(VBOX_VMM_TARGET_X86)
    163166        CPUM_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_RIP);
    164167        if (   (rcStrict != VINF_SUCCESS && rcStrict != VINF_EM_DBG_STEPPED)
     
    173176            return rcStrict;
    174177        }
     178
     179#else
     180# error "port me"
    175181#endif
    176182    }
     
    201207     * Log it.
    202208     */
    203 #ifdef VBOX_VMM_TARGET_ARMV8
     209# ifdef VBOX_VMM_TARGET_ARMV8
    204210    Log(("EMINS: %RGv SP_EL0=%RGv SP_EL1=%RGv\n", (RTGCPTR)pVCpu->cpum.GstCtx.Pc.u64,
    205                                                   (RTGCPTR)pVCpu->cpum.GstCtx.aSpReg[0].u64,
    206                                                   (RTGCPTR)pVCpu->cpum.GstCtx.aSpReg[1].u64));
     211         (RTGCPTR)pVCpu->cpum.GstCtx.aSpReg[0].u64, (RTGCPTR)pVCpu->cpum.GstCtx.aSpReg[1].u64));
    207212    if (pszPrefix)
    208213    {
     
    210215        DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, pszPrefix);
    211216    }
    212 # else
     217# elif defined(VBOX_VMM_TARGET_X86)
    213218    Log(("EMINS: %04x:%RGv RSP=%RGv\n", pVCpu->cpum.GstCtx.cs.Sel, (RTGCPTR)pVCpu->cpum.GstCtx.rip, (RTGCPTR)pVCpu->cpum.GstCtx.rsp));
    214219    if (pszPrefix)
     
    217222        DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, pszPrefix);
    218223    }
     224# else
     225#  error "port me"
    219226# endif
    220227#endif
     
    375382#ifdef VBOX_VMM_TARGET_ARMV8
    376383    LogFlow(("emR3NemExecute%d: (pc=%RGv)\n", pVCpu->idCpu, (RTGCPTR)pVCpu->cpum.GstCtx.Pc.u64));
     384#elif defined(VBOX_VMM_TARGET_X86)
     385    LogFlow(("emR3NemExecute%d: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.cs.Sel, (RTGCPTR)pVCpu->cpum.GstCtx.rip));
    377386#else
    378     LogFlow(("emR3NemExecute%d: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.cs.Sel, (RTGCPTR)pVCpu->cpum.GstCtx.rip));
     387# error "port me"
    379388#endif
    380389    *pfFFDone = false;
     
    411420        }
    412421
    413 #if defined(LOG_ENABLED) && !defined(VBOX_VMM_TARGET_ARMV8)
     422#ifdef LOG_ENABLED
    414423        /*
    415424         * Log important stuff before entering GC.
    416425         */
     426# ifdef VBOX_VMM_TARGET_X86
    417427        if (TRPMHasTrap(pVCpu))
    418428            Log(("CPU%d: Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", pVCpu->idCpu, TRPMGetTrapNo(pVCpu), pVCpu->cpum.GstCtx.cs.Sel, (RTGCPTR)pVCpu->cpum.GstCtx.rip));
     
    441451            }
    442452        }
     453# elif defined(VBOX_VMM_TARGET_ARMV8)
     454        if (!(pVCpu->cpum.GstCtx.fExtrn & CPUMCTX_EXTRN_PC))
     455        {
     456            /** @todo better logging */
     457            if (pVM->cCpus == 1)
     458                Log(("NEM: %RX64\n", pVCpu->cpum.GstCtx.Pc.u64));
     459            else
     460                Log(("NEM-CPU%d: %RX64\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.Pc.u64));
     461        }
     462# else
     463#  error "port me"
     464# endif
    443465        else if (pVM->cCpus == 1)
    444466            Log(("NEMRx: -> NEMR3RunGC\n"));
    445467        else
    446             Log(("NEMRx-CPU%u: -> NEMR3RunGC\n",  pVCpu->idCpu));
     468            Log(("NEMRx-CPU%u: -> NEMR3RunGC\n", pVCpu->idCpu));
    447469#endif /* LOG_ENABLED */
    448470
  • trunk/src/VBox/VMM/VMMR3/GIM.cpp

    r106061 r107227  
    7474#include <iprt/string.h>
    7575
    76 #if !defined(VBOX_VMM_TARGET_ARMV8)
     76#if defined(VBOX_VMM_TARGET_X86)
    7777/* Include all GIM providers. */
    7878# include "GIMMinimalInternal.h"
     
    163163         *        'most up-to-date implementation' version number when 0. Otherwise,
    164164         *        we'll have abiguities when loading the state of older VMs. */
    165 #if !defined(VBOX_VMM_TARGET_ARMV8)
     165#if defined(VBOX_VMM_TARGET_X86)
    166166        if (!RTStrCmp(szProvider, "Minimal"))
    167167        {
     
    210210    switch (pVM->gim.s.enmProviderId)
    211211    {
    212 #if !defined(VBOX_VMM_TARGET_ARMV8)
     212#if defined(VBOX_VMM_TARGET_X86)
    213213        case GIMPROVIDERID_MINIMAL:
    214214            return gimR3MinimalInitCompleted(pVM);
     
    261261    switch (pVM->gim.s.enmProviderId)
    262262    {
    263 #if !defined(VBOX_VMM_TARGET_ARMV8)
     263#if defined(VBOX_VMM_TARGET_X86)
    264264        case GIMPROVIDERID_HYPERV:
    265265            rc = gimR3HvSave(pVM, pSSM);
     
    326326    switch (pVM->gim.s.enmProviderId)
    327327    {
    328 #if !defined(VBOX_VMM_TARGET_ARMV8)
     328#if defined(VBOX_VMM_TARGET_X86)
    329329        case GIMPROVIDERID_HYPERV:
    330330            rc = gimR3HvLoad(pVM, pSSM);
     
    350350static DECLCALLBACK(int) gimR3LoadDone(PVM pVM, PSSMHANDLE pSSM)
    351351{
    352 #if defined(VBOX_VMM_TARGET_ARMV8)
    353352    RT_NOREF(pSSM);
    354 #endif
    355353
    356354    switch (pVM->gim.s.enmProviderId)
    357355    {
    358 #if !defined(VBOX_VMM_TARGET_ARMV8)
     356#if defined(VBOX_VMM_TARGET_X86)
    359357        case GIMPROVIDERID_HYPERV:
    360358            return gimR3HvLoadDone(pVM, pSSM);
     
    379377    switch (pVM->gim.s.enmProviderId)
    380378    {
    381 #if !defined(VBOX_VMM_TARGET_ARMV8)
     379#if defined(VBOX_VMM_TARGET_X86)
    382380        case GIMPROVIDERID_HYPERV:
    383381            return gimR3HvTerm(pVM);
     
    387385#endif
    388386        default:
    389             break;
    390     }
    391     return VINF_SUCCESS;
     387            return VINF_SUCCESS;
     388    }
    392389}
    393390
     
    403400VMMR3_INT_DECL(void) GIMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
    404401{
    405 #if defined(VBOX_VMM_TARGET_ARMV8)
    406402    RT_NOREF(offDelta);
    407 #endif
    408403
    409404    switch (pVM->gim.s.enmProviderId)
    410405    {
    411 #if !defined(VBOX_VMM_TARGET_ARMV8)
     406#if defined(VBOX_VMM_TARGET_X86)
    412407        case GIMPROVIDERID_HYPERV:
    413408            gimR3HvRelocate(pVM, offDelta);
     
    432427    switch (pVM->gim.s.enmProviderId)
    433428    {
    434 #if !defined(VBOX_VMM_TARGET_ARMV8)
     429#if defined(VBOX_VMM_TARGET_X86)
    435430        case GIMPROVIDERID_HYPERV:
    436             return gimR3HvReset(pVM);
     431            gimR3HvReset(pVM);
     432            break;
    437433
    438434        case GIMPROVIDERID_KVM:
    439             return gimR3KvmReset(pVM);
     435            gimR3KvmReset(pVM);
     436            break;
    440437#endif
    441438        default:
     
    474471    switch (pVM->gim.s.enmProviderId)
    475472    {
    476 #if !defined(VBOX_VMM_TARGET_ARMV8)
     473#if defined(VBOX_VMM_TARGET_X86)
    477474        case GIMPROVIDERID_HYPERV:
    478475            return gimR3HvGetDebugSetup(pVM, pDbgSetup);
    479476#endif
    480477        default:
    481             break;
    482     }
    483     return VERR_GIM_NO_DEBUG_CONNECTION;
     478            return VERR_GIM_NO_DEBUG_CONNECTION;
     479    }
    484480}
    485481
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r106731 r107227  
    3737#include <VBox/vmm/mm.h>
    3838#include <VBox/vmm/ssm.h>
     39/** @todo this isn't sustainable.   */
    3940#if defined(VBOX_VMM_TARGET_ARMV8)
    4041# include "IEMInternal-armv8.h"
  • trunk/src/VBox/VMM/VMMR3/MM.cpp

    r106061 r107227  
    171171#include <iprt/assert.h>
    172172#include <iprt/string.h>
    173 #if defined(VBOX_VMM_TARGET_ARMV8)
     173#ifdef VBOX_VMM_TARGET_ARMV8
    174174# include <iprt/file.h>
    175175#endif
     
    271271}
    272272
    273 
    274 #if defined(VBOX_VMM_TARGET_ARMV8)
     273#ifdef VBOX_VMM_TARGET_ARMV8
     274
    275275/**
    276276 * Initializes the given RAM range with data from the given file.
     
    287287    if (RT_SUCCESS(rc))
    288288    {
    289         uint8_t abRead[GUEST_PAGE_SIZE];
    290289        RTGCPHYS GCPhys = GCPhysStart;
    291290
    292291        for (;;)
    293292        {
    294             size_t cbThisRead = 0;
     293            uint8_t abRead[GUEST_PAGE_SIZE];
     294            size_t  cbThisRead = 0;
    295295            rc = RTFileRead(hFile, &abRead[0], sizeof(abRead), &cbThisRead);
    296296            if (RT_FAILURE(rc))
     
    391391        if (u64GCPhysStart >= _4G)
    392392            pVM->mm.s.cbRamAbove4GB += u64MemSize;
    393         else if (u64GCPhysStart + u64MemSize > _4G)
     393        else if (u64GCPhysStart + u64MemSize <= _4G)
     394            pVM->mm.s.cbRamBelow4GB += (uint32_t)u64MemSize;
     395        else
    394396        {
    395             uint64_t cbRamAbove4GB = (u64GCPhysStart + u64MemSize) - _4G;
     397            uint64_t const cbRamAbove4GB = u64GCPhysStart + u64MemSize - _4G;
    396398            pVM->mm.s.cbRamAbove4GB += cbRamAbove4GB;
    397             pVM->mm.s.cbRamBelow4GB += (u64MemSize - cbRamAbove4GB);
     399            pVM->mm.s.cbRamBelow4GB += u64MemSize - cbRamAbove4GB;
    398400        }
    399         else
    400             pVM->mm.s.cbRamBelow4GB += (uint32_t)u64MemSize;
    401     }
    402 
    403     return rc;
    404 }
    405 #endif
    406 
    407 
    408 /**
    409  * Initializes the MM parts which depends on PGM being initialized.
    410  *
    411  * @returns VBox status code.
    412  * @param   pVM         The cross context VM structure.
    413  * @remark  No cleanup necessary since MMR3Term() will be called on failure.
    414  */
    415 VMMR3DECL(int) MMR3InitPaging(PVM pVM)
    416 {
    417     LogFlow(("MMR3InitPaging:\n"));
    418 
    419     /*
    420      * Query the CFGM values.
    421      */
    422     int rc;
    423     PCFGMNODE pMMCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "MM");
    424     if (!pMMCfg)
    425     {
    426         rc = CFGMR3InsertNode(CFGMR3GetRoot(pVM), "MM", &pMMCfg);
    427         AssertRCReturn(rc, rc);
    428     }
    429 
    430 #if defined(VBOX_VMM_TARGET_ARMV8)
    431     rc = mmR3InitRamArmV8(pVM, pMMCfg);
    432 #else
     401    }
     402
     403    return rc;
     404}
     405
     406#elif defined(VBOX_VMM_TARGET_X86)
     407
     408/**
     409 * RAM setup function for X86.
     410 */
     411static int mmR3InitRamX86(PVM pVM, PCFGMNODE pMMCfg)
     412{
     413    RT_NOREF(pMMCfg);
     414
    433415    /** @cfgm{/RamSize, uint64_t, 0, 16TB, 0}
    434416     * Specifies the size of the base RAM that is to be set up during
    435417     * VM initialization.
    436418     */
    437     uint64_t cbRam;
    438     rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam);
     419    uint64_t cbRam = 0;
     420    int rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam);
    439421    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    440422        cbRam = 0;
     
    450432     * to avoid mapping RAM to the range normally used for PCI memory regions.
    451433     * Must be aligned on a 4MB boundary. */
    452     uint32_t cbRamHole;
     434    uint32_t cbRamHole = 0;
    453435    rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "RamHoleSize", &cbRamHole, MM_RAM_HOLE_SIZE_DEFAULT);
    454436    AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamHoleSize\", rc=%Rrc.\n", rc), rc);
     
    561543        }
    562544    }
    563 #endif /* !VBOX_VMM_TARGET_ARMV8 */
     545
     546    AssertMsg(pVM->mm.s.cBasePages == cBasePages || RT_FAILURE(rc), ("%RX64 != %RX64\n", pVM->mm.s.cBasePages, cBasePages));
     547    return rc;
     548}
     549
     550#endif /* VBOX_VMM_TARGET_X86 */
     551
     552/**
     553 * Initializes the MM parts which depends on PGM being initialized.
     554 *
     555 * @returns VBox status code.
     556 * @param   pVM         The cross context VM structure.
     557 * @remark  No cleanup necessary since MMR3Term() will be called on failure.
     558 */
     559VMMR3DECL(int) MMR3InitPaging(PVM pVM)
     560{
     561    LogFlow(("MMR3InitPaging:\n"));
     562
     563    /*
     564     * Query the CFGM values.
     565     */
     566    int rc;
     567    PCFGMNODE pMMCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "MM");
     568    if (!pMMCfg)
     569    {
     570        rc = CFGMR3InsertNode(CFGMR3GetRoot(pVM), "MM", &pMMCfg);
     571        AssertRCReturn(rc, rc);
     572    }
     573
     574#ifdef VBOX_VMM_TARGET_ARMV8
     575    rc = mmR3InitRamArmV8(pVM, pMMCfg);
     576#elif defined(VBOX_VMM_TARGET_X86)
     577    rc = mmR3InitRamX86(pVM, pMMCfg);
     578#else
     579# error "port me"
     580#endif
    564581
    565582    /*
     
    568585     */
    569586    pVM->mm.s.fDoneMMR3InitPaging = true;
    570 #if !defined(VBOX_VMM_TARGET_ARMV8)
    571     AssertMsg(pVM->mm.s.cBasePages == cBasePages || RT_FAILURE(rc), ("%RX64 != %RX64\n", pVM->mm.s.cBasePages, cBasePages));
    572 #endif
    573587
    574588    LogFlow(("MMR3InitPaging: returns %Rrc\n", rc));
  • trunk/src/VBox/VMM/VMMR3/NEMR3.cpp

    r106951 r107227  
    103103                                  "|VmxLbr"
    104104#endif
    105 #if defined(VBOX_VMM_TARGET_ARMV8)
     105#ifdef VBOX_VMM_TARGET_ARMV8
    106106                                  "|VTimerInterrupt"
    107107#endif
     
    140140    }
    141141
    142 #if defined(VBOX_VMM_TARGET_ARMV8)
     142#ifdef VBOX_VMM_TARGET_ARMV8
    143143    /** @cfgm{/NEM/VTimerInterrupt, uint32_t}
    144144     * Specifies the interrupt identifier for the VTimer. */
     
    182182            if (pVM->bMainExecutionEngine == VM_EXEC_ENGINE_NATIVE_API)
    183183            {
    184 #ifndef VBOX_VMM_TARGET_ARMV8 /* NEM is the only option on ARM for now, so calling it turtle and snail mode
    185                                * is a bit unfair as long as we don't have a native hypervisor to compare against :). */
     184#ifndef VBOX_WITH_HWVIRT /* Don't complain if there are no other alternatives. */
    186185# ifdef RT_OS_WINDOWS /* The WHv* API is extremely slow at handling VM exits. The AppleHv and
    187186                         KVM APIs are much faster, thus the different mode name. :-) */
  • trunk/src/VBox/VMM/VMMR3/NEMR3NativeTemplate-linux.cpp.h

    r104840 r107227  
    6666
    6767        CAP_ENTRY__L(KVM_CAP_IRQCHIP),                       /* 0 */
    68 #ifdef VBOX_VMM_TARGET_ARMV8
     68#ifdef VBOX_VMM_TARGET_X86
     69        CAP_ENTRY_ML(KVM_CAP_HLT),
     70#else
    6971        CAP_ENTRY__L(KVM_CAP_HLT),
    70 #else
    71         CAP_ENTRY_ML(KVM_CAP_HLT),
    7272#endif
    7373        CAP_ENTRY__L(KVM_CAP_MMU_SHADOW_CACHE_CONTROL),
     
    120120        CAP_ENTRY__L(KVM_CAP_XEN_HVM),
    121121#endif
    122 #ifdef VBOX_VMM_TARGET_ARMV8
     122#ifdef VBOX_VMM_TARGET_X86
     123        CAP_ENTRY_ML(KVM_CAP_ADJUST_CLOCK),
     124#else
    123125        CAP_ENTRY__L(KVM_CAP_ADJUST_CLOCK),
    124 #else
    125         CAP_ENTRY_ML(KVM_CAP_ADJUST_CLOCK),
    126126#endif
    127127        CAP_ENTRY__L(KVM_CAP_INTERNAL_ERROR_DATA),           /* 40 */
     
    142142        CAP_ENTRY__L(KVM_CAP_DEBUGREGS),                     /* 50 */
    143143#endif
    144 #ifdef VBOX_VMM_TARGET_ARMV8
     144#ifdef VBOX_VMM_TARGET_X86
     145        CAP_ENTRY__S(KVM_CAP_X86_ROBUST_SINGLESTEP, fRobustSingleStep),
     146#else
    145147        CAP_ENTRY__L(KVM_CAP_X86_ROBUST_SINGLESTEP),
    146 #else
    147         CAP_ENTRY__S(KVM_CAP_X86_ROBUST_SINGLESTEP, fRobustSingleStep),
    148148#endif
    149149        CAP_ENTRY__L(KVM_CAP_PPC_OSI),
     
    305305        CAP_ENTRY__L(KVM_CAP_S390_DIAG318),
    306306        CAP_ENTRY__L(KVM_CAP_STEAL_TIME),
    307 #ifdef VBOX_VMM_TARGET_ARMV8
     307#ifdef VBOX_VMM_TARGET_X86
     308        CAP_ENTRY_ML(KVM_CAP_X86_USER_SPACE_MSR),            /* (since 5.10) */
     309        CAP_ENTRY_ML(KVM_CAP_X86_MSR_FILTER),
     310#else
    308311        CAP_ENTRY__L(KVM_CAP_X86_USER_SPACE_MSR),            /* (since 5.10) */
    309312        CAP_ENTRY__L(KVM_CAP_X86_MSR_FILTER),
    310 #else
    311         CAP_ENTRY_ML(KVM_CAP_X86_USER_SPACE_MSR),            /* (since 5.10) */
    312         CAP_ENTRY_ML(KVM_CAP_X86_MSR_FILTER),
    313313#endif
    314314        CAP_ENTRY__L(KVM_CAP_ENFORCE_PV_FEATURE_CPUID),      /* 190 */
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r107113 r107227  
    10311031    {
    10321032        PVMCPU pVCpu = pVM->apCpusR3[idCpu];
    1033 #if defined(VBOX_VMM_TARGET_ARMV8)
     1033#ifdef VBOX_VMM_TARGET_ARMV8
    10341034        SSMR3PutU32(pSSM, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_IRQ));
    10351035        SSMR3PutU32(pSSM, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_FIQ));
    1036 #else
     1036#elif defined(VBOX_VMM_TARGET_X86)
    10371037        SSMR3PutU32(pSSM, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC));
    10381038        SSMR3PutU32(pSSM, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC));
     1039#else
     1040# error "port me"
    10391041#endif
    10401042        SSMR3PutU32(pSSM, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_NMI));
     
    10661068    {
    10671069        PVMCPU pVCpu = pVM->apCpusR3[idCpu];
    1068 #if defined(VBOX_VMM_TARGET_ARMV8)
     1070# ifdef VBOX_VMM_TARGET_ARMV8
    10691071        LogFlow(("pdmR3LoadPrep: VCPU %u %s%s\n", idCpu,
    10701072                VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_IRQ) ? " VMCPU_FF_INTERRUPT_IRQ" : "",
    10711073                VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_FIQ) ? " VMCPU_FF_INTERRUPT_FIQ" : ""));
    1072 #else
     1074# elif defined(VBOX_VMM_TARGET_X86)
    10731075        LogFlow(("pdmR3LoadPrep: VCPU %u %s%s\n", idCpu,
    10741076                VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC) ? " VMCPU_FF_INTERRUPT_APIC" : "",
    10751077                VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC)  ? " VMCPU_FF_INTERRUPT_PIC" : ""));
    1076 #endif
     1078# else
     1079#  error "port me"
     1080# endif
    10771081    }
    10781082#endif
     
    10901094    {
    10911095        PVMCPU pVCpu = pVM->apCpusR3[idCpu];
    1092 #if defined(VBOX_VMM_TARGET_ARMV8)
     1096#ifdef VBOX_VMM_TARGET_ARMV8
    10931097        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_IRQ);
    10941098        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_FIQ);
    1095 #else
     1099#elif defined(VBOX_VMM_TARGET_X86)
    10961100        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC);
    10971101        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC);
     1102#else
     1103# error "port me"
    10981104#endif
    10991105        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
     
    11571163                return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
    11581164            }
    1159 #if defined(VBOX_VMM_TARGET_ARMV8)
     1165#ifdef VBOX_VMM_TARGET_ARMV8
    11601166            AssertLogRelMsg(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_IRQ),
    11611167                            ("VCPU%03u: VMCPU_FF_INTERRUPT_IRQ set! Devices shouldn't set interrupts during state restore...\n", idCpu));
    11621168            if (fInterruptPending)
    11631169                VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_IRQ);
    1164 #else
     1170
     1171#elif defined(VBOX_VMM_TARGET_X86)
    11651172            AssertLogRelMsg(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC),
    11661173                            ("VCPU%03u: VMCPU_FF_INTERRUPT_APIC set! Devices shouldn't set interrupts during state restore...\n", idCpu));
    11671174            if (fInterruptPending)
    11681175                VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC);
     1176#else
     1177# error "port me"
    11691178#endif
    11701179
     
    11791188                return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
    11801189            }
    1181 #if defined(VBOX_VMM_TARGET_ARMV8)
     1190#ifdef VBOX_VMM_TARGET_ARMV8
    11821191            AssertLogRelMsg(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_FIQ),
    11831192                            ("VCPU%03u: VMCPU_FF_INTERRUPT_FIQ set!  Devices shouldn't set interrupts during state restore...\n", idCpu));
    11841193            if (fInterruptPending)
    11851194                VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_FIQ);
    1186 #else
     1195
     1196#elif defined(VBOX_VMM_TARGET_X86)
    11871197            AssertLogRelMsg(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC),
    11881198                            ("VCPU%03u: VMCPU_FF_INTERRUPT_PIC set!  Devices shouldn't set interrupts during state restore...\n", idCpu));
    11891199            if (fInterruptPending)
    11901200                VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC);
     1201#else
     1202# error "port me"
    11911203#endif
    11921204
     
    17301742VMMR3_INT_DECL(void) PDMR3ResetCpu(PVMCPU pVCpu)
    17311743{
    1732 #if defined(VBOX_VMM_TARGET_ARMV8)
     1744#ifdef VBOX_VMM_TARGET_ARMV8
    17331745    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_IRQ);
    17341746    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_FIQ);
    1735 #else
     1747#elif defined(VBOX_VMM_TARGET_X86)
    17361748    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC);
    17371749    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC);
     1750#else
     1751# error "port me"
    17381752#endif
    17391753    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
  • trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp

    r107113 r107227  
    3535#include <VBox/vmm/pgm.h>
    3636#include <VBox/vmm/hm.h>
    37 #ifndef VBOX_VMM_TARGET_ARMV8
     37#ifdef VBOX_VMM_TARGET_X86
    3838# include <VBox/vmm/pdmapic.h>
    3939#endif
     
    6767    Assert(pVM->enmVMState != VMSTATE_LOADING || pVM->pdm.s.fStateLoaded);
    6868
    69 #if defined(VBOX_VMM_TARGET_ARMV8)
     69#ifdef VBOX_VMM_TARGET_X86
     70    PVMCPU pVCpu = pVM->apCpusR3[0];  /* for PIC we always deliver to CPU 0, SMP uses APIC */
     71    PDMApicSetLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */);
     72#else
    7073    AssertReleaseFailed();
    7174    RT_NOREF(pVM);
    72 #else
    73     PVMCPU pVCpu = pVM->apCpusR3[0];  /* for PIC we always deliver to CPU 0, SMP uses APIC */
    74     PDMApicSetLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */);
    7575#endif
    7676}
     
    8686    Assert(pVM->enmVMState != VMSTATE_LOADING || pVM->pdm.s.fStateLoaded);
    8787
    88 #if defined(VBOX_VMM_TARGET_ARMV8)
     88#ifdef VBOX_VMM_TARGET_X86
     89    PVMCPU pVCpu = pVM->apCpusR3[0];  /* for PIC we always deliver to CPU 0, SMP uses APIC */
     90    PDMApicSetLocalInterrupt(pVCpu, 0 /* u8Pin */,  0 /* u8Level */, VINF_SUCCESS /* rcRZ */);
     91#else
    8992    AssertReleaseFailed();
    9093    RT_NOREF(pVM);
    91 #else
    92     PVMCPU pVCpu = pVM->apCpusR3[0];  /* for PIC we always deliver to CPU 0, SMP uses APIC */
    93     PDMApicSetLocalInterrupt(pVCpu, 0 /* u8Pin */,  0 /* u8Level */, VINF_SUCCESS /* rcRZ */);
    9494#endif
    9595}
     
    140140    LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n",
    141141             pDevIns->pReg->szName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc));
    142 #if defined(VBOX_VMM_TARGET_ARMV8)
     142#ifdef VBOX_VMM_TARGET_X86
     143    PVM pVM = pDevIns->Internal.s.pVMR3;
     144    return PDMApicBusDeliver(pVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc);
     145#else
    143146    AssertReleaseFailed();
    144147    RT_NOREF(pDevIns, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc);
    145148    return VERR_NOT_IMPLEMENTED;
    146 #else
    147     PVM pVM = pDevIns->Internal.s.pVMR3;
    148     return PDMApicBusDeliver(pVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc);
    149149#endif
    150150}
  • trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp

    r107194 r107227  
    3434#include "PDMInternal.h"
    3535#include <VBox/vmm/pdm.h>
    36 #if defined(VBOX_VMM_TARGET_ARMV8)
     36#ifdef VBOX_VMM_TARGET_ARMV8
    3737# include <VBox/vmm/gic.h>
    3838# include <VBox/vmm/pmu.h>
    39 #else
     39#elif defined(VBOX_VMM_TARGET_X86)
    4040# include <VBox/vmm/pdmapic.h>
    4141#endif
     
    700700    RegCB.pCfgNode         = NULL;
    701701
    702 #if defined(VBOX_VMM_TARGET_ARMV8)
    703     /*
    704      * Register the internal VMM GIC device.
    705      */
     702    /*
     703     * Register internal VMM devices.
     704     */
     705#ifdef VBOX_VMM_TARGET_ARMV8
     706    /* Register the internal VMM GIC device. */
    706707    int rc = pdmR3DevReg_Register(&RegCB.Core, &g_DeviceGIC);
    707708    AssertRCReturn(rc, rc);
    708709
    709     /*
    710      * Register the internal VMM GIC device, NEM variant.
    711      */
     710    /* Register the internal VMM GIC device, NEM variant. */
    712711    rc = pdmR3DevReg_Register(&RegCB.Core, &g_DeviceGICNem);
    713712    AssertRCReturn(rc, rc);
    714713
    715     /*
    716      * Register the internal VMM PMU device.
    717      */
     714    /* Register the internal VMM PMU device. */
    718715    rc = pdmR3DevReg_Register(&RegCB.Core, &g_DevicePMU);
    719716    AssertRCReturn(rc, rc);
    720 #else
    721     /*
    722      * Register the internal VMM APIC device.
    723     */
     717#endif
     718
     719#ifdef VBOX_VMM_TARGET_X86
     720    /* Register the internal VMM APIC device. */
    724721    int rc = pdmR3DevReg_Register(&RegCB.Core, &g_DeviceAPIC);
    725722    AssertRCReturn(rc, rc);
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r107194 r107227  
    20002000        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL);
    20012001
    2002 #if !defined(VBOX_VMM_TARGET_ARMV8)
     2002#ifdef VBOX_VMM_TARGET_X86
    20032003        if (!pVCpu->pgm.s.fA20Enabled)
    20042004        {
  • trunk/src/VBox/VMM/VMMR3/PGMDbg.cpp

    r107171 r107227  
    10841084        else
    10851085        {
    1086 #ifndef VBOX_VMM_TARGET_ARMV8
     1086#ifdef VBOX_VMM_TARGET_X86
    10871087            Assert(WalkGst.enmType != PGMPTWALKGSTTYPE_INVALID);
    10881088#endif
     
    10951095             */
    10961096            uint64_t cPagesCanSkip;
    1097 #ifndef VBOX_VMM_TARGET_ARMV8
     1097#ifdef VBOX_VMM_TARGET_X86
    10981098            switch (Walk.uLevel)
    10991099            {
     
    11441144                continue;
    11451145            }
    1146 #else
     1146
     1147#elif defined(VBOX_VMM_TARGET_ARMV8)
     1148
    11471149            /** @todo Sketch, needs creating proper defines for constants in armv8.h and using these
    11481150             * instead of hardcoding these here. */
     
    11781180                continue;
    11791181            }
     1182#else
     1183# error "port me"
    11801184#endif
    11811185        }
     
    11851189            break;
    11861190        cPages -= cIncPages;
    1187 #ifndef VBOX_VMM_TARGET_ARMV8
     1191#ifdef VBOX_VMM_TARGET_X86
    11881192        GCPtr += (RTGCPTR)cIncPages << X86_PT_PAE_SHIFT;
     1193#elif defined(VBOX_VMM_TARGET_ARMV8)
     1194        GCPtr += (RTGCPTR)cIncPages << 12;
    11891195#else
    1190         GCPtr += (RTGCPTR)cIncPages << 12;
     1196# error "port me"
    11911197#endif
    11921198
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r107194 r107227  
    63226322*********************************************************************************************************************************/
    63236323
    6324 #if !defined(VBOX_VMM_TARGET_ARMV8)
     6324#ifdef VBOX_VMM_TARGET_X86
    63256325/**
    63266326 * Sets the Address Gate 20 state.
     
    63356335    if (pVCpu->pgm.s.fA20Enabled != fEnable)
    63366336    {
    6337 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     6337# ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    63386338        PCCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
    63396339        if (   CPUMIsGuestInVmxRootMode(pCtx)
     
    63436343            return;
    63446344        }
    6345 #endif
     6345# endif
    63466346        pVCpu->pgm.s.fA20Enabled = fEnable;
    63476347        pVCpu->pgm.s.GCPhysA20Mask = ~((RTGCPHYS)!fEnable << 20);
    63486348        if (VM_IS_NEM_ENABLED(pVCpu->CTX_SUFF(pVM)))
    63496349            NEMR3NotifySetA20(pVCpu, fEnable);
    6350 #ifdef PGM_WITH_A20
     6350# ifdef PGM_WITH_A20
    63516351        VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    63526352        pgmR3RefreshShadowModeAfterA20Change(pVCpu);
    63536353        HMFlushTlb(pVCpu);
    6354 #endif
    6355 #if 0 /* PGMGetPage will apply the A20 mask to the GCPhys it returns, so we must invalid both sides of the TLB. */
     6354# endif
     6355# if 0 /* PGMGetPage will apply the A20 mask to the GCPhys it returns, so we must invalid both sides of the TLB. */
    63566356        IEMTlbInvalidateAllPhysical(pVCpu);
    6357 #else
     6357# else
    63586358        IEMTlbInvalidateAllGlobal(pVCpu);
    6359 #endif
     6359# endif
    63606360        STAM_REL_COUNTER_INC(&pVCpu->pgm.s.cA20Changes);
    63616361    }
    63626362}
    6363 #endif
    6364 
     6363#endif /* VBOX_VMM_TARGET_X86 */
     6364
  • trunk/src/VBox/VMM/VMMR3/PGMSavedState.cpp

    r107171 r107227  
    33313331                AssertLogRelRCReturn(rc, rc);
    33323332
    3333 #if !defined(VBOX_VMM_TARGET_ARMV8)
     3333#ifdef VBOX_VMM_TARGET_X86
    33343334                /* Update the PSE, NX flags and validity masks. */
    33353335                pVCpu->pgm.s.fGst32BitPageSizeExtension = CPUMIsGuestPageSizeExtEnabled(pVCpu);
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r107220 r107227  
    818818        PVMCPU pVCpu = pVM->apCpusR3[i];
    819819
    820 #if defined(VBOX_VMM_TARGET_ARMV8)
     820#ifdef VBOX_VMM_TARGET_ARMV8
    821821        pVCpu->cNsVTimerActivate   = UINT64_MAX;
    822822#endif
     
    13151315        pVCpu->tm.s.u64TSC         = 0;
    13161316        pVCpu->tm.s.u64TSCLastSeen = 0;
    1317 #if defined(VBOX_VMM_TARGET_ARMV8)
     1317#ifdef VBOX_VMM_TARGET_ARMV8
    13181318        pVCpu->cNsVTimerActivate   = UINT64_MAX;
    13191319#endif
  • trunk/src/VBox/VMM/VMMR3/TRPM.cpp

    r106061 r107227  
    387387VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, PVMCPU pVCpu, TRPMEVENT enmEvent, bool *pfInjected)
    388388{
    389 #if defined(VBOX_VMM_TARGET_ARMV8)
    390     RT_NOREF(pVM, pVCpu, enmEvent, pfInjected);
    391     AssertReleaseFailed();
    392     return VERR_NOT_IMPLEMENTED;
    393 #else
     389#ifdef VBOX_VMM_TARGET_X86
    394390    PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
    395391    Assert(!CPUMIsInInterruptShadow(pCtx));
     
    453449    return VINF_EM_RESCHEDULE;
    454450# endif
    455 #endif
     451
     452#else  /* !VBOX_VMM_TARGET_X86 */
     453    RT_NOREF(pVM, pVCpu, enmEvent, pfInjected);
     454    AssertReleaseFailed();
     455    return VERR_NOT_IMPLEMENTED;
     456#endif /* !VBOX_VMM_TARGET_X86 */
    456457}
    457458
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r107194 r107227  
    875875                        if (RT_SUCCESS(rc))
    876876                        {
    877 #if !defined(VBOX_VMM_TARGET_ARMV8)
     877#ifdef VBOX_VMM_TARGET_X86
    878878                            rc = SELMR3Init(pVM);
     879                            if (RT_SUCCESS(rc))
    879880#endif
    880                             if (RT_SUCCESS(rc))
    881881                            {
    882882                                rc = TRPMR3Init(pVM);
     
    906906                                                            if (RT_SUCCESS(rc))
    907907                                                            {
    908 #if !defined(VBOX_VMM_TARGET_ARMV8)
     908#ifdef VBOX_VMM_TARGET_X86
    909909                                                                rc = GCMR3Init(pVM);
     910                                                                if (RT_SUCCESS(rc))
    910911#endif
    911                                                                 if (RT_SUCCESS(rc))
    912912                                                                {
    913913                                                                    rc = PDMR3Init(pVM);
     
    933933                                                                        AssertRC(rc2);
    934934                                                                    }
    935 #if !defined(VBOX_VMM_TARGET_ARMV8)
     935#ifdef VBOX_VMM_TARGET_X86
    936936                                                                    int rc2 = GCMR3Term(pVM);
    937937                                                                    AssertRC(rc2);
     
    958958                                    AssertRC(rc2);
    959959                                }
    960 #if !defined(VBOX_VMM_TARGET_ARMV8)
     960#ifdef VBOX_VMM_TARGET_X86
    961961                                int rc2 = SELMR3Term(pVM);
    962962                                AssertRC(rc2);
     
    10811081    CPUMR3Relocate(pVM);
    10821082    HMR3Relocate(pVM);
    1083 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1083#ifdef VBOX_VMM_TARGET_X86
    10841084    SELMR3Relocate(pVM);
    10851085#endif
    10861086    VMMR3Relocate(pVM, offDelta);
    1087 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1087#ifdef VBOX_VMM_TARGET_X86
    10881088    SELMR3Relocate(pVM);                /* !hack! fix stack! */
    10891089#endif
     
    22372237        rc = TRPMR3Term(pVM);
    22382238        AssertRC(rc);
    2239 #if !defined(VBOX_VMM_TARGET_ARMV8)
     2239#ifdef VBOX_VMM_TARGET_X86
    22402240        rc = SELMR3Term(pVM);
    22412241        AssertRC(rc);
     
    26212621        PDMR3Reset(pVM);
    26222622        PGMR3Reset(pVM);
    2623 #if !defined(VBOX_VMM_TARGET_ARMV8)
     2623#ifdef VBOX_VMM_TARGET_X86
    26242624        SELMR3Reset(pVM);
    26252625#endif
     
    42414241    switch (pVM->bMainExecutionEngine)
    42424242    {
    4243 #if !defined(VBOX_VMM_TARGET_ARMV8)
     4243#ifdef VBOX_WITH_HWVIRT
    42444244        case VM_EXEC_ENGINE_HW_VIRT:
    42454245            return HMIsLongModeAllowed(pVM);
     
    42484248        case VM_EXEC_ENGINE_NATIVE_API:
    42494249            return NEMHCIsLongModeAllowed(pVM);
     4250
     4251        case VM_EXEC_ENGINE_IEM:
     4252            return true;
    42504253
    42514254        case VM_EXEC_ENGINE_NOT_SET:
  • trunk/src/VBox/VMM/VMMR3/VMEmt.cpp

    r106589 r107227  
    568568    }
    569569
    570 #if defined(VBOX_VMM_TARGET_ARMV8)
    571     uint64_t cNsVTimerActivate = TMCpuGetVTimerActivationNano(pVCpu);
    572     const bool fVTimerActive = cNsVTimerActivate != UINT64_MAX;
     570#ifdef VBOX_VMM_TARGET_ARMV8
     571    uint64_t   cNsVTimerActivate = TMCpuGetVTimerActivationNano(pVCpu);
     572    const bool fVTimerActive     = cNsVTimerActivate != UINT64_MAX;
    573573#endif
    574574
     
    590590        if (    VM_FF_IS_ANY_SET(pVM, VM_FF_EXTERNAL_HALTED_MASK)
    591591            ||  VMCPU_FF_IS_ANY_SET(pVCpu, fMask)
    592 #if defined(VBOX_VMM_TARGET_ARMV8)
     592#ifdef VBOX_VMM_TARGET_ARMV8
    593593            ||  cNsElapsedTimers >= cNsVTimerActivate
    594594#endif
    595595            )
    596596        {
    597 #if defined(VBOX_VMM_TARGET_ARMV8)
     597#ifdef VBOX_VMM_TARGET_ARMV8
    598598            cNsVTimerActivate = 0;
    599599#endif
     
    601601        }
    602602
    603 #if defined(VBOX_VMM_TARGET_ARMV8)
     603#ifdef VBOX_VMM_TARGET_ARMV8
    604604        cNsVTimerActivate -= cNsElapsedTimers;
    605605#endif
     
    614614            break;
    615615
    616 #if defined(VBOX_VMM_TARGET_ARMV8)
     616#ifdef VBOX_VMM_TARGET_ARMV8
    617617        u64NanoTS = RT_MIN(cNsVTimerActivate, u64NanoTS);
    618618#endif
     
    679679                fBlockOnce = false;
    680680
    681 #if defined(VBOX_VMM_TARGET_ARMV8)
     681#ifdef VBOX_VMM_TARGET_ARMV8
    682682            cNsVTimerActivate -= RT_MIN(cNsVTimerActivate, Elapsed);
    683683            /* Did the vTimer expire? */
     
    689689    //if (fSpinning) RTLogRelPrintf("spun for %RU64 ns %u loops; lag=%RU64 pct=%d\n", RTTimeNanoTS() - u64Now, cLoops, TMVirtualSyncGetLag(pVM), u32CatchUpPct);
    690690
    691 #if defined(VBOX_VMM_TARGET_ARMV8)
     691#ifdef VBOX_VMM_TARGET_ARMV8
    692692    if (fVTimerActive)
    693693    {
     
    11571157     * Check Relevant FFs.
    11581158     */
    1159 #if defined(VBOX_VMM_TARGET_ARMV8)
    1160     const uint64_t fMaskInterrupts = ((fFlags & VMWAITHALTED_F_IGNORE_IRQS) ? VMCPU_FF_INTERRUPT_IRQ : 0)
     1159#ifdef VBOX_VMM_TARGET_ARMV8
     1160    const uint64_t fMaskIrqs = ((fFlags & VMWAITHALTED_F_IGNORE_IRQS) ? VMCPU_FF_INTERRUPT_IRQ : 0)
    11611161                                   | ((fFlags & VMWAITHALTED_F_IGNORE_FIQS) ? VMCPU_FF_INTERRUPT_FIQ : 0);
    1162     const uint64_t fMask = VMCPU_FF_EXTERNAL_HALTED_MASK & ~fMaskInterrupts;
     1162    const uint64_t fMask     = VMCPU_FF_EXTERNAL_HALTED_MASK & ~fMaskIrqs;
    11631163#else
    1164     const uint64_t fMask = !(fFlags & VMWAITHALTED_F_IGNORE_IRQS)
     1164    const uint64_t fMask     = !(fFlags & VMWAITHALTED_F_IGNORE_IRQS)
    11651165        ? VMCPU_FF_EXTERNAL_HALTED_MASK
    11661166        : VMCPU_FF_EXTERNAL_HALTED_MASK & ~(VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC);
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r107194 r107227  
    130130#include <VBox/sup.h>
    131131#include <VBox/vmm/dbgf.h>
    132 #if defined(VBOX_VMM_TARGET_ARMV8)
     132#ifdef VBOX_VMM_TARGET_ARMV8
    133133# include <VBox/vmm/gic.h>
    134 #else
     134#elif defined(VBOX_VMM_TARGET_X86)
    135135# include <VBox/vmm/pdmapic.h>
    136136#endif
     
    146146#include <iprt/assert.h>
    147147#include <iprt/alloc.h>
    148 #if defined(VBOX_VMM_TARGET_ARMV8)
     148#ifdef VBOX_VMM_TARGET_ARMV8
    149149# include <iprt/armv8.h>
    150150#endif
     
    580580        case VMINITCOMPLETED_HM:
    581581        {
    582 #if !defined(VBOX_VMM_TARGET_ARMV8)
     582#ifdef VBOX_VMM_TARGET_X86
    583583            /*
    584584             * Disable the periodic preemption timers if we can use the
     
    12141214
    12151215#ifdef VBOX_WITH_HWVIRT
    1216 
     1216# ifndef VBOX_VMM_TARGET_X86
     1217#  error "config error"
     1218# endif
    12171219/**
    12181220 * Executes guest code (Intel VT-x and AMD-V).
     
    12231225VMMR3_INT_DECL(int) VMMR3HmRunGC(PVM pVM, PVMCPU pVCpu)
    12241226{
    1225 # if defined(VBOX_VMM_TARGET_ARMV8)
    1226     /* We should actually never get here as the only execution engine is NEM. */
    1227     RT_NOREF(pVM, pVCpu);
    1228     AssertReleaseFailed();
    1229     return VERR_NOT_SUPPORTED;
    1230 # else
    12311227    Log2(("VMMR3HmRunGC: (cs:rip=%04x:%RX64)\n", CPUMGetGuestCS(pVCpu), CPUMGetGuestRIP(pVCpu)));
    12321228
     
    12341230    do
    12351231    {
    1236 #  ifdef NO_SUPCALLR0VMM
     1232# ifdef NO_SUPCALLR0VMM
    12371233        rc = VERR_GENERAL_FAILURE;
    1238 #  else
     1234# else
    12391235        rc = SUPR3CallVMMR0Fast(VMCC_GET_VMR0_FOR_CALL(pVM), VMMR0_DO_HM_RUN, pVCpu->idCpu);
    12401236        if (RT_LIKELY(rc == VINF_SUCCESS))
    12411237            rc = pVCpu->vmm.s.iLastGZRc;
    1242 #  endif
     1238# endif
    12431239    } while (rc == VINF_EM_RAW_INTERRUPT_HYPER);
    12441240
    1245 #  if 0 /** @todo triggers too often */
     1241# if 0 /** @todo triggers too often */
    12461242    Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_TO_R3));
    1247 #  endif
     1243# endif
    12481244
    12491245    /*
     
    12601256    }
    12611257    return vmmR3HandleRing0Assert(pVM, pVCpu);
    1262 # endif
    12631258}
    12641259#endif /* VBOX_WITH_HWVIRT */
    12651260
    12661261
    1267 #if defined(VBOX_VMM_TARGET_ARMV8)
     1262#ifdef VBOX_VMM_TARGET_ARMV8
    12681263
    12691264/**
     
    13181313}
    13191314
    1320 #else /* !VBOX_VMM_TARGET_ARMV8 */
     1315#elif defined(VBOX_VMM_TARGET_X86)
    13211316
    13221317/**
     
    14041399    PGMR3ResetCpu(pVM, pVCpu);
    14051400    PDMR3ResetCpu(pVCpu);   /* Only clears pending interrupts force flags */
    1406 # if !defined(VBOX_VMM_TARGET_ARMV8)
    14071401    PDMR3ApicInitIpi(pVCpu);
    1408 # endif
    14091402    TRPMR3ResetCpu(pVCpu);
    14101403    CPUMR3ResetCpu(pVM, pVCpu);
     
    14491442}
    14501443
    1451 #endif /* !VBOX_VMM_TARGET_ARMV8 */
     1444#endif /* VBOX_VMM_TARGET_X86 */
    14521445
    14531446/**
     
    25822575        c = 0;
    25832576        f = fLocalForcedActions;
    2584 #if defined(VBOX_VMM_TARGET_ARMV8)
     2577#ifdef VBOX_VMM_TARGET_ARMV8
    25852578        PRINT_FLAG(VMCPU_FF_,INTERRUPT_IRQ);
    25862579        PRINT_FLAG(VMCPU_FF_,INTERRUPT_FIQ);
    2587 #else
     2580#elif defined(VBOX_VMM_TARGET_X86)
    25882581        PRINT_FLAG(VMCPU_FF_,INTERRUPT_APIC);
    25892582        PRINT_FLAG(VMCPU_FF_,INTERRUPT_PIC);
     2583#else
     2584# error "port me"
    25902585#endif
    25912586        PRINT_FLAG(VMCPU_FF_,TIMER);
  • trunk/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp

    r106061 r107227  
    374374        case VERR_VMM_LONG_JMP_ERROR:
    375375        {
    376 #if defined(VBOX_VMM_TARGET_ARMV8)
    377             AssertReleaseFailed();
    378 #else
    379376            /*
    380377             * Active trap? This is only of partial interest when in hardware
     
    390387            if (RT_SUCCESS(rc2))
    391388                pHlp->pfnPrintf(pHlp,
    392                                 "!! ACTIVE TRAP=%02x ERRCD=%RX32 CR2=%RGv PC=%RGr Type=%d cbInstr=%02x fIcebp=%RTbool (Guest!)\n",
    393                                 u8TrapNo, uErrorCode, uCR2, CPUMGetGuestRIP(pVCpu), enmType, cbInstr, fIcebp);
    394 
     389                                "!! ACTIVE TRAP=%02x ERRCD=%RX32 CR2=%RGv FlatPC=%RGr Type=%d cbInstr=%02x fIcebp=%RTbool (Guest!)\n",
     390                                u8TrapNo, uErrorCode, uCR2, CPUMGetGuestFlatPC(pVCpu), enmType, cbInstr, fIcebp);
     391
     392#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    395393            /*
    396394             * Dump the relevant hypervisor registers and stack.
     
    422420                PRTHCUINTPTR const pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.abAssertStack[  pVCpu->vmm.s.AssertJmpBuf.UnwindBp
    423421                                                                                   - pVCpu->vmm.s.AssertJmpBuf.UnwindSp];
    424 #if HC_ARCH_BITS == 32
     422# if HC_ARCH_BITS == 32
    425423                pHlp->pfnPrintf(pHlp,
    426424                                "eax=volatile ebx=%08x ecx=volatile edx=volatile esi=%08x edi=%08x\n"
     
    429427                                pBP[-3], pBP[-2], pBP[-1],
    430428                                pBP[1], pVCpu->vmm.s.AssertJmpBuf.SavedEbp - 8, pBP[0], pBP[-4]);
    431 #else
    432 # ifdef RT_OS_WINDOWS
     429# else
     430#  ifdef RT_OS_WINDOWS
    433431                pHlp->pfnPrintf(pHlp,
    434432                                "rax=volatile         rbx=%016RX64 rcx=volatile         rdx=volatile\n"
     
    443441                                pBP[-2], pBP[-1],
    444442                                pBP[1], pVCpu->vmm.s.AssertJmpBuf.UnwindRetSp, pBP[0], pBP[-8]);
    445 # else
     443#  else
    446444                pHlp->pfnPrintf(pHlp,
    447445                                "rax=volatile         rbx=%016RX64 rcx=volatile         rdx=volatile\n"
     
    455453                                pBP[-2], pBP[-1],
    456454                                pBP[1], pVCpu->vmm.s.AssertJmpBuf.UnwindRetSp, pBP[0], pBP[-6]);
     455#  endif
    457456# endif
    458 #endif
    459457
    460458                /* Callstack. */
     
    472470                                    "!! Call Stack:\n"
    473471                                    "!!\n");
    474 #if HC_ARCH_BITS == 32
     472# if HC_ARCH_BITS == 32
    475473                    pHlp->pfnPrintf(pHlp, "EBP      Ret EBP  Ret CS:EIP    Arg0     Arg1     Arg2     Arg3     CS:EIP        Symbol [line]\n");
    476 #else
     474# else
    477475                    pHlp->pfnPrintf(pHlp, "RBP              Ret RBP          Ret RIP          RIP              Symbol [line]\n");
    478 #endif
     476# endif
    479477                    for (PCDBGFSTACKFRAME pFrame = pFirstFrame;
    480478                         pFrame;
    481479                         pFrame = DBGFR3StackWalkNext(pFrame))
    482480                    {
    483 #if HC_ARCH_BITS == 32
     481# if HC_ARCH_BITS == 32
    484482                        pHlp->pfnPrintf(pHlp,
    485483                                        "%RHv %RHv %04RX32:%RHv %RHv %RHv %RHv %RHv",
     
    493491                                        pFrame->Args.au32[3]);
    494492                        pHlp->pfnPrintf(pHlp, " %RTsel:%08RHv", pFrame->AddrPC.Sel, pFrame->AddrPC.off);
    495 #else
     493# else
    496494                        pHlp->pfnPrintf(pHlp,
    497495                                        "%RHv %RHv %RHv %RHv",
     
    500498                                        (RTHCUINTPTR)pFrame->AddrReturnPC.off,
    501499                                        (RTHCUINTPTR)pFrame->AddrPC.off);
    502 #endif
     500# endif
    503501                        if (pFrame->pSymPC)
    504502                        {
     
    588586                                "!! Skipping ring-0 registers and stack, rcErr=%Rrc\n", rcErr);
    589587            }
    590 #endif /* !VBOX_VMM_TARGET_ARMV8 */
     588#endif /* RT_ARCH_AMD64 || RT_ARCH_X86 */
    591589            break;
    592590        }
  • trunk/src/VBox/VMM/dwarfdump-to-offsets.sed

    r104367 r107227  
    7575        x
    7676        H
    77         x
    78         s/\(_OFF_.*\)[\n]\(.*\)$/#define \2\1 \\/
    79         p
    8077    }
    8178    /DW_AT_data_member_location/ {
    82         s/^[[:space:]]*DW_AT_data_member_location[[:space:]]*/                /
    83         p
     79        s/^[[:space:]]*DW_AT_data_member_location[[:space:]]*//
     80        s/[[:space:]]//g
     81        x
     82        H
     83        x
     84        s/\([(]0x[0-9a-zA-F]*[)]\)[\n]\(_OFF_.*\)[\n]\(.*\)$/#define \3\2 \1/p
     85    }
     86    # cleanup hold space.
     87    /^[[:space:]]*$/ {
     88        x
     89        s/\([(]0x[0-9a-zA-F]*[)]\)[\n]\(_OFF_.*\)[\n]\(.*\)$/\3/
     90        s/\(_OFF_.*\)[\n]\(.*\)$/\2/
     91        x
     92        d
    8493    }
    8594}
  • trunk/src/VBox/VMM/include/EMHandleRCTmpl.h

    r106061 r107227  
    112112            break;
    113113
    114 #if !defined(VBOX_VMM_TARGET_ARMV8)
     114#ifdef VBOX_VMM_TARGET_X86
    115115        /*
    116116         * Execute pending I/O Port access.
     
    168168            break;
    169169
    170 #if !defined(VBOX_VMM_TARGET_ARMV8)
     170#ifdef VBOX_VMM_TARGET_X86
    171171        case VINF_EM_EMULATE_SPLIT_LOCK:
    172172            rc = VBOXSTRICTRC_TODO(emR3ExecuteSplitLockInstruction(pVM, pVCpu));
  • trunk/src/VBox/VMM/include/NEMInternal.h

    r106988 r107227  
    3939#include <VBox/vmm/vmapi.h>
    4040#ifdef RT_OS_WINDOWS
    41 #include <iprt/nt/hyperv.h>
    42 #include <iprt/critsect.h>
     41# include <iprt/nt/hyperv.h>
     42# include <iprt/critsect.h>
    4343#elif defined(RT_OS_DARWIN)
    44 # if defined(VBOX_VMM_TARGET_ARMV8)
     44# ifdef VBOX_VMM_TARGET_ARMV8
    4545#  include <Hypervisor/Hypervisor.h>
    4646# else
     
    112112
    113113#ifdef RT_OS_DARWIN
    114 # if !defined(VBOX_VMM_TARGET_ARMV8)
     114# ifndef VBOX_VMM_TARGET_ARMV8
    115115/** vCPU ID declaration to avoid dragging in HV headers here. */
    116116typedef unsigned hv_vcpuid_t;
     
    128128/** @} */
    129129
    130 # if defined(VBOX_VMM_TARGET_ARMV8)
    131130/** The CPUMCTX_EXTRN_XXX mask for IEM. */
    132 #  define NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM      (  IEM_CPUMCTX_EXTRN_MUST_MASK )
     131# ifdef VBOX_VMM_TARGET_ARMV8
     132#  define NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM     (  IEM_CPUMCTX_EXTRN_MUST_MASK )
    133133# else
    134 /** The CPUMCTX_EXTRN_XXX mask for IEM. */
    135 #  define NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM      (  IEM_CPUMCTX_EXTRN_MUST_MASK | CPUMCTX_EXTRN_INHIBIT_INT \
    136                                                       | CPUMCTX_EXTRN_INHIBIT_NMI )
    137 #endif
     134#  define NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM     (  IEM_CPUMCTX_EXTRN_MUST_MASK \
     135                                                     | CPUMCTX_EXTRN_INHIBIT_INT | CPUMCTX_EXTRN_INHIBIT_NMI )
     136# endif
    138137
    139138/** The CPUMCTX_EXTRN_XXX mask for IEM when raising exceptions. */
     
    141140
    142141
    143 # if defined(VBOX_VMM_TARGET_ARMV8)
     142# ifdef VBOX_VMM_TARGET_ARMV8
    144143/**
    145144 * MMIO2 tracking region.
     
    221220    bool                        fUseDebugLoop;
    222221
    223 #if defined(VBOX_VMM_TARGET_ARMV8)
     222#ifdef VBOX_VMM_TARGET_ARMV8
    224223    /** The PPI interrupt number of the vTimer. */
    225224    uint32_t                    u32GicPpiVTimer;
     
    252251    /** Set if we've created the EMTs. */
    253252    bool                        fCreatedEmts : 1;
    254 # if defined(VBOX_VMM_TARGET_ARMV8)
     253# ifdef VBOX_VMM_TARGET_ARMV8
    255254    bool                        fHypercallExit : 1;
    256255    bool                        fGpaAccessFaultExit : 1;
    257256    /** Cache line flush size as a power of two. */
    258257    uint8_t                     cPhysicalAddressWidth;
    259 # else
     258# elif defined(VBOX_VMM_TARGET_X86)
    260259    /** WHvRunVpExitReasonX64Cpuid is supported. */
    261260    bool                        fExtendedMsrExit : 1;
     
    316315    } R0Stats;
    317316
    318 # if defined(VBOX_VMM_TARGET_ARMV8)
     317# ifdef VBOX_VMM_TARGET_ARMV8
    319318    /** Re-distributor memory region for all vCPUs. */
    320319    RTGCPHYS                    GCPhysMmioBaseReDist;
     
    332331    /** Set if EL2 is enabled. */
    333332    bool                        fEl2Enabled  : 1;
    334 # if defined(VBOX_VMM_TARGET_ARMV8)
     333# ifdef VBOX_VMM_TARGET_ARMV8
    335334    /** @name vTimer related state.
    336335     * @{ */
     
    344343    hv_vcpu_config_t            hVCpuCfg;
    345344    /** @} */
    346 # else
     345# elif defined(VBOX_VMM_TARGET_X86)
    347346    /** Set if hv_vm_space_create() was called successfully. */
    348347    bool                        fCreatedAsid : 1;
     
    381380    /** The last valid host LBR info stack range. */
    382381    uint32_t                    idLbrInfoMsrLast;
    383 # endif
     382# endif /* VBOX_VMM_TARGET_X86 */
    384383
    385384    STAMCOUNTER                 StatMapPage;
     
    387386    STAMCOUNTER                 StatMapPageFailed;
    388387    STAMCOUNTER                 StatUnmapPageFailed;
    389 #endif /* RT_OS_WINDOWS */
     388#endif /* RT_OS_DARWIN */
    390389} NEM;
    391390/** Pointer to NEM VM instance data. */
     
    432431    /** Pointer to the KVM_RUN data exchange region. */
    433432    R3PTRTYPE(struct kvm_run *) pRun;
    434 # if defined(VBOX_VMM_TARGET_ARMV8)
     433# ifdef VBOX_VMM_TARGET_ARMV8
    435434    /** The IRQ device levels from device_irq_level. */
    436435    uint64_t                    fIrqDeviceLvls;
     
    439438    /** Status of the FIQ line when last seen. */
    440439    bool                        fFiqLastSeen;
    441 # else
     440# elif defined(VBOX_VMM_TARGET_X86)
    442441    /** The MSR_IA32_APICBASE value known to KVM. */
    443442    uint64_t                    uKvmApicBase;
    444 #endif
     443# endif
    445444
    446445    /** @name Statistics
     
    491490
    492491#elif defined(RT_OS_WINDOWS)
    493 # ifndef VBOX_VMM_TARGET_ARMV8
     492# ifdef VBOX_VMM_TARGET_X86
    494493    /** The current state of the interrupt windows (NEM_WIN_INTW_F_XXX). */
    495494    uint8_t                     fCurrentInterruptWindows;
     
    543542
    544543#elif defined(RT_OS_DARWIN)
    545 # if defined(VBOX_VMM_TARGET_ARMV8)
     544# ifdef VBOX_VMM_TARGET_ARMV8
    546545    /** The vCPU handle associated with the EMT executing this vCPU. */
    547546    hv_vcpu_t                   hVCpu;
     
    557556     * (for first guest exec call on the EMT after loading the saved state). */
    558557    bool                        fIdRegsSynced;
    559 # else
     558
     559# elif defined(VBOX_VMM_TARGET_X86)
    560560    /** The vCPU handle associated with the EMT executing this vCPU. */
    561561    hv_vcpuid_t                 hVCpuId;
     
    628628    /** Pointer to the VMX statistics. */
    629629    PVMXSTATISTICS              pVmxStats;
    630 # endif
     630# endif /* VBOX_VMM_TARGET_X86 */
    631631
    632632    /** @name Statistics
     
    641641    STAMCOUNTER                 StatImportOnReturnSkipped;
    642642    STAMCOUNTER                 StatQueryCpuTick;
    643 #ifdef VBOX_WITH_STATISTICS
     643# ifdef VBOX_WITH_STATISTICS
    644644    STAMPROFILEADV              StatProfGstStateImport;
    645645    STAMPROFILEADV              StatProfGstStateExport;
    646 #endif
     646# endif
    647647    /** @} */
    648648
  • trunk/src/VBox/VMM/testcase/Makefile.kmk

    r106945 r107227  
    156156ifdef VBOX_WITH_RAW_MODE
    157157 tstVMStructRC_TEMPLATE = VBoxRcExe
    158  tstVMStructRC_DEFS     = VBOX_IN_VMM IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE $(VMM_COMMON_DEFS)
     158 tstVMStructRC_DEFS     = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE $(VMM_COMMON_DEFS)
    159159 ifdef VBOX_WITH_R0_LOGGING
    160160  tstVMStructRC_DEFS   += VBOX_WITH_R0_LOGGING
     
    170170 tstVMStructSize_CXXFLAGS += $(VBOX_GCC_Wno-invalid-offsetof)
    171171endif
    172 tstVMStructSize_DEFS    = VBOX_IN_VMM IN_VMM_R3 IN_DIS $(VMM_COMMON_DEFS)
     172tstVMStructSize_DEFS    = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_R3 IN_DIS $(VMM_COMMON_DEFS)
    173173ifdef VBOX_WITH_RAW_MODE
    174174 tstVMStructSize_DEFS  += VBOX_WITH_RAW_MODE
     
    192192 tstAsmStructSize_CXXFLAGS += $(VBOX_GCC_Wno-invalid-offsetof)
    193193endif
    194 tstAsmStructs_DEFS      = VBOX_IN_VMM IN_VMM_R3 IN_DIS $(VMM_COMMON_DEFS)
     194tstAsmStructs_DEFS      = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_R3 IN_DIS $(VMM_COMMON_DEFS)
    195195ifdef VBOX_WITH_RAW_MODE
    196196 tstAsmStructs_DEFS    += VBOX_WITH_RAW_MODE
     
    207207ifdef VBOX_WITH_RAW_MODE
    208208 tstAsmStructsRC_TEMPLATE = VBoxRcExe
    209  tstAsmStructsRC_DEFS   = VBOX_IN_VMM IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE $(VMM_COMMON_DEFS)
     209 tstAsmStructsRC_DEFS   = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE $(VMM_COMMON_DEFS)
    210210 ifdef VBOX_WITH_R0_LOGGING
    211211  tstAsmStructsRC_DEFS += VBOX_WITH_R0_LOGGING
     
    655655
    656656tstIEMAImpl_TEMPLATE  = VBoxR3TstExe
    657 tstIEMAImpl_DEFS      = $(VMM_COMMON_DEFS) IEM_WITHOUT_ASSEMBLY IEM_WITHOUT_INSTRUCTION_STATS
     657tstIEMAImpl_DEFS      = VBOX_VMM_TARGET_X86 $(VMM_COMMON_DEFS) IEM_WITHOUT_ASSEMBLY IEM_WITHOUT_INSTRUCTION_STATS
    658658tstIEMAImpl_SDKS      = VBoxSoftFloatR3Shared
    659659tstIEMAImpl_INCS      = ../include .
     
    677677tstIEMAImplAsm_TEMPLATE      := VBoxR3TstExe
    678678tstIEMAImplAsm_SDKS          := VBoxSoftFloatR3Shared
    679 tstIEMAImplAsm_DEFS           = $(VMM_COMMON_DEFS) IEM_WITH_ASSEMBLY IEM_WITHOUT_INSTRUCTION_STATS TSTIEMAIMPL_WITH_GENERATOR
     679tstIEMAImplAsm_DEFS           = VBOX_VMM_TARGET_X86 $(VMM_COMMON_DEFS) IEM_WITH_ASSEMBLY IEM_WITHOUT_INSTRUCTION_STATS TSTIEMAIMPL_WITH_GENERATOR
    680680tstIEMAImplAsm_ASFLAGS.amd64 := -Werror
    681681tstIEMAImplAsm_ASFLAGS.x86   := -Werror
     
    701701tstIEMCheckMc_TEMPLATE  = VBoxR3TstExe
    702702tstIEMCheckMc_SOURCES   = tstIEMCheckMc.cpp
    703 tstIEMCheckMc_DEFS      = $(VMM_COMMON_DEFS) IEM_WITHOUT_INSTRUCTION_STATS
     703tstIEMCheckMc_DEFS      = VBOX_VMM_TARGET_X86 $(VMM_COMMON_DEFS) IEM_WITHOUT_INSTRUCTION_STATS
    704704tstIEMCheckMc_LIBS      = $(LIB_RUNTIME)
    705705ifeq ($(KBUILD_TARGET),win)
     
    713713#
    714714tstIEMN8veProfiling_TEMPLATE := VBoxR3Exe
    715 tstIEMN8veProfiling_DEFS      = $(VMM_COMMON_DEFS)
     715tstIEMN8veProfiling_DEFS      = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    716716tstIEMN8veProfiling_SOURCES  := tstIEMN8veProfiling.cpp
    717717tstIEMN8veProfiling_LIBS      = $(LIB_VMM) $(LIB_RUNTIME)
     
    722722tstSSM_TEMPLATE         = VBoxR3TstExe
    723723tstSSM_INCS             = $(VBOX_PATH_VMM_SRC)/include
    724 tstSSM_DEFS             = $(VMM_COMMON_DEFS)
     724tstSSM_DEFS             = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    725725tstSSM_SOURCES          = tstSSM.cpp
    726726tstSSM_LIBS             = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
     
    742742 tstCFGM_TEMPLATE        = VBoxR3SignedTstExe
    743743endif
    744 tstCFGM_DEFS             = $(VMM_COMMON_DEFS)
     744tstCFGM_DEFS             = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    745745tstCFGM_SOURCES          = tstCFGM.cpp
    746746tstCFGM_LIBS             = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
     
    781781 tstVMREQ_TEMPLATE        = VBoxR3SignedExe
    782782endif
    783 tstVMREQ_DEFS             = $(VMM_COMMON_DEFS)
     783tstVMREQ_DEFS             = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    784784tstVMREQ_SOURCES          = tstVMREQ.cpp
    785785tstVMREQ_LIBS             = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
     
    801801 tstAnimate_TEMPLATE        = VBoxR3SignedExe
    802802endif
    803 tstAnimate_DEFS             = $(VMM_COMMON_DEFS)
     803tstAnimate_DEFS             = VBOX_VMM_TARGET_X86 $(VMM_COMMON_DEFS)
    804804tstAnimate_SOURCES          = tstAnimate.cpp
    805805tstAnimate_LIBS             = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
     
    918918#
    919919tstPDMQueue_TEMPLATE := VBoxR3Exe
    920 tstPDMQueue_DEFS     = $(VMM_COMMON_DEFS)
     920tstPDMQueue_DEFS      = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    921921tstPDMQueue_SOURCES  := tstPDMQueue.cpp
    922922tstPDMQueue_LIBS     := $(LIB_VMM) $(LIB_RUNTIME)
     
    940940  tstPDMAsyncCompletion_TEMPLATE       = VBoxR3SignedExe
    941941 endif
    942  tstPDMAsyncCompletion_DEFS            = $(VMM_COMMON_DEFS)
     942 tstPDMAsyncCompletion_DEFS            = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    943943 tstPDMAsyncCompletion_INCS            = $(VBOX_PATH_VMM_SRC)/include
    944944 tstPDMAsyncCompletion_SOURCES         = tstPDMAsyncCompletion.cpp
     
    961961  tstPDMAsyncCompletionStress_TEMPLATE = VBoxR3SignedExe
    962962 endif
    963  tstPDMAsyncCompletionStress_DEFS      = $(VMM_COMMON_DEFS)
     963 tstPDMAsyncCompletionStress_DEFS      = VBOX_VMM_TARGET_AGNOSTIC $(VMM_COMMON_DEFS)
    964964 tstPDMAsyncCompletionStress_INCS      = $(VBOX_PATH_VMM_SRC)/include
    965965 tstPDMAsyncCompletionStress_SOURCES   = tstPDMAsyncCompletionStress.cpp
     
    970970 PROGRAMS += tstSSM-2
    971971 tstSSM-2_TEMPLATE      = VBoxR3TstExe
    972  tstSSM-2_DEFS          = IN_VMM_STATIC
     972 tstSSM-2_DEFS          = VBOX_VMM_TARGET_AGNOSTIC IN_VMM_STATIC
    973973 tstSSM-2_SOURCES       = tstSSM-2.cpp
    974974 tstSSM-2_LIBS          = $(PATH_STAGE_LIB)/SSMStandalone$(VBOX_SUFF_LIB)
     
    983983  || defined(VBOX_WITH_DTRACE_RC))
    984984 tstVMStructDTrace_TEMPLATE = VBoxR3AutoTest
    985  tstVMStructDTrace_DEFS    = VBOX_IN_VMM IN_VMM_R3 IN_DIS $(VMM_COMMON_DEFS) IEM_WITHOUT_INSTRUCTION_STATS
     985 tstVMStructDTrace_DEFS    = VBOX_VMM_TARGET_AGNOSTIC VBOX_IN_VMM IN_VMM_R3 IN_DIS $(VMM_COMMON_DEFS) IEM_WITHOUT_INSTRUCTION_STATS
    986986 ifdef VBOX_WITH_RAW_MODE
    987987  tstVMStructDTrace_DEFS  += VBOX_WITH_RAW_MODE
     
    10251025                $(DEFS.$(KBUILD_TARGET_ARCH)) \
    10261026                $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
    1027                 $(VMM_COMMON_DEFS) \
     1027                VBOX_VMM_TARGET_X86 $(VMM_COMMON_DEFS) \
    10281028                ) \
    10291029        -f $(if $(eq $(KBUILD_TARGET),darwin),macho,$(if $(eq $(KBUILD_TARGET),win),coff,elf)) \
  • trunk/src/VBox/VMM/tools/Makefile.kmk

    r106945 r107227  
    6767endif
    6868VBoxCpuReport_TEMPLATE := VBoxR3Static
    69 VBoxCpuReport_DEFS      = VBOX_IN_VMM IN_VMM_R3 IN_VBOX_CPU_REPORT $(VMM_COMMON_DEFS)
     69VBoxCpuReport_DEFS      = VBOX_VMM_TARGET_X86 VBOX_IN_VMM IN_VMM_R3 IN_VBOX_CPU_REPORT $(VMM_COMMON_DEFS)
    7070VBoxCpuReport_INCS      = ../include
    7171VBoxCpuReport_SOURCES   = \
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