Skip to content

Commit 5d01e6c

Browse files
Mikael StarvikLinus Torvalds
authored andcommitted
[PATCH] CRIS update: updates for 2.6.12
Patches to make CRIS work with 2.6.12. Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent dcf1310 commit 5d01e6c

15 files changed

Lines changed: 88 additions & 119 deletions

File tree

‎arch/cris/arch-v10/kernel/ptrace.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/ptrace.h>
1212
#include <linux/user.h>
1313
#include <linux/signal.h>
14+
#include <linux/security.h>
1415

1516
#include <asm/uaccess.h>
1617
#include <asm/page.h>
@@ -86,9 +87,13 @@ sys_ptrace(long request, long pid, long addr, long data)
8687
ret = -EPERM;
8788

8889
if (request == PTRACE_TRACEME) {
90+
/* are we already being traced? */
8991
if (current->ptrace & PT_PTRACED)
9092
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. */
9297
current->ptrace |= PT_PTRACED;
9398
ret = 0;
9499
goto out;
@@ -207,7 +212,7 @@ sys_ptrace(long request, long pid, long addr, long data)
207212
case PTRACE_KILL:
208213
ret = 0;
209214

210-
if (child->state == TASK_ZOMBIE)
215+
if (child->exit_state == EXIT_ZOMBIE)
211216
break;
212217

213218
child->exit_code = SIGKILL;

‎arch/cris/kernel/module.c‎

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void *module_alloc(unsigned long size)
3232
{
3333
if (size == 0)
3434
return NULL;
35-
return vmalloc(size);
35+
return vmalloc_exec(size);
3636
}
3737

3838

@@ -59,26 +59,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
5959
unsigned int relsec,
6060
struct module *me)
6161
{
62-
unsigned int i;
63-
Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
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;
62+
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
63+
return -ENOEXEC;
8264
}
8365

8466
int apply_relocate_add(Elf32_Shdr *sechdrs,
@@ -90,7 +72,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
9072
unsigned int i;
9173
Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
9274

93-
DEBUGP ("Applying relocate section %u to %u\n", relsec,
75+
DEBUGP ("Applying add relocate section %u to %u\n", relsec,
9476
sechdrs[relsec].sh_info);
9577

9678
for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
@@ -103,7 +85,18 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
10385
Elf32_Sym *sym
10486
= ((Elf32_Sym *)sechdrs[symindex].sh_addr
10587
+ 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+
}
107100
}
108101

109102
return 0;

‎arch/cris/kernel/process.c‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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 $
22
*
33
* linux/arch/cris/kernel/process.c
44
*
@@ -8,6 +8,18 @@
88
* Authors: Bjorn Wesen (bjornw@axis.com)
99
*
1010
* $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+
*
1123
* Revision 1.17 2004/04/05 13:53:48 starvik
1224
* Merge of Linux 2.6.5
1325
*
@@ -161,18 +173,18 @@ EXPORT_SYMBOL(init_task);
161173
* region by enable_hlt/disable_hlt.
162174
*/
163175

164-
static int hlt_counter=0;
176+
int cris_hlt_counter=0;
165177

166178
void disable_hlt(void)
167179
{
168-
hlt_counter++;
180+
cris_hlt_counter++;
169181
}
170182

171183
EXPORT_SYMBOL(disable_hlt);
172184

173185
void enable_hlt(void)
174186
{
175-
hlt_counter--;
187+
cris_hlt_counter--;
176188
}
177189

178190
EXPORT_SYMBOL(enable_hlt);
@@ -195,16 +207,19 @@ void cpu_idle (void)
195207
/* endless idle loop with no priority at all */
196208
while (1) {
197209
while (!need_resched()) {
198-
void (*idle)(void) = pm_idle;
199-
210+
void (*idle)(void);
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;
200217
if (!idle)
201218
idle = default_idle;
202-
203219
idle();
204220
}
205221
schedule();
206222
}
207-
208223
}
209224

210225
void hard_reset_now (void);

