aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-02-16 06:18:19 +0000
committerrsc <devnull@localhost>2006-02-16 06:18:19 +0000
commit8712d1a38e87e8f51257a80246f51d075aae7f5b (patch)
treecfd7b4516444f50d7ed0c682592ba6dead21c071
parent229086e79014909293b56271b529ed97e700932e (diff)
downloadplan9port-8712d1a38e87e8f51257a80246f51d075aae7f5b.tar.gz
plan9port-8712d1a38e87e8f51257a80246f51d075aae7f5b.tar.bz2
plan9port-8712d1a38e87e8f51257a80246f51d075aae7f5b.zip
more
-rw-r--r--src/libthread/Linux-sparc64-swapcontext.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libthread/Linux-sparc64-swapcontext.c b/src/libthread/Linux-sparc64-swapcontext.c
index ac6fd5bc..a621b7a1 100644
--- a/src/libthread/Linux-sparc64-swapcontext.c
+++ b/src/libthread/Linux-sparc64-swapcontext.c
@@ -19,18 +19,21 @@
#include <ucontext.h>
+#define UC_M_PC 40
+#define UC_M_NPC 48
+
extern int __getcontext (ucontext_t *ucp);
extern int __setcontext (const ucontext_t *ucp, int restoremask);
int
-__swapcontext (ucontext_t *oucp, const ucontext_t *ucp)
+swapcontext (ucontext_t *oucp, const ucontext_t *ucp)
{
extern void __swapcontext_ret (void);
/* Save the current machine context to oucp. */
__getcontext (oucp);
/* Modify oucp to skip the __setcontext call on reactivation. */
- oucp->uc_mcontext.mc_gregs[MC_PC] = (long) __swapcontext_ret;
- oucp->uc_mcontext.mc_gregs[MC_NPC] = ((long) __swapcontext_ret) + 4;
+ *(long*)((char*)oucp+UC_M_PC) = (long)__swapcontext_ret;
+ *(long*)((char*)oucp+UC_M_NPC) = (long)__swapcontext_ret + 4;
/* Restore the machine context in ucp. */
__setcontext (ucp, 1);
return 0;
@@ -45,4 +48,3 @@ __swapcontext_ret: \n\
.size __swapcontext_ret, .-__swapcontext_ret \n\
");
-weak_alias (__swapcontext, swapcontext)