| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 * Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <inttypes.h> | 8 #include <inttypes.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 close(fd); /* done with this now */ | 171 close(fd); /* done with this now */ |
| 172 | 172 |
| 173 s = (char *)base_of_rom; | 173 s = (char *)base_of_rom; |
| 174 for (i=0; i<sb.st_size; i += FMAP_SEARCH_STRIDE) { | 174 for (i=0; i<sb.st_size; i += FMAP_SEARCH_STRIDE) { |
| 175 if (0 == strncmp(s, "__FMAP__", 8)) { | 175 if (0 == strncmp(s, "__FMAP__", 8)) { |
| 176 printf("hit at 0x%08x\n", (uint32_t)i); | 176 printf("hit at 0x%08x\n", (uint32_t)i); |
| 177 retval = dump_fmap(s); | 177 retval = dump_fmap(s); |
| 178 break; | 178 break; |
| 179 } | 179 } |
| 180 s++; | 180 s += FMAP_SEARCH_STRIDE; |
| 181 } | 181 } |
| 182 | 182 |
| 183 if (0 != munmap(base_of_rom, sb.st_size)) { | 183 if (0 != munmap(base_of_rom, sb.st_size)) { |
| 184 fprintf(stderr, "%s: can't munmap %s: %s\n", | 184 fprintf(stderr, "%s: can't munmap %s: %s\n", |
| 185 progname, | 185 progname, |
| 186 argv[optind], | 186 argv[optind], |
| 187 strerror(errno)); | 187 strerror(errno)); |
| 188 return 1; | 188 return 1; |
| 189 } | 189 } |
| 190 | 190 |
| 191 return retval; | 191 return retval; |
| 192 } | 192 } |
| OLD | NEW |