Index: trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c	(revision 7331)
+++ trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c	(revision 7331)
@@ -0,0 +1,244 @@
+/* $Id$ */
+/** @file
+ * innotek Portable Runtime - Multiprocessor, Ring-0 Driver, Solaris.
+ */
+
+/*
+ * Copyright (C) 2008 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "the-solaris-kernel.h"
+
+#include <iprt/mp.h>
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+#include <iprt/asm.h>
+#include "r0drv/mp-r0drv.h"
+
+
+RTDECL(RTCPUID) RTMpCpuId(void)
+{
+    return cpuid_get_chipid(CPU); /* is there a better way? */
+}
+
+
+RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
+{
+    cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL;
+    return pCpu
+        && cpu_is_online(pCpu);
+}
+
+
+RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
+{
+    cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL;
+    return pCpu != NULL;
+}
+
+
+RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
+{
+    return idCpu < NCPU ? idCpu : -1;
+}
+
+
+RTDECL(RTCPUID) RTMpCpuIdFromSetIndex(int iCpu)
+{
+    return (unsigned)iCpu < NCPU ? iCpu : NIL_RTCPUID;
+}
+
+
+RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet)
+{
+    RTCPUID idCpu;
+
+    RTCpuSetEmpty(pSet);
+    idCpu = RTMpGetMaxCpuId(); /* it's inclusive */
+    do
+    {
+        if (RTMpDoesCpuExist(idCpu))
+            RTCpuSetAdd(pSet, idCpu);
+    } while (idCpu-- > 0);
+
+    return pSet;
+}
+
+
+RTDECL(RTCPUID) RTMpGetCount(void)
+{
+    return ncpus;
+}
+
+
+RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
+{
+    RTCPUID idCpu;
+
+    RTCpuSetEmpty(pSet);
+    idCpu = RTMpGetMaxCpuId(); /* it's inclusive */
+    do
+    {
+        if (RTMpIsCpuOnline(idCpu))
+            RTCpuSetAdd(pSet, idCpu);
+    } while (idCpu-- > 0);
+
+    return pSet;
+}
+
+
+RTDECL(RTCPUID) RTMpGetOnlineCount(void)
+{
+    return ncpus_online;
+}
+
+
+
+/**
+ * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
+ * for the RTMpOnAll API.
+ *
+ * @param   uArgs       Pointer to the RTMPARGS package.
+ * @param   uIgnored1   Ignored.
+ * @param   uIgnored2   Ignored.
+ */
+static int rtmpOnAllSolarisWrapper(xc_arg_t uArg, xc_arg_t uIgnored1, xc_arg_t uIgnored2)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)(uArg);
+
+    pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
+
+    NOREF(uIgnored1);
+    NOREF(uIgnored2);
+    return 0;
+}
+
+
+RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    cpuset_t Set;
+    RTMPARGS Args;
+
+    Args.pfnWorker = pfnWorker;
+    Args.pvUser1 = pvUser1;
+    Args.pvUser2 = pvUser2;
+    Args.idCpu = NIL_RTCPUID;
+    Args.cHits = 0;
+
+    CPUSET_ALL(Set);
+    xc_call((uintptr_t)&Args, 0, 0, X_CALL_HIPRI, Set, rtmpOnAllSolarisWrapper);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
+ * for the RTMpOnOthers API.
+ *
+ * @param   uArgs       Pointer to the RTMPARGS package.
+ * @param   uIgnored1   Ignored.
+ * @param   uIgnored2   Ignored.
+ */
+static int rtmpOnOthersSolarisWrapper(xc_arg_t uArg, xc_arg_t uIgnored1, xc_arg_t uIgnored2)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)(uArg);
+    RTCPUID idCpu = RTMpCpuId();
+
+    Assert(idCpu != pArgs->idCpu);
+    pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+
+    NOREF(uIgnored1);
+    NOREF(uIgnored2);
+    return 0;
+}
+
+
+RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    int rc;
+    cpuset_t Set;
+    RTMPARGS Args;
+
+    Args.pfnWorker = pfnWorker;
+    Args.pvUser1 = pvUser1;
+    Args.pvUser2 = pvUser2;
+    Args.idCpu = RTMpCpuId();
+    Args.cHits = 0;
+
+    CPUSET_ALL_BUT(Set, Args.idCpu);
+    xc_call((uintptr_t)&Args, 0, 0, X_CALL_HIPRI, Set, rtmpOnOthersSolarisWrapper);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
+ * for the RTMpOnSpecific API.
+ *
+ *
+ * @param   uArgs       Pointer to the RTMPARGS package.
+ * @param   uIgnored1   Ignored.
+ * @param   uIgnored2   Ignored.
+ */
+static int rtmpOnSpecificSolarisWrapper(xc_arg_t uArg, xc_arg_t uIgnored1, xc_arg_t uIgnored2)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)(uArg);
+    RTCPUID idCpu = RTMpCpuId();
+
+    Assert(idCpu != pArgs->idCpu);
+    pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+    ASMAtomicIncU32(&pArgs->cHits);
+
+    NOREF(uIgnored1);
+    NOREF(uIgnored2);
+    return 0;
+}
+
+
+RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    int rc;
+    cpuset_t Set;
+    RTMPARGS Args;
+
+    Args.pfnWorker = pfnWorker;
+    Args.pvUser1 = pvUser1;
+    Args.pvUser2 = pvUser2;
+    Args.idCpu = idCpu;
+    Args.cHits = 0;
+
+    CPUSET_ZERO(Set);
+    AssertReturn(idCpu < NCPU, VERR_INVALID_PARAMETER);
+    CPUSET_ADD(Set, idCpu);
+
+    xc_call((uintptr_t)&Args, 0, 0, X_CALL_HIPRI, Set, rtmpOnSpecificSolarisWrapper);
+    Assert(ASMAtomicUoReadU32(&Args.cHits) <= 1);
+
+    return ASMAtomicUoReadU32(&Args.cHits) == 1
+         ? VINF_SUCCESS
+         : VERR_CPU_NOT_FOUND;
+}
+
Index: trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.cpp
===================================================================
--- trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.cpp	(revision 7254)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/* $Id$ */
-/** @file
- * innotek Portable Runtime - Multiprocessor, Ring-0 Driver, Solaris.
- */
-
-/*
- * Copyright (C) 2008 innotek GmbH
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include "the-solaris-kernel.h"
-
-#include <iprt/mp.h>
-#include <iprt/err.h>
-#include <iprt/asm.h>
-#include "r0drv/mp-r0drv.h"
-
-
-RTDECL(RTCPUID) RTMpCpuId(void)
-{
-    return ???;
-}
-
-
-/** 
- * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 
- * for the RTMpOnAll API.
- * 
- * @param   u64         Pointer to the RTMPARGS package.
- * @param   u64Ignored  Ignored.
- */
-static void rtmpOnAllSolarisWrapper(uint64_t u64, uint64_t u64Ignored)
-{
-    PRTMPARGS pArgs = (PRTMPARGS)(uintptr_t)u64;
-    pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
-    NOREF(u64Ignored);
-}
-
-
-RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
-{
-    RTMPARGS Args;
-    Args.pfnWorker = pfnWorker;
-    Args.pvUser1 = pvUser1;
-    Args.pvUser2 = pvUser2;
-    Args.idCpu = NIL_RTCPUID;
-    Args.cHits = 0;
-    xt_all(rtmpOnAllSolarisWrapper, (uintptr_t)&Args, 0);
-    return VINF_SUCCESS;
-}
-
-
-/** 
- * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 
- * for the RTMpOnOthers API.
- * 
- * @param   u64         Pointer to the RTMPARGS package.
- * @param   u64Ignored  Ignored.
- */
-static void rtmpOnOthersSolarisWrapper(uint64_t u64, uint64_t u64Ignored)
-{
-    PRTMPARGS pArgs = (PRTMPARGS)(uintptr_t)u64;
-    RTCPUID idCpu = RTMpCpuId();
-    if (idCpu != pArgs->idCpu)
-        pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
-    NOREF(u64Ignored);
-}
-
-
-RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
-{
-    int rc;
-    RTMPARGS Args;
-    Args.pfnWorker = pfnWorker;
-    Args.pvUser1 = pvUser1;
-    Args.pvUser2 = pvUser2;
-    Args.idCpu = NIL_RTCPUID;
-    Args.cHits = 0;
-    xt_all(rtmpOnOthersSolarisWrapper, (uintptr_t)&Args, 0);
-    return VINF_SUCCESS;
-}
-
-
-/** 
- * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 
- * for the RTMpOnSpecific API.
- * 
- * @param   pvArg   Pointer to the RTMPARGS package.
- */
-static void rtmpOnSpecificSolarisWrapper(void *pvArg)
-{
-    PRTMPARGS pArgs = (PRTMPARGS)pvArg;
-    Assert(pArgs->idCpu == RTMpCpuId());
-    pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
-    ASMAtomicIncU32(&pArgs->cHits);
-}
-
-
-RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
-{
-    int rc;
-    RTMPARGS Args;
-    Args.pfnWorker = pfnWorker;
-    Args.pvUser1 = pvUser1;
-    Args.pvUser2 = pvUser2;
-    Args.idCpu = idCpu;
-    Args.cHits = 0;
-    xt_one(idCpu, rtmpOnSpecificSolarisWrapper, (uintptr_t)&Args, 0);
-    return Args.cHits == 1 
-         ? VINF_SUCCESS 
-         : VERR_CPU_NOT_FOUND;
-}
-
Index: trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
===================================================================
--- trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h	(revision 7254)
+++ trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h	(revision 7331)
@@ -28,4 +28,6 @@
 #define ___the_solaris_kernel_h
 
+#define _MACHDEP /* needed for cpuset_t and sys/x_call.h */
+
 #include <sys/kmem.h>
 #include <sys/types.h>
@@ -42,4 +44,7 @@
 #include <sys/cyclic.h>
 #include <sys/class.h>
+#include <sys/cpuvar.h>
+#include <sys/x_call.h> /* in platform dir */
+#include <sys/x86_archext.h>
 #include <vm/hat.h>
 #include <vm/seg_vn.h>
