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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
#ifndef _M68K_PAGE_H
2
#define _M68K_PAGE_H
3
 
4
#include <linux/config.h>
5
 
6
/* PAGE_SHIFT determines the page size */
7
#ifndef CONFIG_SUN3
8
#define PAGE_SHIFT      (12)
9
#else
10
#define PAGE_SHIFT      (13)
11
#endif
12
#ifdef __ASSEMBLY__
13
#define PAGE_SIZE       (1 << PAGE_SHIFT)
14
#else
15
#define PAGE_SIZE       (1UL << PAGE_SHIFT)
16
#endif
17
#define PAGE_MASK       (~(PAGE_SIZE-1))
18
 
19
#ifdef __KERNEL__
20
 
21
#include <asm/setup.h>
22
 
23
#if PAGE_SHIFT < 13
24
#define KTHREAD_SIZE (8192)
25
#else
26
#define KTHREAD_SIZE PAGE_SIZE
27
#endif
28
 
29
#ifndef __ASSEMBLY__
30
 
31
#define get_user_page(vaddr)            __get_free_page(GFP_KERNEL)
32
#define free_user_page(page, addr)      free_page(addr)
33
 
34
/*
35
 * We don't need to check for alignment etc.
36
 */
37
#ifdef CPU_M68040_OR_M68060_ONLY
38
static inline void copy_page(void *to, void *from)
39
{
40
  unsigned long tmp;
41
 
42
  __asm__ __volatile__("1:\t"
43
                       ".chip 68040\n\t"
44
                       "move16 %1@+,%0@+\n\t"
45
                       "move16 %1@+,%0@+\n\t"
46
                       ".chip 68k\n\t"
47
                       "dbra  %2,1b\n\t"
48
                       : "=a" (to), "=a" (from), "=d" (tmp)
49
                       : "0" (to), "1" (from) , "2" (PAGE_SIZE / 32 - 1)
50
                       );
51
}
52
 
53
static inline void clear_page(void *page)
54
{
55
        unsigned long data, tmp;
56
        void *sp = page;
57
 
58
        data = 0;
59
 
60
        *((unsigned long *)(page))++ = 0;
61
        *((unsigned long *)(page))++ = 0;
62
        *((unsigned long *)(page))++ = 0;
63
        *((unsigned long *)(page))++ = 0;
64
 
65
        __asm__ __volatile__("1:\t"
66
                             ".chip 68040\n\t"
67
                             "move16 %2@+,%0@+\n\t"
68
                             ".chip 68k\n\t"
69
                             "subqw  #8,%2\n\t"
70
                             "subqw  #8,%2\n\t"
71
                             "dbra   %1,1b\n\t"
72
                             : "=a" (page), "=d" (tmp)
73
                             : "a" (sp), "0" (page),
74
                               "1" ((PAGE_SIZE - 16) / 16 - 1));
75
}
76
 
77
#else
78
#define clear_page(page)        memset((page), 0, PAGE_SIZE)
79
#define copy_page(to,from)      memcpy((to), (from), PAGE_SIZE)
80
#endif
81
 
82
#define clear_user_page(page, vaddr)    clear_page(page)
83
#define copy_user_page(to, from, vaddr) copy_page(to, from)
84
 
85
/*
86
 * These are used to make use of C type-checking..
87
 */
88
typedef struct { unsigned long pte; } pte_t;
89
typedef struct { unsigned long pmd[16]; } pmd_t;
90
typedef struct { unsigned long pgd; } pgd_t;
91
typedef struct { unsigned long pgprot; } pgprot_t;
92
 
93
#define pte_val(x)      ((x).pte)
94
#define pmd_val(x)      ((&x)->pmd[0])
95
#define pgd_val(x)      ((x).pgd)
96
#define pgprot_val(x)   ((x).pgprot)
97
 
98
#define __pte(x)        ((pte_t) { (x) } )
99
#define __pmd(x)        ((pmd_t) { (x) } )
100
#define __pgd(x)        ((pgd_t) { (x) } )
101
#define __pgprot(x)     ((pgprot_t) { (x) } )
102
 
103
/* to align the pointer to the (next) page boundary */
104
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
105
 
106
/* Pure 2^n version of get_order */
107
static inline int get_order(unsigned long size)
108
{
109
        int order;
110
 
111
        size = (size-1) >> (PAGE_SHIFT-1);
112
        order = -1;
113
        do {
114
                size >>= 1;
115
                order++;
116
        } while (size);
117
        return order;
118
}
119
 
120
#endif /* !__ASSEMBLY__ */
121
 
122
#include <asm/page_offset.h>
123
 
124
#define PAGE_OFFSET             (PAGE_OFFSET_RAW)
125
 
126
#ifndef __ASSEMBLY__
127
 
128
#ifndef CONFIG_SUN3
129
 
130
#define WANT_PAGE_VIRTUAL
131
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
132
extern unsigned long m68k_memoffset;
133
 
134
#define __pa(vaddr)             ((unsigned long)(vaddr)+m68k_memoffset)
135
#define __va(paddr)             ((void *)((unsigned long)(paddr)-m68k_memoffset))
136
#else
137
#define __pa(vaddr)             virt_to_phys((void *)vaddr)
138
#define __va(paddr)             phys_to_virt((unsigned long)paddr)
139
#endif
140
 
141
#else   /* !CONFIG_SUN3 */
142
/* This #define is a horrible hack to suppress lots of warnings. --m */
143
#define __pa(x) ___pa((unsigned long)x)
144
static inline unsigned long ___pa(unsigned long x)
145
{
146
     if(x == 0)
147
          return 0;
148
     if(x >= PAGE_OFFSET)
149
        return (x-PAGE_OFFSET);
150
     else
151
        return (x+0x2000000);
152
}
153
 
154
static inline void *__va(unsigned long x)
155
{
156
     if(x == 0)
157
          return (void *)0;
158
 
159
     if(x < 0x2000000)
160
        return (void *)(x+PAGE_OFFSET);
161
     else
162
        return (void *)(x-0x2000000);
163
}
164
#endif  /* CONFIG_SUN3 */
165
 
166
#define MAP_NR(addr)            (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
167
#define virt_to_page(kaddr)     (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT))
168
#define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
169
 
170
#ifdef CONFIG_DEBUG_BUGVERBOSE
171
#ifndef CONFIG_SUN3
172
#define BUG() do { \
173
        printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
174
        asm volatile("illegal"); \
175
} while (0)
176
#else
177
#define BUG() do { \
178
        printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
179
        panic("BUG!"); \
180
} while (0)
181
#endif
182
#else
183
#define BUG() do { \
184
        asm volatile("illegal"); \
185
} while (0)
186
#endif
187
 
188
#define PAGE_BUG(page) do { \
189
        BUG(); \
190
} while (0)
191
 
192
#endif /* __ASSEMBLY__ */
193
 
194
#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
195
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
196
 
197
#endif /* __KERNEL__ */
198
 
199
#endif /* _M68K_PAGE_H */

powered by: WebSVN 2.1.0

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