the-darwin-kernel.h revision 1ba8a0ccd2665ea7cdb82f6b0f65c5145265c786
/* $Id$ */
/** @file
* IPRT - Include all necessary headers for the Darwing kernel.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___the_darwin_kernel_h
#define ___the_darwin_kernel_h
/* Problematic header(s) containing conflicts with IPRT first. */
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
#include <mach/vm_param.h>
/* Include the IPRT definitions of the conflicting #defines & typedefs. */
/* After including cdefs, we can check that this really is Darwin. */
#ifndef RT_OS_DARWIN
# error "RT_OS_DARWIN must be defined!"
#endif
/* now we're ready for including the rest of the Darwin headers. */
#include <kern/sched_prim.h>
#include <i386/mp_events.h>
#include <mach/thread_act.h>
#include <IOKit/IOMemoryDescriptor.h>
#include <IOKit/IOMapper.h>
/* mach/vm_types.h */
extern vm_map_t kernel_map;
extern pmap_t kernel_pmap;
/* mach/i386/thread_act.h */
extern void mp_rendezvous(void (*)(void *), void (*)(void *), void (*)(void *), void *);
extern void mp_rendezvous_no_intrs(void (*)(void *), void *);
/* osfmk/i386/cpu_number.h */
extern int cpu_number(void);
/* i386/machine_routines.h */
extern int ml_get_max_cpus(void);
/*
* Internals of the Darwin Ring-0 IPRT.
*/
extern lck_grp_t *g_pDarwinLockGroup;
/**
* Converts from nanoseconds to Darwin absolute time units.
* @returns Darwin absolute time.
* @param u64Nano Time interval in nanoseconds
*/
{
return u64AbsTime;
}
/**
* Convert from mach kernel return code to IPRT status code.
*/
{
switch (rc)
{
case KERN_SUCCESS: return VINF_SUCCESS;
default: return VERR_GENERAL_FAILURE;
}
}
#endif