1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9 #ifndef _ASM_PAGE_H
10 #define _ASM_PAGE_H
11
12 #include <linux/config.h>
13
14 /* PAGE_SHIFT determines the page size */
15 #define PAGE_SHIFT 12
16 #define PAGE_SIZE (1UL << PAGE_SHIFT)
17 #define PAGE_MASK (~(PAGE_SIZE-1))
18
19 #ifdef __KERNEL__
20
21 #ifndef _LANGUAGE_ASSEMBLY
22
23 #define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0)
24 #define PAGE_BUG(page) do { BUG(); } while (0)
25
26 extern void (*_clear_page)(void * page);
27 extern void (*_copy_page)(void * to, void * from);
28
29 #define clear_page(page) _clear_page(page)
30 #define copy_page(to, from) _copy_page(to, from)
31 #define clear_user_page(page, vaddr) clear_page(page)
32 #define copy_user_page(to, from, vaddr) copy_page(to, from)
33
34 /*
35 * These are used to make use of C type-checking..
36 */
37 typedef struct { unsigned long pte; } pte_t;
38 typedef struct { unsigned long pmd; } pmd_t;
39 typedef struct { unsigned long pgd; } pgd_t;
40 typedef struct { unsigned long pgprot; } pgprot_t;
41
42 #define pte_val(x) ((x).pte)
43 #define pmd_val(x) ((x).pmd)
44 #define pgd_val(x) ((x).pgd)
45 #define pgprot_val(x) ((x).pgprot)
46
47 #define __pte(x) ((pte_t) { (x) } )
48 #define __pme(x) ((pme_t) { (x) } )
49 #define __pgd(x) ((pgd_t) { (x) } )
50 #define __pgprot(x) ((pgprot_t) { (x) } )
51
52 #endif /* _LANGUAGE_ASSEMBLY */
53
54 /* to align the pointer to the (next) page boundary */
55 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
56
57 /*
58 * This handles the memory map.
59 * We handle pages at KSEG0 for kernels with upto 512mb of memory,
60 * at XKPHYS for kernels with more than that.
61 */
62 #ifdef CONFIG_SGI_IP22
63 #define PAGE_OFFSET 0xffffffff80000000UL
64 #endif
65 #ifdef CONFIG_SGI_IP27
66 #define PAGE_OFFSET 0xa800000000000000UL
67 #endif
68
69 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
70 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
71 #ifndef CONFIG_DISCONTIGMEM
72 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
73 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
74 #endif
75
76 #endif /* defined (__KERNEL__) */
77
78 #endif /* _ASM_PAGE_H */
79
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.