From 73f211ecb1aa88ede289ca72039ffa0fc2522a7f Mon Sep 17 00:00:00 2001 From: Mikhail Zaslonko Date: Mon, 7 Oct 2024 16:21:50 +0200 Subject: [PATCH] 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 Reviewed-by: Alexander Egorenkov Signed-off-by: Steffen Eiden --- include/boot/loaders_layout.h | 7 +++-- zipl/boot/Makefile | 11 ++++++- .../{eckd2dump_sv.lds.S => eckd2dump.lds.S} | 29 ++++++++++--------- zipl/boot/stage2.lds.S | 12 ++------ 4 files changed, 33 insertions(+), 26 deletions(-) rename zipl/boot/{eckd2dump_sv.lds.S => eckd2dump.lds.S} (65%) diff --git a/include/boot/loaders_layout.h b/include/boot/loaders_layout.h index c85fcca9..19867a34 100644 --- a/include/boot/loaders_layout.h +++ b/include/boot/loaders_layout.h @@ -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) diff --git a/zipl/boot/Makefile b/zipl/boot/Makefile index 75c9f064..063bbc87 100644 --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -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 diff --git a/zipl/boot/eckd2dump_sv.lds.S b/zipl/boot/eckd2dump.lds.S similarity index 65% rename from zipl/boot/eckd2dump_sv.lds.S rename to zipl/boot/eckd2dump.lds.S index d574fd66..05da8ad8 100644 --- a/zipl/boot/eckd2dump_sv.lds.S +++ b/zipl/boot/eckd2dump.lds.S @@ -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 = .; diff --git a/zipl/boot/stage2.lds.S b/zipl/boot/stage2.lds.S index 4eba7f24..2218d5ca 100644 --- a/zipl/boot/stage2.lds.S +++ b/zipl/boot/stage2.lds.S @@ -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 = .;