Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

avr32: setup crt for early panic()

Before the CRT was (fully) set up in kernel_entry (bss cleared before in
_start, but also not before jump to panic() in no_tag_table case).

This patch fixes this up to have a fully working CRT when branching to panic()
in no_tag_table.

Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: stable@vger.kernel.org

authored by

Andreas Bießmann and committed by
Hans-Christian Egtvedt
7a2a74f4 b4789b8e

+25 -25
+25 -5
arch/avr32/boot/u-boot/head.S
··· 8 8 * published by the Free Software Foundation. 9 9 */ 10 10 #include <asm/setup.h> 11 + #include <asm/thread_info.h> 12 + #include <asm/sysreg.h> 11 13 12 14 /* 13 15 * The kernel is loaded where we want it to be and all caches ··· 22 20 .section .init.text,"ax" 23 21 .global _start 24 22 _start: 25 - /* Check if the boot loader actually provided a tag table */ 26 - lddpc r0, magic_number 27 - cp.w r12, r0 28 - brne no_tag_table 29 - 30 23 /* Initialize .bss */ 31 24 lddpc r2, bss_start_addr 32 25 lddpc r3, end_addr ··· 30 33 1: st.d r2++, r0 31 34 cp r2, r3 32 35 brlo 1b 36 + 37 + /* Initialize status register */ 38 + lddpc r0, init_sr 39 + mtsr SYSREG_SR, r0 40 + 41 + /* Set initial stack pointer */ 42 + lddpc sp, stack_addr 43 + sub sp, -THREAD_SIZE 44 + 45 + #ifdef CONFIG_FRAME_POINTER 46 + /* Mark last stack frame */ 47 + mov lr, 0 48 + mov r7, 0 49 + #endif 50 + 51 + /* Check if the boot loader actually provided a tag table */ 52 + lddpc r0, magic_number 53 + cp.w r12, r0 54 + brne no_tag_table 33 55 34 56 /* 35 57 * Save the tag table address for later use. This must be done ··· 69 53 .long __bss_start 70 54 end_addr: 71 55 .long _end 56 + init_sr: 57 + .long 0x007f0000 /* Supervisor mode, everything masked */ 58 + stack_addr: 59 + .long init_thread_union 72 60 73 61 no_tag_table: 74 62 sub r12, pc, (. - 2f)
-20
arch/avr32/kernel/head.S
··· 10 10 #include <linux/linkage.h> 11 11 12 12 #include <asm/page.h> 13 - #include <asm/thread_info.h> 14 - #include <asm/sysreg.h> 15 13 16 14 .section .init.text,"ax" 17 15 .global kernel_entry 18 16 kernel_entry: 19 - /* Initialize status register */ 20 - lddpc r0, init_sr 21 - mtsr SYSREG_SR, r0 22 - 23 - /* Set initial stack pointer */ 24 - lddpc sp, stack_addr 25 - sub sp, -THREAD_SIZE 26 - 27 - #ifdef CONFIG_FRAME_POINTER 28 - /* Mark last stack frame */ 29 - mov lr, 0 30 - mov r7, 0 31 - #endif 32 - 33 17 /* Start the show */ 34 18 lddpc pc, kernel_start_addr 35 19 36 20 .align 2 37 - init_sr: 38 - .long 0x007f0000 /* Supervisor mode, everything masked */ 39 - stack_addr: 40 - .long init_thread_union 41 21 kernel_start_addr: 42 22 .long start_kernel