qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/rx/cpu: Use address_space_ldl() to read reset vector


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] target/rx/cpu: Use address_space_ldl() to read reset vector address
Date: Sun, 15 Mar 2020 14:50:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/15/20 2:48 PM, Philippe Mathieu-Daudé wrote:
From: Philippe Mathieu-Daudé <address@hidden>

Hmm author email should be <address@hidden>...


The RX code flash is not a Masked ROM but a EEPROM (electrically
erasable programmable flash memory).
When implementing the flash hardware, the rom_ptr() returns NULL
and the reset vector is not set.
Instead, use the address_space ld/st API to fetch the reset vector
address from the code flash.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
Based-on: <address@hidden>

Same issue might occurs in Cortex-M arm_cpu_reset()
---
  target/rx/cpu.c | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index 9c224a273c..d3bd09e753 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -26,6 +26,8 @@
  #include "hw/loader.h"
  #include "fpu/softfloat.h"
+#define CPU_RESET_VECTOR 0xfffffffc
+
  static void rx_cpu_set_pc(CPUState *cs, vaddr value)
  {
      RXCPU *cpu = RXCPU(cs);
@@ -51,17 +53,13 @@ static void rx_cpu_reset(CPUState *s)
      RXCPU *cpu = RXCPU(s);
      RXCPUClass *rcc = RXCPU_GET_CLASS(cpu);
      CPURXState *env = &cpu->env;
-    uint32_t *resetvec;
rcc->parent_reset(s); memset(env, 0, offsetof(CPURXState, end_reset_fields)); - resetvec = rom_ptr(0xfffffffc, 4);
-    if (resetvec) {
-        /* In the case of kernel, it is ignored because it is not set. */
-        env->pc = ldl_p(resetvec);
-    }
+    env->pc = address_space_ldl(cpu_get_address_space(s, 0),
+                                CPU_RESET_VECTOR, MEMTXATTRS_UNSPECIFIED, 
NULL);
      rx_cpu_unpack_psw(env, 0, 1);
      env->regs[0] = env->isp = env->usp = 0;
      env->fpsw = 0;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]