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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
#ifndef __ASM_SH64_PGALLOC_H
2
#define __ASM_SH64_PGALLOC_H
3
 
4
#include <asm/processor.h>
5
#include <linux/threads.h>
6
#include <linux/slab.h>
7
 
8
#define pgd_quicklist ((unsigned long *)0)
9
#define pmd_quicklist ((unsigned long *)0)
10
#define pte_quicklist ((unsigned long *)0)
11
#define pgtable_cache_size 0L
12
 
13
/*
14
#define pmd_populate(mm, pmd, pte) \
15
                set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
16
 
17
*/
18
 
19
/*
20
 * Allocate and free page tables.
21
 */
22
 
23
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
24
{
25
        unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t));
26
        pgd_t *pgd = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL);
27
 
28
        if (pgd)
29
                memset(pgd, 0, pgd_size);
30
 
31
        return pgd;
32
}
33
 
34
static inline void pgd_free(pgd_t *pgd)
35
{
36
        kfree(pgd);
37
}
38
 
39
static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address)
40
{
41
        pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL);
42
        if (pte)
43
                clear_page(pte);
44
        return pte;
45
}
46
 
47
static inline pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address)
48
{
49
        return 0;
50
}
51
 
52
static inline void pte_free_slow(pte_t *pte)
53
{
54
        free_page((unsigned long)pte);
55
}
56
 
57
#define pte_free(pte)           pte_free_slow(pte)
58
 
59
#define pgd_set(pgd,pmd) pgd_val(*pgd) = ( ((unsigned long)pmd) & PAGE_MASK)
60
 
61
#define pgd_populate(mm, pgd, pmd)      pgd_set(pgd,pmd)
62
 
63
 
64
static inline pmd_t*
65
pmd_alloc_one_fast (struct mm_struct *mm, unsigned long addr)
66
{
67
#if defined(CONFIG_SH64_PGTABLE_2_LEVEL)
68
        BUG();
69
#endif
70
        return 0;
71
}
72
 
73
static inline pmd_t*
74
pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
75
{
76
        pmd_t *pmd = NULL;
77
 
78
#if defined(CONFIG_SH64_PGTABLE_2_LEVEL)
79
        BUG();
80
#elif defined(CONFIG_SH64_PGTABLE_3_LEVEL)
81
        pmd = (pmd_t *) __get_free_page(GFP_KERNEL);
82
 
83
        if (pmd != NULL )
84
                clear_page(pmd);
85
#endif
86
        return pmd;
87
}
88
 
89
#if defined(CONFIG_SH64_PGTABLE_2_LEVEL)
90
static inline void
91
pmd_free (pmd_t *pmd)
92
{
93
        return;
94
}
95
#elif defined(CONFIG_SH64_PGTABLE_3_LEVEL)
96
static inline void
97
pmd_free (pmd_t *pmd)
98
{
99
 free_page((unsigned long)pmd);
100
}
101
#endif
102
 
103
 
104
static inline void
105
pmd_populate (struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
106
{
107
 
108
  pmd_set(pmd,pte);
109
 
110
 
111
    //     pmd_val(*pmd_entry) = __pa(pte);
112
}
113
 
114
 
115
/* Do nothing */
116
#define do_check_pgt_cache(low, high)   (0)
117
 
118
/*
119
 * TLB flushing:
120
 *
121
 *  - flush_tlb() flushes the current mm struct TLBs
122
 *  - flush_tlb_all() flushes all processes TLBs
123
 *  - flush_tlb_mm(mm) flushes the specified mm context TLB's
124
 *  - flush_tlb_page(vma, vmaddr) flushes one page
125
 *  - flush_tlb_range(mm, start, end) flushes a range of pages
126
 *  - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
127
 */
128
 
129
extern void flush_tlb(void);
130
extern void flush_tlb_all(void);
131
extern void flush_tlb_mm(struct mm_struct *mm);
132
extern void flush_tlb_range(struct mm_struct *mm, unsigned long start,
133
                            unsigned long end);
134
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
135
 
136
static inline void flush_tlb_pgtables(struct mm_struct *mm,
137
                                      unsigned long start, unsigned long end)
138
{ /* Nothing to do */
139
}
140
 
141
/* These are generic functions. These will need to change once D cache
142
 * aliasing support has been added.
143
 */
144
 
145
static inline pte_t ptep_get_and_clear(pte_t *ptep)
146
{
147
        pte_t pte = *ptep;
148
        pte_clear(ptep);
149
        return pte;
150
}
151
 
152
/*
153
 * Following functions are same as generic ones.
154
 */
155
static inline int ptep_test_and_clear_young(pte_t *ptep)
156
{
157
        pte_t pte = *ptep;
158
        if (!pte_young(pte))
159
                return 0;
160
        set_pte(ptep, pte_mkold(pte));
161
        return 1;
162
}
163
 
164
static inline int ptep_test_and_clear_dirty(pte_t *ptep)
165
{
166
        pte_t pte = *ptep;
167
        if (!pte_dirty(pte))
168
                return 0;
169
        set_pte(ptep, pte_mkclean(pte));
170
        return 1;
171
}
172
 
173
static inline void ptep_set_wrprotect(pte_t *ptep)
174
{
175
        pte_t old_pte = *ptep;
176
        set_pte(ptep, pte_wrprotect(old_pte));
177
}
178
 
179
static inline void ptep_mkdirty(pte_t *ptep)
180
{
181
        pte_t old_pte = *ptep;
182
        set_pte(ptep, pte_mkdirty(old_pte));
183
}
184
#endif /* __ASM_SH64_PGALLOC_H */
185
 

powered by: WebSVN 2.1.0

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