aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc-stub.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1994-02-24 01:49:15 +0000
committerStu Grossman <grossman@cygnus>1994-02-24 01:49:15 +0000
commit75a006d94f08c4f01e44f6caae6f161159902be7 (patch)
tree9d7d48737f76c3c2a79c646ee9a209016c07234a /gdb/sparc-stub.c
parent30d7f715a9d1ffb5ca11b66c4de1879a315f8636 (diff)
downloadgdb-75a006d94f08c4f01e44f6caae6f161159902be7.zip
gdb-75a006d94f08c4f01e44f6caae6f161159902be7.tar.gz
gdb-75a006d94f08c4f01e44f6caae6f161159902be7.tar.bz2
* sparc-stub.c (trap_low): Make trap handler work for arbitrary
numbers of register windows.
Diffstat (limited to 'gdb/sparc-stub.c')
-rw-r--r--gdb/sparc-stub.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/gdb/sparc-stub.c b/gdb/sparc-stub.c
index 5de62a3..d2e7b43 100644
--- a/gdb/sparc-stub.c
+++ b/gdb/sparc-stub.c
@@ -157,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
@@ -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 */