aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c9
-rw-r--r--arch/cris/kernel/module.c39
-rw-r--r--arch/cris/kernel/process.c31
-rw-r--r--include/asm-cris/arch-v10/bitops.h2
-rw-r--r--include/asm-cris/arch-v10/offset.h2
-rw-r--r--include/asm-cris/bitops.h35
-rw-r--r--include/asm-cris/kmap_types.h4
-rw-r--r--include/asm-cris/page.h7
-rw-r--r--include/asm-cris/pgalloc.h10
-rw-r--r--include/asm-cris/pgtable.h42
-rw-r--r--include/asm-cris/processor.h9
-rw-r--r--include/asm-cris/thread_info.h2
-rw-r--r--include/asm-cris/timex.h2
-rw-r--r--include/asm-cris/types.h2
-rw-r--r--include/asm-cris/unistd.h11
15 files changed, 88 insertions, 119 deletions
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index 581ecabaae53..130dd214e41d 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -11,6 +11,7 @@
11#include <linux/ptrace.h> 11#include <linux/ptrace.h>
12#include <linux/user.h> 12#include <linux/user.h>
13#include <linux/signal.h> 13#include <linux/signal.h>
14#include <linux/security.h>
14 15
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16#include <asm/page.h> 17#include <asm/page.h>
@@ -86,9 +87,13 @@ sys_ptrace(long request, long pid, long addr, long data)
86 ret = -EPERM; 87 ret = -EPERM;
87 88
88 if (request == PTRACE_TRACEME) { 89 if (request == PTRACE_TRACEME) {
90 /* are we already being traced? */
89 if (current->ptrace & PT_PTRACED) 91 if (current->ptrace & PT_PTRACED)
90 goto out; 92 goto out;
91 93 ret = security_ptrace(current->parent, current);
94 if (ret)
95 goto out;
96 /* set the ptrace bit in the process flags. */
92 current->ptrace |= PT_PTRACED; 97 current->ptrace |= PT_PTRACED;
93 ret = 0; 98 ret = 0;
94 goto out; 99 goto out;
@@ -207,7 +212,7 @@ sys_ptrace(long request, long pid, long addr, long data)
207 case PTRACE_KILL: 212 case PTRACE_KILL:
208 ret = 0; 213 ret = 0;
209 214
210 if (child->state == TASK_ZOMBIE) 215 if (child->exit_state == EXIT_ZOMBIE)
211 break; 216 break;
212 217
213 child->exit_code = SIGKILL; 218 child->exit_code = SIGKILL;
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index f1d3e784f30c..11b867df8617 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -32,7 +32,7 @@ void *module_alloc(unsigned long size)
32{ 32{
33 if (size == 0) 33 if (size == 0)
34 return NULL; 34 return NULL;
35 return vmalloc(size); 35 return vmalloc_exec(size);
36} 36}
37 37
38 38
@@ -59,26 +59,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
59 unsigned int relsec, 59 unsigned int relsec,
60 struct module *me) 60 struct module *me)
61{ 61{
62 unsigned int i; 62 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
63 Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; 63 return -ENOEXEC;
64 Elf32_Sym *sym;
65 uint32_t *location;
66
67 DEBUGP("Applying relocate section %u to %u\n", relsec,
68 sechdrs[relsec].sh_info);
69 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
70 /* This is where to make the change */
71 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_offset
72 + rel[i].r_offset;
73 /* This is the symbol it is referring to. Note that all
74 undefined symbols have been resolved. */
75 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
76 + ELF32_R_SYM(rel[i].r_info);
77
78 /* We add the value into the location given */
79 *location += sym->st_value;
80 }
81 return 0;
82} 64}
83 65
84int apply_relocate_add(Elf32_Shdr *sechdrs, 66int apply_relocate_add(Elf32_Shdr *sechdrs,
@@ -90,7 +72,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
90 unsigned int i; 72 unsigned int i;
91 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; 73 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
92 74
93 DEBUGP ("Applying relocate section %u to %u\n", relsec, 75 DEBUGP ("Applying add relocate section %u to %u\n", relsec,
94 sechdrs[relsec].sh_info); 76 sechdrs[relsec].sh_info);
95 77
96 for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) { 78 for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
@@ -103,7 +85,18 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
103 Elf32_Sym *sym 85 Elf32_Sym *sym
104 = ((Elf32_Sym *)sechdrs[symindex].sh_addr 86 = ((Elf32_Sym *)sechdrs[symindex].sh_addr
105 + ELF32_R_SYM (rela[i].r_info)); 87 + ELF32_R_SYM (rela[i].r_info));
106 *loc = sym->st_value + rela[i].r_addend; 88 switch (ELF32_R_TYPE(rela[i].r_info)) {
89 case R_CRIS_32:
90 *loc = sym->st_value + rela[i].r_addend;
91 break;
92 case R_CRIS_32_PCREL:
93 *loc = sym->st_value - (unsigned)loc + rela[i].r_addend - 4;
94 break;
95 default:
96 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
97 me->name, ELF32_R_TYPE(rela[i].r_info));
98 return -ENOEXEC;
99 }
107 } 100 }
108 101
109 return 0; 102 return 0;
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index a5ad2b675853..949a0e40e03c 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -1,4 +1,4 @@
1/* $Id: process.c,v 1.17 2004/04/05 13:53:48 starvik Exp $ 1/* $Id: process.c,v 1.21 2005/03/04 08:16:17 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/process.c 3 * linux/arch/cris/kernel/process.c
4 * 4 *
@@ -8,6 +8,18 @@
8 * Authors: Bjorn Wesen (bjornw@axis.com) 8 * Authors: Bjorn Wesen (bjornw@axis.com)
9 * 9 *
10 * $Log: process.c,v $ 10 * $Log: process.c,v $
11 * Revision 1.21 2005/03/04 08:16:17 starvik
12 * Merge of Linux 2.6.11.
13 *
14 * Revision 1.20 2005/01/18 05:57:22 starvik
15 * Renamed hlt_counter to cris_hlt_counter and made it global.
16 *
17 * Revision 1.19 2004/10/19 13:07:43 starvik
18 * Merge of Linux 2.6.9
19 *
20 * Revision 1.18 2004/08/16 12:37:23 starvik
21 * Merge of Linux 2.6.8
22 *
11 * Revision 1.17 2004/04/05 13:53:48 starvik 23 * Revision 1.17 2004/04/05 13:53:48 starvik
12 * Merge of Linux 2.6.5 24 * Merge of Linux 2.6.5
13 * 25 *
@@ -161,18 +173,18 @@ EXPORT_SYMBOL(init_task);
161 * region by enable_hlt/disable_hlt. 173 * region by enable_hlt/disable_hlt.
162 */ 174 */
163 175
164static int hlt_counter=0; 176int cris_hlt_counter=0;
165 177
166void disable_hlt(void) 178void disable_hlt(void)
167{ 179{
168 hlt_counter++; 180 cris_hlt_counter++;
169} 181}
170 182
171EXPORT_SYMBOL(disable_hlt); 183EXPORT_SYMBOL(disable_hlt);
172 184
173void enable_hlt(void) 185void enable_hlt(void)
174{ 186{
175 hlt_counter--; 187 cris_hlt_counter--;
176} 188}
177 189
178EXPORT_SYMBOL(enable_hlt); 190EXPORT_SYMBOL(enable_hlt);
@@ -195,16 +207,19 @@ void cpu_idle (void)
195 /* endless idle loop with no priority at all */ 207 /* endless idle loop with no priority at all */
196 while (1) { 208 while (1) {
197 while (!need_resched()) { 209 while (!need_resched()) {
198 void (*idle)(void) = pm_idle; 210 void (*idle)(void);
199 211 /*
212 * Mark this as an RCU critical section so that
213 * synchronize_kernel() in the unload path waits
214 * for our completion.
215 */
216 idle = pm_idle;
200 if (!idle) 217 if (!idle)
201 idle = default_idle; 218 idle = default_idle;
202
203 idle(); 219 idle();
204 } 220 }
205 schedule(); 221 schedule();
206 } 222 }
207
208} 223}
209 224
210void hard_reset_now (void); 225void hard_reset_now (void);
diff --git a/include/asm-cris/arch-v10/bitops.h b/include/asm-cris/arch-v10/bitops.h
index 21b7ae8c9bb3..b73f5396e5a6 100644
--- a/include/asm-cris/arch-v10/bitops.h
+++ b/include/asm-cris/arch-v10/bitops.h
@@ -51,7 +51,7 @@ extern inline unsigned long ffz(unsigned long w)
51 * 51 *
52 * Undefined if no bit exists, so code should check against 0 first. 52 * Undefined if no bit exists, so code should check against 0 first.
53 */ 53 */
54extern __inline__ unsigned long __ffs(unsigned long word) 54extern inline unsigned long __ffs(unsigned long word)
55{ 55{
56 return cris_swapnwbrlz(~word); 56 return cris_swapnwbrlz(~word);
57} 57}
diff --git a/include/asm-cris/arch-v10/offset.h b/include/asm-cris/arch-v10/offset.h
index fcbd77eab281..675b51d85639 100644
--- a/include/asm-cris/arch-v10/offset.h
+++ b/include/asm-cris/arch-v10/offset.h
@@ -25,7 +25,7 @@
25#define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */ 25#define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */
26#define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */ 26#define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */
27 27
28#define TASK_pid 133 /* offsetof(struct task_struct, pid) */ 28#define TASK_pid 141 /* offsetof(struct task_struct, pid) */
29 29
30#define LCLONE_VM 256 /* CLONE_VM */ 30#define LCLONE_VM 256 /* CLONE_VM */
31#define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */ 31#define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index d7861115d731..e3da57f97964 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -16,6 +16,7 @@
16 16
17#include <asm/arch/bitops.h> 17#include <asm/arch/bitops.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/atomic.h>
19#include <linux/compiler.h> 20#include <linux/compiler.h>
20 21
21/* 22/*
@@ -88,7 +89,7 @@ struct __dummy { unsigned long a[100]; };
88 * It also implies a memory barrier. 89 * It also implies a memory barrier.
89 */ 90 */
90 91
91extern inline int test_and_set_bit(int nr, void *addr) 92extern inline int test_and_set_bit(int nr, volatile unsigned long *addr)
92{ 93{
93 unsigned int mask, retval; 94 unsigned int mask, retval;
94 unsigned long flags; 95 unsigned long flags;
@@ -96,15 +97,15 @@ extern inline int test_and_set_bit(int nr, void *addr)
96 97
97 adr += nr >> 5; 98 adr += nr >> 5;
98 mask = 1 << (nr & 0x1f); 99 mask = 1 << (nr & 0x1f);
99 local_save_flags(flags); 100 cris_atomic_save(addr, flags);
100 local_irq_disable();
101 retval = (mask & *adr) != 0; 101 retval = (mask & *adr) != 0;
102 *adr |= mask; 102 *adr |= mask;
103 cris_atomic_restore(addr, flags);
103 local_irq_restore(flags); 104 local_irq_restore(flags);
104 return retval; 105 return retval;
105} 106}
106 107
107extern inline int __test_and_set_bit(int nr, void *addr) 108extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
108{ 109{
109 unsigned int mask, retval; 110 unsigned int mask, retval;
110 unsigned int *adr = (unsigned int *)addr; 111 unsigned int *adr = (unsigned int *)addr;
@@ -131,7 +132,7 @@ extern inline int __test_and_set_bit(int nr, void *addr)
131 * It also implies a memory barrier. 132 * It also implies a memory barrier.
132 */ 133 */
133 134
134extern inline int test_and_clear_bit(int nr, void *addr) 135extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
135{ 136{
136 unsigned int mask, retval; 137 unsigned int mask, retval;
137 unsigned long flags; 138 unsigned long flags;
@@ -139,11 +140,10 @@ extern inline int test_and_clear_bit(int nr, void *addr)
139 140
140 adr += nr >> 5; 141 adr += nr >> 5;
141 mask = 1 << (nr & 0x1f); 142 mask = 1 << (nr & 0x1f);
142 local_save_flags(flags); 143 cris_atomic_save(addr, flags);
143 local_irq_disable();
144 retval = (mask & *adr) != 0; 144 retval = (mask & *adr) != 0;
145 *adr &= ~mask; 145 *adr &= ~mask;
146 local_irq_restore(flags); 146 cris_atomic_restore(addr, flags);
147 return retval; 147 return retval;
148} 148}
149 149
@@ -157,7 +157,7 @@ extern inline int test_and_clear_bit(int nr, void *addr)
157 * but actually fail. You must protect multiple accesses with a lock. 157 * but actually fail. You must protect multiple accesses with a lock.
158 */ 158 */
159 159
160extern inline int __test_and_clear_bit(int nr, void *addr) 160extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
161{ 161{
162 unsigned int mask, retval; 162 unsigned int mask, retval;
163 unsigned int *adr = (unsigned int *)addr; 163 unsigned int *adr = (unsigned int *)addr;
@@ -177,24 +177,23 @@ extern inline int __test_and_clear_bit(int nr, void *addr)
177 * It also implies a memory barrier. 177 * It also implies a memory barrier.
178 */ 178 */
179 179
180extern inline int test_and_change_bit(int nr, void *addr) 180extern inline int test_and_change_bit(int nr, volatile unsigned long *addr)
181{ 181{
182 unsigned int mask, retval; 182 unsigned int mask, retval;
183 unsigned long flags; 183 unsigned long flags;
184 unsigned int *adr = (unsigned int *)addr; 184 unsigned int *adr = (unsigned int *)addr;
185 adr += nr >> 5; 185 adr += nr >> 5;
186 mask = 1 << (nr & 0x1f); 186 mask = 1 << (nr & 0x1f);
187 local_save_flags(flags); 187 cris_atomic_save(addr, flags);
188 local_irq_disable();
189 retval = (mask & *adr) != 0; 188 retval = (mask & *adr) != 0;
190 *adr ^= mask; 189 *adr ^= mask;
191 local_irq_restore(flags); 190 cris_atomic_restore(addr, flags);
192 return retval; 191 return retval;
193} 192}
194 193
195/* WARNING: non atomic and it can be reordered! */ 194/* WARNING: non atomic and it can be reordered! */
196 195
197extern inline int __test_and_change_bit(int nr, void *addr) 196extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
198{ 197{
199 unsigned int mask, retval; 198 unsigned int mask, retval;
200 unsigned int *adr = (unsigned int *)addr; 199 unsigned int *adr = (unsigned int *)addr;
@@ -215,7 +214,7 @@ extern inline int __test_and_change_bit(int nr, void *addr)
215 * This routine doesn't need to be atomic. 214 * This routine doesn't need to be atomic.
216 */ 215 */
217 216
218extern inline int test_bit(int nr, const void *addr) 217extern inline int test_bit(int nr, const volatile unsigned long *addr)
219{ 218{
220 unsigned int mask; 219 unsigned int mask;
221 unsigned int *adr = (unsigned int *)addr; 220 unsigned int *adr = (unsigned int *)addr;
@@ -259,7 +258,7 @@ extern inline int test_bit(int nr, const void *addr)
259 * @offset: The bitnumber to start searching at 258 * @offset: The bitnumber to start searching at
260 * @size: The maximum size to search 259 * @size: The maximum size to search
261 */ 260 */
262extern inline int find_next_zero_bit (void * addr, int size, int offset) 261extern inline int find_next_zero_bit (const unsigned long * addr, int size, int offset)
263{ 262{
264 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 263 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
265 unsigned long result = offset & ~31UL; 264 unsigned long result = offset & ~31UL;
@@ -301,7 +300,7 @@ extern inline int find_next_zero_bit (void * addr, int size, int offset)
301 * @offset: The bitnumber to start searching at 300 * @offset: The bitnumber to start searching at
302 * @size: The maximum size to search 301 * @size: The maximum size to search
303 */ 302 */
304static __inline__ int find_next_bit(void *addr, int size, int offset) 303static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
305{ 304{
306 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 305 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
307 unsigned long result = offset & ~31UL; 306 unsigned long result = offset & ~31UL;
@@ -367,7 +366,7 @@ found_middle:
367#define minix_test_bit(nr,addr) test_bit(nr,addr) 366#define minix_test_bit(nr,addr) test_bit(nr,addr)
368#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 367#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
369 368
370extern inline int sched_find_first_bit(unsigned long *b) 369extern inline int sched_find_first_bit(const unsigned long *b)
371{ 370{
372 if (unlikely(b[0])) 371 if (unlikely(b[0]))
373 return __ffs(b[0]); 372 return __ffs(b[0]);
diff --git a/include/asm-cris/kmap_types.h b/include/asm-cris/kmap_types.h
index eec0974c2417..492988cb9077 100644
--- a/include/asm-cris/kmap_types.h
+++ b/include/asm-cris/kmap_types.h
@@ -17,8 +17,8 @@ enum km_type {
17 KM_PTE1, 17 KM_PTE1,
18 KM_IRQ0, 18 KM_IRQ0,
19 KM_IRQ1, 19 KM_IRQ1,
20 KM_CRYPTO_USER, 20 KM_SOFTIRQ0,
21 KM_CRYPTO_SOFTIRQ, 21 KM_SOFTIRQ1,
22 KM_TYPE_NR 22 KM_TYPE_NR
23}; 23};
24 24
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index c767da1ef8f5..bbf17bd39385 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -29,18 +29,15 @@
29 */ 29 */
30#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
31typedef struct { unsigned long pte; } pte_t; 31typedef struct { unsigned long pte; } pte_t;
32typedef struct { unsigned long pmd; } pmd_t;
33typedef struct { unsigned long pgd; } pgd_t; 32typedef struct { unsigned long pgd; } pgd_t;
34typedef struct { unsigned long pgprot; } pgprot_t; 33typedef struct { unsigned long pgprot; } pgprot_t;
35#endif 34#endif
36 35
37#define pte_val(x) ((x).pte) 36#define pte_val(x) ((x).pte)
38#define pmd_val(x) ((x).pmd)
39#define pgd_val(x) ((x).pgd) 37#define pgd_val(x) ((x).pgd)
40#define pgprot_val(x) ((x).pgprot) 38#define pgprot_val(x) ((x).pgprot)
41 39
42#define __pte(x) ((pte_t) { (x) } ) 40#define __pte(x) ((pte_t) { (x) } )
43#define __pmd(x) ((pmd_t) { (x) } )
44#define __pgd(x) ((pgd_t) { (x) } ) 41#define __pgd(x) ((pgd_t) { (x) } )
45#define __pgprot(x) ((pgprot_t) { (x) } ) 42#define __pgprot(x) ((pgprot_t) { (x) } )
46 43
@@ -73,10 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
73 70
74#ifndef __ASSEMBLY__ 71#ifndef __ASSEMBLY__
75 72
76#define BUG() do { \
77 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
78} while (0)
79
80/* Pure 2^n version of get_order */ 73/* Pure 2^n version of get_order */
81static inline int get_order(unsigned long size) 74static inline int get_order(unsigned long size)
82{ 75{
diff --git a/include/asm-cris/pgalloc.h b/include/asm-cris/pgalloc.h
index b202e62ed6e0..a131776edf41 100644
--- a/include/asm-cris/pgalloc.h
+++ b/include/asm-cris/pgalloc.h
@@ -47,16 +47,6 @@ extern inline void pte_free(struct page *pte)
47 47
48#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 48#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
49 49
50/*
51 * We don't have any real pmd's, and this code never triggers because
52 * the pgd will always be present..
53 */
54
55#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
56#define pmd_free(x) do { } while (0)
57#define __pmd_free_tlb(tlb,x) do { } while (0)
58#define pgd_populate(mm, pmd, pte) BUG()
59
60#define check_pgt_cache() do { } while (0) 50#define check_pgt_cache() do { } while (0)
61 51
62#endif 52#endif
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
index f7042944b073..a9143bed99db 100644
--- a/include/asm-cris/pgtable.h
+++ b/include/asm-cris/pgtable.h
@@ -5,7 +5,8 @@
5#ifndef _CRIS_PGTABLE_H 5#ifndef _CRIS_PGTABLE_H
6#define _CRIS_PGTABLE_H 6#define _CRIS_PGTABLE_H
7 7
8#include <asm-generic/4level-fixup.h> 8#include <asm/page.h>
9#include <asm-generic/pgtable-nopmd.h>
9 10
10#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
11#include <linux/config.h> 12#include <linux/config.h>
@@ -41,22 +42,14 @@ extern void paging_init(void);
41 * but the define is needed for a generic inline function.) 42 * but the define is needed for a generic inline function.)
42 */ 43 */
43#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) 44#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
44#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) 45#define set_pgu(pudptr, pudval) (*(pudptr) = pudval)
45 46
46/* PMD_SHIFT determines the size of the area a second-level page table can 47/* PGDIR_SHIFT determines the size of the area a second-level page table can
47 * map. It is equal to the page size times the number of PTE's that fit in 48 * map. It is equal to the page size times the number of PTE's that fit in
48 * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number. 49 * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number.
49 */ 50 */
50 51
51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2)) 52#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2))
52#define PMD_SIZE (1UL << PMD_SHIFT)
53#define PMD_MASK (~(PMD_SIZE-1))
54
55/* PGDIR_SHIFT determines what a third-level page table entry can map.
56 * Since we fold into a two-level structure, this is the same as PMD_SHIFT.
57 */
58
59#define PGDIR_SHIFT PMD_SHIFT
60#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 53#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
61#define PGDIR_MASK (~(PGDIR_SIZE-1)) 54#define PGDIR_MASK (~(PGDIR_SIZE-1))
62 55
@@ -67,7 +60,6 @@ extern void paging_init(void);
67 * divide it by 4 (shift by 2). 60 * divide it by 4 (shift by 2).
68 */ 61 */
69#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2)) 62#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2))
70#define PTRS_PER_PMD 1
71#define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2)) 63#define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2))
72 64
73/* calculate how many PGD entries a user-level program can use 65/* calculate how many PGD entries a user-level program can use
@@ -105,7 +97,7 @@ extern unsigned long empty_zero_page;
105#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) 97#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
106#define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0) 98#define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0)
107 99
108#define pmd_none(x) (!pmd_val(x)) 100#define pmd_none(x) (!pmd_val(x))
109/* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad 101/* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad
110 * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries. 102 * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries.
111 */ 103 */
@@ -116,16 +108,6 @@ extern unsigned long empty_zero_page;
116#ifndef __ASSEMBLY__ 108#ifndef __ASSEMBLY__
117 109
118/* 110/*
119 * The "pgd_xxx()" functions here are trivial for a folded two-level
120 * setup: the pgd is never bad, and a pmd always exists (as it's folded
121 * into the pgd entry)
122 */
123extern inline int pgd_none(pgd_t pgd) { return 0; }
124extern inline int pgd_bad(pgd_t pgd) { return 0; }
125extern inline int pgd_present(pgd_t pgd) { return 1; }
126extern inline void pgd_clear(pgd_t * pgdp) { }
127
128/*
129 * The following only work if pte_present() is true. 111 * The following only work if pte_present() is true.
130 * Undefined behaviour if not.. 112 * Undefined behaviour if not..
131 */ 113 */
@@ -275,7 +257,7 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
275#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 257#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
276 258
277/* to find an entry in a page-table-directory. */ 259/* to find an entry in a page-table-directory. */
278#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 260#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
279 261
280/* to find an entry in a page-table-directory */ 262/* to find an entry in a page-table-directory */
281extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) 263extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
@@ -286,12 +268,6 @@ extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
286/* to find an entry in a kernel page-table-directory */ 268/* to find an entry in a kernel page-table-directory */
287#define pgd_offset_k(address) pgd_offset(&init_mm, address) 269#define pgd_offset_k(address) pgd_offset(&init_mm, address)
288 270
289/* Find an entry in the second-level page table.. */
290extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
291{
292 return (pmd_t *) dir;
293}
294
295/* Find an entry in the third-level page table.. */ 271/* Find an entry in the third-level page table.. */
296#define __pte_offset(address) \ 272#define __pte_offset(address) \
297 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 273 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
@@ -308,8 +284,6 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
308 284
309#define pte_ERROR(e) \ 285#define pte_ERROR(e) \
310 printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) 286 printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e))
311#define pmd_ERROR(e) \
312 printk("%s:%d: bad pmd %p(%08lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
313#define pgd_ERROR(e) \ 287#define pgd_ERROR(e) \
314 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) 288 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
315 289
@@ -348,5 +322,7 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma,
348#define pte_to_pgoff(x) (pte_val(x) >> 6) 322#define pte_to_pgoff(x) (pte_val(x) >> 6)
349#define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) 323#define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE)
350 324
325typedef pte_t *pte_addr_t;
326
351#endif /* __ASSEMBLY__ */ 327#endif /* __ASSEMBLY__ */
352#endif /* _CRIS_PGTABLE_H */ 328#endif /* _CRIS_PGTABLE_H */
diff --git a/include/asm-cris/processor.h b/include/asm-cris/processor.h
index 623bdf06d911..0dc218117bd8 100644
--- a/include/asm-cris/processor.h
+++ b/include/asm-cris/processor.h
@@ -55,15 +55,6 @@ unsigned long get_wchan(struct task_struct *p);
55 55
56#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 56#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
57 57
58/*
59 * Free current thread data structures etc..
60 */
61
62extern inline void exit_thread(void)
63{
64 /* Nothing needs to be done. */
65}
66
67extern unsigned long thread_saved_pc(struct task_struct *tsk); 58extern unsigned long thread_saved_pc(struct task_struct *tsk);
68 59
69/* Free all resources held by a thread. */ 60/* Free all resources held by a thread. */
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h
index 5ba4b7865cc5..cef0140fc104 100644
--- a/include/asm-cris/thread_info.h
+++ b/include/asm-cris/thread_info.h
@@ -43,7 +43,7 @@ struct thread_info {
43 43
44#endif 44#endif
45 45
46#define PREEMPT_ACTIVE 0x4000000 46#define PREEMPT_ACTIVE 0x10000000
47 47
48/* 48/*
49 * macros/functions for gaining access to the thread information structure 49 * macros/functions for gaining access to the thread information structure
diff --git a/include/asm-cris/timex.h b/include/asm-cris/timex.h
index 375c41af47de..3fb069a37717 100644
--- a/include/asm-cris/timex.h
+++ b/include/asm-cris/timex.h
@@ -14,7 +14,7 @@
14 * used so it does not matter. 14 * used so it does not matter.
15 */ 15 */
16 16
17typedef unsigned int cycles_t; 17typedef unsigned long long cycles_t;
18 18
19extern inline cycles_t get_cycles(void) 19extern inline cycles_t get_cycles(void)
20{ 20{
diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h
index 41a0d450ba1d..8fa6d6c7afce 100644
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -52,7 +52,7 @@ typedef unsigned long long u64;
52typedef u32 dma_addr_t; 52typedef u32 dma_addr_t;
53typedef u32 dma64_addr_t; 53typedef u32 dma64_addr_t;
54 54
55typedef unsigned int kmem_bufctl_t; 55typedef unsigned short kmem_bufctl_t;
56 56
57#endif /* __ASSEMBLY__ */ 57#endif /* __ASSEMBLY__ */
58 58
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index e80bf276b101..28232ad2ff34 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -288,8 +288,15 @@
288#define __NR_mq_timedreceive (__NR_mq_open+3) 288#define __NR_mq_timedreceive (__NR_mq_open+3)
289#define __NR_mq_notify (__NR_mq_open+4) 289#define __NR_mq_notify (__NR_mq_open+4)
290#define __NR_mq_getsetattr (__NR_mq_open+5) 290#define __NR_mq_getsetattr (__NR_mq_open+5)
291 291#define __NR_sys_kexec_load 283
292#define NR_syscalls 283 292#define __NR_waitid 284
293/* #define __NR_sys_setaltroot 285 */
294#define __NR_add_key 286
295#define __NR_request_key 287
296#define __NR_keyctl 288
297
298#define NR_syscalls 289
299
293 300
294 301
295#ifdef __KERNEL__ 302#ifdef __KERNEL__