Commit 3b760e046b54a362bdcc39c45b339dafb61d82dd

Authored by pbrook
1 parent 52b43737

Use load_image_targphys.

Signed-off-by: Paul Brook <paul@codesourcery.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7054 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 11 deletions
hw/arm_boot.c
@@ -192,8 +192,6 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) @@ -192,8 +192,6 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
192 int is_linux = 0; 192 int is_linux = 0;
193 uint64_t elf_entry; 193 uint64_t elf_entry;
194 target_ulong entry; 194 target_ulong entry;
195 - uint32_t pd;  
196 - void *loader_phys;  
197 195
198 /* Load the kernel. */ 196 /* Load the kernel. */
199 if (!info->kernel_filename) { 197 if (!info->kernel_filename) {
@@ -208,11 +206,6 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) @@ -208,11 +206,6 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
208 qemu_register_reset(main_cpu_reset, env); 206 qemu_register_reset(main_cpu_reset, env);
209 } 207 }
210 208
211 - /* FIXME: We should make load_image take a guest physical address. */  
212 - pd = cpu_get_physical_page_desc(info->loader_start);  
213 - loader_phys = phys_ram_base + (pd & TARGET_PAGE_MASK) +  
214 - (info->loader_start & ~TARGET_PAGE_MASK);  
215 -  
216 /* Assume that raw images are linux kernels, and ELF images are not. */ 209 /* Assume that raw images are linux kernels, and ELF images are not. */
217 kernel_size = load_elf(info->kernel_filename, 0, &elf_entry, NULL, NULL); 210 kernel_size = load_elf(info->kernel_filename, 0, &elf_entry, NULL, NULL);
218 entry = elf_entry; 211 entry = elf_entry;
@@ -221,9 +214,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) @@ -221,9 +214,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
221 &is_linux); 214 &is_linux);
222 } 215 }
223 if (kernel_size < 0) { 216 if (kernel_size < 0) {
224 - kernel_size = load_image(info->kernel_filename,  
225 - loader_phys + KERNEL_LOAD_ADDR);  
226 entry = info->loader_start + KERNEL_LOAD_ADDR; 217 entry = info->loader_start + KERNEL_LOAD_ADDR;
  218 + kernel_size = load_image_targphys(info->kernel_filename, entry,
  219 + ram_size - KERNEL_LOAD_ADDR);
227 is_linux = 1; 220 is_linux = 1;
228 } 221 }
229 if (kernel_size < 0) { 222 if (kernel_size < 0) {
@@ -237,8 +230,10 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) @@ -237,8 +230,10 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
237 env->thumb = entry & 1; 230 env->thumb = entry & 1;
238 } else { 231 } else {
239 if (info->initrd_filename) { 232 if (info->initrd_filename) {
240 - initrd_size = load_image(info->initrd_filename,  
241 - loader_phys + INITRD_LOAD_ADDR); 233 + initrd_size = load_image_targphys(info->initrd_filename,
  234 + info->loader_start
  235 + + INITRD_LOAD_ADDR,
  236 + ram_size - INITRD_LOAD_ADDR);
242 if (initrd_size < 0) { 237 if (initrd_size < 0) {
243 fprintf(stderr, "qemu: could not load initrd '%s'\n", 238 fprintf(stderr, "qemu: could not load initrd '%s'\n",
244 info->initrd_filename); 239 info->initrd_filename);