Skip to content

Commit

Permalink
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/kyle/parisc-2.6

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6:
  agp: parisc-agp.c - use correct page_mask function
  parisc: Fix linker script breakage.
  parisc: convert to asm-generic/hardirq.h
  parisc: Make THREAD_SIZE available to assembly files and linker scripts.
  parisc: correct use of SHF_ALLOC
  parisc: rename parisc's vmalloc_start to parisc_vmalloc_start
  parisc: add me to Maintainers
  parisc: includecheck fix: signal.c
  parisc: HAVE_ARCH_TRACEHOOK
  parisc: add skeleton syscall.h
  parisc: stop using task->ptrace for {single,block}step flags
  parisc: split syscall_trace into two halves
  parisc: add missing TI_TASK macro in syscall.S
  parisc: tracehook_signal_handler
  parisc: tracehook_report_syscall
  • Loading branch information
torvalds committed Oct 8, 2009
2 parents d82e23d + 4ef8774 commit 385c51d
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 81 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3973,6 +3973,7 @@ F: drivers/block/paride/
PARISC ARCHITECTURE
M: Kyle McMartin <[email protected]>
M: Helge Deller <[email protected]>
M: "James E.J. Bottomley" <[email protected]>
L: [email protected]
W: http://www.parisc-linux.org/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6.git
Expand Down
1 change: 1 addition & 0 deletions arch/parisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ config PARISC
select BUG
select HAVE_PERF_EVENTS
select GENERIC_ATOMIC64 if !64BIT
select HAVE_ARCH_TRACEHOOK
help
The PA-RISC microprocessor is designed by Hewlett-Packard and used
in many of their workstations & servers (HP9000 700 and 800 series,
Expand Down
4 changes: 2 additions & 2 deletions arch/parisc/include/asm/fixmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#define KERNEL_MAP_END (TMPALIAS_MAP_START)

#ifndef __ASSEMBLY__
extern void *vmalloc_start;
extern void *parisc_vmalloc_start;
#define PCXL_DMA_MAP_SIZE (8*1024*1024)
#define VMALLOC_START ((unsigned long)vmalloc_start)
#define VMALLOC_START ((unsigned long)parisc_vmalloc_start)
#define VMALLOC_END (KERNEL_MAP_END)
#endif /*__ASSEMBLY__*/

Expand Down
20 changes: 1 addition & 19 deletions arch/parisc/include/asm/hardirq.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
/* hardirq.h: PA-RISC hard IRQ support.
*
* Copyright (C) 2001 Matthew Wilcox <[email protected]>
*
* The locking is really quite interesting. There's a cpu-local
* count of how many interrupts are being handled, and a global
* lock. An interrupt can only be serviced if the global lock
* is free. You can't be sure no more interrupts are being
* serviced until you've acquired the lock and then checked
* all the per-cpu interrupt counts are all zero. It's a specialised
* br_lock, and that's exactly how Sparc does it. We don't because
* it's more locking for us. This way is lock-free in the interrupt path.
*/

#ifndef _PARISC_HARDIRQ_H
#define _PARISC_HARDIRQ_H

#include <linux/threads.h>
#include <linux/irq.h>

typedef struct {
unsigned long __softirq_pending; /* set_bit is used on this */
} ____cacheline_aligned irq_cpustat_t;

#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */

void ack_bad_irq(unsigned int irq);
#include <asm-generic/hardirq.h>

#endif /* _PARISC_HARDIRQ_H */
5 changes: 4 additions & 1 deletion arch/parisc/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ void user_enable_block_step(struct task_struct *task);
#define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0)
#define user_space(regs) (((regs)->iasq[1] != 0) ? 1 : 0)
#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3)
#define user_stack_pointer(regs) ((regs)->gr[30])
unsigned long profile_pc(struct pt_regs *);
extern void show_regs(struct pt_regs *);
#endif


#endif /* __KERNEL__ */

#endif
40 changes: 40 additions & 0 deletions arch/parisc/include/asm/syscall.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* syscall.h */

#ifndef _ASM_PARISC_SYSCALL_H_
#define _ASM_PARISC_SYSCALL_H_

#include <linux/err.h>
#include <asm/ptrace.h>

static inline long syscall_get_nr(struct task_struct *tsk,
struct pt_regs *regs)
{
return regs->gr[20];
}

static inline void syscall_get_arguments(struct task_struct *tsk,
struct pt_regs *regs, unsigned int i,
unsigned int n, unsigned long *args)
{
BUG_ON(i);

switch (n) {
case 6:
args[5] = regs->gr[21];
case 5:
args[4] = regs->gr[22];
case 4:
args[3] = regs->gr[23];
case 3:
args[2] = regs->gr[24];
case 2:
args[1] = regs->gr[25];
case 1:
args[0] = regs->gr[26];
break;
default:
BUG();
}
}

#endif /*_ASM_PARISC_SYSCALL_H_*/
14 changes: 9 additions & 5 deletions arch/parisc/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ struct thread_info {
#define init_thread_info (init_thread_union.thread_info)
#define init_stack (init_thread_union.stack)

/* how to get the thread information struct from C */
#define current_thread_info() ((struct thread_info *)mfctl(30))

#endif /* !__ASSEMBLY */

/* thread information allocation */

#define THREAD_SIZE_ORDER 2
Expand All @@ -40,11 +45,6 @@ struct thread_info {
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
#define THREAD_SHIFT (PAGE_SHIFT + THREAD_SIZE_ORDER)

/* how to get the thread information struct from C */
#define current_thread_info() ((struct thread_info *)mfctl(30))

#endif /* !__ASSEMBLY */

#define PREEMPT_ACTIVE_BIT 28
#define PREEMPT_ACTIVE (1 << PREEMPT_ACTIVE_BIT)

Expand All @@ -60,6 +60,8 @@ struct thread_info {
#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */
#define TIF_FREEZE 7 /* is freezing for suspend */
#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
#define TIF_SINGLESTEP 9 /* single stepping? */
#define TIF_BLOCKSTEP 10 /* branch stepping? */

#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
Expand All @@ -69,6 +71,8 @@ struct thread_info {
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#define _TIF_FREEZE (1 << TIF_FREEZE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)

#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
_TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
Expand Down
4 changes: 2 additions & 2 deletions arch/parisc/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ int main(void)
DEFINE(DTLB_OFF_COUNT, offsetof(struct pdc_cache_info, dt_off_count));
DEFINE(DTLB_LOOP, offsetof(struct pdc_cache_info, dt_loop));
BLANK();
DEFINE(PA_BLOCKSTEP_BIT, 31-PT_BLOCKSTEP_BIT);
DEFINE(PA_SINGLESTEP_BIT, 31-PT_SINGLESTEP_BIT);
DEFINE(TIF_BLOCKSTEP_PA_BIT, 31-TIF_BLOCKSTEP);
DEFINE(TIF_SINGLESTEP_PA_BIT, 31-TIF_SINGLESTEP);
BLANK();
DEFINE(ASM_PMD_SHIFT, PMD_SHIFT);
DEFINE(ASM_PGDIR_SHIFT, PGDIR_SHIFT);
Expand Down
21 changes: 11 additions & 10 deletions arch/parisc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -2047,12 +2047,13 @@ syscall_do_signal:
b,n syscall_check_sig

syscall_restore:
/* Are we being ptraced? */
LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1

ldw TASK_PTRACE(%r1), %r19
bb,< %r19,31,syscall_restore_rfi
nop
/* Are we being ptraced? */
ldw TASK_FLAGS(%r1),%r19
ldi (_TIF_SINGLESTEP|_TIF_BLOCKSTEP),%r2
and,COND(=) %r19,%r2,%r0
b,n syscall_restore_rfi

ldo TASK_PT_FR31(%r1),%r19 /* reload fpregs */
rest_fp %r19
Expand Down Expand Up @@ -2113,16 +2114,16 @@ syscall_restore_rfi:
ldi 0x0b,%r20 /* Create new PSW */
depi -1,13,1,%r20 /* C, Q, D, and I bits */

/* The values of PA_SINGLESTEP_BIT and PA_BLOCKSTEP_BIT are
* set in include/linux/ptrace.h and converted to PA bitmap
/* The values of SINGLESTEP_BIT and BLOCKSTEP_BIT are
* set in thread_info.h and converted to PA bitmap
* numbers in asm-offsets.c */

/* if ((%r19.PA_SINGLESTEP_BIT)) { %r20.27=1} */
extru,= %r19,PA_SINGLESTEP_BIT,1,%r0
/* if ((%r19.SINGLESTEP_BIT)) { %r20.27=1} */
extru,= %r19,TIF_SINGLESTEP_PA_BIT,1,%r0
depi -1,27,1,%r20 /* R bit */

/* if ((%r19.PA_BLOCKSTEP_BIT)) { %r20.7=1} */
extru,= %r19,PA_BLOCKSTEP_BIT,1,%r0
/* if ((%r19.BLOCKSTEP_BIT)) { %r20.7=1} */
extru,= %r19,TIF_BLOCKSTEP_PA_BIT,1,%r0
depi -1,7,1,%r20 /* T bit */

STREG %r20,TASK_PT_PSW(%r1)
Expand Down
5 changes: 0 additions & 5 deletions arch/parisc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,3 @@ void __init init_IRQ(void)
set_eiem(cpu_eiem); /* EIEM : enable all external intr */

}

void ack_bad_irq(unsigned int irq)
{
printk(KERN_WARNING "unexpected IRQ %d\n", irq);
}
2 changes: 1 addition & 1 deletion arch/parisc/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ int module_finalize(const Elf_Ehdr *hdr,
* ourselves */
for (i = 1; i < hdr->e_shnum; i++) {
if(sechdrs[i].sh_type == SHT_SYMTAB
&& (sechdrs[i].sh_type & SHF_ALLOC)) {
&& (sechdrs[i].sh_flags & SHF_ALLOC)) {
int strindex = sechdrs[i].sh_link;
/* FIXME: AWFUL HACK
* The cast is to drop the const from
Expand Down
42 changes: 21 additions & 21 deletions arch/parisc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/smp.h>
#include <linux/errno.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/user.h>
#include <linux/personality.h>
#include <linux/security.h>
Expand All @@ -35,7 +36,8 @@
*/
void ptrace_disable(struct task_struct *task)
{
task->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP);
clear_tsk_thread_flag(task, TIF_SINGLESTEP);
clear_tsk_thread_flag(task, TIF_BLOCKSTEP);

/* make sure the trap bits are not set */
pa_psw(task)->r = 0;
Expand All @@ -55,8 +57,8 @@ void user_disable_single_step(struct task_struct *task)

void user_enable_single_step(struct task_struct *task)
{
task->ptrace &= ~PT_BLOCKSTEP;
task->ptrace |= PT_SINGLESTEP;
clear_tsk_thread_flag(task, TIF_BLOCKSTEP);
set_tsk_thread_flag(task, TIF_SINGLESTEP);

if (pa_psw(task)->n) {
struct siginfo si;
Expand Down Expand Up @@ -98,8 +100,8 @@ void user_enable_single_step(struct task_struct *task)

void user_enable_block_step(struct task_struct *task)
{
task->ptrace &= ~PT_SINGLESTEP;
task->ptrace |= PT_BLOCKSTEP;
clear_tsk_thread_flag(task, TIF_SINGLESTEP);
set_tsk_thread_flag(task, TIF_BLOCKSTEP);

/* Enable taken branch trap. */
pa_psw(task)->r = 0;
Expand Down Expand Up @@ -263,22 +265,20 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
}
#endif

long do_syscall_trace_enter(struct pt_regs *regs)
{
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
tracehook_report_syscall_entry(regs))
return -1L;

return regs->gr[20];
}

void syscall_trace(void)
void do_syscall_trace_exit(struct pt_regs *regs)
{
if (!test_thread_flag(TIF_SYSCALL_TRACE))
return;
if (!(current->ptrace & PT_PTRACED))
return;
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
? 0x80 : 0));
/*
* this isn't the same as continuing with a signal, but it will do
* for normal use. strace only continues with a signal if the
* stopping signal is not SIGTRAP. -brl
*/
if (current->exit_code) {
send_sig(current->exit_code, current, 1);
current->exit_code = 0;
}
int stepping = test_thread_flag(TIF_SINGLESTEP) ||
test_thread_flag(TIF_BLOCKSTEP);

if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
tracehook_report_syscall_exit(regs, stepping);
}
5 changes: 4 additions & 1 deletion arch/parisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/compat.h>
Expand All @@ -34,7 +35,6 @@
#include <asm/asm-offsets.h>

#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#include "signal32.h"
#endif

Expand Down Expand Up @@ -468,6 +468,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
sigaddset(&current->blocked,sig);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);

tracehook_signal_handler(sig, info, ka, regs, 0);

return 1;
}

Expand Down
22 changes: 14 additions & 8 deletions arch/parisc/kernel/syscall.S
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,23 @@ tracesys:
STREG %r18,PT_GR18(%r2)
/* Finished saving things for the debugger */

ldil L%syscall_trace,%r1
copy %r2,%r26
ldil L%do_syscall_trace_enter,%r1
ldil L%tracesys_next,%r2
be R%syscall_trace(%sr7,%r1)
be R%do_syscall_trace_enter(%sr7,%r1)
ldo R%tracesys_next(%r2),%r2

tracesys_next:
tracesys_next:
/* do_syscall_trace_enter either returned the syscallno, or -1L,
* so we skip restoring the PT_GR20 below, since we pulled it from
* task->thread.regs.gr[20] above.
*/
copy %ret0,%r20
ldil L%sys_call_table,%r1
ldo R%sys_call_table(%r1), %r19

ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
LDREG TI_TASK(%r1), %r1
LDREG TASK_PT_GR20(%r1), %r20
LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */
LDREG TASK_PT_GR25(%r1), %r25
LDREG TASK_PT_GR24(%r1), %r24
Expand Down Expand Up @@ -336,7 +341,8 @@ tracesys_exit:
#ifdef CONFIG_64BIT
ldo -16(%r30),%r29 /* Reference param save area */
#endif
bl syscall_trace, %r2
ldo TASK_REGS(%r1),%r26
bl do_syscall_trace_exit,%r2
STREG %r28,TASK_PT_GR28(%r1) /* save return value now */
ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
LDREG TI_TASK(%r1), %r1
Expand All @@ -353,12 +359,12 @@ tracesys_exit:

tracesys_sigexit:
ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
LDREG 0(%r1), %r1
LDREG TI_TASK(%r1), %r1
#ifdef CONFIG_64BIT
ldo -16(%r30),%r29 /* Reference param save area */
#endif
bl syscall_trace, %r2
nop
bl do_syscall_trace_exit,%r2
ldo TASK_REGS(%r1),%r26

ldil L%syscall_exit_rfi,%r1
be,n R%syscall_exit_rfi(%sr7,%r1)
Expand Down
Loading

0 comments on commit 385c51d

Please sign in to comment.