Write return address for threads in assembly so we can reliably
grab their return values.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@58 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/vg_helpers.S b/vg_helpers.S
index 4d1f8c2..e0afa6c 100644
--- a/vg_helpers.S
+++ b/vg_helpers.S
@@ -68,6 +68,37 @@
.text
+
+.global VG_(pthreadreturn_bogusRA)
+VG_(pthreadreturn_bogusRA):
+ subl $20, %esp # allocate arg block
+ movl %esp, %edx # %edx == &_zzq_args[0]
+ movl $VG_USERREQ__PTHREAD_RETURNS, 0(%edx) # request
+ movl %eax, 4(%edx) # arg1 == thread return value
+ movl $0, 8(%edx) # arg2
+ movl $0, 12(%edx) # arg3
+ movl $0, 16(%edx) # arg4
+ movl %edx, %eax
+ # and now the magic sequence itself:
+ roll $29, %eax
+ roll $3, %eax
+ rorl $27, %eax
+ rorl $5, %eax
+ roll $13, %eax
+ roll $19, %eax
+ # should never get here
+ pushl $pthreadreturn_bogusRA_panic_msg
+ call VG_(panic)
+
+.data
+pthreadreturn_bogusRA_panic_msg:
+.ascii "vg_pthreadreturn_bogusRA: VG_USERREQ__PTHREAD_RETURNS was missed"
+.byte 0
+.text
+
+
+
+
/* ------------------ REAL CPU HELPERS ------------------ */
/* The rest of this lot run on the real CPU. */