OSDN Git Service

Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebieder...
[uclinux-h8/linux.git] / arch / x86 / kernel / ptrace.c
index a78fff5..ffae9b9 100644 (file)
@@ -39,6 +39,7 @@
 #include <asm/hw_breakpoint.h>
 #include <asm/traps.h>
 #include <asm/syscall.h>
+#include <asm/fsgsbase.h>
 
 #include "tls.h"
 
@@ -396,12 +397,11 @@ static int putreg(struct task_struct *child,
                if (value >= TASK_SIZE_MAX)
                        return -EIO;
                /*
-                * When changing the segment base, use do_arch_prctl_64
-                * to set either thread.fs or thread.fsindex and the
-                * corresponding GDT slot.
+                * When changing the FS base, use the same
+                * mechanism as for do_arch_prctl_64().
                 */
                if (child->thread.fsbase != value)
-                       return do_arch_prctl_64(child, ARCH_SET_FS, value);
+                       return x86_fsbase_write_task(child, value);
                return 0;
        case offsetof(struct user_regs_struct,gs_base):
                /*
@@ -410,7 +410,7 @@ static int putreg(struct task_struct *child,
                if (value >= TASK_SIZE_MAX)
                        return -EIO;
                if (child->thread.gsbase != value)
-                       return do_arch_prctl_64(child, ARCH_SET_GS, value);
+                       return x86_gsbase_write_task(child, value);
                return 0;
 #endif
        }
@@ -434,20 +434,10 @@ static unsigned long getreg(struct task_struct *task, unsigned long offset)
                return get_flags(task);
 
 #ifdef CONFIG_X86_64
-       case offsetof(struct user_regs_struct, fs_base): {
-               /*
-                * XXX: This will not behave as expected if called on
-                * current or if fsindex != 0.
-                */
-               return task->thread.fsbase;
-       }
-       case offsetof(struct user_regs_struct, gs_base): {
-               /*
-                * XXX: This will not behave as expected if called on
-                * current or if fsindex != 0.
-                */
-               return task->thread.gsbase;
-       }
+       case offsetof(struct user_regs_struct, fs_base):
+               return x86_fsbase_read_task(task);
+       case offsetof(struct user_regs_struct, gs_base):
+               return x86_gsbase_read_task(task);
 #endif
        }