Commit 82790064116b066531c8b61067509a0fd4169ee0
1 parent
06c0b388
Cast ELF datatypes properly to host 64bit types.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3407 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
6 additions
and
3 deletions
elf_ops.h
... | ... | @@ -159,7 +159,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, |
159 | 159 | goto fail; |
160 | 160 | |
161 | 161 | if (pentry) |
162 | - *pentry = (uint64_t)ehdr.e_entry; | |
162 | + *pentry = (uint64_t)(elf_sword)ehdr.e_entry; | |
163 | 163 | |
164 | 164 | glue(load_symbols, SZ)(&ehdr, fd, must_swab); |
165 | 165 | |
... | ... | @@ -206,9 +206,9 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, |
206 | 206 | } |
207 | 207 | qemu_free(phdr); |
208 | 208 | if (lowaddr) |
209 | - *lowaddr = (uint64_t)low; | |
209 | + *lowaddr = (uint64_t)(elf_sword)low; | |
210 | 210 | if (highaddr) |
211 | - *highaddr = (uint64_t)high; | |
211 | + *highaddr = (uint64_t)(elf_sword)high; | |
212 | 212 | return total_size; |
213 | 213 | fail: |
214 | 214 | qemu_free(data); | ... | ... |
loader.c
... | ... | @@ -173,6 +173,7 @@ static void *load_at(int fd, int offset, int size) |
173 | 173 | |
174 | 174 | #define SZ 32 |
175 | 175 | #define elf_word uint32_t |
176 | +#define elf_sword int32_t | |
176 | 177 | #define bswapSZs bswap32s |
177 | 178 | #include "elf_ops.h" |
178 | 179 | |
... | ... | @@ -182,6 +183,7 @@ static void *load_at(int fd, int offset, int size) |
182 | 183 | #undef elf_sym |
183 | 184 | #undef elf_note |
184 | 185 | #undef elf_word |
186 | +#undef elf_sword | |
185 | 187 | #undef bswapSZs |
186 | 188 | #undef SZ |
187 | 189 | #define elfhdr elf64_hdr |
... | ... | @@ -190,6 +192,7 @@ static void *load_at(int fd, int offset, int size) |
190 | 192 | #define elf_shdr elf64_shdr |
191 | 193 | #define elf_sym elf64_sym |
192 | 194 | #define elf_word uint64_t |
195 | +#define elf_sword int64_t | |
193 | 196 | #define bswapSZs bswap64s |
194 | 197 | #define SZ 64 |
195 | 198 | #include "elf_ops.h" | ... | ... |