s390/head: fix error message on unsupported hardware

startup calls the C function _sclp_print_early() if the machine we're
running on is not supported by the kernel. sclp.c is getting built
with -m64, so _sclp_print_early() expects the zSeries ELF ABI to be
used.

We previously called _sclp_print_early() using the S/390 ELF ABI, with
a stack frame size of 96 bytes and while being in 31-bit address
mode. This caused _sclp_wait_int() (called indirectly from
_sclp_print_early()) to jump to an undefined address. While
_sclp_wait_int() contained some code to deal with being called in
31-bit addressing mode, it didn't quite work. While fixing this is
possible, the code would still only work by chance and could break any
time.

Ensure compliance with the zSeries ELF ABI by switching to 64-bit
addressing mode early and using a minimum stack frame size of 160
bytes.

Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Sascha Silbe 2015-11-04 13:32:08 +01:00 committed by Martin Schwidefsky
parent ce5c2d2c25
commit c6eafbf990

View File

@ -26,6 +26,7 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/ptrace.h>
#define ARCH_OFFSET 4 #define ARCH_OFFSET 4
@ -364,7 +365,7 @@ ENTRY(startup_kdump)
bras %r13,0f bras %r13,0f
.fill 16,4,0x0 .fill 16,4,0x0
0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs 0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
sam31 # switch to 31 bit addressing mode sam64 # switch to 64 bit addressing mode
basr %r13,0 # get base basr %r13,0 # get base
.LPG0: .LPG0:
xc 0x200(256),0x200 # partially clear lowcore xc 0x200(256),0x200 # partially clear lowcore
@ -395,7 +396,7 @@ ENTRY(startup_kdump)
jnz 1b jnz 1b
j 4f j 4f
2: l %r15,.Lstack-.LPG0(%r13) 2: l %r15,.Lstack-.LPG0(%r13)
ahi %r15,-96 ahi %r15,-STACK_FRAME_OVERHEAD
la %r2,.Lals_string-.LPG0(%r13) la %r2,.Lals_string-.LPG0(%r13)
l %r3,.Lsclp_print-.LPG0(%r13) l %r3,.Lsclp_print-.LPG0(%r13)
basr %r14,%r3 basr %r14,%r3
@ -429,8 +430,7 @@ ENTRY(startup_kdump)
.long 1, 0xc0000000 .long 1, 0xc0000000
#endif #endif
4: 4:
/* Continue with 64bit startup code in head64.S */ /* Continue with startup code in head64.S */
sam64 # switch to 64 bit mode
jg startup_continue jg startup_continue
.align 8 .align 8