M installer/installer/cpio.c +5 -4
@@ 21,6 21,7 @@
*/
#include "loader.h"
+#include <arch.h>
#include <string.h>
#include <ebcdic.h>
@@ 75,7 76,7 @@ static void save_file(struct table *te,
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 @@ static void save_file(struct table *te,
wto("Could not create file '");
wto(te->fn);
wto("'.\n");
- die();
+ sigp_stop();
}
if (te->text)
@@ 91,7 92,7 @@ static void save_file(struct table *te,
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 @@ static void readcard(u8 *buf)
}
if (ret)
- die();
+ sigp_stop();
}
void unload_archive(void)
M installer/installer/edf.c +15 -14
@@ 1,5 1,5 @@
/*
- * Copyright (c) 2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2011-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*
* 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 <arch.h>
#include <string.h>
#include <ebcdic.h>
#include <list.h>
@@ 88,14 89,14 @@ static void block_map_add(u8 *fn, u8 *ft
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 @@ static void *read_file_blk(u8 *fn, u8 *f
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 @@ static void *read_file_blk(u8 *fn, u8 *f
map->buf = malloc(adt->adt.DBSIZ);
if (!map->buf)
- die();
+ sigp_stop();
read_blk(map->buf, map->lba);
@@ 140,7 141,7 @@ static void blk_set_dirty(u8 *fn, u8 *ft
map = block_map_find(fn, ft, level, blk);
if (!map || !map->buf)
- die();
+ sigp_stop();
map->dirty = 1;
}
@@ 155,7 156,7 @@ void writeback_buffers()
continue;
if (!cur->buf)
- die();
+ sigp_stop();
write_blk(cur->buf, cur->lba);
}
@@ 212,7 213,7 @@ static void update_directory(struct FST
}
}
- die();
+ sigp_stop();
}
static int file_blocks_at_level(u32 ADBC, int level)
@@ 254,7 255,7 @@ static void __read_file(struct FST *fst)
blocks = file_blocks_at_level(fst->ADBC, level);
if (level == fst->NLVL && blocks != 1)
- die();
+ sigp_stop();
/* read in each block */
for(i=0; i<blocks; i++) {
@@ 334,7 335,7 @@ found:
}
}
- die();
+ sigp_stop();
return 0;
}
@@ 365,7 366,7 @@ static void __append_block(struct FST *f
int x;
if (!lvl)
- die();
+ sigp_stop();
buf = read_file_blk(fst->FNAME, fst->FTYPE, lvl,
blk-1);
@@ 417,7 418,7 @@ void append_record(struct FST *fst, u8 *
u8 *dbuf;
if (fst->RECFM != FSTDFIX)
- die();
+ sigp_stop();
foff = fst->AIC * fst->LRECL;
@@ 460,7 461,7 @@ void mount_fs()
(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 @@ void mount_fs()
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;
M installer/installer/loader.h +0 -19
@@ 51,25 51,6 @@ static inline int strlen(char *p)
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))
M installer/installer/loader_c.c +30 -11
@@ 1,9 1,28 @@
/*
- * Copyright (c) 2007-2019 Josef 'Jeff' Sipek
+ * Copyright (c) 2007-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ *
+ * 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 <binfmt_elf.h>
+#include <arch.h>
#include <string.h>
#include <ebcdic.h>
@@ 31,7 50,7 @@ void __readwrite_blk(void *ptr, u32 lba,
u16 cc, hh, r;
if (lba < 1)
- die();
+ sigp_stop();
memset(ccw, 0, sizeof(ccw));
@@ 84,7 103,7 @@ void __readwrite_blk(void *ptr, u32 lba,
* issue IO
*/
if (__do_io(dasd_sch))
- die();
+ sigp_stop();
}
static int dev_dasd(void)
@@ 105,7 124,7 @@ static int dev_dasd(void)
ret = __do_io(dasd_sch);
if (ret)
- die();
+ sigp_stop();
if ((id.dev_type == 0x3390) &&
(id.dev_model == 0x0A) &&
@@ 142,7 161,7 @@ static u64 find_devnum(u64 devnum)
u64 sch;
if (devnum > 0xffff)
- die();
+ sigp_stop();
memset(&schib, 0, sizeof(struct schib));
@@ 166,7 185,7 @@ static u64 find_devnum(u64 devnum)
schib.pmcw.e = 1;
if (modify_sch(sch, &schib))
- die();
+ sigp_stop();
return sch;
}
@@ 197,7 216,7 @@ void wto(char *str)
ret = __do_io(con_sch);
if (ret)
- die();
+ sigp_stop();
}
void wtor(char *str, char *inp, int buflen)
@@ 223,7 242,7 @@ void wtor(char *str, char *inp, int bufl
ret = __do_io(con_sch);
if (ret)
- die();
+ sigp_stop();
ebcdic2ascii((u8*)inp, buflen);
}
@@ 261,7 280,7 @@ void load_nucleus(void)
*/
con_sch = find_devnum(CON_DEVNUM);
if (con_sch > 0x1ffff)
- die();
+ sigp_stop();
/*
* greet the user on the console
@@ 302,7 321,7 @@ void load_nucleus(void)
*/
wto("done. (Not yet implemented)\n");
- die();
+ sigp_stop();
} else
wto("Formatting skipped.\n");
@@ 341,5 360,5 @@ void load_nucleus(void)
"m" (pgm_new_psw_diswait[0])
);
- die();
+ sigp_stop();
}