# HG changeset patch # User Josef 'Jeff' Sipek # Date 1565104862 14400 # Tue Aug 06 11:21:02 2019 -0400 # Node ID 991adc3ab4b41113158737e344a8304521c89d53 # Parent 9056cff5956f9c0b41d71bf38a57d2b23d2181ee installer: don't open-code sigp_stop() Signed-off-by: Josef 'Jeff' Sipek diff --git a/installer/installer/cpio.c b/installer/installer/cpio.c --- a/installer/installer/cpio.c +++ b/installer/installer/cpio.c @@ -21,6 +21,7 @@ */ #include "loader.h" +#include #include #include @@ -75,7 +76,7 @@ wto(te->fn); wto("' already exists on the device.\n"); wto("The device has been left unmodified.\n"); - die(); + sigp_stop(); } ret = create_file(te->fn, te->ft, te->lrecl, &fst); @@ -83,7 +84,7 @@ wto("Could not create file '"); wto(te->fn); wto("'.\n"); - die(); + sigp_stop(); } if (te->text) @@ -91,7 +92,7 @@ if (te->lba) { if (filesize > te->lrecl) - die(); + sigp_stop(); snprintf(pbuf, 100, "special file, writing copy of data to LBA %d\n", te->lba); wto(pbuf); @@ -147,7 +148,7 @@ } if (ret) - die(); + sigp_stop(); } void unload_archive(void) diff --git a/installer/installer/edf.c b/installer/installer/edf.c --- a/installer/installer/edf.c +++ b/installer/installer/edf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Josef 'Jeff' Sipek + * Copyright (c) 2011-2019 Josef 'Jeff' Sipek * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -21,6 +21,7 @@ */ #include "loader.h" +#include #include #include #include @@ -88,14 +89,14 @@ map = block_map_find(fn, ft, level, blk_no); if (map) { if (map->lba != lba) - die(); + sigp_stop(); return; } map = malloc(sizeof(struct block_map)); if (!map) - die(); + sigp_stop(); memcpy(map->fn, fn, 8); memcpy(map->ft, ft, 8); @@ -119,7 +120,7 @@ snprintf(buf,128,"%s could not find block %d at level %d\n", __func__, blk, level); wto(buf); - die(); + sigp_stop(); } if (map->buf) @@ -127,7 +128,7 @@ map->buf = malloc(adt->adt.DBSIZ); if (!map->buf) - die(); + sigp_stop(); read_blk(map->buf, map->lba); @@ -140,7 +141,7 @@ map = block_map_find(fn, ft, level, blk); if (!map || !map->buf) - die(); + sigp_stop(); map->dirty = 1; } @@ -155,7 +156,7 @@ continue; if (!cur->buf) - die(); + sigp_stop(); write_blk(cur->buf, cur->lba); } @@ -212,7 +213,7 @@ } } - die(); + sigp_stop(); } static int file_blocks_at_level(u32 ADBC, int level) @@ -254,7 +255,7 @@ blocks = file_blocks_at_level(fst->ADBC, level); if (level == fst->NLVL && blocks != 1) - die(); + sigp_stop(); /* read in each block */ for(i=0; iFNAME, fst->FTYPE, lvl, blk-1); @@ -417,7 +418,7 @@ u8 *dbuf; if (fst->RECFM != FSTDFIX) - die(); + sigp_stop(); foff = fst->AIC * fst->LRECL; @@ -460,7 +461,7 @@ (adt->adt.DBSIZ != EDF_SUPPORTED_BLOCK_SIZE) || (adt->adt.OFFST != 0) || (adt->adt.FSTSZ != sizeof(struct FST))) - die(); + sigp_stop(); block_map_add(DIRECTOR_FN, DIRECTOR_FT, 0, 0, adt->adt.DOP); @@ -472,7 +473,7 @@ memcmp(fst[1].FNAME, ALLOCMAP_FN, 8) || memcmp(fst[1].FTYPE, ALLOCMAP_FT, 8) || (fst[1].RECFM != FSTDFIX)) - die(); + sigp_stop(); directory = fst; allocmap = fst+1; diff --git a/installer/installer/loader.h b/installer/installer/loader.h --- a/installer/installer/loader.h +++ b/installer/installer/loader.h @@ -51,25 +51,6 @@ return i; } -/* - * halt the cpu - * - * NOTE: we don't care about not clobbering registers as when this - * code executes, the CPU will be stopped. - */ -static inline void die(void) -{ - asm volatile( - "SR %r1, %r1 # not used, but should be zero\n" - "SR %r3, %r3 # CPU Address\n" - "SIGP %r1, %r3, 0x05 # Signal, order 0x05\n" - ); - - /* - * Just in case SIGP fails - */ - for(;;); -} #define ADDR31(x) ((u32) (u64) (x)) diff --git a/installer/installer/loader_c.c b/installer/installer/loader_c.c --- a/installer/installer/loader_c.c +++ b/installer/installer/loader_c.c @@ -1,9 +1,28 @@ /* - * Copyright (c) 2007-2019 Josef 'Jeff' Sipek + * Copyright (c) 2007-2019 Josef 'Jeff' Sipek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include "loader.h" #include +#include #include #include @@ -31,7 +50,7 @@ u16 cc, hh, r; if (lba < 1) - die(); + sigp_stop(); memset(ccw, 0, sizeof(ccw)); @@ -84,7 +103,7 @@ * issue IO */ if (__do_io(dasd_sch)) - die(); + sigp_stop(); } static int dev_dasd(void) @@ -105,7 +124,7 @@ ret = __do_io(dasd_sch); if (ret) - die(); + sigp_stop(); if ((id.dev_type == 0x3390) && (id.dev_model == 0x0A) && @@ -142,7 +161,7 @@ u64 sch; if (devnum > 0xffff) - die(); + sigp_stop(); memset(&schib, 0, sizeof(struct schib)); @@ -166,7 +185,7 @@ schib.pmcw.e = 1; if (modify_sch(sch, &schib)) - die(); + sigp_stop(); return sch; } @@ -197,7 +216,7 @@ ret = __do_io(con_sch); if (ret) - die(); + sigp_stop(); } void wtor(char *str, char *inp, int buflen) @@ -223,7 +242,7 @@ ret = __do_io(con_sch); if (ret) - die(); + sigp_stop(); ebcdic2ascii((u8*)inp, buflen); } @@ -261,7 +280,7 @@ */ con_sch = find_devnum(CON_DEVNUM); if (con_sch > 0x1ffff) - die(); + sigp_stop(); /* * greet the user on the console @@ -302,7 +321,7 @@ */ wto("done. (Not yet implemented)\n"); - die(); + sigp_stop(); } else wto("Formatting skipped.\n"); @@ -341,5 +360,5 @@ "m" (pgm_new_psw_diswait[0]) ); - die(); + sigp_stop(); }