Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdadd54d authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar
Browse files

x86: x86 ptrace generic requests



This removes duplicated code by calling the generic ptrace_request and
compat_ptrace_request functions for the things they already handle.

Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent bb61682b
Loading
Loading
Loading
Loading
+1 −36
Original line number Original line Diff line number Diff line
@@ -760,12 +760,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
	unsigned long __user *datap = (unsigned long __user *)data;
	unsigned long __user *datap = (unsigned long __user *)data;


	switch (request) {
	switch (request) {
	/* when I and D space are separate, these will need to be fixed. */
	case PTRACE_PEEKTEXT: /* read word at location addr. */
	case PTRACE_PEEKDATA:
		ret = generic_ptrace_peekdata(child, addr, data);
		break;

	/* read the word at location addr in the USER area. */
	/* read the word at location addr in the USER area. */
	case PTRACE_PEEKUSR: {
	case PTRACE_PEEKUSR: {
		unsigned long tmp;
		unsigned long tmp;
@@ -787,12 +781,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
		break;
		break;
	}
	}


	/* when I and D space are separate, this will have to be fixed. */
	case PTRACE_POKETEXT: /* write the word at location addr. */
	case PTRACE_POKEDATA:
		ret = generic_ptrace_pokedata(child, addr, data);
		break;

	case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
	case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
		ret = -EIO;
		ret = -EIO;
		if ((addr & (sizeof(data) - 1)) || addr < 0 ||
		if ((addr & (sizeof(data) - 1)) || addr < 0 ||
@@ -1183,24 +1171,6 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
	childregs = task_pt_regs(child);
	childregs = task_pt_regs(child);


	switch (request) {
	switch (request) {
	case PTRACE_PEEKDATA:
	case PTRACE_PEEKTEXT:
		ret = 0;
		if (access_process_vm(child, addr, &val, sizeof(u32), 0) !=
		    sizeof(u32))
			ret = -EIO;
		else
			ret = put_user(val, (unsigned int __user *)datap);
		break;

	case PTRACE_POKEDATA:
	case PTRACE_POKETEXT:
		ret = 0;
		if (access_process_vm(child, addr, &data, sizeof(u32), 1) !=
		    sizeof(u32))
			ret = -EIO;
		break;

	case PTRACE_PEEKUSR:
	case PTRACE_PEEKUSR:
		ret = getreg32(child, addr, &val);
		ret = getreg32(child, addr, &val);
		if (ret == 0)
		if (ret == 0)
@@ -1246,13 +1216,8 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
					     sizeof(struct user32_fxsr_struct),
					     sizeof(struct user32_fxsr_struct),
					     datap);
					     datap);


	case PTRACE_GETEVENTMSG:
		ret = put_user(child->ptrace_message,
			       (unsigned int __user *)compat_ptr(data));
		break;

	default:
	default:
		BUG();
		return compat_ptrace_request(child, request, addr, data);
	}
	}


 out:
 out: