* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / asm-mips / page.h
blobaa740dcd03fc3afa572b89e821967af0fd28ceed
1 /* $Id: page.h,v 1.6 1999/01/04 16:09:24 ralf Exp $
3 * Definitions for page handling
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
9 * Copyright (C) 1994 - 1998 by Ralf Baechle
11 #ifndef __ASM_MIPS_PAGE_H
12 #define __ASM_MIPS_PAGE_H
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))
19 #ifdef __KERNEL__
21 #define STRICT_MM_TYPECHECKS
23 #ifndef _LANGUAGE_ASSEMBLY
25 extern void (*clear_page)(unsigned long page);
26 extern void (*copy_page)(unsigned long to, unsigned long from);
28 #ifdef STRICT_MM_TYPECHECKS
30 * These are used to make use of C type-checking..
32 typedef struct { unsigned long pte; } pte_t;
33 typedef struct { unsigned long pmd; } pmd_t;
34 typedef struct { unsigned long pgd; } pgd_t;
35 typedef struct { unsigned long pgprot; } pgprot_t;
37 #define pte_val(x) ((x).pte)
38 #define pmd_val(x) ((x).pmd)
39 #define pgd_val(x) ((x).pgd)
40 #define pgprot_val(x) ((x).pgprot)
42 #define __pte(x) ((pte_t) { (x) } )
43 #define __pme(x) ((pme_t) { (x) } )
44 #define __pgd(x) ((pgd_t) { (x) } )
45 #define __pgprot(x) ((pgprot_t) { (x) } )
47 #else /* !defined (STRICT_MM_TYPECHECKS) */
49 * .. while these make it easier on the compiler
51 typedef unsigned long pte_t;
52 typedef unsigned long pmd_t;
53 typedef unsigned long pgd_t;
54 typedef unsigned long pgprot_t;
56 #define pte_val(x) (x)
57 #define pmd_val(x) (x)
58 #define pgd_val(x) (x)
59 #define pgprot_val(x) (x)
61 #define __pte(x) (x)
62 #define __pmd(x) (x)
63 #define __pgd(x) (x)
64 #define __pgprot(x) (x)
66 #endif /* !defined (STRICT_MM_TYPECHECKS) */
68 #endif /* _LANGUAGE_ASSEMBLY */
70 /* to align the pointer to the (next) page boundary */
71 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
74 * This handles the memory map.
75 * We handle pages at KSEG0 for kernels with 32 bit address space.
77 #define PAGE_OFFSET 0x80000000UL
78 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
79 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
80 #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
82 #endif /* defined (__KERNEL__) */
84 #endif /* __ASM_MIPS_PAGE_H */