‎include/asm-cris/arch-v10/bitops.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern inline unsigned long ffz(unsigned long w)
5151
*
5252
* Undefined if no bit exists, so code should check against 0 first.
5353
*/
54-
extern __inline__ unsigned long __ffs(unsigned long word)
54+
extern inline unsigned long __ffs(unsigned long word)
5555
{
5656
return cris_swapnwbrlz(~word);
5757
}

‎include/asm-cris/arch-v10/offset.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */
2626
#define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */
2727

28-
#define TASK_pid 133 /* offsetof(struct task_struct, pid) */
28+
#define TASK_pid 141 /* offsetof(struct task_struct, pid) */
2929

3030
#define LCLONE_VM 256 /* CLONE_VM */
3131
#define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */

‎include/asm-cris/bitops.h‎

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <asm/arch/bitops.h>
1818
#include <asm/system.h>
19+
#include <asm/atomic.h>
1920
#include <linux/compiler.h>
2021

2122
/*
@@ -88,23 +89,23 @@ struct __dummy { unsigned long a[100]; };
8889
* It also implies a memory barrier.
8990
*/
9091

91-
extern inline int test_and_set_bit(int nr, void *addr)
92+
extern inline int test_and_set_bit(int nr, volatile unsigned long *addr)
9293
{
9394
unsigned int mask, retval;
9495
unsigned long flags;
9596
unsigned int *adr = (unsigned int *)addr;
9697

9798
adr += nr >> 5;
9899
mask = 1 << (nr & 0x1f);
99-
local_save_flags(flags);
100-
local_irq_disable();
100+
cris_atomic_save(addr, flags);
101101
retval = (mask & *adr) != 0;
102102
*adr |= mask;
103+
cris_atomic_restore(addr, flags);
103104
local_irq_restore(flags);
104105
return retval;
105106
}
106107

