From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 12/19] csky: Debug and Ptrace GDB Date: Mon, 26 Mar 2018 15:06:21 +0200 Message-ID: References: <31d854396de0d279cdd3bc621806362e79cca60e.1521399976.git.ren_guo@c-sky.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <31d854396de0d279cdd3bc621806362e79cca60e.1521399976.git.ren_guo@c-sky.com> Sender: linux-kernel-owner@vger.kernel.org To: Guo Ren Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, thomas.petazzoni@bootlin.com, wbx@uclibc-ng.org List-Id: linux-arch.vger.kernel.org On Sun, Mar 18, 2018 at 8:51 PM, Guo Ren wrote: > Signed-off-by: Guo Ren > + */ > +long arch_ptrace(struct task_struct *child, long request, unsigned long addr, > + unsigned long data) > +{ > + unsigned long tmp = 0, ret = 0; > + int i; > + > + switch (request) { > + /* read the word at location addr in the USER area. */ > + case PTRACE_PEEKUSR: > + > + case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ > + case PTRACE_GETREGS: /* Get all gp regs from the child. */ > + case PTRACE_SETREGS: /* Set all gp regs in the child. */ > + for (i = 0; i <= CSKY_GREG_NUM; i++) { > + ret = get_user(tmp, (unsigned long *)data); I think all of these should use the regset code like arch/riscv/kernel/ptrace.c does. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f193.google.com ([209.85.220.193]:33923 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbeCZNGW (ORCPT ); Mon, 26 Mar 2018 09:06:22 -0400 MIME-Version: 1.0 In-Reply-To: <31d854396de0d279cdd3bc621806362e79cca60e.1521399976.git.ren_guo@c-sky.com> References: <31d854396de0d279cdd3bc621806362e79cca60e.1521399976.git.ren_guo@c-sky.com> From: Arnd Bergmann Date: Mon, 26 Mar 2018 15:06:21 +0200 Message-ID: Subject: Re: [PATCH 12/19] csky: Debug and Ptrace GDB Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: Guo Ren Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, thomas.petazzoni@bootlin.com, wbx@uclibc-ng.org Message-ID: <20180326130621.4BifPPIO96nE0aXP8xf4ibJeUoBv7IXLud1E0t1sJVc@z> On Sun, Mar 18, 2018 at 8:51 PM, Guo Ren wrote: > Signed-off-by: Guo Ren > + */ > +long arch_ptrace(struct task_struct *child, long request, unsigned long addr, > + unsigned long data) > +{ > + unsigned long tmp = 0, ret = 0; > + int i; > + > + switch (request) { > + /* read the word at location addr in the USER area. */ > + case PTRACE_PEEKUSR: > + > + case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ > + case PTRACE_GETREGS: /* Get all gp regs from the child. */ > + case PTRACE_SETREGS: /* Set all gp regs in the child. */ > + for (i = 0; i <= CSKY_GREG_NUM; i++) { > + ret = get_user(tmp, (unsigned long *)data); I think all of these should use the regset code like arch/riscv/kernel/ptrace.c does. Arnd