VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h@ 4612

Last change on this file since 4612 was 4071, checked in by vboxsync, 18 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1/* $Id: the-darwin-kernel.h 4071 2007-08-07 17:07:59Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime - Include all necessary headers for the Darwing kernel.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___the_darwin_kernel_h
19#define ___the_darwin_kernel_h
20
21/* Problematic header(s) containing conflicts with IPRT first. */
22#define __STDC_CONSTANT_MACROS
23#define __STDC_LIMIT_MACROS
24#include <sys/param.h>
25#include <mach/vm_param.h>
26#undef ALIGN
27#undef MIN
28#undef MAX
29#undef PAGE_SIZE
30#undef PAGE_SHIFT
31
32/* Include the IPRT definitions of the conflicting #defines & typedefs. */
33#include <iprt/cdefs.h>
34#include <iprt/types.h>
35#include <iprt/param.h>
36
37
38/* After including cdefs, we can check that this really is Darwin. */
39#ifndef RT_OS_DARWIN
40# error "RT_OS_DARWIN must be defined!"
41#endif
42
43/* now we're ready for including the rest of the Darwin headers. */
44#include <kern/thread.h>
45#include <kern/clock.h>
46#include <kern/sched_prim.h>
47#include <kern/locks.h>
48#include <libkern/libkern.h>
49#include <mach/thread_act.h>
50#include <mach/vm_map.h>
51#include <pexpert/pexpert.h>
52#include <sys/conf.h>
53#include <sys/errno.h>
54#include <sys/ioccom.h>
55#include <sys/malloc.h>
56#include <sys/proc.h>
57#include <IOKit/IOTypes.h>
58#include <IOKit/IOLib.h>
59#include <IOKit/IOMemoryDescriptor.h>
60#include <IOKit/IOMapper.h>
61
62
63__BEGIN_DECLS
64/* mach/vm_types.h */
65typedef struct pmap *pmap_t;
66
67/* vm/vm_kern.h */
68extern vm_map_t kernel_map;
69
70/* vm/pmap.h */
71extern pmap_t kernel_pmap;
72
73/* kern/task.h */
74extern vm_map_t get_task_map(task_t);
75
76/* osfmk/i386/pmap.h */
77extern ppnum_t pmap_find_phys(pmap_t, addr64_t);
78
79/* vm/vm_map.h */
80extern kern_return_t vm_map_wire(vm_map_t, vm_map_offset_t, vm_map_offset_t, vm_prot_t, boolean_t);
81extern kern_return_t vm_map_unwire(vm_map_t, vm_map_offset_t, vm_map_offset_t, boolean_t);
82
83/* mach/i386/thread_act.h */
84extern kern_return_t thread_terminate(thread_t);
85__END_DECLS
86
87
88/*
89 * Internals of the Darwin Ring-0 IPRT.
90 */
91
92__BEGIN_DECLS
93extern lck_grp_t *g_pDarwinLockGroup;
94__END_DECLS
95
96
97/**
98 * Converts from nanoseconds to Darwin absolute time units.
99 * @returns Darwin absolute time.
100 * @param u64Nano Time interval in nanoseconds
101 */
102DECLINLINE(uint64_t) rtDarwinAbsTimeFromNano(const uint64_t u64Nano)
103{
104 uint64_t u64AbsTime;
105 nanoseconds_to_absolutetime(u64Nano, &u64AbsTime);
106 return u64AbsTime;
107}
108
109
110#include <iprt/err.h>
111
112/**
113 * Convert from mach kernel return code to IPRT status code.
114 * @todo put this where it belongs! (i.e. in a separate file and prototype in iprt/err.h)
115 */
116DECLINLINE(int) RTErrConvertFromMachKernReturn(kern_return_t rc)
117{
118 switch (rc)
119 {
120 case KERN_SUCCESS: return VINF_SUCCESS;
121 default: return VERR_GENERAL_FAILURE;
122 }
123}
124
125#endif
126
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