Mark Wielaard 05491c
commit f666d20249ff381dfc9bf5a621c544560527af40
Mark Wielaard 05491c
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard 05491c
Date:   Wed May 22 10:21:08 2013 +0000
Mark Wielaard 05491c
Mark Wielaard 05491c
    Support PTRACE_GET/SET_THREAD_AREA on x86.
Mark Wielaard 05491c
    BZ#320063.  (Josh Stone, jistone@redhat.com)
Mark Wielaard 05491c
    
Mark Wielaard 05491c
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13403 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard 05491c
Mark Wielaard 05491c
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 05491c
index 7e75899..ed60a15 100644
Mark Wielaard 05491c
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 05491c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 05491c
@@ -1118,6 +1118,10 @@ PRE(sys_ptrace)
Mark Wielaard 05491c
       PRE_MEM_WRITE( "ptrace(getfpxregs)", ARG4, 
Mark Wielaard 05491c
                      sizeof(struct vki_user_fxsr_struct) );
Mark Wielaard 05491c
       break;
Mark Wielaard 05491c
+   case VKI_PTRACE_GET_THREAD_AREA:
Mark Wielaard 05491c
+      PRE_MEM_WRITE( "ptrace(get_thread_area)", ARG4, 
Mark Wielaard 05491c
+                     sizeof(struct vki_user_desc) );
Mark Wielaard 05491c
+      break;
Mark Wielaard 05491c
    case VKI_PTRACE_SETREGS:
Mark Wielaard 05491c
       PRE_MEM_READ( "ptrace(setregs)", ARG4, 
Mark Wielaard 05491c
 		     sizeof (struct vki_user_regs_struct));
Mark Wielaard 05491c
@@ -1130,6 +1134,10 @@ PRE(sys_ptrace)
Mark Wielaard 05491c
       PRE_MEM_READ( "ptrace(setfpxregs)", ARG4, 
Mark Wielaard 05491c
                      sizeof(struct vki_user_fxsr_struct) );
Mark Wielaard 05491c
       break;
Mark Wielaard 05491c
+   case VKI_PTRACE_SET_THREAD_AREA:
Mark Wielaard 05491c
+      PRE_MEM_READ( "ptrace(set_thread_area)", ARG4, 
Mark Wielaard 05491c
+                     sizeof(struct vki_user_desc) );
Mark Wielaard 05491c
+      break;
Mark Wielaard 05491c
    case VKI_PTRACE_GETEVENTMSG:
Mark Wielaard 05491c
       PRE_MEM_WRITE( "ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
Mark Wielaard 05491c
       break;
Mark Wielaard 05491c
@@ -1167,6 +1175,9 @@ POST(sys_ptrace)
Mark Wielaard 05491c
    case VKI_PTRACE_GETFPXREGS:
Mark Wielaard 05491c
       POST_MEM_WRITE( ARG4, sizeof(struct vki_user_fxsr_struct) );
Mark Wielaard 05491c
       break;
Mark Wielaard 05491c
+   case VKI_PTRACE_GET_THREAD_AREA:
Mark Wielaard 05491c
+      POST_MEM_WRITE( ARG4, sizeof(struct vki_user_desc) );
Mark Wielaard 05491c
+      break;
Mark Wielaard 05491c
    case VKI_PTRACE_GETEVENTMSG:
Mark Wielaard 05491c
       POST_MEM_WRITE( ARG4, sizeof(unsigned long));
Mark Wielaard 05491c
       break;
Mark Wielaard 05491c
diff --git a/include/vki/vki-x86-linux.h b/include/vki/vki-x86-linux.h
Mark Wielaard 05491c
index 7c072d6..adfcb08 100644
Mark Wielaard 05491c
--- a/include/vki/vki-x86-linux.h
Mark Wielaard 05491c
+++ b/include/vki/vki-x86-linux.h
Mark Wielaard 05491c
@@ -812,6 +812,8 @@ struct vki_shminfo64 {
Mark Wielaard 05491c
 #define VKI_PTRACE_SETFPREGS          15
Mark Wielaard 05491c
 #define VKI_PTRACE_GETFPXREGS         18
Mark Wielaard 05491c
 #define VKI_PTRACE_SETFPXREGS         19
Mark Wielaard 05491c
+#define VKI_PTRACE_GET_THREAD_AREA    25
Mark Wielaard 05491c
+#define VKI_PTRACE_SET_THREAD_AREA    26
Mark Wielaard 05491c
 
Mark Wielaard 05491c
 //----------------------------------------------------------------------
Mark Wielaard 05491c
 // From linux-2.6.15.4/include/asm-i386/vm86.h