diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:30:58 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:58 -0500 |
commit | 5fd4d16bd59a9fc84ca94c4fce4abc23fe219108 (patch) | |
tree | 9d0312183af7070c027e5d0d4d1707cbc81c6c1b | |
parent | ce90f340855d7a9b3bec24f0fe49a76904242387 (diff) |
x86: x86-32 ptrace get/putreg current task
This generalizes the getreg and putreg functions so they can be used on the
current task, as well as on a task stopped in TASK_TRACED and switched off.
This lays the groundwork to share this code for all kinds of user-mode
machine state access, not just ptrace.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/ptrace_32.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c index 5aca84ef26d5..26071305de2c 100644 --- a/arch/x86/kernel/ptrace_32.c +++ b/arch/x86/kernel/ptrace_32.c | |||
@@ -55,6 +55,12 @@ static int putreg(struct task_struct *child, | |||
55 | if (value && (value & 3) != 3) | 55 | if (value && (value & 3) != 3) |
56 | return -EIO; | 56 | return -EIO; |
57 | child->thread.gs = value; | 57 | child->thread.gs = value; |
58 | if (child == current) | ||
59 | /* | ||
60 | * The user-mode %gs is not affected by | ||
61 | * kernel entry, so we must update the CPU. | ||
62 | */ | ||
63 | loadsegment(gs, value); | ||
58 | return 0; | 64 | return 0; |
59 | case DS: | 65 | case DS: |
60 | case ES: | 66 | case ES: |
@@ -104,6 +110,8 @@ static unsigned long getreg(struct task_struct *child, unsigned long regno) | |||
104 | break; | 110 | break; |
105 | case GS: | 111 | case GS: |
106 | retval = child->thread.gs; | 112 | retval = child->thread.gs; |
113 | if (child == current) | ||
114 | savesegment(gs, retval); | ||
107 | break; | 115 | break; |
108 | case DS: | 116 | case DS: |
109 | case ES: | 117 | case ES: |