mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Add a boot loader for protected virtualization (PV) that can be combined with a kernel/initrd/parmfile to form a single bootable file. This file must be constructed in a way that it can be used (1) for a QEMU direct kernel boot and (2) it can be zipl'ed by the normal, unmodified zipl program. This new boot loader consists of two parts: 1. stage3a boot loader (cleartext), this loader is responsible for the transition into the protected mode by doing diag308 subcode 8 and 10 calls. 2. stage3b boot loader (encrypted), this loader is very similar to the normal zipl stage3 boot loader. It will be loaded by the Ultravisor after the successful transition into protected mode. Like the zipl stage3 boot loader it moves the kernel and patches in the values for initrd and parmline. The requirements for (1) and (2) result in the following constraints: 1. It must be possible to place stage3a and stage3b at a location >= 0x10000 because the zipl stage3 loader zeroes out everything at addresses lower than 0x10000 of the image. 2. As the stage3 loader of zipl assumes that the passed kernel image looks like a normal kernel image, the zipl stage3 loader modifies the content at the memory area 0x10400 - 0x10800, therefore we leave this area unused in our stage3a loader. 3. The default entry address used by the zipl stage3 loader is 0x10000 so we add a simple branch to 0x11000 at 0x10000 so the zipl stage3 loader can modify the area 0x10400 - 0x10800 without affecting the stage3a loader. The stage3b loader is linked at address 0x9000, therefore it will not work at another address. The relocation support for the stage3b loader, so that it can be placed at addresses != 0x9000, is added in the next patch. This loader with relocation support has the name 'stage3b_reloc'. The memory layout of the single bootable file looks like: +-----------------------+-----------+------------------------+ |Start |End |Use | +=======================+===========+========================+ |0 |0x7 |Short PSW, starting | | | |instruction at 0x11000 | +-----------------------+-----------+------------------------+ |0x10000 |0x10012 |Branch to 0x11000 | +-----------------------+-----------+------------------------+ |0x10013 |0x10fff |Left intentionally | | | |unused | +-----------------------+-----------+------------------------+ |0x11000 |0x12fff |Stage3a | +-----------------------+-----------+------------------------+ |0x13000 |0x13fff |IPIB used as argument | | | |for the diag308 call | +-----------------------+-----------+------------------------+ |0x14000 |0x1[45]fff |UV header used for the | | | |diag308 call (size can | | | |be either 1 or 2 pages) | +-----------------------+-----------+------------------------+ |NEXT_PAGE_ALIGNED_ADDR | |Encrypted Kernel | +-----------------------+-----------+------------------------+ |NEXT_PAGE_ALIGNED_ADDR | |Encrypted Cmdline | +-----------------------+-----------+------------------------+ |NEXT_PAGE_ALIGNED_ADDR | |Encrypted Initrd | +-----------------------+-----------+------------------------+ |NEXT_PAGE_ALIGNED_ADDR | |Encrypted Stage3b_reloc | +-----------------------+-----------+------------------------+ Reviewed-by: Philipp Rudo <prudo@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
26 lines
585 B
C
26 lines
585 B
C
/*
|
|
* Common memory layout for stage3a and stage3b bootloader.
|
|
*
|
|
* Copyright IBM Corp. 2020
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
|
|
#ifndef COMMON_MEMORY_LAYOUT_H
|
|
#define COMMON_MEMORY_LAYOUT_H
|
|
|
|
#include "boot/loaders_layout.h"
|
|
|
|
#define STACK_ADDRESS STAGE3_STACK_ADDRESS
|
|
#define STACK_SIZE STAGE3_STACK_SIZE
|
|
|
|
#define HEAP_ADDRESS STAGE3_HEAP_ADDRESS
|
|
#define HEAP_SIZE STAGE3_HEAP_SIZE
|
|
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
#endif /* __ASSEMBLER__ */
|
|
#endif /* COMMON_MEMORY_LAYOUT_H */
|