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

Subversion Repositories or1k

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/* $Id: page.h,v 1.1.1.1 2004-04-15 03:01:06 phoenix Exp $ */
2
 
3
#ifndef _SPARC64_PAGE_H
4
#define _SPARC64_PAGE_H
5
 
6
#define PAGE_SHIFT   13
7
#ifndef __ASSEMBLY__
8
/* I have my suspicions... -DaveM */
9
#define PAGE_SIZE    (1UL << PAGE_SHIFT)
10
#else
11
#define PAGE_SIZE    (1 << PAGE_SHIFT)
12
#endif
13
 
14
#define PAGE_MASK    (~(PAGE_SIZE-1))
15
 
16
 
17
#ifdef __KERNEL__
18
 
19
#ifndef __ASSEMBLY__
20
 
21
#ifdef CONFIG_DEBUG_BUGVERBOSE
22
extern void do_BUG(const char *file, int line);
23
#define BUG() do {                                      \
24
        do_BUG(__FILE__, __LINE__);                     \
25
        __builtin_trap();                               \
26
} while (0)
27
#else
28
#define BUG()           __builtin_trap()
29
#endif
30
 
31
#define PAGE_BUG(page)  BUG()
32
 
33
/* Sparc64 is slow at multiplication, we prefer to use some extra space. */
34
#define WANT_PAGE_VIRTUAL 1
35
 
36
extern void _clear_page(void *page);
37
#define clear_page(X)   _clear_page((void *)(X))
38
extern void clear_user_page(void *page, unsigned long vaddr);
39
#define copy_page(X,Y)  __memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
40
extern void copy_user_page(void *to, void *from, unsigned long vaddr);
41
 
42
/* GROSS, defining this makes gcc pass these types as aggregates,
43
 * and thus on the stack, turn this crap off... -DaveM
44
 */
45
 
46
/* #define STRICT_MM_TYPECHECKS */
47
 
48
#ifdef STRICT_MM_TYPECHECKS
49
/* These are used to make use of C type-checking.. */
50
typedef struct { unsigned long pte; } pte_t;
51
typedef struct { unsigned long iopte; } iopte_t;
52
typedef struct { unsigned int pmd; } pmd_t;
53
typedef struct { unsigned int pgd; } pgd_t;
54
typedef struct { unsigned long ctxd; } ctxd_t;
55
typedef struct { unsigned long pgprot; } pgprot_t;
56
typedef struct { unsigned long iopgprot; } iopgprot_t;
57
 
58
#define pte_val(x)      ((x).pte)
59
#define iopte_val(x)    ((x).iopte)
60
#define pmd_val(x)      ((unsigned long)(x).pmd)
61
#define pgd_val(x)      ((unsigned long)(x).pgd)
62
#define ctxd_val(x)     ((x).ctxd)
63
#define pgprot_val(x)   ((x).pgprot)
64
#define iopgprot_val(x) ((x).iopgprot)
65
 
66
#define __pte(x)        ((pte_t) { (x) } )
67
#define __iopte(x)      ((iopte_t) { (x) } )
68
#define __pmd(x)        ((pmd_t) { (x) } )
69
#define __pgd(x)        ((pgd_t) { (x) } )
70
#define __ctxd(x)       ((ctxd_t) { (x) } )
71
#define __pgprot(x)     ((pgprot_t) { (x) } )
72
#define __iopgprot(x)   ((iopgprot_t) { (x) } )
73
 
74
#else
75
/* .. while these make it easier on the compiler */
76
typedef unsigned long pte_t;
77
typedef unsigned long iopte_t;
78
typedef unsigned int pmd_t;
79
typedef unsigned int pgd_t;
80
typedef unsigned long ctxd_t;
81
typedef unsigned long pgprot_t;
82
typedef unsigned long iopgprot_t;
83
 
84
#define pte_val(x)      (x)
85
#define iopte_val(x)    (x)
86
#define pmd_val(x)      ((unsigned long)(x))
87
#define pgd_val(x)      ((unsigned long)(x))
88
#define ctxd_val(x)     (x)
89
#define pgprot_val(x)   (x)
90
#define iopgprot_val(x) (x)
91
 
92
#define __pte(x)        (x)
93
#define __iopte(x)      (x)
94
#define __pmd(x)        (x)
95
#define __pgd(x)        (x)
96
#define __ctxd(x)       (x)
97
#define __pgprot(x)     (x)
98
#define __iopgprot(x)   (x)
99
 
100
#endif /* (STRICT_MM_TYPECHECKS) */
101
 
102
#define TASK_UNMAPPED_BASE      ((current->thread.flags & SPARC_FLAG_32BIT) ? \
103
                                 (0x0000000070000000UL) : (PAGE_OFFSET))
104
 
105
#endif /* !(__ASSEMBLY__) */
106
 
107
/* to align the pointer to the (next) page boundary */
108
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
109
 
110
#ifndef __ASSEMBLY__
111
/* Do prdele, look what happens to be in %g4... */
112
register unsigned long PAGE_OFFSET asm("g4");
113
#else
114
#define PAGE_OFFSET             0xFFFFF80000000000
115
#endif
116
 
117
#define __pa(x)                 ((unsigned long)(x) - PAGE_OFFSET)
118
#define __va(x)                 ((void *)((unsigned long) (x) + PAGE_OFFSET))
119
#define virt_to_page(kaddr)     (mem_map + ((__pa(kaddr)-phys_base) >> PAGE_SHIFT))
120
#define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
121
 
122
#define virt_to_phys __pa
123
#define phys_to_virt __va
124
 
125
#ifndef __ASSEMBLY__
126
 
127
/* The following structure is used to hold the physical
128
 * memory configuration of the machine.  This is filled in
129
 * probe_memory() and is later used by mem_init() to set up
130
 * mem_map[].  We statically allocate SPARC_PHYS_BANKS of
131
 * these structs, this is arbitrary.  The entry after the
132
 * last valid one has num_bytes==0.
133
 */
134
 
135
struct sparc_phys_banks {
136
        unsigned long base_addr;
137
        unsigned long num_bytes;
138
};
139
 
140
#define SPARC_PHYS_BANKS 32
141
 
142
extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
143
 
144
/* Pure 2^n version of get_order */
145
extern __inline__ int get_order(unsigned long size)
146
{
147
        int order;
148
 
149
        size = (size-1) >> (PAGE_SHIFT-1);
150
        order = -1;
151
        do {
152
                size >>= 1;
153
                order++;
154
        } while (size);
155
        return order;
156
}
157
 
158
#endif /* !(__ASSEMBLY__) */
159
 
160
#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
161
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
162
 
163
#endif /* !(__KERNEL__) */
164
 
165
#endif /* !(_SPARC64_PAGE_H) */

powered by: WebSVN 2.1.0

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