hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/arm/mm/alignment.c
....@@ -19,6 +19,7 @@
1919 #include <linux/init.h>
2020 #include <linux/sched/signal.h>
2121 #include <linux/uaccess.h>
22
+#include <linux/dovetail.h>
2223
2324 #include <asm/cp15.h>
2425 #include <asm/system_info.h>
....@@ -807,10 +808,12 @@
807808 u16 tinstr = 0;
808809 int isize = 4;
809810 int thumb2_32b = 0;
810
- int fault;
811
+ int fault, ret = 0;
811812
812813 if (interrupts_enabled(regs))
813
- local_irq_enable();
814
+ hard_local_irq_enable();
815
+
816
+ mark_trap_entry(ARM_TRAP_ALIGNMENT, regs);
814817
815818 instrptr = instruction_pointer(regs);
816819
....@@ -938,7 +941,7 @@
938941 if (thumb_mode(regs))
939942 regs->ARM_cpsr = it_advance(regs->ARM_cpsr);
940943
941
- return 0;
944
+ goto out;
942945
943946 bad_or_fault:
944947 if (type == TYPE_ERROR)
....@@ -947,7 +950,7 @@
947950 * We got a fault - fix it up, or die.
948951 */
949952 do_bad_area(addr, fsr, regs);
950
- return 0;
953
+ goto out;
951954
952955 swp:
953956 pr_err("Alignment trap: not handling swp instruction\n");
....@@ -961,7 +964,8 @@
961964 isize << 1,
962965 isize == 2 ? tinstr : instr, instrptr);
963966 ai_skipped += 1;
964
- return 1;
967
+ ret = 1;
968
+ goto out;
965969
966970 user:
967971 ai_user += 1;
....@@ -992,12 +996,15 @@
992996 * entry-common.S) and disable the alignment trap only if
993997 * there is no work pending for this thread.
994998 */
995
- raw_local_irq_disable();
999
+ hard_local_irq_disable();
9961000 if (!(current_thread_info()->flags & _TIF_WORK_MASK))
9971001 set_cr(cr_no_alignment);
9981002 }
9991003
1000
- return 0;
1004
+out:
1005
+ mark_trap_exit(ARM_TRAP_ALIGNMENT, regs);
1006
+
1007
+ return ret;
10011008 }
10021009
10031010 static int __init noalign_setup(char *__unused)