Skip to content

Commit b9d6243

Browse files
committed
Merge branch 'work.sparc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2 parents 062c84f + 415ddc3 commit b9d6243

File tree

8 files changed

+5
-121
lines changed

8 files changed

+5
-121
lines changed

arch/sparc/include/asm/processor_32.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,12 @@ struct thread_struct {
5050
unsigned long fsr;
5151
unsigned long fpqdepth;
5252
struct fpq fpqueue[16];
53-
unsigned long flags;
5453
mm_segment_t current_ds;
5554
};
5655

57-
#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
58-
#define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */
59-
6056
#define INIT_THREAD { \
61-
.flags = SPARC_FLAG_KTHREAD, \
6257
.current_ds = KERNEL_DS, \
58+
.kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
6359
}
6460

6561
/* Do necessary setup to start up a newly executed thread. */

arch/sparc/include/asm/thread_info_64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct thread_info {
118118
.task = &tsk, \
119119
.current_ds = ASI_P, \
120120
.preempt_count = INIT_PREEMPT_COUNT, \
121+
.kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
121122
}
122123

123124
/* how to get the thread information struct from C */

arch/sparc/kernel/head_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ continue_boot:
515515

516516
/* I want a kernel stack NOW! */
517517
set init_thread_union, %g1
518-
set (THREAD_SIZE - STACKFRAME_SZ), %g2
518+
set (THREAD_SIZE - STACKFRAME_SZ - TRACEREG_SZ), %g2
519519
add %g1, %g2, %sp
520520
mov 0, %fp /* And for good luck */
521521

arch/sparc/kernel/head_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ tlb_fixup_done:
706706
wr %g0, ASI_P, %asi
707707
mov 1, %g1
708708
sllx %g1, THREAD_SHIFT, %g1
709-
sub %g1, (STACKFRAME_SZ + STACK_BIAS), %g1
709+
sub %g1, (STACKFRAME_SZ + STACK_BIAS + TRACEREG_SZ), %g1
710710
add %g6, %g1, %sp
711711

712712
/* Set per-cpu pointer initially to zero, this makes

arch/sparc/kernel/process_32.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,6 @@ void flush_thread(void)
216216
clear_thread_flag(TIF_USEDFPU);
217217
#endif
218218
}
219-
220-
/* This task is no longer a kernel thread. */
221-
if (current->thread.flags & SPARC_FLAG_KTHREAD) {
222-
current->thread.flags &= ~SPARC_FLAG_KTHREAD;
223-
224-
/* We must fixup kregs as well. */
225-
/* XXX This was not fixed for ti for a while, worked. Unused? */
226-
current->thread.kregs = (struct pt_regs *)
227-
(task_stack_page(current) + (THREAD_SIZE - TRACEREG_SZ));
228-
}
229219
}
230220

231221
static inline struct sparc_stackf __user *
@@ -313,7 +303,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
313303
extern int nwindows;
314304
unsigned long psr;
315305
memset(new_stack, 0, STACKFRAME_SZ + TRACEREG_SZ);
316-
p->thread.flags |= SPARC_FLAG_KTHREAD;
317306
p->thread.current_ds = KERNEL_DS;
318307
ti->kpc = (((unsigned long) ret_from_kernel_thread) - 0x8);
319308
childregs->u_regs[UREG_G1] = sp; /* function */
@@ -325,7 +314,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
325314
}
326315
memcpy(new_stack, (char *)regs - STACKFRAME_SZ, STACKFRAME_SZ + TRACEREG_SZ);
327316
childregs->u_regs[UREG_FP] = sp;
328-
p->thread.flags &= ~SPARC_FLAG_KTHREAD;
329317
p->thread.current_ds = USER_DS;
330318
ti->kpc = (((unsigned long) ret_from_fork) - 0x8);
331319
ti->kpsr = current->thread.fork_kpsr | PSR_PIL;

arch/sparc/kernel/setup_32.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ static __init void leon_patch(void)
266266
}
267267

268268
struct tt_entry *sparc_ttable;
269-
static struct pt_regs fake_swapper_regs;
270269

