1
/*********************************************************
2
* Copyright (C) 2002 VMware, Inc. All rights reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation version 2 and no later version.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* You should have received a copy of the GNU General Public License along
14
* with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
*********************************************************/
19
#ifndef __COMPAT_PAGE_H__
20
# define __COMPAT_PAGE_H__
27
/* The pfn_to_page() API appeared in 2.5.14 and changed to function during 2.6.x */
28
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) && !defined(pfn_to_page)
29
# define pfn_to_page(_pfn) (mem_map + (_pfn))
30
# define page_to_pfn(_page) ((_page) - mem_map)
34
/* The virt_to_page() API appeared in 2.4.0 --hpreg */
35
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0) && !defined(virt_to_page)
36
# define virt_to_page(_kvAddr) pfn_to_page(MAP_NR(_kvAddr))
41
* The get_order() API appeared at some point in 2.3.x, and was then backported
42
* in 2.2.17-21mdk and in the stock 2.2.18. Because we can only detect its
43
* definition through makefile tricks, we provide our own for now --hpreg
46
compat_get_order(unsigned long size) // IN
50
size = (size - 1) >> (PAGE_SHIFT - 1);
61
* BUG() was added to <asm/page.h> in 2.2.18, and was moved to <asm/bug.h>
64
* XXX: Technically, this belongs in some sort of "compat_asm_page.h" file, but
65
* since our compatibility wrappers don't distinguish between <asm/xxx.h> and
66
* <linux/xxx.h>, putting it here is reasonable.
70
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
71
__asm__ __volatile__(".byte 0x0f,0x0b"); \
75
#endif /* __COMPAT_PAGE_H__ */