the-linux-kernel.h revision 2b80aa00cbee106b9ec709660eadb6f59f4ca121
/* $Id$ */
/** @file
* InnoTek Portable Runtime - Include all necessary headers for the Linux kernel.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#ifndef __the_linux_kernel_h__
#define __the_linux_kernel_h__
/*
* Then use the linux bool type for all the stuff include here.
*/
#define bool linux_bool
#include <linux/autoconf.h>
/* We only support 2.4 and 2.6 series kernels */
#endif
#endif
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
# define MODVERSIONS
# include <linux/modversions.h>
# endif
#endif
#ifndef KBUILD_STR
# define KBUILD_STR(s) s
# else
# define KBUILD_STR(s) #s
# endif
#endif
#include <linux/spinlock.h>
#include <asm/semaphore.h>
#endif
/* For the basic additions module */
#include <linux/interrupt.h>
#include <linux/completion.h>
/* For the shared folders module */
#define wchar_t linux_wchar_t
# ifndef page_to_pfn
# endif
#endif
#ifndef DEFINE_WAIT
#endif
/*
* 2.4 compatibility wrappers
*/
# ifndef MAX_JIFFY_OFFSET
# endif
{
# else
return (j * 1000) / HZ;
# endif
}
{
# if HZ > 1000
return MAX_JIFFY_OFFSET;
# endif
# else
# endif
}
# endif /* < 2.4.29 || >= 2.6.0 */
do { \
add_wait_queue(q, wait); \
} while (0)
# define finish_wait(q, wait) \
do { \
remove_wait_queue(q, wait); \
} while (0)
#endif /* < 2.6.7 */
/*
* This sucks soooo badly! Why don't they export __PAGE_KERNEL_EXEC so PAGE_KERNEL_EXEC would be usable?
*/
#if defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE)
# define MY_PAGE_KERNEL_EXEC __pgprot(cpu_has_pge ? _PAGE_KERNEL_EXEC | _PAGE_GLOBAL : _PAGE_KERNEL_EXEC)
#else
# define MY_PAGE_KERNEL_EXEC PAGE_KERNEL
#endif
/*
* The redhat hack section.
* - The current hacks are for 2.4.21-15.EL only.
*/
#ifndef NO_REDHAT_HACKS
/* accounting. */
# ifdef VM_ACCOUNT
# endif
# endif
/* backported remap_page_range. */
# ifdef tlb_vma /* probably not good enough... */
# define HAVE_26_STYLE_REMAP_PAGE_RANGE 1
# endif
# endif
# ifndef __AMD64__
/* In 2.6.9-22.ELsmp we have to call change_page_attr() twice when changing
* the page attributes from PAGE_KERNEL to something else, because there appears
* to be a bug in one of the many patches that redhat applied.
* It should be safe to do this on less buggy linux kernels too. ;-)
*/
do { \
} while (0)
# endif /* !__AMD64__ */
#endif /* !NO_REDHAT_HACKS */
#ifndef MY_DO_MUNMAP
# define MY_DO_MUNMAP(a,b,c) do_munmap(a, b, c)
#endif
#ifndef MY_CHANGE_PAGE_ATTR
# ifdef __AMD64__ /** @todo This is a cheap hack, but it'll get around that 'else BUG();' in __change_page_attr(). */
do { \
} while (0)
# else
# endif
#endif
#ifndef PAGE_OFFSET_MASK
#endif
/*
* Stop using the linux bool type.
*/
#undef bool
#endif