alignment.c (a02001086bbfb4da35d1228bebc2f1b442db455f) alignment.c (4ed89f2228061422ce5f62545fd0b6f6648bd2cc)
1/*
2 * linux/arch/arm/mm/alignment.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Modifications for ARM processor (c) 1995-2001 Russell King
6 * Thumb alignment fault fixups (c) 2004 MontaVista Software, Inc.
7 * - Adapted from gdb/sim/arm/thumbemu.c -- Thumb instruction emulation.
8 * Copyright (C) 1996, Cygnus Software Technologies Ltd.

--- 99 unchanged lines hidden (view full) ---

108 * Ignoring the alignment fault is not an option on these
109 * CPUs since we spin re-faulting the instruction without
110 * making any progress.
111 */
112 if (cpu_is_v6_unaligned() && !(new_usermode & (UM_FIXUP | UM_SIGNAL))) {
113 new_usermode |= UM_FIXUP;
114
115 if (warn)
1/*
2 * linux/arch/arm/mm/alignment.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Modifications for ARM processor (c) 1995-2001 Russell King
6 * Thumb alignment fault fixups (c) 2004 MontaVista Software, Inc.
7 * - Adapted from gdb/sim/arm/thumbemu.c -- Thumb instruction emulation.
8 * Copyright (C) 1996, Cygnus Software Technologies Ltd.

--- 99 unchanged lines hidden (view full) ---

108 * Ignoring the alignment fault is not an option on these
109 * CPUs since we spin re-faulting the instruction without
110 * making any progress.
111 */
112 if (cpu_is_v6_unaligned() && !(new_usermode & (UM_FIXUP | UM_SIGNAL))) {
113 new_usermode |= UM_FIXUP;
114
115 if (warn)
116 printk(KERN_WARNING "alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n");
116 pr_warn("alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n");
117 }
118
119 return new_usermode;
120}
121
122#ifdef CONFIG_PROC_FS
123static const char *usermode_action[] = {
124 "ignored",

--- 393 unchanged lines hidden (view full) ---

518 * [ls]dm alignment faults are noisy!
519 */
520#if !(defined CONFIG_CPU_ARM922T) && !(defined CONFIG_CPU_ARM920T)
521 /*
522 * This is a "hint" - we already have eaddr worked out by the
523 * processor for us.
524 */
525 if (addr != eaddr) {
117 }
118
119 return new_usermode;
120}
121
122#ifdef CONFIG_PROC_FS
123static const char *usermode_action[] = {
124 "ignored",

--- 393 unchanged lines hidden (view full) ---

518 * [ls]dm alignment faults are noisy!
519 */
520#if !(defined CONFIG_CPU_ARM922T) && !(defined CONFIG_CPU_ARM920T)
521 /*
522 * This is a "hint" - we already have eaddr worked out by the
523 * processor for us.
524 */
525 if (addr != eaddr) {
526 printk(KERN_ERR "LDMSTM: PC = %08lx, instr = %08lx, "
526 pr_err("LDMSTM: PC = %08lx, instr = %08lx, "
527 "addr = %08lx, eaddr = %08lx\n",
528 instruction_pointer(regs), instr, addr, eaddr);
529 show_regs(regs);
530 }
531#endif
532
533 if (user_mode(regs)) {
534 for (regbits = REGMASK_BITS(instr), rd = 0; regbits;

--- 27 unchanged lines hidden (view full) ---

562 regs->ARM_pc -= correction;
563 return TYPE_DONE;
564
565fault:
566 regs->ARM_pc -= correction;
567 return TYPE_FAULT;
568
569bad:
527 "addr = %08lx, eaddr = %08lx\n",
528 instruction_pointer(regs), instr, addr, eaddr);
529 show_regs(regs);
530 }
531#endif
532
533 if (user_mode(regs)) {
534 for (regbits = REGMASK_BITS(instr), rd = 0; regbits;

--- 27 unchanged lines hidden (view full) ---

562 regs->ARM_pc -= correction;
563 return TYPE_DONE;
564
565fault:
566 regs->ARM_pc -= correction;
567 return TYPE_FAULT;
568
569bad:
570 printk(KERN_ERR "Alignment trap: not handling ldm with s-bit set\n");
570 pr_err("Alignment trap: not handling ldm with s-bit set\n");
571 return TYPE_ERROR;
572}
573
574/*
575 * Convert Thumb ld/st instruction forms to equivalent ARM instructions so
576 * we can reuse ARM userland alignment fault fixups for Thumb.
577 *
578 * This implementation was initially based on the algorithm found in

--- 315 unchanged lines hidden (view full) ---

894 goto bad;
895 /*
896 * We got a fault - fix it up, or die.
897 */
898 do_bad_area(addr, fsr, regs);
899 return 0;
900
901 swp:
571 return TYPE_ERROR;
572}
573
574/*
575 * Convert Thumb ld/st instruction forms to equivalent ARM instructions so
576 * we can reuse ARM userland alignment fault fixups for Thumb.
577 *
578 * This implementation was initially based on the algorithm found in

--- 315 unchanged lines hidden (view full) ---

894 goto bad;
895 /*
896 * We got a fault - fix it up, or die.
897 */
898 do_bad_area(addr, fsr, regs);
899 return 0;
900
901 swp:
902 printk(KERN_ERR "Alignment trap: not handling swp instruction\n");
902 pr_err("Alignment trap: not handling swp instruction\n");
903
904 bad:
905 /*
906 * Oops, we didn't handle the instruction.
907 */
903
904 bad:
905 /*
906 * Oops, we didn't handle the instruction.
907 */
908 printk(KERN_ERR "Alignment trap: not handling instruction "
908 pr_err("Alignment trap: not handling instruction "
909 "%0*lx at [<%08lx>]\n",
910 isize << 1,
911 isize == 2 ? tinstr : instr, instrptr);
912 ai_skipped += 1;
913 return 1;
914
915 user:
916 ai_user += 1;

--- 92 unchanged lines hidden ---
909 "%0*lx at [<%08lx>]\n",
910 isize << 1,
911 isize == 2 ? tinstr : instr, instrptr);
912 ai_skipped += 1;
913 return 1;
914
915 user:
916 ai_user += 1;

--- 92 unchanged lines hidden ---