Skip to content

Commit 7a2a74f

Browse files
Andreas Bießmannhegtvedt-te
authored andcommitted
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
1 parent b4789b8 commit 7a2a74f

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

‎arch/avr32/boot/u-boot/head.S‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* published by the Free Software Foundation.
99
*/
1010
#include <asm/setup.h>
11+
#include <asm/thread_info.h>
12+
#include <asm/sysreg.h>
1113

1214
/*
1315
* The kernel is loaded where we want it to be and all caches
@@ -20,11 +22,6 @@
2022
.section .init.text,"ax"
2123
.global _start
2224
_start:
23-
/* Check if the boot loader actually provided a tag table */
24-
lddpc r0, magic_number
25-
cp.w r12, r0
26-
brne no_tag_table
27-
2825
/* Initialize .bss */
2926
lddpc r2, bss_start_addr
3027
lddpc r3, end_addr
@@ -34,6 +31,25 @@ _start:
3431
cp r2, r3
3532
brlo 1b
3633

34+
/* Initialize status register */
35+
lddpc r0, init_sr
36+
mtsr SYSREG_SR, r0
37+
38+
/* Set initial stack pointer */
39+
lddpc sp, stack_addr
40+
sub sp, -THREAD_SIZE
41+
42+
#ifdef CONFIG_FRAME_POINTER
43+
/* Mark last stack frame */
44+
mov lr, 0
45+
mov r7, 0
46+
#endif
47+
48+
/* Check if the boot loader actually provided a tag table */
49+
lddpc r0, magic_number
50+
cp.w r12, r0
51+
brne no_tag_table
52+
3753
/*
3854
* Save the tag table address for later use. This must be done
3955
* _after_ .bss has been initialized...
@@ -53,6 +69,10 @@ bss_start_addr:
5369
.long __bss_start
5470
end_addr:
5571
.long _end
72+
init_sr:
73+
.long 0x007f0000 /* Supervisor mode, everything masked */
74+
stack_addr:
75+
.long init_thread_union
5676

5777
no_tag_table:
5878
sub r12, pc, (. - 2f)

‎arch/avr32/kernel/head.S‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,13 @@
1010
#include <linux/linkage.h>
1111

1212
#include <asm/page.h>
13-
#include <asm/thread_info.h>
14-
#include <asm/sysreg.h>
1513

1614
.section .init.text,"ax"
1715
.global kernel_entry
1816
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-
3317
/* Start the show */
3418
lddpc pc, kernel_start_addr
3519

3620
.align 2
37-
init_sr:
38-
.long 0x007f0000 /* Supervisor mode, everything masked */
39-
stack_addr:
40-
.long init_thread_union
4121
kernel_start_addr:
4222
.long start_kernel

0 commit comments

Comments
 (0)