Implement separate user (SPU) and interrupt (SPI) stack pointers.
authorAndrew Cagney <cagney@redhat.com>
Fri, 13 Feb 1998 05:22:49 +0000 (05:22 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 13 Feb 1998 05:22:49 +0000 (05:22 +0000)
sim/d10v/ChangeLog
sim/d10v/d10v_sim.h
sim/d10v/simops.c

index 4294cd7f421f94c9de568834ba63b663c8d539dc..7c884fbf25b62c604607ce02883578777bb87172 100644 (file)
@@ -1,3 +1,11 @@
+Fri Feb 13 15:15:58 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * simops.c (move_to_cr): Sync regs[SP_IDX] with State.sp according
+       to PSW:SM.
+
+       * d10v_sim.h (struct _state): Add sp, as holding area for SPI/SPU.
+       (SP_IDX): Define.
+
 Wed Feb 11 16:53:49 1998  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * simops.c (OP_5F00): Call error instead of abort for unknown
index df95426ea1e5cc96a8c5dd9c5edb21914841f20b..665c529bbfdb0ad8afc180c95abade1eec68fbcf 100644 (file)
@@ -75,10 +75,15 @@ enum _ins_type
 
 extern unsigned long ins_type_counters[ (int)INS_MAX ];
 
+enum {
+  SP_IDX = 15,
+};
+
 struct _state
 {
   reg_t regs[16];              /* general-purpose registers */
   reg_t cregs[16];             /* control registers */
+  reg_t sp[2];                  /* holding area for SPI(0)/SPU(1) */
   int64 a[2];                  /* accumulators */
   uint8 SM;
   uint8 EA;
index 9263c423dc91c58e40eec1825db69035e730a429..ef34f9423b34d6cf0073f697bccd388d642ce92b 100644 (file)
@@ -50,6 +50,7 @@ move_to_cr (int cr, reg_t val)
   switch (cr)
     {
     case PSW_CR:
+      State.sp[State.SM] = State.regs[SP_IDX]; /* save old SP */
       State.SM = (val & PSW_SM_BIT) != 0;
       State.EA = (val & PSW_EA_BIT) != 0;
       State.DB = (val & PSW_DB_BIT) != 0;
@@ -62,6 +63,7 @@ move_to_cr (int cr, reg_t val)
       State.F0 = (val & PSW_F0_BIT) != 0;
       State.F1 = (val & PSW_F1_BIT) != 0;
       State.C =  (val & PSW_C_BIT) != 0;
+      State.regs[SP_IDX] = State.sp[State.SM]; /* restore new SP */
       if (State.ST && !State.FX)
        {
          (*d10v_callback->printf_filtered)
This page took 0.027906 seconds and 4 git commands to generate.