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 | 32 | |
33 | 33 | #ifdef MIPS_HAS_MIPS64 |
34 | 34 | #define INITRD_LOAD_ADDR (int64_t)0x80800000 |
35 | -#define ENVP_ADDR (int64_t)0x80002000 | |
36 | 35 | #else |
37 | 36 | #define INITRD_LOAD_ADDR (int32_t)0x80800000 |
38 | -#define ENVP_ADDR (int32_t)0x80002000 | |
39 | 37 | #endif |
40 | 38 | |
39 | +#define ENVP_ADDR (int32_t)0x80002000 | |
41 | 40 | #define VIRT_TO_PHYS_ADDEND (-((int64_t)(int32_t)0x80000000)) |
42 | 41 | |
43 | 42 | #define ENVP_NB_ENTRIES 16 |
... | ... | @@ -390,36 +389,36 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t |
390 | 389 | |
391 | 390 | /* Small bootloader */ |
392 | 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 | 395 | /* Second part of the bootloader */ |
397 | 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 | 411 | static void prom_set(int index, const char *string, ...) |
413 | 412 | { |
414 | 413 | va_list ap; |
415 | - uint32_t *p; | |
416 | - uint32_t table_addr; | |
414 | + int32_t *p; | |
415 | + int32_t table_addr; | |
417 | 416 | char *s; |
418 | 417 | |
419 | 418 | if (index >= ENVP_NB_ENTRIES) |
420 | 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 | 422 | p += index; |
424 | 423 | |
425 | 424 | if (string == NULL) { |
... | ... | @@ -427,7 +426,7 @@ static void prom_set(int index, const char *string, ...) |
427 | 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 | 430 | s = (char *) (phys_ram_base + VIRT_TO_PHYS_ADDEND + table_addr); |
432 | 431 | |
433 | 432 | stl_raw(p, table_addr); | ... | ... |