* corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c,
[deliverable/binutils-gdb.git] / gdb / sparc-stub.c
index 2688b4263f54b21888a1f5298d3f7e9ee2aaa3be..d2e7b438a8dc658d96f4779e59472198bf8bdadb 100644 (file)
@@ -86,7 +86,6 @@
 
 #include <string.h>
 #include <signal.h>
-#include <memory.h>
 
 /************************************************************************
  *
@@ -158,9 +157,27 @@ _trap_low:
 
        mov     %g1, %l4                ! Save g1, we use it to hold the wim
        srl     %l3, 1, %g1             ! Rotate wim right
-       sll     %l3, 8-1, %l5
-       or      %l5, %g1, %g1
+       tst     %g1
+       bg      good_wim                ! Branch if new wim is non-zero
 
+! At this point, we need to bring a 1 into the high order bit of the wim.
+! Since we don't want to make any assumptions about the number of register
+! windows, we figure it out dynamically so as to setup the wim correctly.
+
+       not     %g1                     ! Fill g1 with ones
+       mov     %g1, %wim               ! Fill the wim with ones
+       nop
+       nop
+       nop
+       mov     %wim, %g1               ! Read back the wim
+       inc     %g1                     ! Now g1 has 1 just to left of wim
+       srl     %g1, 1, %g1             ! Now put 1 at top of wim
+       mov     %g0, %wim               ! Clear wim so that subsequent save
+       nop                             !  won't trap
+       nop
+       nop
+
+good_wim:
        save    %g0, %g0, %g0           ! Slip into next window
        mov     %g1, %wim               ! Install the new wim
 
@@ -220,9 +237,6 @@ recursive_trap:
        call    _handle_exception
        add     %sp, 24 * 4, %o0        ! Pass address of registers
 
-       restore                         ! Ensure that previous window is valid
-       save    %g0, %g0, %g0           !  by causing a window_underflow trap
-
 ! Reload all of the registers that aren't on the stack
 
        ld      [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
@@ -237,6 +251,10 @@ recursive_trap:
 
        ldd     [%sp + (24 + 64) * 4], %l0 ! Y & PSR
        ldd     [%sp + (24 + 68) * 4], %l2 ! PC & NPC
+
+       restore                         ! Ensure that previous window is valid
+       save    %g0, %g0, %g0           !  by causing a window_underflow trap
+
        mov     %l0, %y
        mov     %l1, %psr               ! Make sure that traps are disabled
                                        ! for rett
@@ -758,7 +776,7 @@ handle_exception (registers)
          break;
 #if 0
        case 't':               /* Test feature */
-         asm (" std %f31,[%sp]");
+         asm (" std %f30,[%sp]");
          break;
 #endif
        case 'r':               /* Reset */
This page took 0.024366 seconds and 4 git commands to generate.