From 2e1c958de4e22b6badc13dba1a0ebaa5aa798664 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 2 Aug 2011 12:35:03 +0200 Subject: arch/openrisc/mm/init.c: trivial: use BUG_ON Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); @@ identifier x; @@ -if (!x) BUG(); +BUG_ON(!x); // Signed-off-by: Julia Lawall Signed-off-by: Jonas Bonn --- arch/openrisc/mm/init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c index 359dcb20fe8..736f6b2f30a 100644 --- a/arch/openrisc/mm/init.c +++ b/arch/openrisc/mm/init.c @@ -222,8 +222,7 @@ void __init mem_init(void) { int codesize, reservedpages, datasize, initsize; - if (!mem_map) - BUG(); + BUG_ON(!mem_map); set_max_mapnr_init(); -- cgit v1.2.3-70-g09d2 From dec830189e1e192a80f574243a2dc31bdc1c4fc5 Mon Sep 17 00:00:00 2001 From: Stefan Kristiansson Date: Thu, 10 Nov 2011 16:38:29 +0100 Subject: openrisc: enable passing of flattened device tree pointer This patch enables passing a fdt pointer to the kernel. This makes for the kernel parameter API: void kernel(unsigned int fdt); which, in accordance with the OpenRISC ABI results in: r3 = pointer to fdt Signed-off-by: Stefan Kristiansson Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/head.S | 17 ++++++++++++++++- arch/openrisc/kernel/setup.c | 18 +++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index c75018d2264..1088b5fca3b 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -26,6 +26,7 @@ #include #include #include +#include #define tophys(rd,rs) \ l.movhi rd,hi(-KERNELBASE) ;\ @@ -440,6 +441,9 @@ _dispatch_do_ipage_fault: __HEAD .global _start _start: + /* save kernel parameters */ + l.or r25,r0,r3 /* pointer to fdt */ + /* * ensure a deterministic start */ @@ -471,7 +475,6 @@ _start: CLEAR_GPR(r22) CLEAR_GPR(r23) CLEAR_GPR(r24) - CLEAR_GPR(r25) CLEAR_GPR(r26) CLEAR_GPR(r27) CLEAR_GPR(r28) @@ -565,6 +568,18 @@ enable_mmu: // reset the simulation counters l.nop 5 + /* check fdt header magic word */ + l.lwz r3,0(r25) /* load magic from fdt into r3 */ + l.movhi r4,hi(OF_DT_HEADER) + l.ori r4,r4,lo(OF_DT_HEADER) + l.sfeq r3,r4 + l.bf _fdt_found + l.nop + /* magic number mismatch, set fdt pointer to null */ + l.or r25,r0,r0 +_fdt_found: + /* pass fdt pointer to or32_early_setup in r3 */ + l.or r3,r0,r25 LOAD_SYMBOL_2_GPR(r24, or32_early_setup) l.jalr r24 l.nop diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index 1422f747f52..bf5eba22ce9 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c @@ -207,18 +207,18 @@ void __init setup_cpuinfo(void) * Handles the pointer to the device tree that this kernel is to use * for establishing the available platform devices. * - * For now, this is limited to using the built-in device tree. In the future, - * it is intended that this function will take a pointer to the device tree - * that is potentially built-in, but potentially also passed in by the - * bootloader, or discovered by some equally clever means... + * Falls back on built-in device tree in case null pointer is passed. */ -void __init or32_early_setup(void) +void __init or32_early_setup(unsigned int fdt) { - - early_init_devtree(__dtb_start); - - printk(KERN_INFO "Compiled-in FDT at 0x%p\n", __dtb_start); + if (fdt) { + early_init_devtree((void*) fdt); + printk(KERN_INFO "FDT at 0x%08x\n", fdt); + } else { + early_init_devtree(__dtb_start); + printk(KERN_INFO "Compiled-in FDT at %p\n", __dtb_start); + } } static int __init openrisc_device_probe(void) -- cgit v1.2.3-70-g09d2 From 4ca159f725e46462fbad64c928437a6651f6405b Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 14 Feb 2012 11:40:54 +0000 Subject: OpenRISC: Don't reimplement force_sigsegv() Instead of open coding the sequence from force_sigsegv() just call it. This also fixes a bug because we were modifying ka->sa.sa_handler (which is a copy of sighand->action[]), whereas the intention of the code was to modify sighand->action[] directly. As the original code was working with a copy it had no effect on signal delivery. Acked-by: Oleg Nesterov Cc: Jonas Bonn Cc: Arnd Bergmann Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/signal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 95207ab0c99..53741ba0210 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -250,9 +250,7 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, return; give_sigsegv: - if (sig == SIGSEGV) - ka->sa.sa_handler = SIG_DFL; - force_sig(SIGSEGV, current); + force_sigsegv(sig, current); } static inline void -- cgit v1.2.3-70-g09d2 From b675eeb743abaa0b99a35c1fd32fea8e13a17d32 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 14 Feb 2012 11:40:55 +0000 Subject: OpenRISC: No need to reset handler if SA_ONESHOT get_signal_to_deliver() already resets the signal handler if SA_ONESHOT is set in ka->sa.sa_flags, there's no need to do it again in handle_signal(). Furthermore, because we were modifying ka->sa.sa_handler (which is a copy of sighand->action[]) instead of sighand->action[] the original code actually had no effect on signal delivery. Acked-by: Oleg Nesterov Cc: Jonas Bonn Cc: Arnd Bergmann Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/signal.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 53741ba0210..92d2218fcb9 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -260,9 +260,6 @@ handle_signal(unsigned long sig, { setup_rt_frame(sig, ka, info, oldset, regs); - if (ka->sa.sa_flags & SA_ONESHOT) - ka->sa.sa_handler = SIG_DFL; - spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NODEFER)) -- cgit v1.2.3-70-g09d2 From e933c70de0e2590d41f5edd3133e7ee12b4e0bc6 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 14 Feb 2012 11:40:56 +0000 Subject: OpenRISC: Don't mask signals if we fail to setup signal stack setup_rt_frame() needs to return an indication of whether it succeeded or failed in setting up the signal stack frame. If setup_rt_frame() fails then we must not modify current->blocked. Acked-by: Oleg Nesterov Cc: Jonas Bonn Cc: Arnd Bergmann Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/signal.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 92d2218fcb9..14764e827a6 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -189,8 +189,8 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, * trampoline which performs the syscall sigreturn, or a provided * user-mode trampoline. */ -static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs *regs) +static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *set, struct pt_regs *regs) { struct rt_sigframe *frame; unsigned long return_ip; @@ -247,18 +247,23 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, /* actually move the usp to reflect the stacked frame */ regs->sp = (unsigned long)frame; - return; + return 0; give_sigsegv: force_sigsegv(sig, current); + return -EFAULT; } -static inline void +static inline int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) { - setup_rt_frame(sig, ka, info, oldset, regs); + int ret; + + ret = setup_rt_frame(sig, ka, info, oldset, regs); + if (ret) + return ret; spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); @@ -267,6 +272,8 @@ handle_signal(unsigned long sig, recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); + + return 0; } /* @@ -355,13 +362,13 @@ void do_signal(struct pt_regs *regs) oldset = ¤t->blocked; /* Whee! Actually deliver the signal. */ - handle_signal(signr, &info, &ka, oldset, regs); - /* a signal was successfully delivered; the saved - * sigmask will have been stored in the signal frame, - * and will be restored by sigreturn, so we can simply - * clear the TIF_RESTORE_SIGMASK flag */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) + if (!handle_signal(signr, &info, &ka, oldset, regs)) { + /* a signal was successfully delivered; the saved + * sigmask will have been stored in the signal frame, + * and will be restored by sigreturn, so we can simply + * clear the TIF_RESTORE_SIGMASK flag */ clear_thread_flag(TIF_RESTORE_SIGMASK); + } tracehook_signal_handler(signr, &info, &ka, regs, test_thread_flag(TIF_SINGLESTEP)); -- cgit v1.2.3-70-g09d2 From d8d4b20df48287a7e9e37f706c410b13bc0438cf Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 14 Feb 2012 11:40:57 +0000 Subject: OpenRISC: Use set_current_blocked() and block_sigmask() As described in e6fa16ab ("signal: sigprocmask() should do retarget_shared_pending()") the modification of current->blocked is incorrect as we need to check whether the signal we're about to block is pending in the shared queue. Also, use the new helper function introduced in commit 5e6292c0f28f ("signal: add block_sigmask() for adding sigmask to current->blocked") which centralises the code for updating current->blocked after successfully delivering a signal and reduces the amount of duplicate code across architectures. In the past some architectures got this code wrong, so using this helper function should stop that from happening again. Cc: Oleg Nesterov Cc: Jonas Bonn Cc: Arnd Bergmann Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/signal.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 14764e827a6..cf35ea032a7 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -102,10 +102,7 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs) goto badframe; sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); + set_current_blocked(&set); if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) goto badframe; @@ -265,13 +262,7 @@ handle_signal(unsigned long sig, if (ret) return ret; - spin_lock_irq(¤t->sighand->siglock); - sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); - if (!(ka->sa.sa_flags & SA_NODEFER)) - sigaddset(¤t->blocked, sig); - recalc_sigpending(); - - spin_unlock_irq(¤t->sighand->siglock); + block_sigmask(ka, sig); return 0; } -- cgit v1.2.3-70-g09d2 From 17425275112960af0dc9882c06c343d3b6ec8dc9 Mon Sep 17 00:00:00 2001 From: Danny Kukawka Date: Thu, 16 Feb 2012 14:56:14 +0100 Subject: openrisc: included linux/thread_info.h twice arch/openrisc/include/asm/uaccess.h: included 'linux/thread_info.h' twice, remove the duplicate. Signed-off-by: Danny Kukawka Signed-off-by: Jonas Bonn --- arch/openrisc/include/asm/uaccess.h | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index c310e45b538..f5abaa0ffc3 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #define VERIFY_READ 0 -- cgit v1.2.3-70-g09d2 From 754d5c2bf65847f7ff4e0047a830154abe666112 Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Fri, 18 Nov 2011 14:40:04 +0100 Subject: openrisc: Set shortest clock event to 100 ticks It takes a couple of instructions to actually configure a clock event so setting an alarm just 1 clock cycle in the future isn't going to work; doing so results in setting an alarm in the "past" in which case the event won't fire until the timer overflows and rolls back around to the "current time". Not quite sure how many clock cycles it actually takes to get through to actually writing the register, but 100 seems to work reliably. Use generic helper to set up the clock event while we're at it. Reported-by: Jan Schulte Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/time.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/time.c b/arch/openrisc/kernel/time.c index bd946ef1623..7c52e9494a8 100644 --- a/arch/openrisc/kernel/time.c +++ b/arch/openrisc/kernel/time.c @@ -125,16 +125,13 @@ irqreturn_t __irq_entry timer_interrupt(struct pt_regs *regs) static __init void openrisc_clockevent_init(void) { - clockevents_calc_mult_shift(&clockevent_openrisc_timer, - cpuinfo.clock_frequency, 4); + clockevent_openrisc_timer.cpumask = cpumask_of(0); /* We only have 28 bits */ - clockevent_openrisc_timer.max_delta_ns = - clockevent_delta2ns((u32) 0x0fffffff, &clockevent_openrisc_timer); - clockevent_openrisc_timer.min_delta_ns = - clockevent_delta2ns(1, &clockevent_openrisc_timer); - clockevent_openrisc_timer.cpumask = cpumask_of(0); - clockevents_register_device(&clockevent_openrisc_timer); + clockevents_config_and_register(&clockevent_openrisc_timer, + cpuinfo.clock_frequency, + 100, 0x0fffffff); + } /** -- cgit v1.2.3-70-g09d2 From 0662d33ad940a2bc4aff4c6a6701e2168dae1cc5 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Fri, 2 Mar 2012 01:55:11 +0100 Subject: OpenRISC: Select GENERIC_ATOMIC64 To have atomit64_t on OpenRISC we need GENERIC_ATOMIC64. Signed-off-by: Richard Weinberger Signed-off-by: Jonas Bonn --- arch/openrisc/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/openrisc') diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index bc428b5f126..a4787197d8f 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -16,6 +16,7 @@ config OPENRISC select GENERIC_IRQ_SHOW select GENERIC_IOMAP select GENERIC_CPU_DEVICES + select GENERIC_ATOMIC64 config MMU def_bool y -- cgit v1.2.3-70-g09d2 From 01c4d33ac5ca7920f0e0f6b25bdfd3fa479fd973 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Fri, 2 Mar 2012 01:55:15 +0100 Subject: OpenRISC: Export dump_stack() dump_stack() is used by modules and needs to be exported. Signed-off-by: Richard Weinberger Signed-off-by: Jonas Bonn --- arch/openrisc/kernel/traps.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index a4ec44a052b..ab68ffc8575 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -115,6 +115,7 @@ void dump_stack(void) show_stack(current, &stack); } +EXPORT_SYMBOL(dump_stack); void show_registers(struct pt_regs *regs) { -- cgit v1.2.3-70-g09d2 From 2f099a280e92c259598d8ed8da82c7ec2dd49845 Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Fri, 2 Mar 2012 07:56:09 +0100 Subject: openrisc: fix virt_addr_valid virt_addr_valid() shouldn't be comparing the address to memory_end which is a phys_addr_t. Change this to do like other arches and check that the address falls within a valid page frame. Signed-off-by: Jonas Bonn --- arch/openrisc/include/asm/page.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h index b041b344b22..c4ffaee5f94 100644 --- a/arch/openrisc/include/asm/page.h +++ b/arch/openrisc/include/asm/page.h @@ -94,8 +94,7 @@ extern unsigned long memory_end; #define pfn_valid(pfn) ((pfn) < max_mapnr) -#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ - ((void *)(kaddr) < (void *)memory_end)) +#define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr))) #endif /* __ASSEMBLY__ */ -- cgit v1.2.3-70-g09d2 From 6cbe5e95267449ea0b79c0b049342409949da3ac Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Fri, 2 Mar 2012 10:05:24 +0100 Subject: openrisc: sanitize use of orig_gpr11 The pt_regs struct had both a 'syscallno' field and an 'orig_gpr11' field and it wasn't really clear how these were supposed to be used. This patch removes the syscallno field altogether and makes orig_gpr11 work more like other architectures: keep track of syscall number in progress or hold -1 for non-syscall exceptions. Signed-off-by: Jonas Bonn --- arch/openrisc/include/asm/ptrace.h | 6 +++++- arch/openrisc/include/asm/syscall.h | 7 ++----- arch/openrisc/kernel/entry.S | 16 ++++++++-------- arch/openrisc/kernel/ptrace.c | 4 ++-- arch/openrisc/kernel/signal.c | 2 +- arch/openrisc/kernel/traps.c | 8 ++++---- 6 files changed, 22 insertions(+), 21 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h index e612ce4512c..4651a737591 100644 --- a/arch/openrisc/include/asm/ptrace.h +++ b/arch/openrisc/include/asm/ptrace.h @@ -73,9 +73,13 @@ struct pt_regs { }; }; long pc; + /* For restarting system calls: + * Set to syscall number for syscall exceptions, + * -1 for all other exceptions. + */ long orig_gpr11; /* For restarting system calls */ - long syscallno; /* Syscall number (used by strace) */ long dummy; /* Cheap alignment fix */ + long dummy2; /* Cheap alignment fix */ }; /* TODO: Rename this to REDZONE because that's what it is */ diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h index 9f0337055d2..b752bb67891 100644 --- a/arch/openrisc/include/asm/syscall.h +++ b/arch/openrisc/include/asm/syscall.h @@ -25,7 +25,7 @@ static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { - return regs->syscallno ? regs->syscallno : -1; + return regs->orig_gpr11; } static inline void @@ -50,10 +50,7 @@ static inline void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val) { - if (error) - regs->gpr[11] = -error; - else - regs->gpr[11] = val; + regs->gpr[11] = (long) error ?: val; } static inline void diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index d5f9c35a583..6e61af8682b 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -95,7 +95,6 @@ handler: ;\ /* r1, EPCR, ESR a already saved */ ;\ l.sw PT_GPR2(r1),r2 ;\ l.sw PT_GPR3(r1),r3 ;\ - l.sw PT_ORIG_GPR11(r1),r11 ;\ /* r4 already save */ ;\ l.sw PT_GPR5(r1),r5 ;\ l.sw PT_GPR6(r1),r6 ;\ @@ -125,7 +124,9 @@ handler: ;\ /* r30 already save */ ;\ /* l.sw PT_GPR30(r1),r30*/ ;\ l.sw PT_GPR31(r1),r31 ;\ - l.sw PT_SYSCALLNO(r1),r0 + /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\ + l.addi r30,r0,-1 ;\ + l.sw PT_ORIG_GPR11(r1),r30 #define UNHANDLED_EXCEPTION(handler,vector) \ .global handler ;\ @@ -133,7 +134,6 @@ handler: ;\ /* r1, EPCR, ESR already saved */ ;\ l.sw PT_GPR2(r1),r2 ;\ l.sw PT_GPR3(r1),r3 ;\ - l.sw PT_ORIG_GPR11(r1),r11 ;\ l.sw PT_GPR5(r1),r5 ;\ l.sw PT_GPR6(r1),r6 ;\ l.sw PT_GPR7(r1),r7 ;\ @@ -162,7 +162,9 @@ handler: ;\ /* r31 already saved */ ;\ l.sw PT_GPR30(r1),r30 ;\ /* l.sw PT_GPR31(r1),r31 */ ;\ - l.sw PT_SYSCALLNO(r1),r0 ;\ + /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\ + l.addi r30,r0,-1 ;\ + l.sw PT_ORIG_GPR11(r1),r30 ;\ l.addi r3,r1,0 ;\ /* r4 is exception EA */ ;\ l.addi r5,r0,vector ;\ @@ -554,6 +556,7 @@ ENTRY(_sys_call_handler) l.sw PT_GPR9(r1),r9 /* r10 already saved */ l.sw PT_GPR11(r1),r11 + /* orig_gpr11 must be set for syscalls */ l.sw PT_ORIG_GPR11(r1),r11 /* r12,r13 already saved */ @@ -567,9 +570,6 @@ ENTRY(_sys_call_handler) /* r30 is the only register we clobber in the fast path */ /* r30 already saved */ /* l.sw PT_GPR30(r1),r30 */ - /* This is used by do_signal to determine whether to check for - * syscall restart or not */ - l.sw PT_SYSCALLNO(r1),r11 _syscall_check_trace_enter: /* If TIF_SYSCALL_TRACE is set, then we want to do syscall tracing */ @@ -731,7 +731,7 @@ _syscall_trace_enter: * so that we can do the syscall for real and return to the syscall * hot path. */ - l.lwz r11,PT_SYSCALLNO(r1) + l.lwz r11,PT_GPR11(r1) l.lwz r3,PT_GPR3(r1) l.lwz r4,PT_GPR4(r1) l.lwz r5,PT_GPR5(r1) diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c index 7259047d5f9..6deacb6b95a 100644 --- a/arch/openrisc/kernel/ptrace.c +++ b/arch/openrisc/kernel/ptrace.c @@ -188,11 +188,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) */ ret = -1L; - audit_syscall_entry(audit_arch(), regs->syscallno, + audit_syscall_entry(audit_arch(), regs->gpr[11], regs->gpr[3], regs->gpr[4], regs->gpr[5], regs->gpr[6]); - return ret ? : regs->syscallno; + return ret ? : regs->gpr[11]; } asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index cf35ea032a7..e970743251a 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -305,7 +305,7 @@ void do_signal(struct pt_regs *regs) * below mean that the syscall executed to completion and no * restart is necessary. */ - if (regs->syscallno) { + if (regs->orig_gpr11) { int restart = 0; switch (regs->gpr[11]) { diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c index ab68ffc8575..a2ee12948f4 100644 --- a/arch/openrisc/kernel/traps.c +++ b/arch/openrisc/kernel/traps.c @@ -146,8 +146,8 @@ void show_registers(struct pt_regs *regs) regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]); printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n", regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]); - printk(" RES: %08lx oGPR11: %08lx syscallno: %08lx\n", - regs->gpr[11], regs->orig_gpr11, regs->syscallno); + printk(" RES: %08lx oGPR11: %08lx\n", + regs->gpr[11], regs->orig_gpr11); printk("Process %s (pid: %d, stackpage=%08lx)\n", current->comm, current->pid, (unsigned long)current); @@ -208,8 +208,8 @@ void nommu_dump_state(struct pt_regs *regs, regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]); printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n", regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]); - printk(" RES: %08lx oGPR11: %08lx syscallno: %08lx\n", - regs->gpr[11], regs->orig_gpr11, regs->syscallno); + printk(" RES: %08lx oGPR11: %08lx\n", + regs->gpr[11], regs->orig_gpr11); printk("Process %s (pid: %d, stackpage=%08lx)\n", ((struct task_struct *)(__pa(current)))->comm, -- cgit v1.2.3-70-g09d2 From 1bc0b9fd7510742cf159ecc9e4d2fa87c804939a Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Tue, 6 Mar 2012 07:57:25 +0100 Subject: openrisc: remove semicolon from KSTK_ defs Things break rather ungracefully when a semicolon gets substituted into an expression... discovered while build-testing linux-next for 3.4 Signed-off-by: Jonas Bonn --- arch/openrisc/include/asm/processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h index bb54c97b978..f7516fa78b5 100644 --- a/arch/openrisc/include/asm/processor.h +++ b/arch/openrisc/include/asm/processor.h @@ -81,8 +81,8 @@ extern inline void prepare_to_copy(struct task_struct *tsk) #define INIT_THREAD { } -#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc); -#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp); +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) +#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -- cgit v1.2.3-70-g09d2 From fa8d9d74c360726fe743b08af00ee3d0e0eb8bc1 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Fri, 2 Mar 2012 16:41:02 +0100 Subject: OpenRISC: Remove memory_start/end prototypes OpenRISC does not have global memory_start and memory_end symbols. The prototypes are in vain. Signed-off-by: Richard Weinberger Signed-off-by: Jonas Bonn --- arch/openrisc/include/asm/page.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch/openrisc') diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h index c4ffaee5f94..108906f991d 100644 --- a/arch/openrisc/include/asm/page.h +++ b/arch/openrisc/include/asm/page.h @@ -71,9 +71,6 @@ typedef struct page *pgtable_t; #define __pgd(x) ((pgd_t) { (x) }) #define __pgprot(x) ((pgprot_t) { (x) }) -extern unsigned long memory_start; -extern unsigned long memory_end; - #endif /* !__ASSEMBLY__ */ -- cgit v1.2.3-70-g09d2