sim: h8300 SBR initial value fix

Message ID 1464323935-26150-1-git-send-email-ysato@users.sourceforge.jp
State New, archived
Headers

Commit Message

Yoshinori Sato May 27, 2016, 4:38 a.m. UTC
  SBR is initialize to 0xFFFFFF00.

2016-05-27  Yoshinori Sato  <ysao@users.sourceforge.jp>

	* compile.c (init_pointer): SBR initialize to 0xFFFFFF00
	(sim_open): Remove missing initialize.

---
 sim/h8300/compile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mike Frysinger May 27, 2016, 6:18 p.m. UTC | #1
On 27 May 2016 13:38, Yoshinori Sato wrote:
> SBR is initialize to 0xFFFFFF00.
> 
> 2016-05-27  Yoshinori Sato  <ysao@users.sourceforge.jp>
> 
> 	* compile.c (init_pointer): SBR initialize to 0xFFFFFF00
> 	(sim_open): Remove missing initialize.
> 
> ---
>  sim/h8300/compile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
> index c1c61d8..c892379 100644
> --- a/sim/h8300/compile.c
> +++ b/sim/h8300/compile.c
> @@ -1764,6 +1764,7 @@ init_pointers (SIM_DESC sd)
>        h8_set_mask (sd, memory_size - 1);
>  
>        memset (h8_get_reg_buf (sd), 0, sizeof (((STATE_CPU (sd, 0))->regs)));
> +      h8_set_sbr (sd,  0xFFFFFF00);
>  
>        for (i = 0; i < 8; i++)
>  	{
> @@ -4843,7 +4844,6 @@ sim_open (SIM_OPEN_KIND kind,
>  
>    cpu = STATE_CPU (sd, 0);
>    SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
> -  cpu->regs[SBR_REGNUM] = 0xFFFFFF00;
>    /* sim_cpu object is new, so some initialization is needed.  */
>    init_pointers_needed = 1;

OK for now, but the init_pointers() func really needs to die.
i just haven't finished ripping that cruft out yet.
-mike
  

Patch

diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index c1c61d8..c892379 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -1764,6 +1764,7 @@  init_pointers (SIM_DESC sd)
       h8_set_mask (sd, memory_size - 1);
 
       memset (h8_get_reg_buf (sd), 0, sizeof (((STATE_CPU (sd, 0))->regs)));
+      h8_set_sbr (sd,  0xFFFFFF00);
 
       for (i = 0; i < 8; i++)
 	{
@@ -4843,7 +4844,6 @@  sim_open (SIM_OPEN_KIND kind,
 
   cpu = STATE_CPU (sd, 0);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
-  cpu->regs[SBR_REGNUM] = 0xFFFFFF00;
   /* sim_cpu object is new, so some initialization is needed.  */
   init_pointers_needed = 1;