1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Startup glue code to uncompress the kernel
4 *
5 * Copyright IBM Corp. 2010
6 *
7 *   Author(s):	Martin Schwidefsky <schwidefsky@de.ibm.com>
8 */
9
10#include <linux/init.h>
11#include <linux/linkage.h>
12#include <asm/asm-offsets.h>
13#include <asm/thread_info.h>
14#include <asm/page.h>
15#include "sizes.h"
16
17__HEAD
18ENTRY(startup_decompressor)
19	basr	%r13,0			# get base
20.LPG1:
21	# setup stack
22	lg	%r15,.Lstack-.LPG1(%r13)
23	aghi	%r15,-160
24	brasl	%r14,decompress_kernel
25	# Set up registers for memory mover. We move the decompressed image to
26	# 0x100000, where startup_continue of the decompressed image is supposed
27	# to be.
28	lgr	%r4,%r2
29	lg	%r2,.Loffset-.LPG1(%r13)
30	lg	%r3,.Lmvsize-.LPG1(%r13)
31	lgr	%r5,%r3
32	# Move the memory mover someplace safe so it doesn't overwrite itself.
33	la	%r1,0x200
34	mvc	0(mover_end-mover,%r1),mover-.LPG1(%r13)
35	# When the memory mover is done we pass control to
36	# arch/s390/kernel/head64.S:startup_continue which lives at 0x100000 in
37	# the decompressed image.
38	lgr	%r6,%r2
39	br	%r1
40mover:
41	mvcle	%r2,%r4,0
42	jo	mover
43	br	%r6
44mover_end:
45
46	.align	8
47.Lstack:
48	.quad	0x8000 + (1<<(PAGE_SHIFT+THREAD_SIZE_ORDER))
49.Loffset:
50	.quad	0x100000
51.Lmvsize:
52	.quad	SZ__bss_start
53