VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.cpp@ 7254

Last change on this file since 7254 was 7254, checked in by vboxsync, 17 years ago

Sketched out RTMp*. (All the platform specific code is disabled.)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: mp-r0drv-solaris.cpp 7254 2008-03-04 00:52:03Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime - Multiprocessor, Ring-0 Driver, Solaris.
4 */
5
6/*
7 * Copyright (C) 2008 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include "the-solaris-kernel.h"
32
33#include <iprt/mp.h>
34#include <iprt/err.h>
35#include <iprt/asm.h>
36#include "r0drv/mp-r0drv.h"
37
38
39RTDECL(RTCPUID) RTMpCpuId(void)
40{
41 return ???;
42}
43
44
45/**
46 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
47 * for the RTMpOnAll API.
48 *
49 * @param u64 Pointer to the RTMPARGS package.
50 * @param u64Ignored Ignored.
51 */
52static void rtmpOnAllSolarisWrapper(uint64_t u64, uint64_t u64Ignored)
53{
54 PRTMPARGS pArgs = (PRTMPARGS)(uintptr_t)u64;
55 pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
56 NOREF(u64Ignored);
57}
58
59
60RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
61{
62 RTMPARGS Args;
63 Args.pfnWorker = pfnWorker;
64 Args.pvUser1 = pvUser1;
65 Args.pvUser2 = pvUser2;
66 Args.idCpu = NIL_RTCPUID;
67 Args.cHits = 0;
68 xt_all(rtmpOnAllSolarisWrapper, (uintptr_t)&Args, 0);
69 return VINF_SUCCESS;
70}
71
72
73/**
74 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
75 * for the RTMpOnOthers API.
76 *
77 * @param u64 Pointer to the RTMPARGS package.
78 * @param u64Ignored Ignored.
79 */
80static void rtmpOnOthersSolarisWrapper(uint64_t u64, uint64_t u64Ignored)
81{
82 PRTMPARGS pArgs = (PRTMPARGS)(uintptr_t)u64;
83 RTCPUID idCpu = RTMpCpuId();
84 if (idCpu != pArgs->idCpu)
85 pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
86 NOREF(u64Ignored);
87}
88
89
90RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
91{
92 int rc;
93 RTMPARGS Args;
94 Args.pfnWorker = pfnWorker;
95 Args.pvUser1 = pvUser1;
96 Args.pvUser2 = pvUser2;
97 Args.idCpu = NIL_RTCPUID;
98 Args.cHits = 0;
99 xt_all(rtmpOnOthersSolarisWrapper, (uintptr_t)&Args, 0);
100 return VINF_SUCCESS;
101}
102
103
104/**
105 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
106 * for the RTMpOnSpecific API.
107 *
108 * @param pvArg Pointer to the RTMPARGS package.
109 */
110static void rtmpOnSpecificSolarisWrapper(void *pvArg)
111{
112 PRTMPARGS pArgs = (PRTMPARGS)pvArg;
113 Assert(pArgs->idCpu == RTMpCpuId());
114 pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
115 ASMAtomicIncU32(&pArgs->cHits);
116}
117
118
119RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
120{
121 int rc;
122 RTMPARGS Args;
123 Args.pfnWorker = pfnWorker;
124 Args.pvUser1 = pvUser1;
125 Args.pvUser2 = pvUser2;
126 Args.idCpu = idCpu;
127 Args.cHits = 0;
128 xt_one(idCpu, rtmpOnSpecificSolarisWrapper, (uintptr_t)&Args, 0);
129 return Args.cHits == 1
130 ? VINF_SUCCESS
131 : VERR_CPU_NOT_FOUND;
132}
133
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette