3 * Loads binary into VM memory.
10 #include <sys/types.h>
21 void abort_tool (char *msg, char *arg)
27 void readBinary (char *fileName)
35 pDesc = open (fileName, O_RDONLY | O_BINARY);
37 abort_tool ("Unable to open %s\n", fileName);
38 pLength = lseek (pDesc, 0, SEEK_END);
39 lseek (pDesc, 0, SEEK_SET);
40 pBinary = (void *) malloc (pLength);
42 while (pTotal < pLength)
44 pNumRead = read (pDesc, pBinary + pTotal, pLength - pTotal);
47 printf ("Unexpected EOF\n");
53 printf ("Installing binary %d\n", (int) pBinary);
55 install_binary (pBinary);
58 printf ("Checking validity of magic number\n");
60 if (get_master_record()->magicNumber != MAGIC)
62 printf ("Fatal: bad magic number: 0x%X. Linked for RCX?"
63 "\n", get_master_record()->magicNumber);