FreeCalypso > hg > freecalypso-reveng
view miscprog/cinitdump.c @ 361:5d1c186cc3cf
fluid-mnf/target-bin/cmd39.m0: hand-crafted
by copying cmd.m0 and manually patching the S3 record that contains
the 16-bit word at 0x1140, the literal pool DPLL init constant
used by hardware_init_calypso()
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 14 Mar 2020 19:33:52 +0000 |
parents | e493fcff28ab |
children |
line wrap: on
line source
/* * This program dumps the cinit section records from a firmware image * sans symbols, given just the cinit start address and knowing the * record structure. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> FILE *inf; u_long offset; u_long get_word() { u_char bytes[4]; u_long word; fread(bytes, 1, 4, inf); word = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24); printf("%8lx:\t%08lx\n", offset, word); offset += 4; return word; } main(argc, argv) char **argv; { u_long len, count; if (argc != 3) { fprintf(stderr, "usage: %s filename start-addr\n", argv[0]); exit(1); } inf = fopen(argv[1], "r"); if (!inf) { perror(argv[1]); exit(1); } offset = strtoul(argv[2], 0, 0); fseek(inf, offset, SEEK_SET); for (;;) { len = get_word(); if (!len) break; len = (len + 3) & ~3; get_word(); /* bss address */ for (count = 0; count < len; count += 4) get_word(); putchar('\n'); } exit(0); }