zipl/boot: Combine linker scripts for CCW DASD dumpers

Combine linker scripts for single volume and multi-volume ECKD dumpers
to avoid duplicating. Use C preprocessor to define conditional symbols.
Cleanup the generic stage2 linker script(stage2.lds). Since it is still
used for FBA and TAPE dumpers (fba2dump and tape2dump) the .stage2dump.tail
section should be preserved.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2024-10-07 16:21:50 +02:00
committed by Steffen Eiden
parent 8d2290977b
commit 73f211ecb1
4 changed files with 33 additions and 26 deletions

View File

@@ -21,13 +21,14 @@
#define STAGE2_DESC _AC(0x78, UL)
#define STAGE2_ENTRY _AC(0x2018, UL)
#define ECKD2DUMP_MV_TAIL_ADDRESS _AC(0x5000, UL)
#define STAGE2_HEAP_ADDRESS _AC(0x6000, UL)
#define ECKD2DUMP_SV_HEAP_ADDRESS _AC(0xb000, UL)
#define ECKD2DUMP_HEAP_ADDRESS _AC(0xb000, UL)
#define STAGE2_HEAP_SIZE _AC(0x3000, UL)
#define STAGE2_STACK_ADDRESS _AC(0xe400, UL)
#define STAGE2_STACK_SIZE _AC(0x1c00, UL)
#define ECKD2DUMP_SV_STACK_ADDRESS _AC(0xe000, UL)
#define ECKD2DUMP_SV_STACK_SIZE _AC(0x2000, UL)
#define ECKD2DUMP_STACK_ADDRESS _AC(0xe000, UL)
#define ECKD2DUMP_STACK_SIZE _AC(0x2000, UL)
#define STAGE2_MAX_SIZE _AC(0x3000, UL)
#define STAGE2_DUMPER_SIZE_V1 _AC(0x1000, UL)

View File

@@ -53,6 +53,15 @@ endif
%.lds: %.lds.S
$(CPP) -Wp,-MD,.$@.d,-MT,$@ $(INCLUDE_PARMS) -P -C -o $@ $<
eckd2dump_sv.lds: eckd2dump.lds.S
$(CPP) -Wp,-MD,.$@.d,-MT,$@ $(INCLUDE_PARMS) -D STAGE2DUMP_TAIL_ADDRESS=0x9ff0 \
-P -C -o $@ $<
eckd2dump_mv.lds: eckd2dump.lds.S
$(CPP) -Wp,-MD,.$@.d,-MT,$@ $(INCLUDE_PARMS) -D STAGE2DUMP_TAIL_ADDRESS=0x4ff0 \
-D ECKD2DUMP_MV -P -C -o $@ $<
stage2.lds: stage2.lds.S
$(CPP) -Wp,-MD,.$@.d,-MT,$@ $(INCLUDE_PARMS) -D STAGE2DUMP_TAIL_ADDRESS=0x4ff0 \
-P -C -o $@ $<
fba0.exec eckd0_ldl.exec eckd0_cdl.exec tape0.exec: \
stage0.lds
@@ -69,7 +78,7 @@ eckd2dump_sv.exec: \
libc.o ebcdic.o sclp.o entry.o eckd2dump_sv.lds
eckd2dump_mv.exec: \
head.o stage2dump.o cio.o eckd2dump.o eckd2dump_mv.o \
libc.o ebcdic.o sclp.o entry.o stage2.lds
libc.o ebcdic.o sclp.o entry.o eckd2dump_mv.lds
fba2dump.exec: \
head.o stage2dump.o cio.o fba2dump.o \
libc.o ebcdic.o sclp.o entry.o stage2.lds

View File

