Skip to content

Commit 97bcb0f

Browse files
committed
ARM: set BE8 if LE in head code
If we are booting in LE and compiled for BE8, then add code to set the state to bE8. Since the instruction stream is always LE, we do not need to do anything special to the instruction. Also ensure that the secondary processors are started in the same mode. Note, we do add about 20 bytes to the kernel image, but it seems easier to do this than adding another configuration to change. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Dave Martin <Dave.Martin@arm.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
1 parent 2f9bf9b commit 97bcb0f

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎arch/arm/boot/compressed/head.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ start:
135135
.word _edata @ zImage end address
136136
THUMB( .thumb )
137137
1:
138+
ARM_BE8( setend be ) @ go BE8 if compiled for BE8
138139
mrs r9, cpsr
139140
#ifdef CONFIG_ARM_VIRT_EXT
140141
bl __hyp_stub_install @ get into SVC mode, reversibly

‎arch/arm/kernel/head.S‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777

7878
__HEAD
7979
ENTRY(stext)
80+
ARM_BE8(setend be ) @ ensure we are in BE8 mode
8081

8182
THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
8283
THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
@@ -352,6 +353,9 @@ ENTRY(secondary_startup)
352353
* the processor type - there is no need to check the machine type
353354
* as it has already been validated by the primary processor.
354355
*/
356+
357+
ARM_BE8(setend be) @ ensure we are in BE8 mode
358+
355359
#ifdef CONFIG_ARM_VIRT_EXT
356360
bl __hyp_stub_install_secondary
357361
#endif

‎arch/arm/kernel/sleep.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ ENDPROC(cpu_resume_after_mmu)
130130
.data
131131
.align
132132
ENTRY(cpu_resume)
133+
ARM_BE8(setend be) @ ensure we are in BE mode
133134
mov r1, #0
134135
ALT_SMP(mrc p15, 0, r0, c0, c0, 5)
135136
ALT_UP_B(1f)

0 commit comments

Comments
 (0)