comparison arm7dis/common.c @ 87:f7fba8518fa2

armdis: skeleton compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 29 Mar 2014 00:23:16 +0000
parents 537cf2245d98
children c883e60df239
comparison
equal deleted inserted replaced
86:537cf2245d98 87:f7fba8518fa2
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 char *binfilename; 9 char *binfilename;
10 u_char *filemap; 10 u_char *filemap;
11 u_long disasm_len, base_vma; 11 unsigned disasm_len, base_vma;
12 12
13 common_init(argc, argv, instr_size) 13 common_init(argc, argv, instr_size)
14 char **argv; 14 char **argv;
15 { 15 {
16 int fd; 16 int fd;
17 struct stat st; 17 struct stat st;
18 u_long fileoff; 18 unsigned fileoff;
19 19
20 if (argc < 2 || argc > 5) { 20 if (argc < 2 || argc > 5) {
21 fprintf(stderr, 21 fprintf(stderr,
22 "usage: %s binfile [file-offset [len [vaddr]]]\n", 22 "usage: %s binfile [file-offset [len [vaddr]]]\n",
23 argv[0]); 23 argv[0]);
57 fprintf(stderr, 57 fprintf(stderr,
58 "error: length of region to be disassembled must be a multiple of %d bytes\n", 58 "error: length of region to be disassembled must be a multiple of %d bytes\n",
59 instr_size); 59 instr_size);
60 exit(1); 60 exit(1);
61 } 61 }
62 filemap = mmap(NULL, disasm_len, PROT_READ, MAP_PRIVATE, fd, fileoff); 62 filemap = mmap(NULL, (size_t) disasm_len, PROT_READ, MAP_PRIVATE, fd,
63 (off_t) fileoff);
63 if (filemap == MAP_FAILED) { 64 if (filemap == MAP_FAILED) {
64 perror("mmap"); 65 perror("mmap");
65 exit(1); 66 exit(1);
66 } 67 }
67 close(fd); 68 close(fd);