Commit 3ddd00658edf6c1af0c22f9cdcf963efdeda91bb
1 parent
a2d1ebaf
Fix 64bit-induced MIPS Malta breakage, by Aurelien Jarno.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2365 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
19 additions
and
20 deletions
hw/mips_malta.c
@@ -32,12 +32,11 @@ | @@ -32,12 +32,11 @@ | ||
32 | 32 | ||
33 | #ifdef MIPS_HAS_MIPS64 | 33 | #ifdef MIPS_HAS_MIPS64 |
34 | #define INITRD_LOAD_ADDR (int64_t)0x80800000 | 34 | #define INITRD_LOAD_ADDR (int64_t)0x80800000 |
35 | -#define ENVP_ADDR (int64_t)0x80002000 | ||
36 | #else | 35 | #else |
37 | #define INITRD_LOAD_ADDR (int32_t)0x80800000 | 36 | #define INITRD_LOAD_ADDR (int32_t)0x80800000 |
38 | -#define ENVP_ADDR (int32_t)0x80002000 | ||
39 | #endif | 37 | #endif |
40 | 38 | ||
39 | +#define ENVP_ADDR (int32_t)0x80002000 | ||
41 | #define VIRT_TO_PHYS_ADDEND (-((int64_t)(int32_t)0x80000000)) | 40 | #define VIRT_TO_PHYS_ADDEND (-((int64_t)(int32_t)0x80000000)) |
42 | 41 | ||
43 | #define ENVP_NB_ENTRIES 16 | 42 | #define ENVP_NB_ENTRIES 16 |
@@ -390,36 +389,36 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t | @@ -390,36 +389,36 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t | ||
390 | 389 | ||
391 | /* Small bootloader */ | 390 | /* Small bootloader */ |
392 | p = (uint32_t *) (phys_ram_base + bios_offset); | 391 | p = (uint32_t *) (phys_ram_base + bios_offset); |
393 | - stl_raw(p++, 0x0bf00010); /* j 0x1fc00040 */ | ||
394 | - stl_raw(p++, 0x00000000); /* nop */ | 392 | + stl_raw(p++, 0x0bf00010); /* j 0x1fc00040 */ |
393 | + stl_raw(p++, 0x00000000); /* nop */ | ||
395 | 394 | ||
396 | /* Second part of the bootloader */ | 395 | /* Second part of the bootloader */ |
397 | p = (uint32_t *) (phys_ram_base + bios_offset + 0x040); | 396 | p = (uint32_t *) (phys_ram_base + bios_offset + 0x040); |
398 | - stl_raw(p++, 0x3c040000); /* lui a0, 0 */ | ||
399 | - stl_raw(p++, 0x34840002); /* ori a0, a0, 2 */ | ||
400 | - stl_raw(p++, 0x3c050000 | ((ENVP_ADDR) >> 16)); /* lui a1, high(ENVP_ADDR) */ | ||
401 | - stl_raw(p++, 0x34a50000 | ((ENVP_ADDR) & 0xffff)); /* ori a1, a0, low(ENVP_ADDR) */ | ||
402 | - stl_raw(p++, 0x3c060000 | ((ENVP_ADDR + 8) >> 16)); /* lui a2, high(ENVP_ADDR + 8) */ | ||
403 | - stl_raw(p++, 0x34c60000 | ((ENVP_ADDR + 8) & 0xffff)); /* ori a2, a2, low(ENVP_ADDR + 8) */ | ||
404 | - stl_raw(p++, 0x3c070000 | ((env->ram_size) >> 16)); /* lui a3, high(env->ram_size) */ | ||
405 | - stl_raw(p++, 0x34e70000 | ((env->ram_size) & 0xffff)); /* ori a3, a3, low(env->ram_size) */ | ||
406 | - stl_raw(p++, 0x3c1f0000 | ((kernel_addr) >> 16)); /* lui ra, high(kernel_addr) */; | ||
407 | - stl_raw(p++, 0x37ff0000 | ((kernel_addr) & 0xffff)); /* ori ra, ra, low(kernel_addr) */ | ||
408 | - stl_raw(p++, 0x03e00008); /* jr ra */ | ||
409 | - stl_raw(p++, 0x00000000); /* nop */ | 397 | + stl_raw(p++, 0x3c040000); /* lui a0, 0 */ |
398 | + stl_raw(p++, 0x34840002); /* ori a0, a0, 2 */ | ||
399 | + stl_raw(p++, 0x3c050000 | ((ENVP_ADDR >> 16) & 0xffff)); /* lui a1, high(ENVP_ADDR) */ | ||
400 | + stl_raw(p++, 0x34a50000 | (ENVP_ADDR & 0xffff)); /* ori a1, a0, low(ENVP_ADDR) */ | ||
401 | + stl_raw(p++, 0x3c060000 | (((ENVP_ADDR + 8) >> 16) & 0xffff)); /* lui a2, high(ENVP_ADDR + 8) */ | ||
402 | + stl_raw(p++, 0x34c60000 | ((ENVP_ADDR + 8) & 0xffff)); /* ori a2, a2, low(ENVP_ADDR + 8) */ | ||
403 | + stl_raw(p++, 0x3c070000 | (env->ram_size >> 16)); /* lui a3, high(env->ram_size) */ | ||
404 | + stl_raw(p++, 0x34e70000 | (env->ram_size & 0xffff)); /* ori a3, a3, low(env->ram_size) */ | ||
405 | + stl_raw(p++, 0x3c1f0000 | ((kernel_addr >> 16) & 0xffff)); /* lui ra, high(kernel_addr) */; | ||
406 | + stl_raw(p++, 0x37ff0000 | (kernel_addr & 0xffff)); /* ori ra, ra, low(kernel_addr) */ | ||
407 | + stl_raw(p++, 0x03e00008); /* jr ra */ | ||
408 | + stl_raw(p++, 0x00000000); /* nop */ | ||
410 | } | 409 | } |
411 | 410 | ||
412 | static void prom_set(int index, const char *string, ...) | 411 | static void prom_set(int index, const char *string, ...) |
413 | { | 412 | { |
414 | va_list ap; | 413 | va_list ap; |
415 | - uint32_t *p; | ||
416 | - uint32_t table_addr; | 414 | + int32_t *p; |
415 | + int32_t table_addr; | ||
417 | char *s; | 416 | char *s; |
418 | 417 | ||
419 | if (index >= ENVP_NB_ENTRIES) | 418 | if (index >= ENVP_NB_ENTRIES) |
420 | return; | 419 | return; |
421 | 420 | ||
422 | - p = (uint32_t *) (phys_ram_base + ENVP_ADDR + VIRT_TO_PHYS_ADDEND); | 421 | + p = (int32_t *) (phys_ram_base + ENVP_ADDR + VIRT_TO_PHYS_ADDEND); |
423 | p += index; | 422 | p += index; |
424 | 423 | ||
425 | if (string == NULL) { | 424 | if (string == NULL) { |
@@ -427,7 +426,7 @@ static void prom_set(int index, const char *string, ...) | @@ -427,7 +426,7 @@ static void prom_set(int index, const char *string, ...) | ||
427 | return; | 426 | return; |
428 | } | 427 | } |
429 | 428 | ||
430 | - table_addr = ENVP_ADDR + sizeof(uint32_t) * ENVP_NB_ENTRIES + index * ENVP_ENTRY_SIZE; | 429 | + table_addr = ENVP_ADDR + sizeof(int32_t) * ENVP_NB_ENTRIES + index * ENVP_ENTRY_SIZE; |
431 | s = (char *) (phys_ram_base + VIRT_TO_PHYS_ADDEND + table_addr); | 430 | s = (char *) (phys_ram_base + VIRT_TO_PHYS_ADDEND + table_addr); |
432 | 431 | ||
433 | stl_raw(p, table_addr); | 432 | stl_raw(p, table_addr); |