aboutsummaryrefslogtreecommitdiff
path: root/hw/mips_r4k.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-21 01:19:56 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-21 01:19:56 +0000
commitc570fd169c16f110781f31e0e963542a15229ee9 (patch)
treea829998efa7b38a23addc5b248c8e416d513dea2 /hw/mips_r4k.c
parent328a42406d1da2044e2918918ac744f95a1eeb36 (diff)
Preliminiary MIPS64 support, disabled by default due to performance impact.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2250 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/mips_r4k.c')
-rw-r--r--hw/mips_r4k.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 61db814d97..ca3a4ffce9 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -11,10 +11,10 @@
#define BIOS_FILENAME "mips_bios.bin"
//#define BIOS_FILENAME "system.bin"
-#define KERNEL_LOAD_ADDR 0x80010000
-#define INITRD_LOAD_ADDR 0x80800000
+#define KERNEL_LOAD_ADDR SIGN_EXTEND32(0x80010000)
+#define INITRD_LOAD_ADDR SIGN_EXTEND32(0x80800000)
-#define VIRT_TO_PHYS_ADDEND (-0x80000000LL)
+#define VIRT_TO_PHYS_ADDEND (-SIGN_EXTEND32(0x80000000LL))
static const int ide_iobase[2] = { 0x1f0, 0x170 };
static const int ide_iobase2[2] = { 0x3f6, 0x376 };
@@ -74,9 +74,11 @@ void load_kernel (CPUState *env, int ram_size, const char *kernel_filename,
long kernel_size, initrd_size;
kernel_size = load_elf(kernel_filename, VIRT_TO_PHYS_ADDEND, &entry);
- if (kernel_size >= 0)
+ if (kernel_size >= 0) {
+ if ((entry & ~0x7fffffffULL) == 0x80000000)
+ entry = SIGN_EXTEND32(entry);
env->PC = entry;
- else {
+ } else {
kernel_size = load_image(kernel_filename,
phys_ram_base + KERNEL_LOAD_ADDR + VIRT_TO_PHYS_ADDEND);
if (kernel_size < 0) {
@@ -103,7 +105,7 @@ void load_kernel (CPUState *env, int ram_size, const char *kernel_filename,
if (initrd_size > 0) {
int ret;
ret = sprintf(phys_ram_base + (16 << 20) - 256,
- "rd_start=0x%08x rd_size=%li ",
+ "rd_start=0x" TLSZ " rd_size=%li ",
INITRD_LOAD_ADDR,
initrd_size);
strcpy (phys_ram_base + (16 << 20) - 256 + ret, kernel_cmdline);