1 | /* $Id: initterm-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Initialization & Termination, R0 Driver, Solaris.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 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 |
|
---|
28 | /*******************************************************************************
|
---|
29 | * Header Files *
|
---|
30 | *******************************************************************************/
|
---|
31 | #include "the-solaris-kernel.h"
|
---|
32 | #include "internal/iprt.h"
|
---|
33 |
|
---|
34 | #include <iprt/err.h>
|
---|
35 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
36 | # include <iprt/asm-amd64-x86.h>
|
---|
37 | #endif
|
---|
38 | #include "internal/initterm.h"
|
---|
39 |
|
---|
40 |
|
---|
41 | /*******************************************************************************
|
---|
42 | * Global Variables *
|
---|
43 | *******************************************************************************/
|
---|
44 | /** Indicates that the spl routines (and therefore a bunch of other ones too)
|
---|
45 | * will set EFLAGS::IF and break code that disables interrupts. */
|
---|
46 | bool g_frtSolarisSplSetsEIF = false;
|
---|
47 |
|
---|
48 | /** timeout_generic address. */
|
---|
49 | PFNSOL_timeout_generic g_pfnrtR0Sol_timeout_generic = NULL;
|
---|
50 | /** untimeout_generic address. */
|
---|
51 | PFNSOL_untimeout_generic g_pfnrtR0Sol_untimeout_generic = NULL;
|
---|
52 | /** cyclic_reprogram address. */
|
---|
53 | PFNSOL_cyclic_reprogram g_pfnrtR0Sol_cyclic_reprogram = NULL;
|
---|
54 |
|
---|
55 |
|
---|
56 | DECLHIDDEN(int) rtR0InitNative(void)
|
---|
57 | {
|
---|
58 | /*
|
---|
59 | * Initialize vbi (keeping it separate for now)
|
---|
60 | */
|
---|
61 | int rc = vbi_init();
|
---|
62 | if (!rc)
|
---|
63 | {
|
---|
64 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
65 | /*
|
---|
66 | * Detect whether spl*() is preserving the interrupt flag or not.
|
---|
67 | * This is a problem on S10.
|
---|
68 | */
|
---|
69 | RTCCUINTREG uOldFlags = ASMIntDisableFlags();
|
---|
70 | int iOld = splr(DISP_LEVEL);
|
---|
71 | if (ASMIntAreEnabled())
|
---|
72 | g_frtSolarisSplSetsEIF = true;
|
---|
73 | splx(iOld);
|
---|
74 | if (ASMIntAreEnabled())
|
---|
75 | g_frtSolarisSplSetsEIF = true;
|
---|
76 | ASMSetFlags(uOldFlags);
|
---|
77 | #else
|
---|
78 | /* PORTME: See if the amd64/x86 problem applies to this architecture. */
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | /*
|
---|
82 | * Dynamically resolve new symbols we want to use.
|
---|
83 | */
|
---|
84 | g_pfnrtR0Sol_timeout_generic = (PFNSOL_timeout_generic )kobj_getsymvalue("timeout_generic", 1);
|
---|
85 | g_pfnrtR0Sol_untimeout_generic = (PFNSOL_untimeout_generic)kobj_getsymvalue("untimeout_generic", 1);
|
---|
86 | if ((g_pfnrtR0Sol_timeout_generic == NULL) != (g_pfnrtR0Sol_untimeout_generic == NULL))
|
---|
87 | {
|
---|
88 | static const char *s_apszFn[2] = { "timeout_generic", "untimeout_generic" };
|
---|
89 | bool iMissingFn = g_pfnrtR0Sol_timeout_generic == NULL;
|
---|
90 | cmn_err(CE_NOTE, "rtR0InitNative: Weird! Found %s but not %s!\n", s_apszFn[!iMissingFn], s_apszFn[iMissingFn]);
|
---|
91 | g_pfnrtR0Sol_timeout_generic = NULL;
|
---|
92 | g_pfnrtR0Sol_untimeout_generic = NULL;
|
---|
93 | }
|
---|
94 |
|
---|
95 | g_pfnrtR0Sol_cyclic_reprogram = (PFNSOL_cyclic_reprogram )kobj_getsymvalue("cyclic_reprogram", 1);
|
---|
96 |
|
---|
97 |
|
---|
98 | return VINF_SUCCESS;
|
---|
99 | }
|
---|
100 | cmn_err(CE_NOTE, "vbi_init failed. rc=%d\n", rc);
|
---|
101 | return VERR_GENERAL_FAILURE;
|
---|
102 | }
|
---|
103 |
|
---|
104 |
|
---|
105 | DECLHIDDEN(void) rtR0TermNative(void)
|
---|
106 | {
|
---|
107 | }
|
---|
108 |
|
---|