Skip to contentSkip to conversation

PPC: mac newworld: fix cpu NIP reset value

PATCH In review Alexander Graf 3 participants 4 messages Apr 4, 2013 – Apr 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: mac newworld: fix cpu NIP reset value

On -M mac99, we can run 970 CPUs. However, these CPUs define the initial instruction pointer they start execution at as part of their bootup protocol, so effectively it's up to the board to decide where they start.

This went unnoticed, because they used to boot at the same location our flash was mapped to, but due to the recent reset changes our 970 CPUs want to reset to 0x100 now, which is always a 0 instruction.

Set the initial IP to something reasonable for -M mac99.

---
 hw/ppc/mac_newworld.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/ppc/mac_newworld.c +2 -0
index a08a6b2..ca7d98f 100644
@@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
     PowerPCCPU *cpu = opaque;
 
     cpu_reset(CPU(cpu));
+    /* 970 CPUs want to get their initial IP as part of their boot protocol */
+    cpu->env.nip = PROM_ADDR + 0x100;
 }
 
 /* PowerPC Mac99 hardware initialisation */
Signature · 1 line
1.6.0.2
#1 lore raw

Am 04.04.2013 18:47, schrieb Alexander Graf:

Quoted 20 lines

On -M mac99, we can run 970 CPUs. However, these CPUs define the initial instruction pointer they start execution at as part of their bootup protocol, so effectively it's up to the board to decide where they start.

This went unnoticed, because they used to boot at the same location our flash was mapped to, but due to the recent reset changes our 970 CPUs want to reset to 0x100 now, which is always a 0 instruction.

Set the initial IP to something reasonable for -M mac99.

---
 hw/ppc/mac_newworld.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/ppc/mac_newworld.c +0 -0
index a08a6b2..ca7d98f 100644

hw/ppc/mac_newworld.c static void ppc_core99_reset(void *opaque) · line 133

Quoted 8 lines
hw/ppc/mac_newworld.c +2 -0
@@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
     PowerPCCPU *cpu = opaque;
 
     cpu_reset(CPU(cpu));
+    /* 970 CPUs want to get their initial IP as part of their boot protocol */
+    cpu->env.nip = PROM_ADDR + 0x100;
 }
 
 /* PowerPC Mac99 hardware initialisation */

That is lacking a restriction to 970... :) There's probably some -cpu to make it start from -4 instead, no?

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw

Am 04.04.2013 um 21:06 schrieb Andreas Färber <[email protected]>:

Quoted 28 lines

Am 04.04.2013 18:47, schrieb Alexander Graf:

Quoted 27 lines

On -M mac99, we can run 970 CPUs. However, these CPUs define the initial instruction pointer they start execution at as part of their bootup protocol, so effectively it's up to the board to decide where they start.

This went unnoticed, because they used to boot at the same location our flash was mapped to, but due to the recent reset changes our 970 CPUs want to reset to 0x100 now, which is always a 0 instruction.

Set the initial IP to something reasonable for -M mac99.

---
hw/ppc/mac_newworld.c | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
hw/ppc/mac_newworld.c +2 -0
index a08a6b2..ca7d98f 100644
@@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
    PowerPCCPU *cpu = opaque;
 
    cpu_reset(CPU(cpu));
+    /* 970 CPUs want to get their initial IP as part of their boot protocol */
+    cpu->env.nip = PROM_ADDR + 0x100;
 }
 
Quoted 4 lines

hw/ppc/mac_newworld.c static void ppc_core99_reset(void *opaque) · line 133

Quoted 1 line
hw/ppc/mac_newworld.c +0 -0
 /* PowerPC Mac99 hardware initialisation */

That is lacking a restriction to 970... :) There's probably some -cpu to make it start from -4 instead, no?

There shouldn't. All CPUs compatible with -M mac99 boot from 0xfff0100.

Alex

Quoted 6 lines

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Reviewed-by on v1 1/1
#3 lore raw
In reply to Alexander Graf
Quoted 8 lines · Alexander Graf

On -M mac99, we can run 970 CPUs. However, these CPUs define the initial instruction pointer they start execution at as part of their bootup protocol, so effectively it's up to the board to decide where they start.

This went unnoticed, because they used to boot at the same location our flash was mapped to, but due to the recent reset changes our 970 CPUs want to reset to 0x100 now, which is always a 0 instruction.

This is one of the regressions introduced by my patch, thanks for fixing it.

Quoted 21 lines

Set the initial IP to something reasonable for -M mac99.

---
 hw/ppc/mac_newworld.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/ppc/mac_newworld.c +2 -0
index a08a6b2..ca7d98f 100644
@@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
     PowerPCCPU *cpu = opaque;
 
     cpu_reset(CPU(cpu));
+    /* 970 CPUs want to get their initial IP as part of their boot protocol */
+    cpu->env.nip = PROM_ADDR + 0x100;
 }
 
 /* PowerPC Mac99 hardware initialisation */
Signature · 1 line
Fabien Chouteau