OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-i386/] [page.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _I386_PAGE_H
2
#define _I386_PAGE_H
3
 
4
/* PAGE_SHIFT determines the page size */
5
#define PAGE_SHIFT      12
6
#define PAGE_SIZE       (1UL << PAGE_SHIFT)
7
#define PAGE_MASK       (~(PAGE_SIZE-1))
8
 
9
#ifdef __KERNEL__
10
#ifndef __ASSEMBLY__
11
 
12
#include <linux/config.h>
13
 
14
#ifdef CONFIG_X86_USE_3DNOW
15
 
16
#include <asm/mmx.h>
17
 
18
#define clear_page(page)        mmx_clear_page((void *)(page))
19
#define copy_page(to,from)      mmx_copy_page(to,from)
20
 
21
#else
22
 
23
/*
24
 *      On older X86 processors its not a win to use MMX here it seems.
25
 *      Maybe the K6-III ?
26
 */
27
 
28
#define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
29
#define copy_page(to,from)      memcpy((void *)(to), (void *)(from), PAGE_SIZE)
30
 
31
#endif
32
 
33
#define clear_user_page(page, vaddr)    clear_page(page)
34
#define copy_user_page(to, from, vaddr) copy_page(to, from)
35
 
36
/*
37
 * These are used to make use of C type-checking..
38
 */
39
#if CONFIG_X86_PAE
40
typedef struct { unsigned long pte_low, pte_high; } pte_t;
41
typedef struct { unsigned long long pmd; } pmd_t;
42
typedef struct { unsigned long long pgd; } pgd_t;
43
#define pte_val(x)      ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
44
#else
45
typedef struct { unsigned long pte_low; } pte_t;
46
typedef struct { unsigned long pmd; } pmd_t;
47
typedef struct { unsigned long pgd; } pgd_t;
48
#define pte_val(x)      ((x).pte_low)
49
#endif
50
#define PTE_MASK        PAGE_MASK
51
 
52
typedef struct { unsigned long pgprot; } pgprot_t;
53
 
54
#define pmd_val(x)      ((x).pmd)
55
#define pgd_val(x)      ((x).pgd)
56
#define pgprot_val(x)   ((x).pgprot)
57
 
58
#define __pte(x) ((pte_t) { (x) } )
59
#define __pmd(x) ((pmd_t) { (x) } )
60
#define __pgd(x) ((pgd_t) { (x) } )
61
#define __pgprot(x)     ((pgprot_t) { (x) } )
62
 
63
#endif /* !__ASSEMBLY__ */
64
 
65
/* to align the pointer to the (next) page boundary */
66
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
67
 
68
/*
69
 * This handles the memory map.. We could make this a config
70
 * option, but too many people screw it up, and too few need
71
 * it.
72
 *
73
 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
74
 * a virtual address space of one gigabyte, which limits the
75
 * amount of physical memory you can use to about 950MB.
76
 *
77
 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
78
 * and CONFIG_HIGHMEM64G options in the kernel configuration.
79
 */
80
 
81
#define __PAGE_OFFSET           (0xC0000000)
82
 
83
/*
84
 * This much address space is reserved for vmalloc() and iomap()
85
 * as well as fixmap mappings.
86
 */
87
#define __VMALLOC_RESERVE       (128 << 20)
88
 
89
#ifndef __ASSEMBLY__
90
 
91
/*
92
 * Tell the user there is some problem. Beep too, so we can
93
 * see^H^H^Hhear bugs in early bootup as well!
94
 * The offending file and line are encoded after the "officially
95
 * undefined" opcode for parsing in the trap handler.
96
 */
97
 
98
#if 1   /* Set to zero for a slightly smaller kernel */
99
#define BUG()                           \
100
 __asm__ __volatile__(  "ud2\n"         \
101
                        "\t.word %c0\n" \
102
                        "\t.long %c1\n" \
103
                         : : "i" (__LINE__), "i" (__FILE__))
104
#else
105
#define BUG() __asm__ __volatile__("ud2\n")
106
#endif
107
 
108
#define PAGE_BUG(page) do { \
109
        BUG(); \
110
} while (0)
111
 
112
/* Pure 2^n version of get_order */
113
static __inline__ int get_order(unsigned long size)
114
{
115
        int order;
116
 
117
        size = (size-1) >> (PAGE_SHIFT-1);
118
        order = -1;
119
        do {
120
                size >>= 1;
121
                order++;
122
        } while (size);
123
        return order;
124
}
125
 
126
#endif /* __ASSEMBLY__ */
127
 
128
#define PAGE_OFFSET             ((unsigned long)__PAGE_OFFSET)
129
#define VMALLOC_RESERVE         ((unsigned long)__VMALLOC_RESERVE)
130
#define __MAXMEM                (-__PAGE_OFFSET-__VMALLOC_RESERVE)
131
#define MAXMEM                  ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE))
132
#define __pa(x)                 ((unsigned long)(x)-PAGE_OFFSET)
133
#define __va(x)                 ((void *)((unsigned long)(x)+PAGE_OFFSET))
134
#define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
135
#define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
136
 
137
#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
138
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
139
 
140
#endif /* __KERNEL__ */
141
 
142
#endif /* _I386_PAGE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.