VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/mp.h@ 86669

Last change on this file since 86669 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: mp.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * IPRT - Internal RTMp header
4 */
5
6/*
7 * Copyright (C) 2016-2020 Oracle Corporation
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#ifndef IPRT_INCLUDED_INTERNAL_mp_h
28#define IPRT_INCLUDED_INTERNAL_mp_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <iprt/assert.h>
34#include <iprt/mp.h>
35
36RT_C_DECLS_BEGIN
37
38
39#ifdef RT_OS_WINDOWS
40/** @todo Return the processor group + number instead.
41 * Unfortunately, DTrace and HM makes the impossible for the time being as it
42 * seems to be making the stupid assumption that idCpu == iCpuSet. */
43#if 0
44# define IPRT_WITH_RTCPUID_AS_GROUP_AND_NUMBER
45#endif
46
47# ifdef IPRT_WITH_RTCPUID_AS_GROUP_AND_NUMBER
48
49/** @def RTMPCPUID_FROM_GROUP_AND_NUMBER
50 * Creates the RTCPUID value.
51 *
52 * @remarks We Increment a_uGroup by 1 to make sure the ID is never the same as
53 * the CPU set index.
54 *
55 * @remarks We put the group in the top to make it easy to construct the MAX ID.
56 * For that reason we also just use 8 bits for the processor number, as
57 * it keeps the range small.
58 */
59# define RTMPCPUID_FROM_GROUP_AND_NUMBER(a_uGroup, a_uGroupMember) \
60 ( (uint8_t)(a_uGroupMember) | (((uint32_t)(a_uGroup) + 1) << 8) )
61
62/** Extracts the group number from a RTCPUID value. */
63DECLINLINE(uint16_t) rtMpCpuIdGetGroup(RTCPUID idCpu)
64{
65 Assert(idCpu != NIL_RTCPUID);
66 uint16_t idxGroup = idCpu >> 8;
67 Assert(idxGroup != 0);
68 return idxGroup - 1;
69}
70
71/** Extracts the group member number from a RTCPUID value. */
72DECLINLINE(uint8_t) rtMpCpuIdGetGroupMember(RTCPUID idCpu)
73{
74 Assert(idCpu != NIL_RTCPUID);
75 return (uint8_t)idCpu;
76}
77
78# endif /* IPRT_WITH_RTCPUID_AS_GROUP_AND_NUMBER */
79#endif /* RT_OS_WINDOWS */
80
81
82RT_C_DECLS_END
83
84#endif /* !IPRT_INCLUDED_INTERNAL_mp_h */
85
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