Index: /trunk/include/VBox/vm.h
===================================================================
--- /trunk/include/VBox/vm.h	(revision 31325)
+++ /trunk/include/VBox/vm.h	(revision 31326)
@@ -705,4 +705,6 @@
     /** Number of virtual CPUs. */
     uint32_t                    cCpus;
+    /** CPU priority (1-100) */
+    uint32_t                    uCpuPriority;
 
     /** Size of the VM structure including the VMCPU array. */
@@ -713,5 +715,5 @@
 
     /** Reserved; alignment. */
-    uint32_t                    u32Reserved[6];
+    uint32_t                    u32Reserved[5];
 
     /** @name Public VMM Switcher APIs
Index: /trunk/include/VBox/vm.mac
===================================================================
--- /trunk/include/VBox/vm.mac	(revision 31325)
+++ /trunk/include/VBox/vm.mac	(revision 31326)
@@ -53,7 +53,8 @@
     .hSelf                  resd 1
     .cCpus                  resd 1
+    .uCpuPriority           resd 1
     .cbSelf                 resd 1
     .offVMCPU               resd 1
-    .u32Reserved            resd 6
+    .u32Reserved            resd 5
 
     .pfnVMMGCGuestToHostAsmGuestCtx RTRCPTR_RES 1
Index: /trunk/include/VBox/vmapi.h
===================================================================
--- /trunk/include/VBox/vmapi.h	(revision 31325)
+++ /trunk/include/VBox/vmapi.h	(revision 31326)
@@ -406,5 +406,5 @@
 VMMR3DECL(int)              VMR3HotUnplugCpu(PVM pVM, VMCPUID idCpu);
 VMMR3DECL(int)              VMR3HotPlugCpu(PVM pVM, VMCPUID idCpu);
-
+VMMR3DECL(int)              VMR3SetCpuPriority(PVM pVM, unsigned ulCpuPriority);
 /** @} */
 #endif /* IN_RING3 */
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 31325)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 31326)
@@ -534,4 +534,7 @@
     hrc = pMachine->COMGETTER(CPUCount)(&cCpus);                                        H();
 
+    ULONG ulCpuPriority = 100;
+    hrc = pMachine->COMGETTER(CPUPriority)(&ulCpuPriority);                             H();
+
     Bstr osTypeId;
     hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam());                         H();
@@ -567,4 +570,5 @@
         InsertConfigInteger(pRoot, "RamHoleSize",          cbRamHole);
         InsertConfigInteger(pRoot, "NumCPUs",              cCpus);
+        InsertConfigInteger(pRoot, "CpuPriority",          ulCpuPriority);
         InsertConfigInteger(pRoot, "TimerMillies",         10);
 #ifdef VBOX_WITH_RAW_MODE
Index: /trunk/src/VBox/VMM/VM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VM.cpp	(revision 31325)
+++ /trunk/src/VBox/VMM/VM.cpp	(revision 31326)
@@ -561,4 +561,5 @@
         AssertRelease(pVM->pSession == pUVM->vm.s.pSession);
         AssertRelease(pVM->cCpus == cCpus);
+        AssertRelease(pVM->uCpuPriority == 100);
         AssertRelease(pVM->offVMCPU == RT_UOFFSETOF(VM, aCpus));
 
@@ -589,5 +590,6 @@
         if (RT_SUCCESS(rc))
         {
-            rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "HwVirtExtForced", &pVM->fHwVirtExtForced, false);
+            PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
+            rc = CFGMR3QueryBoolDef(pRoot, "HwVirtExtForced", &pVM->fHwVirtExtForced, false);
             if (RT_SUCCESS(rc) && pVM->fHwVirtExtForced)
                 pVM->fHWACCMEnabled = true;
@@ -599,8 +601,8 @@
             if (psz && !strcmp(psz, "fake"))
             {
-                CFGMR3RemoveValue(CFGMR3GetRoot(pVM), "RawR3Enabled");
-                CFGMR3InsertInteger(CFGMR3GetRoot(pVM), "RawR3Enabled", 0);
-                CFGMR3RemoveValue(CFGMR3GetRoot(pVM), "RawR0Enabled");
-                CFGMR3InsertInteger(CFGMR3GetRoot(pVM), "RawR0Enabled", 0);
+                CFGMR3RemoveValue(pRoot, "RawR3Enabled");
+                CFGMR3InsertInteger(pRoot, "RawR3Enabled", 0);
+                CFGMR3RemoveValue(pRoot, "RawR0Enabled");
+                CFGMR3InsertInteger(pRoot, "RawR0Enabled", 0);
             }
 
@@ -611,5 +613,5 @@
             {
                 uint32_t cCPUsCfg;
-                rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "NumCPUs", &cCPUsCfg, 1);
+                rc = CFGMR3QueryU32Def(pRoot, "NumCPUs", &cCPUsCfg, 1);
                 AssertLogRelMsgRC(rc, ("Configuration error: Querying \"NumCPUs\" as integer failed, rc=%Rrc\n", rc));
                 if (RT_SUCCESS(rc) && cCPUsCfg != cCpus)
@@ -622,4 +624,7 @@
             if (RT_SUCCESS(rc))
             {
+                rc = CFGMR3QueryU32Def(pRoot, "CpuPriority", &pVM->uCpuPriority, 100);
+                AssertLogRelMsgRC(rc, ("Configuration error: Querying \"CpuPriority\" as integer failed, rc=%Rrc\n", rc));
+
                 /*
                  * Init the ring-3 components and ring-3 per cpu data, finishing it off
Index: /trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp	(revision 31325)
+++ /trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp	(revision 31326)
@@ -588,5 +588,5 @@
                         pGVM->hSelf     = iHandle;
                         pGVM->pVM       = NULL;
-                        pGVM->cCpus     = cCpus;
+                        pGVM->cCpus     = cCpus;                        
 
                         gvmmR0InitPerVMData(pGVM);
@@ -607,11 +607,12 @@
                             PVM pVM = (PVM)RTR0MemObjAddress(pGVM->gvmm.s.VMMemObj); AssertPtr(pVM);
                             memset(pVM, 0, cPages << PAGE_SHIFT);
-                            pVM->enmVMState = VMSTATE_CREATING;
-                            pVM->pVMR0      = pVM;
-                            pVM->pSession   = pSession;
-                            pVM->hSelf      = iHandle;
-                            pVM->cbSelf     = cbVM;
-                            pVM->cCpus      = cCpus;
-                            pVM->offVMCPU   = RT_UOFFSETOF(VM, aCpus);
+                            pVM->enmVMState     = VMSTATE_CREATING;
+                            pVM->pVMR0          = pVM;
+                            pVM->pSession       = pSession;
+                            pVM->hSelf          = iHandle;
+                            pVM->cbSelf         = cbVM;
+                            pVM->cCpus          = cCpus;
+                            pVM->uCpuPriority   = 100; /* default is maximum priority. */
+                            pVM->offVMCPU       = RT_UOFFSETOF(VM, aCpus);
 
                             rc = RTR0MemObjAllocPage(&pGVM->gvmm.s.VMPagesMemObj, cPages * sizeof(SUPPAGE), false /* fExecutable */);
