diff options
Diffstat (limited to 'arch/sh/mm/alignment.c')
| -rw-r--r-- | arch/sh/mm/alignment.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c index 00fb9e3f057c..b2595b8548ee 100644 --- a/arch/sh/mm/alignment.c +++ b/arch/sh/mm/alignment.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
| 15 | #include <linux/uaccess.h> | 15 | #include <linux/uaccess.h> |
| 16 | #include <asm/alignment.h> | 16 | #include <asm/alignment.h> |
| 17 | #include <asm/processor.h> | ||
| 17 | 18 | ||
| 18 | static unsigned long se_user; | 19 | static unsigned long se_user; |
| 19 | static unsigned long se_sys; | 20 | static unsigned long se_sys; |
| @@ -59,9 +60,36 @@ void inc_unaligned_kernel_access(void) | |||
| 59 | se_sys++; | 60 | se_sys++; |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 63 | /* | ||
| 64 | * This defaults to the global policy which can be set from the command | ||
| 65 | * line, while processes can overload their preferences via prctl(). | ||
| 66 | */ | ||
| 62 | unsigned int unaligned_user_action(void) | 67 | unsigned int unaligned_user_action(void) |
| 63 | { | 68 | { |
| 64 | return se_usermode; | 69 | unsigned int action = se_usermode; |
| 70 | |||
| 71 | if (current->thread.flags & SH_THREAD_UAC_SIGBUS) { | ||
| 72 | action &= ~UM_FIXUP; | ||
| 73 | action |= UM_SIGNAL; | ||
| 74 | } | ||
| 75 | |||
| 76 | if (current->thread.flags & SH_THREAD_UAC_NOPRINT) | ||
| 77 | action &= ~UM_WARN; | ||
| 78 | |||
| 79 | return action; | ||
| 80 | } | ||
| 81 | |||
| 82 | int get_unalign_ctl(struct task_struct *tsk, unsigned long addr) | ||
| 83 | { | ||
| 84 | return put_user(tsk->thread.flags & SH_THREAD_UAC_MASK, | ||
| 85 | (unsigned int __user *)addr); | ||
| 86 | } | ||
| 87 | |||
| 88 | int set_unalign_ctl(struct task_struct *tsk, unsigned int val) | ||
| 89 | { | ||
| 90 | tsk->thread.flags = (tsk->thread.flags & ~SH_THREAD_UAC_MASK) | | ||
| 91 | (val & SH_THREAD_UAC_MASK); | ||
| 92 | return 0; | ||
| 65 | } | 93 | } |
| 66 | 94 | ||
| 67 | void unaligned_fixups_notify(struct task_struct *tsk, insn_size_t insn, | 95 | void unaligned_fixups_notify(struct task_struct *tsk, insn_size_t insn, |