107-
extern inline int __test_and_set_bit(int nr, void *addr)
108+
extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
108109
{
109110
unsigned int mask, retval;
110111
unsigned int *adr = (unsigned int *)addr;
@@ -131,19 +132,18 @@ extern inline int __test_and_set_bit(int nr, void *addr)
131132
* It also implies a memory barrier.
132133
*/
133134

134-
extern inline int test_and_clear_bit(int nr, void *addr)
135+
extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
135136
{
136137
unsigned int mask, retval;
137138
unsigned long flags;
138139
unsigned int *adr = (unsigned int *)addr;
139140

140141
adr += nr >> 5;
141142
mask = 1 << (nr & 0x1f);
142-
local_save_flags(flags);
143-
local_irq_disable();
143+
cris_atomic_save(addr, flags);
144144
retval = (mask & *adr) != 0;
145145
*adr &= ~mask;
146-
local_irq_restore(flags);
146+
cris_atomic_restore(addr, flags);
147147
return retval;
148148
}
149149

@@ -157,7 +157,7 @@ extern inline int test_and_clear_bit(int nr, void *addr)
157157
* but actually fail. You must protect multiple accesses with a lock.
158158
*/
159159

160-
extern inline int __test_and_clear_bit(int nr, void *addr)
160+
extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
161161
{
162162
unsigned int mask, retval;
163163
unsigned int *adr = (unsigned int *)addr;
@@ -177,24 +177,23 @@ extern inline int __test_and_clear_bit(int nr, void *addr)
177177
* It also implies a memory barrier.
178178
*/
179179

180-
extern inline int test_and_change_bit(int nr, void *addr)
180+
extern inline int test_and_change_bit(int nr, volatile unsigned long *addr)
181181
{
182182
unsigned int mask, retval;
183183
unsigned long flags;
184184
unsigned int *adr = (unsigned int *)addr;
185185
adr += nr >> 5;
186186
mask = 1 << (nr & 0x1f);
187-
local_save_flags(flags);
188-
local_irq_disable();
187+
cris_atomic_save(addr, flags);
189188
retval = (mask & *adr) != 0;
190189
*adr ^= mask;
191-
local_irq_restore(flags);
190+
cris_atomic_restore(addr, flags);
192191
return retval;
193192
}
194193

195194
/* WARNING: non atomic and it can be reordered! */
196195

197-
extern inline int __test_and_change_bit(int nr, void *addr)
196+
extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
198197
{
199198
unsigned int mask, retval;
200199
unsigned int *adr = (unsigned int *)addr;
@@ -215,7 +214,7 @@ extern inline int __test_and_change_bit(int nr, void *addr)
215214
* This routine doesn't need to be atomic.
216215
*/
217216

218-
extern inline int test_bit(int nr, const void *addr)
217+
extern inline int test_bit(int nr, const volatile unsigned long *addr)
219218
{
220219
unsigned int mask;
221220
unsigned int *adr = (unsigned int *)addr;
@@ -259,7 +258,7 @@ extern inline int test_bit(int nr, const void *addr)
259258
* @offset: The bitnumber to start searching at
260259
* @size: The maximum size to search
261260
*/
262-
extern inline int find_next_zero_bit (void * addr, int size, int offset)
261+
extern inline int find_next_zero_bit (const unsigned long * addr, int size, int offset)
263262
{
264263
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
265264
unsigned long result = offset & ~31UL;
@@ -301,7 +300,7 @@ extern inline int find_next_zero_bit (void * addr, int size, int offset)
301300
* @offset: The bitnumber to start searching at
302301
* @size: The maximum size to search
303302
*/
304-
static __inline__ int find_next_bit(void *addr, int size, int offset)
303+
static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
305304
{
306305
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
307306
unsigned long result = offset & ~31UL;
@@ -367,7 +366,7 @@ static __inline__ int find_next_bit(void *addr, int size, int offset)
367366
#define minix_test_bit(nr,addr) test_bit(nr,addr)
368367
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
369368

370-
extern inline int sched_find_first_bit(unsigned long *b)
369+
extern inline int sched_find_first_bit(const unsigned long *b)
371370
{
372371
if (unlikely(b[0]))
373372
return __ffs(b[0]);

‎include/asm-cris/kmap_types.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ enum km_type {
1717
KM_PTE1,
1818
KM_IRQ0,
1919
KM_IRQ1,
20-
KM_CRYPTO_USER,
21-
KM_CRYPTO_SOFTIRQ,
20+
KM_SOFTIRQ0,
21+
KM_SOFTIRQ1,
2222
KM_TYPE_NR
2323
};
2424

‎include/asm-cris/page.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,15 @@
2929
*/
3030
#ifndef __ASSEMBLY__
3131
typedef struct { unsigned long pte; } pte_t;
32-
typedef struct { unsigned long pmd; } pmd_t;
3332
typedef struct { unsigned long pgd; } pgd_t;
3433
typedef struct { unsigned long pgprot; } pgprot_t;
3534
#endif
3635

3736
#define pte_val(x) ((x).pte)
38-
#define pmd_val(x) ((x).pmd)
3937
#define pgd_val(x) ((x).pgd)
4038
#define pgprot_val(x) ((x).pgprot)
4139

4240
#define __pte(x) ((pte_t) { (x) } )
43-
#define __pmd(x) ((pmd_t) { (x) } )
4441
#define __pgd(x) ((pgd_t) { (x) } )
4542
#define __pgprot(x) ((pgprot_t) { (x) } )
4643

@@ -73,10 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
7370

7471
#ifndef __ASSEMBLY__
7572

76-
#define BUG() do { \
77-
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
78-
} while (0)
79-
8073
/* Pure 2^n version of get_order */
8174
static inline int get_order(unsigned long size)
8275
{

‎include/asm-cris/pgalloc.h‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ extern inline void pte_free(struct page *pte)
4747

4848
#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
4949

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-
6050
#define check_pgt_cache() do { } while (0)
6151

6252
#endif

0 commit comments

Comments
 (0)