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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
#ifndef _OR32_PAGE_H
2
#define _OR32_PAGE_H
3
 
4
#include <linux/config.h>
5
 
6
/* PAGE_SHIFT determines the page size */
7
#define PAGE_SHIFT              13
8
#define PAGE_SIZE               (1UL << PAGE_SHIFT)
9
#define PAGE_MASK               (~(PAGE_SIZE-1))
10
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
11
 
12
#define PAGE_OFFSET             0xc0000000      
13
#define KERNELBASE              PAGE_OFFSET
14
 
15
#ifdef __KERNEL__
16
 
17
#ifndef __ASSEMBLY__
18
#define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
19
#define copy_page(to,from)      memcpy((void *)(to), (void *)(from), PAGE_SIZE)
20
 
21
#define clear_user_page(page, vaddr)    clear_page(page)
22
#define copy_user_page(to, from, vaddr) copy_page(to, from)
23
 
24
#define STRICT_MM_TYPECHECKS
25
 
26
#ifdef STRICT_MM_TYPECHECKS
27
/*
28
 * These are used to make use of C type-checking..
29
 */
30
typedef struct { unsigned long pte; } pte_t;
31
typedef struct { unsigned long pmd; } pmd_t;
32
typedef struct { unsigned long pgd; } pgd_t;
33
typedef struct { unsigned long pgprot; } pgprot_t;
34
 
35
#define pte_val(x)      ((x).pte)
36
#define pmd_val(x)      ((x).pmd)
37
#define pgd_val(x)      ((x).pgd)
38
#define pgprot_val(x)   ((x).pgprot)
39
 
40
#define __pte(x)        ((pte_t) { (x) } )
41
#define __pmd(x)        ((pmd_t) { (x) } )
42
#define __pgd(x)        ((pgd_t) { (x) } )
43
#define __pgprot(x)     ((pgprot_t) { (x) } )
44
 
45
#else /* STRICT_MM_TYPECHECKS */
46
/*
47
 * .. while these make it easier on the compiler
48
 */
49
typedef unsigned long pte_t;
50
typedef unsigned long pmd_t;
51
typedef unsigned long pgd_t;
52
typedef unsigned long pgprot_t;
53
 
54
#define pte_val(x)      (x)
55
#define pmd_val(x)      (x)
56
#define pgd_val(x)      (x)
57
#define pgprot_val(x)   (x)
58
 
59
#define __pte(x)        (x)
60
#define __pmd(x)        (x)
61
#define __pgd(x)        (x)
62
#define __pgprot(x)     (x)
63
 
64
#endif /* STRICT_MM_TYPECHECKS */
65
 
66
#define BUG() do { \
67
  printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
68
} while (0)
69
 
70
#define PAGE_BUG(page) do { \
71
         BUG(); \
72
} while (0)
73
 
74
 
75
/* Pure 2^n version of get_order */
76
static __inline__ int get_order(unsigned long size)
77
{
78
        int order;
79
 
80
        size = (size-1) >> (PAGE_SHIFT-1);
81
        order = -1;
82
        do {
83
                size >>= 1;
84
                order++;
85
        } while (size);
86
        return order;
87
}
88
 
89
 
90
/* macros to convert between really physical and virtual addresses
91
 */
92
 
93
#define __pa(x)                 ((unsigned long)(x) - PAGE_OFFSET)
94
#define __va(x)                 ((void *)((unsigned long)(x) + PAGE_OFFSET))
95
 
96
#define virt_to_page(kaddr)    (mem_map + (((unsigned long)kaddr - PAGE_OFFSET) >> PAGE_SHIFT))
97
#define VALID_PAGE(page)       ((page - mem_map) < max_mapnr)
98
 
99
/* from linker script */
100
 
101
extern unsigned long dram_start, dram_end;
102
 
103
#endif /* __ASSEMBLY__ */
104
 
105
#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
106
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
107
 
108
#endif /* __KERNEL__ */
109
 
110
#endif /* _OR32_PAGE_H */
111
 

powered by: WebSVN 2.1.0

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