Skip to contentSkip to conversation

UML - ptrace floating point fixes

PATCH New Jeff Dike 1 participant 1 message Aug 23, 2007

Subsystems (2)
lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 3/7 UML - ptrace floating point fixes

Handle floating point state better in ptrace. The code now correctly distinguishes between PTRACE_[GS]ETFPREGS and PTRACE_[GS]ETFPXREGS. The FPX requests get handed off to arch-specific code because that's not generic.

get_fpregs, set_fpregs, set_fpregs, and set_fpxregs needed real implementations.

Something here exposed a missing include in asm/page.h, which needed linux/types.h in order to get gfp_t, so that's fixed here.

--

 arch/um/kernel/ptrace.c         |   18 +++------
 arch/um/sys-i386/ptrace.c       |   73 ++++++++++++++++++++++++++--------------
 arch/um/sys-x86_64/ptrace.c     |   53 +++++++++++++++++++++--------
 include/asm-um/page.h           |    1 
 include/asm-um/ptrace-generic.h |   11 +++---
 include/asm-um/ptrace-i386.h    |    6 +++
 6 files changed, 107 insertions(+), 55 deletions(-)
arch/um/kernel/ptrace.c +6 -12
Index: linux-2.6.22/arch/um/kernel/ptrace.c
===================================================================
@@ -143,22 +143,14 @@ long arch_ptrace(struct task_struct *chi
 #endif
 #ifdef PTRACE_GETFPREGS
 	case PTRACE_GETFPREGS: /* Get the child FPU state. */
-		ret = get_fpregs(data, child);
+		ret = get_fpregs((struct user_i387_struct __user *) data,
+				 child);
 		break;
 #endif
 #ifdef PTRACE_SETFPREGS
 	case PTRACE_SETFPREGS: /* Set the child FPU state. */
-	        ret = set_fpregs(data, child);
-		break;
-#endif
-#ifdef PTRACE_GETFPXREGS
-	case PTRACE_GETFPXREGS: /* Get the child FPU state. */
-		ret = get_fpxregs(data, child);
-		break;
-#endif
-#ifdef PTRACE_SETFPXREGS
-	case PTRACE_SETFPXREGS: /* Set the child FPU state. */
-		ret = set_fpxregs(data, child);
+	        ret = set_fpregs((struct user_i387_struct __user *) data,
+				 child);
 		break;
 #endif
 	case PTRACE_GET_THREAD_AREA:
@@ -227,6 +219,8 @@ long arch_ptrace(struct task_struct *chi
 #endif
 	default:
 		ret = ptrace_request(child, request, addr, data);
+		if (ret == -EIO)
+			ret = subarch_ptrace(child, request, addr, data);
 		break;
 	}
 
arch/um/sys-x86_64/ptrace.c +39 -14

67 lines not on this page · raw message

include/asm-um/ptrace-generic.h +7 -4
Index: linux-2.6.22/include/asm-um/ptrace-generic.h
===================================================================
@@ -9,6 +9,7 @@
 #ifndef __ASSEMBLY__
 
 #include "asm/arch/ptrace-abi.h"
+#include <asm/user.h>
 #include "sysdep/ptrace.h"
 
 struct pt_regs {
@@ -35,12 +36,14 @@ struct pt_regs {
 
 struct task_struct;
 
+extern long subarch_ptrace(struct task_struct *child, long request, long addr,
+			   long data);
 extern unsigned long getreg(struct task_struct *child, int regno);
 extern int putreg(struct task_struct *child, int regno, unsigned long value);
-extern int get_fpregs(unsigned long buf, struct task_struct *child);
-extern int set_fpregs(unsigned long buf, struct task_struct *child);
-extern int get_fpxregs(unsigned long buf, struct task_struct *child);
-extern int set_fpxregs(unsigned long buf, struct task_struct *tsk);
+extern int get_fpregs(struct user_i387_struct __user *buf,
+		      struct task_struct *child);
+extern int set_fpregs(struct user_i387_struct __user *buf,
+		      struct task_struct *child);
 
 extern void show_regs(struct pt_regs *regs);
 
include/asm-um/ptrace-i386.h +6 -0
Index: linux-2.6.22/include/asm-um/ptrace-i386.h
===================================================================
@@ -10,6 +10,7 @@
 
 #include "linux/compiler.h"
 #include "asm/ptrace-generic.h"
+#include <asm/user.h>
 #include "sysdep/ptrace.h"
 
 #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs)
@@ -45,6 +46,11 @@
  */
 struct user_desc;
 
+extern int get_fpxregs(struct user_fxsr_struct __user *buf,
+		       struct task_struct *child);
+extern int set_fpxregs(struct user_fxsr_struct __user *buf,
+		       struct task_struct *tsk);
+
 extern int ptrace_get_thread_area(struct task_struct *child, int idx,
                                   struct user_desc __user *user_desc);
 
arch/um/sys-i386/ptrace.c +48 -25

105 lines not on this page · raw message

include/asm-um/page.h +1 -0
Index: linux-2.6.22/include/asm-um/page.h
===================================================================
@@ -9,6 +9,7 @@
 
 struct page;
 
+#include <linux/types.h>
 #include <asm/vm-flags.h>
 
 /* PAGE_SHIFT determines the page size */

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel