diff options
-rw-r--r-- | arch/parisc/kernel/unaligned.c | 16 | ||||
-rw-r--r-- | include/asm-parisc/processor.h | 19 |
2 files changed, 29 insertions, 6 deletions
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c index 62eea35bcd69..eaae8a021f9f 100644 --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c | |||
@@ -513,15 +513,18 @@ void handle_unaligned(struct pt_regs *regs) | |||
513 | register int flop=0; /* true if this is a flop */ | 513 | register int flop=0; /* true if this is a flop */ |
514 | 514 | ||
515 | /* log a message with pacing */ | 515 | /* log a message with pacing */ |
516 | if (user_mode(regs)) | 516 | if (user_mode(regs)) { |
517 | { | 517 | if (current->thread.flags & PARISC_UAC_SIGBUS) { |
518 | if (unaligned_count > 5 && jiffies - last_time > 5*HZ) | 518 | goto force_sigbus; |
519 | { | 519 | } |
520 | |||
521 | if (unaligned_count > 5 && jiffies - last_time > 5*HZ) { | ||
520 | unaligned_count = 0; | 522 | unaligned_count = 0; |
521 | last_time = jiffies; | 523 | last_time = jiffies; |
522 | } | 524 | } |
523 | if (++unaligned_count < 5) | 525 | |
524 | { | 526 | if (!(current->thread.flags & PARISC_UAC_NOPRINT) |
527 | && ++unaligned_count < 5) { | ||
525 | char buf[256]; | 528 | char buf[256]; |
526 | sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n", | 529 | sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n", |
527 | current->comm, current->pid, regs->ior, regs->iaoq[0]); | 530 | current->comm, current->pid, regs->ior, regs->iaoq[0]); |
@@ -530,6 +533,7 @@ void handle_unaligned(struct pt_regs *regs) | |||
530 | show_regs(regs); | 533 | show_regs(regs); |
531 | #endif | 534 | #endif |
532 | } | 535 | } |
536 | |||
533 | if (!unaligned_enabled) | 537 | if (!unaligned_enabled) |
534 | goto force_sigbus; | 538 | goto force_sigbus; |
535 | } | 539 | } |
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h index a9dfadd05658..aae40e8c3aa8 100644 --- a/include/asm-parisc/processor.h +++ b/include/asm-parisc/processor.h | |||
@@ -122,8 +122,27 @@ struct thread_struct { | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | /* Thread struct flags. */ | 124 | /* Thread struct flags. */ |
125 | #define PARISC_UAC_NOPRINT (1UL << 0) /* see prctl and unaligned.c */ | ||
126 | #define PARISC_UAC_SIGBUS (1UL << 1) | ||
125 | #define PARISC_KERNEL_DEATH (1UL << 31) /* see die_if_kernel()... */ | 127 | #define PARISC_KERNEL_DEATH (1UL << 31) /* see die_if_kernel()... */ |
126 | 128 | ||
129 | #define PARISC_UAC_SHIFT 0 | ||
130 | #define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS) | ||
131 | |||
132 | #define SET_UNALIGN_CTL(task,value) \ | ||
133 | ({ \ | ||
134 | (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \ | ||
135 | | (((value) << PARISC_UAC_SHIFT) & \ | ||
136 | PARISC_UAC_MASK)); \ | ||
137 | 0; \ | ||
138 | }) | ||
139 | |||
140 | #define GET_UNALIGN_CTL(task,addr) \ | ||
141 | ({ \ | ||
142 | put_user(((task)->thread.flags & PARISC_UAC_MASK) \ | ||
143 | >> PARISC_UAC_SHIFT, (int __user *) (addr)); \ | ||
144 | }) | ||
145 | |||
127 | #define INIT_THREAD { \ | 146 | #define INIT_THREAD { \ |
128 | regs: { gr: { 0, }, \ | 147 | regs: { gr: { 0, }, \ |
129 | fr: { 0, }, \ | 148 | fr: { 0, }, \ |