271270
/* Called from head_32.S - before we have setup anything
272271
* in the kernel. Be very careful with what you do here.
@@ -363,8 +362,6 @@ void __init setup_arch(char **cmdline_p)
363362
(*(linux_dbvec->teach_debugger))();
364363
}
365364

366-
init_task.thread.kregs = &fake_swapper_regs;
367-
368365
/* Run-time patch instructions to match the cpu model */
369366
per_cpu_patch();
370367

arch/sparc/kernel/setup_64.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ extern int root_mountflags;
165165

166166
char reboot_command[COMMAND_LINE_SIZE];
167167

168-
static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
169-
170168
static void __init per_cpu_patch(void)
171169
{
172170
struct cpuid_patch_entry *p;
@@ -661,8 +659,6 @@ void __init setup_arch(char **cmdline_p)
661659
rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
662660
#endif
663661

664-
task_thread_info(&init_task)->kregs = &fake_swapper_regs;
665-
666662
#ifdef CONFIG_IP_PNP
667663
if (!ic_set_manually) {
668664
phandle chosen = prom_finddevice("/chosen");

arch/sparc/kernel/unaligned_32.c

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -274,103 +274,9 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
274274
}
275275
}
276276

277-
static inline int ok_for_user(struct pt_regs *regs, unsigned int insn,
278-
enum direction dir)
279-
{
280-
unsigned int reg;
281-
int size = ((insn >> 19) & 3) == 3 ? 8 : 4;
282-
283-
if ((regs->pc | regs->npc) & 3)
284-
return 0;
285-
286-
/* Must access_ok() in all the necessary places. */
287-
#define WINREG_ADDR(regnum) \
288-
((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
289-
290-
reg = (insn >> 25) & 0x1f;
291-
if (reg >= 16) {
292-
if (!access_ok(WINREG_ADDR(reg - 16), size))
293-
return -EFAULT;
294-
}
295-
reg = (insn >> 14) & 0x1f;
296-
if (reg >= 16) {
297-
if (!access_ok(WINREG_ADDR(reg - 16), size))
298-
return -EFAULT;
299-
}
300-
if (!(insn & 0x2000)) {
301-
reg = (insn & 0x1f);
302-
if (reg >= 16) {
303-
if (!access_ok(WINREG_ADDR(reg - 16), size))
304-
return -EFAULT;
305-
}
306-
}
307-
#undef WINREG_ADDR
308-
return 0;
309-
}
310-
311-
static void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
277+
asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
312278
{
313279
send_sig_fault(SIGBUS, BUS_ADRALN,
314280
(void __user *)safe_compute_effective_address(regs, insn),
315281
0, current);
316282
}
317-
318-
asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
319-
{
320-
enum direction dir;
321-
322-
if(!(current->thread.flags & SPARC_FLAG_UNALIGNED) ||
323-
(((insn >> 30) & 3) != 3))
324-
goto kill_user;
325-
dir = decode_direction(insn);
326-
if(!ok_for_user(regs, insn, dir)) {
327-
goto kill_user;
328-
} else {
329-
int err, size = decode_access_size(insn);
330-
unsigned long addr;
331-
332-
if(floating_point_load_or_store_p(insn)) {
333-
printk("User FPU load/store unaligned unsupported.\n");
334-
goto kill_user;
335-
}
336-
337-
addr = compute_effective_address(regs, insn);
338-
perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, addr);
339-
switch(dir) {
340-
case load:
341-
err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
342-
regs),
343-
size, (unsigned long *) addr,
344-
decode_signedness(insn));
345-
break;
346-
347-
case store:
348-
err = do_int_store(((insn>>25)&0x1f), size,
349-
(unsigned long *) addr, regs);
350-
break;
351-
352-
case both:
353-
/*
354-
* This was supported in 2.4. However, we question
355-
* the value of SWAP instruction across word boundaries.
356-
*/
357-
printk("Unaligned SWAP unsupported.\n");
358-
err = -EFAULT;
359-
break;
360-
361-
default:
362-
unaligned_panic("Impossible user unaligned trap.");
363-
goto out;
364-
}
365-
if (err)
366-
goto kill_user;
367-
else
368-
advance(regs);
369-
goto out;
370-
}
371-
372-
kill_user:
373-
user_mna_trap_fault(regs, insn);
374-
out:
375-
;
376-
}

0 commit comments

Comments
 (0)