VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h@ 40972

Last change on this file since 40972 was 40972, checked in by vboxsync, 13 years ago

Runtime/r0drv/solaris: use page.h's PG_KFLT define.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
Line 
1/* $Id: the-solaris-kernel.h 40972 2012-04-18 13:30:14Z vboxsync $ */
2/** @file
3 * IPRT - Include all necessary headers for the Solaris kernel.
4 */
5
6/*
7 * Copyright (C) 2006-2007 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 ___the_solaris_kernel_h
28#define ___the_solaris_kernel_h
29
30#include <sys/kmem.h>
31#include <sys/types.h>
32#include <sys/mman.h>
33#include <sys/thread.h>
34#include <sys/mutex.h>
35#include <sys/condvar.h>
36#include <sys/sdt.h>
37#include <sys/schedctl.h>
38#include <sys/time.h>
39#include <sys/sysmacros.h>
40#include <sys/cmn_err.h>
41#include <sys/vmsystm.h>
42#include <sys/cyclic.h>
43#include <sys/class.h>
44#include <sys/cpuvar.h>
45#include <sys/archsystm.h>
46#include <sys/x_call.h> /* in platform dir */
47#include <sys/x86_archext.h>
48#include <vm/hat.h>
49#include <vm/seg_vn.h>
50#include <vm/seg_kmem.h>
51#include <vm/page.h>
52#include <sys/ddi.h>
53#include <sys/sunddi.h>
54#include <sys/spl.h>
55#include <sys/archsystm.h>
56#include <sys/callo.h>
57#include <sys/kobj.h>
58#include <sys/ctf_api.h>
59#include <sys/modctl.h>
60
61#undef u /* /usr/include/sys/user.h:249:1 is where this is defined to (curproc->p_user). very cool. */
62#ifndef PG_KFLT /* introduced in snv_153, previous builds don't define this. */
63# define PG_KFLT (0x0200)
64#endif
65
66#include <iprt/cdefs.h>
67#include <iprt/types.h>
68#include <iprt/dbg.h>
69
70RT_C_DECLS_BEGIN
71
72/* IPRT functions. */
73DECLHIDDEN(void *) rtR0SolMemAlloc(uint64_t cbPhysHi, uint64_t *puPhys, size_t cb, uint64_t cbAlign, bool fContig);
74DECLHIDDEN(void) rtR0SolMemFree(void *pv, size_t cb);
75
76
77/* Solaris functions. */
78typedef callout_id_t (*PFNSOL_timeout_generic)(int type, void (*func)(void *),
79 void *arg, hrtime_t expiration,
80 hrtime_t resultion, int flags);
81typedef hrtime_t (*PFNSOL_untimeout_generic)(callout_id_t id, int nowait);
82typedef int (*PFNSOL_cyclic_reprogram)(cyclic_id_t id, hrtime_t expiration);
83typedef void (*PFNSOL_contig_free)(void *addr, size_t size);
84
85/* IPRT globals. */
86extern bool g_frtSolSplSetsEIF;
87extern struct ddi_dma_attr g_SolarisX86PhysMemLimits;
88extern RTCPUSET g_rtMpSolCpuSet;
89extern PFNSOL_timeout_generic g_pfnrtR0Sol_timeout_generic;
90extern PFNSOL_untimeout_generic g_pfnrtR0Sol_untimeout_generic;
91extern PFNSOL_cyclic_reprogram g_pfnrtR0Sol_cyclic_reprogram;
92extern PFNSOL_contig_free g_pfnrtR0Sol_contig_free;
93extern bool g_frtSolUseKflt;
94extern size_t g_offrtSolThreadPreempt;
95extern size_t g_offrtSolCpuPreempt;
96extern size_t g_offrtSolCpuForceKernelPreempt;
97extern bool g_frtSolInitDone;
98extern RTDBGKRNLINFO g_hKrnlDbgInfo;
99
100/*
101 * Workarounds for running on old versions of solaris with different cross call
102 * interfaces. If we find xc_init_cpu() in the kernel, then just use the
103 * defined interfaces for xc_call() from the include file where the xc_call()
104 * interfaces just takes a pointer to a ulong_t array. The array must be long
105 * enough to hold "ncpus" bits at runtime.
106
107 * The reason for the hacks is that using the type "cpuset_t" is pretty much
108 * impossible from code built outside the Solaris source repository that wants
109 * to run on multiple releases of Solaris.
110 *
111 * For old style xc_call()s, 32 bit solaris and older 64 bit versions use
112 * "ulong_t" as cpuset_t.
113 *
114 * Later versions of 64 bit Solaris used: struct {ulong_t words[x];}
115 * where "x" depends on NCPU.
116 *
117 * We detect the difference in 64 bit support by checking the kernel value of
118 * max_cpuid, which always holds the compiled value of NCPU - 1.
119 *
120 * If Solaris increases NCPU to more than 256, VBox will continue to work on
121 * all versions of Solaris as long as the number of installed CPUs in the
122 * machine is <= IPRT_SOLARIS_NCPUS. If IPRT_SOLARIS_NCPUS is increased, this
123 * code has to be re-written some to provide compatibility with older Solaris
124 * which expects cpuset_t to be based on NCPU==256 -- or we discontinue
125 * support of old Nevada/S10.
126 */
127#define IPRT_SOL_NCPUS 256
128#define IPRT_SOL_SET_WORDS (IPRT_SOL_NCPUS / (sizeof(ulong_t) * 8))
129#define IPRT_SOL_X_CALL_HIPRI (2) /* for Old Solaris interface */
130typedef struct RTSOLCPUSET
131{
132 ulong_t auCpus[IPRT_SOL_SET_WORDS];
133} RTSOLCPUSET;
134typedef RTSOLCPUSET *PRTSOLCPUSET;
135
136/* Avoid warnings even if it means more typing... */
137typedef struct RTR0FNSOLXCCALL
138{
139 union
140 {
141 void *(*pfnSol_xc_call) (xc_arg_t, xc_arg_t, xc_arg_t, ulong_t *, xc_func_t);
142 void *(*pfnSol_xc_call_old) (xc_arg_t, xc_arg_t, xc_arg_t, int, RTSOLCPUSET, xc_func_t);
143 void *(*pfnSol_xc_call_old_ulong)(xc_arg_t, xc_arg_t, xc_arg_t, int, ulong_t, xc_func_t);
144 } u;
145} RTR0FNSOLXCCALL;
146typedef RTR0FNSOLXCCALL *PRTR0FNSOLXCCALL;
147
148extern RTR0FNSOLXCCALL g_rtSolXcCall;
149extern bool g_frtSolOldIPI;
150extern bool g_frtSolOldIPIUlong;
151
152
153/* Solaris globals. */
154extern uintptr_t kernelbase;
155
156/* Misc stuff from newer kernels. */
157#ifndef CALLOUT_FLAG_ABSOLUTE
158# define CALLOUT_FLAG_ABSOLUTE 2
159#endif
160
161RT_C_DECLS_END
162
163#endif /* ___the_solaris_kernel_h */
164
Note: See TracBrowser for help on using the repository browser.

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