@@ -1,14 +1,14 @@
/*
* Memory layout of stage 2 for single volume dasd
* dump tool with compression support
* Memory layout of stage 2 for ECKD DASD dump tool
* (single volume and multi volume)
* ===============================================
*
* General memory layout
* ---------------------
*
* 0x0000-0x1fff Lowcore
* 0x2000-0x9fff Sections (load): head, text, data, rodata, rodata.str
* 0xa000-0xafff Sections: bss
* 0x2000-0xafff Sections (load): head, text, data, rodata, rodata.str,
* stage2dump.tail, eckd2dump_mv.tail, bss
* 0xb000-0xdfff Memory allocation (heap)
* 0xe000-0xffff Stack
*
@@ -17,7 +17,9 @@
*
* 0x78 Stage 2 description parameters
* 0x2018 Stage 2 entry point
* 0x9ff8 Max mem dump parameter
* 0x4ff0 Stage 2 multi-volume dump parameters (eckd2dump_mv)
* 0x5000 Multi-volume dump parameters table (eckd2dump_mv)
* 0x9ff0 Stage 2 single volume dump parameters (eckd2dump_sv)
*/
#include "boot/loaders_layout.h"
@@ -39,17 +41,18 @@ SECTIONS
__ex_table_stop = .;
.rodata : {*(.rodata) }
.data : { *(.data) }
__stage2_params = .;
. = 0x9ff0;
. = STAGE2DUMP_TAIL_ADDRESS;
.stage2dump.tail : { *(.stage2dump.tail) }
. = 0xa000;
#ifdef ECKD2DUMP_MV
. = ECKD2DUMP_MV_TAIL_ADDRESS;
.eckd2dump_mv.tail : { *(.eckd2dump_mv.tail) }
#endif
__bss_start = .;
.bss : { *(.bss) }
__bss_stop = .;
. = ECKD2DUMP_SV_HEAP_ADDRESS;
. = ECKD2DUMP_HEAP_ADDRESS;
__heap_start = .;
.heap : {
. += STAGE2_HEAP_SIZE;
@@ -58,11 +61,11 @@ SECTIONS
}
__heap_stop = .;
. = ECKD2DUMP_SV_STACK_ADDRESS;
. = ECKD2DUMP_STACK_ADDRESS;
__stack_start = .;
.stack : {
. += ECKD2DUMP_SV_STACK_SIZE;
ASSERT(__stack_end - __stack_start == ECKD2DUMP_SV_STACK_SIZE,
. += ECKD2DUMP_STACK_SIZE;
ASSERT(__stack_end - __stack_start == ECKD2DUMP_STACK_SIZE,
"Stack section doesn't conform to the described memory layout");
}
__stack_end = .;

View File

@@ -7,8 +7,7 @@
*
* 0x0000-0x1fff Lowcore
* 0x2000-0x4fff Sections (load): head, text, data, rodata, rodata.str
* 0x5000-0x51ff eckd2dump_mv parameter block (426 bytes)
* 0x5200-0x5fff Sections: bss
* 0x5000-0x5fff Sections: bss
* 0x6000-0x8fff Memory allocation (heap)
* 0x9000-0x9fff Memory to load stage3 parameter to
* 0xa000-0xdfff Memory to load stage3 to
@@ -20,9 +19,7 @@
*
* 0x78 Stage 2 description parameters
* 0x2018 Stage 2 entry point
* 0x3ff7 eckd2dump_mv force parameter
* 0x3ff8 Max mem dump parameter
* 0x5000-0x51ff eckd2dump_mv parameter block (426 bytes)
* 0x4ff0 Stage 2 dump parameters (FBA or Tape standalone dump)
*/
#include "boot/loaders_layout.h"
@@ -46,12 +43,9 @@ SECTIONS
.data : { *(.data) }
__stage2_params = .;
. = 0x4ff0;
. = STAGE2DUMP_TAIL_ADDRESS;
.stage2dump.tail : { *(.stage2dump.tail) }
. = 0x5000;
.eckd2dump_mv.tail : { *(.eckd2dump_mv.tail) }
. = 0x5200;
__bss_start = .;
.bss : { *(.bss) }
__bss_stop = .;