44 static void file_load_raw(
struct machine *m,
struct memory *mem,
45 char *filename, uint64_t *entrypointp)
49 unsigned char buf[16384];
50 uint64_t entry, loadaddr, vaddr, skip = 0;
58 p = strchr(filename,
':');
60 fprintf(stderr,
"\n");
65 loadaddr = vaddr = entry = strtoull(filename, NULL, 0);
71 skip = strtoull(p2, NULL, 0);
74 if (strchr(p,
':') != NULL) {
75 entry = strtoull(p, NULL, 0);
76 p = strchr(p,
':') + 1;
82 loadaddr = (int64_t)(int32_t)loadaddr;
83 entry = (int64_t)(int32_t)entry;
84 vaddr = (int64_t)(int32_t)vaddr;
85 skip = (int64_t)(int32_t)skip;
88 f = fopen(strrchr(filename,
':')+1,
"r");
94 fseek(
f, skip, SEEK_SET);
98 size_t to_read =
sizeof(buf);
102 if (vaddr & (
sizeof(buf) - 1))
103 to_read =
sizeof(buf) - (vaddr & (
sizeof(buf)-1));
105 len = fread(buf, 1, to_read,
f);
114 debug(
"RAW: 0x%" PRIx64
" bytes @ 0x%08" PRIx64,
115 (uint64_t) (ftello(
f) - skip), (uint64_t) loadaddr);
118 debug(
" (0x%" PRIx64
" bytes of header skipped)",
125 *entrypointp = entry;
127 n_executables_loaded ++;