VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/iprt.h@ 22052

最後變更 在這個檔案從22052是 22052,由 vboxsync 提交於 16 年 前

IPRT: RT_MORE_STRICT for r0rdv and r0drv/darwin.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.6 KB
 
1/* $Id: iprt.h 22052 2009-08-07 09:45:48Z vboxsync $ */
2/** @file
3 * IPRT - Internal header for miscellaneous global defs and types.
4 */
5
6/*
7 * Copyright (C) 2009 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___internal_iprt_h
32#define ___internal_iprt_h
33
34#include <iprt/cdefs.h>
35#include <iprt/types.h>
36
37/** @def RT_EXPORT_SYMBOL
38 * This define is really here just for the linux kernel.
39 * @param Name The symbol name.
40 */
41#if defined(RT_OS_LINUX) \
42 && defined(IN_RING0) \
43 && defined(MODULE) \
44 && !defined(RT_NO_EXPORT_SYMBOL)
45# define bool linux_bool /* see r0drv/linux/the-linux-kernel.h */
46# include <linux/autoconf.h>
47# include <linux/module.h>
48# undef bool
49# define RT_EXPORT_SYMBOL(Name) EXPORT_SYMBOL(Name)
50#else
51# define RT_EXPORT_SYMBOL(Name) extern int g_rtExportSymbolDummyVariable
52#endif
53
54
55/** @def RT_ASSERT_PREEMPT_CPUID_VAR
56 * Partner to RT_ASSERT_PREEMPT_CPUID_VAR. Declares and initializes a variable
57 * idAssertCpu to NIL_RTCPUID if preemption is enabled and to RTMpCpuId if
58 * disabled. When RT_MORE_STRICT isn't defined it declares an uninitialized
59 * dummy variable.
60 *
61 * Requires iprt/mp.h and iprt/asm.h.
62 */
63/** @def RT_ASSERT_PREEMPT_CPUID
64 * Asserts that we didn't change CPU since RT_ASSERT_PREEMPT_CPUID_VAR if
65 * preemption is disabled. Will also detect changes in preemption
66 * disable/enable status. This is a noop when RT_MORE_STRICT isn't defined. */
67#ifdef RT_MORE_STRICT
68# define RT_ASSERT_PREEMPT_CPUID_VAR() \
69 RTCPUID const idAssertCpu = RTThreadPreemptIsEnabled(NIL_RTTHREAD) ? NIL_RTCPUID : RTMpCpuId()
70# define RT_ASSERT_PREEMPT_CPUID() \
71 do \
72 { \
73 RTCPUID const idAssertCpuNow = RTThreadPreemptIsEnabled(NIL_RTTHREAD) ? NIL_RTCPUID : RTMpCpuId(); \
74 AssertMsg(idAssertCpu == idAssertCpuNow, ("%#x, %#x\n", idAssertCpu, idAssertCpuNow)); \
75 } while (0)
76
77#else
78# define RT_ASSERT_PREEMPT_CPUID_VAR() RTCPUID idAssertCpuDummy
79# define RT_ASSERT_PREEMPT_CPUID() NOREF(idAssertCpuDummy)
80#endif
81
82/** @def RT_ASSERT_INTS_ON
83 * Asserts that interrupts are disabled when RT_MORE_STRICT is defined. */
84#ifdef RT_MORE_STRICT
85# define RT_ASSERT_INTS_ON() Assert(ASMIntAreEnabled())
86#else
87# define RT_ASSERT_INTS_ON() do { } while (0)
88#endif
89
90/** @def RT_ASSERT_PREEMPTIBLE
91 * Asserts that preemption hasn't been disabled (using
92 * RTThreadPreemptDisable) when RT_MORE_STRICT is defined. */
93#ifdef RT_MORE_STRICT
94# define RT_ASSERT_PREEMPTIBLE() Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD))
95#else
96# define RT_ASSERT_PREEMPTIBLE() do { } while (0)
97#endif
98
99#endif
100
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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