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>
This commit is contained in:
parent
ce90f34085
commit
5fd4d16bd5
|
@ -55,6 +55,12 @@ static int putreg(struct task_struct *child,
|
||||||
if (value && (value & 3) != 3)
|
if (value && (value & 3) != 3)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
child->thread.gs = value;
|
child->thread.gs = value;
|
||||||
|
if (child == current)
|
||||||
|
/*
|
||||||
|
* The user-mode %gs is not affected by
|
||||||
|
* kernel entry, so we must update the CPU.
|
||||||
|
*/
|
||||||
|
loadsegment(gs, value);
|
||||||
return 0;
|
return 0;
|
||||||
case DS:
|
case DS:
|
||||||
case ES:
|
case ES:
|
||||||
|
@ -104,6 +110,8 @@ static unsigned long getreg(struct task_struct *child, unsigned long regno)
|
||||||
break;
|
break;
|
||||||
case GS:
|
case GS:
|
||||||
retval = child->thread.gs;
|
retval = child->thread.gs;
|
||||||
|
if (child == current)
|
||||||
|
savesegment(gs, retval);
|
||||||
break;
|
break;
|
||||||
case DS:
|
case DS:
|
||||||
case ES:
|
case ES:
|
||||||
|
|
Loading…
Reference in New Issue