VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h@ 78398

Last change on this file since 78398 was 77131, checked in by vboxsync, 6 years ago

the-freebsd-kernel.h,memobj-r0drv-freebsd.cpp: Build fix for newer FreeBSD versions

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 5.4 KB
Line 
1/* $Id: the-freebsd-kernel.h 77131 2019-02-01 17:29:01Z vboxsync $ */
2/** @file
3 * IPRT - Ring-0 Driver, The FreeBSD Kernel Headers.
4 */
5
6/*
7 * Contributed by knut st. osmundsen.
8 *
9 * Copyright (C) 2007-2019 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * The contents of this file may alternatively be used under the terms
20 * of the Common Development and Distribution License Version 1.0
21 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
22 * VirtualBox OSE distribution, in which case the provisions of the
23 * CDDL are applicable instead of those of the GPL.
24 *
25 * You may elect to license modified versions of this file under the
26 * terms and conditions of either the GPL or the CDDL or both.
27 *
28 * --------------------------------------------------------------------
29 *
30 * This code is based on:
31 *
32 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
33 *
34 * Permission is hereby granted, free of charge, to any person
35 * obtaining a copy of this software and associated documentation
36 * files (the "Software"), to deal in the Software without
37 * restriction, including without limitation the rights to use,
38 * copy, modify, merge, publish, distribute, sublicense, and/or sell
39 * copies of the Software, and to permit persons to whom the
40 * Software is furnished to do so, subject to the following
41 * conditions:
42 *
43 * The above copyright notice and this permission notice shall be
44 * included in all copies or substantial portions of the Software.
45 *
46 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
47 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
48 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
49 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
50 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
51 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
52 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
53 * OTHER DEALINGS IN THE SOFTWARE.
54 */
55
56#ifndef IPRT_INCLUDED_SRC_r0drv_freebsd_the_freebsd_kernel_h
57#define IPRT_INCLUDED_SRC_r0drv_freebsd_the_freebsd_kernel_h
58#ifndef RT_WITHOUT_PRAGMA_ONCE
59# pragma once
60#endif
61
62#include <iprt/types.h>
63
64/* Deal with conflicts first. */
65#include <sys/param.h>
66#undef PVM
67#include <sys/bus.h>
68#include <sys/types.h>
69#include <sys/errno.h>
70#include <sys/kernel.h>
71#include <sys/uio.h>
72#include <sys/libkern.h>
73#include <sys/systm.h>
74#include <sys/malloc.h>
75#include <sys/pcpu.h>
76#include <sys/proc.h>
77#include <sys/limits.h>
78#include <sys/unistd.h>
79#include <sys/kthread.h>
80#include <sys/lock.h>
81#if __FreeBSD_version >= 1000030
82#include <sys/rwlock.h>
83#endif
84#include <sys/mutex.h>
85#include <sys/sched.h>
86#include <sys/callout.h>
87#include <sys/cpu.h>
88#include <sys/smp.h>
89#include <sys/sleepqueue.h>
90#include <sys/sx.h>
91#include <vm/vm.h>
92#include <vm/pmap.h> /* for vtophys */
93#include <vm/vm_map.h>
94#include <vm/vm_object.h>
95#include <vm/vm_kern.h>
96#include <vm/vm_param.h> /* KERN_SUCCESS ++ */
97#include <vm/vm_page.h>
98#include <vm/vm_phys.h> /* vm_phys_alloc_* */
99#include <vm/vm_extern.h> /* kmem_alloc_attr */
100#include <vm/vm_pageout.h> /* vm_contig_grow_cache */
101#include <sys/vmmeter.h> /* cnt */
102#include <sys/resourcevar.h>
103#include <machine/cpu.h>
104
105/**
106 * Wrappers around the sleepq_ KPI.
107 */
108#if __FreeBSD_version >= 800026
109# define SLEEPQ_TIMEDWAIT(EventInt) sleepq_timedwait(EventInt, 0)
110# define SLEEPQ_TIMEDWAIT_SIG(EventInt) sleepq_timedwait_sig(EventInt, 0)
111# define SLEEPQ_WAIT(EventInt) sleepq_wait(EventInt, 0)
112# define SLEEPQ_WAIT_SIG(EventInt) sleepq_wait_sig(EventInt, 0)
113#else
114# define SLEEPQ_TIMEDWAIT(EventInt) sleepq_timedwait(EventInt)
115# define SLEEPQ_TIMEDWAIT_SIG(EventInt) sleepq_timedwait_sig(EventInt)
116# define SLEEPQ_WAIT(EventInt) sleepq_wait(EventInt)
117# define SLEEPQ_WAIT_SIG(EventInt) sleepq_wait_sig(EventInt)
118#endif
119
120/**
121 * Our pmap_enter version
122 */
123#if __FreeBSD_version >= 701105
124# define MY_PMAP_ENTER(pPhysMap, AddrR3, pPage, fProt, fWired) \
125 pmap_enter(pPhysMap, AddrR3, VM_PROT_NONE, pPage, fProt, fWired)
126#else
127# define MY_PMAP_ENTER(pPhysMap, AddrR3, pPage, fProt, fWired) \
128 pmap_enter(pPhysMap, AddrR3, pPage, fProt, fWired)
129#endif
130
131/**
132 * The VM object lock/unlock wrappers for older kernels.
133 */
134#if __FreeBSD_version < 1000030
135# define VM_OBJECT_WLOCK(a_pObject) VM_OBJECT_LOCK((a_pObject))
136# define VM_OBJECT_WUNLOCK(a_pObject) VM_OBJECT_UNLOCK((a_pObject))
137#endif
138
139#if __FreeBSD_version >= 1100077
140# define MY_LIM_MAX_PROC(a_pProc, a_Limit) lim_max_proc((a_pProc), (a_Limit))
141#else
142# define MY_LIM_MAX_PROC(a_pProc, a_Limit) lim_max((a_pProc), (a_Limit))
143#endif
144
145/**
146 * Check whether we can use kmem_alloc_attr for low allocs.
147 */
148#if (__FreeBSD_version >= 900011) \
149 || (__FreeBSD_version < 900000 && __FreeBSD_version >= 800505) \
150 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 703101)
151# define USE_KMEM_ALLOC_ATTR
152#endif
153
154/**
155 * Check whether we can use kmem_alloc_prot.
156 */
157#if 0 /** @todo Not available yet. */
158# define USE_KMEM_ALLOC_PROT
159#endif
160
161#endif /* !IPRT_INCLUDED_SRC_r0drv_freebsd_the_freebsd_kernel_h */
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