Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2970483ybt; Mon, 29 Jun 2020 11:46:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiBIzT8xG/9lDcEWYGWWcg4TNabfyuNXkAuLaZRzRCtryxnou+MxewfKJ7zx6QWmPKSddV X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr5611237edy.198.1593456386469; Mon, 29 Jun 2020 11:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593456386; cv=none; d=google.com; s=arc-20160816; b=AG3HibCsisQrOl0xtY5Fx4VBYj7CC0ZfdU4VeN8jb7hZYu1pavt0x5cCaOknmOQm3i fOOfb4WhNBYVt5jwdgmQaZVgoGEdrZ85XjGtCOnyuiapMhc22O7ZQJDD18Xc+j3v1U2R 8j8yodepebfyZLbknAXS4yR9AZp1pYpibLRoMC1a21pL38TwgEwhttzpScsIqjz+uku7 vVIWhjxQtdJD+T8eYGW73vWn3qPmqW2Vb32X5kxqLsyqonVjKDMH7Loq2YdGUvMPDbTa WHWUT8C/nIwN7izxnt1HANFBDa1CcmOH2nQ3l3CRfgayxwRQeAq0lDUtm2dCRtE6aDby PP3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Nzz5IttCetuHocC7tN1eRWJ9XbkTuHCzvy4FlMIEHVk=; b=xpNIxjbF9MM2IXUTIp4vYfTR0LZHIUSz7d9hOfhXa3MapFNBssvIenIrRmIuzp2R7H dsYsaaDL+1C/phDvLuNAcMVAhyYIgwTTYMouJA5kDQIsxb27HaEfl0S3vBZW07Pt5n5e CVGoMO/hcDIx0PMc3HG3M0O/Lw6WuCxl/8sOmaauDHzHnuBiVRMzpp1NhaVQLcRalMdz Iy3cf35pK7ODdeV6uz1tXXNxRDvb20HM0JWloRLbPdbns9I9eg7STUaeOCX8dVULqo0g oVEvcPMleReQsEVpYVHUzhjna7rvP+NFlAIizn8Hk+oQTAzU9447vuV5RIqpUY7n8f5N iuGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si293489ejw.73.2020.06.29.11.46.02; Mon, 29 Jun 2020 11:46:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbgF2Sn7 (ORCPT + 99 others); Mon, 29 Jun 2020 14:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729140AbgF2Smw (ORCPT ); Mon, 29 Jun 2020 14:42:52 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59136C033C30; Mon, 29 Jun 2020 11:26:38 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpyUD-002Dwm-0p; Mon, 29 Jun 2020 18:26:33 +0000 From: Al Viro To: Linus Torvalds Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, David Miller , Tony Luck , Will Deacon Subject: [PATCH 33/41] hexagon: switch to ->get2() Date: Mon, 29 Jun 2020 19:26:20 +0100 Message-Id: <20200629182628.529995-33-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200629182628.529995-1-viro@ZenIV.linux.org.uk> References: <20200629182349.GA2786714@ZenIV.linux.org.uk> <20200629182628.529995-1-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- arch/hexagon/kernel/ptrace.c | 62 +++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c index dcbf7ea960cc..fa6287d1a061 100644 --- a/arch/hexagon/kernel/ptrace.c +++ b/arch/hexagon/kernel/ptrace.c @@ -35,58 +35,38 @@ void user_disable_single_step(struct task_struct *child) static int genregs_get(struct task_struct *target, const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) + srtuct membuf to) { - int ret; - unsigned int dummy; struct pt_regs *regs = task_pt_regs(target); - - if (!regs) - return -EIO; - /* The general idea here is that the copyout must happen in * exactly the same order in which the userspace expects these * regs. Now, the sequence in userspace does not match the * sequence in the kernel, so everything past the 32 gprs * happens one at a time. */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ®s->r00, 0, 32*sizeof(unsigned long)); - -#define ONEXT(KPT_REG, USR_REG) \ - if (!ret) \ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, \ - KPT_REG, offsetof(struct user_regs_struct, USR_REG), \ - offsetof(struct user_regs_struct, USR_REG) + \ - sizeof(unsigned long)); - + membuf_write(&to, ®s->r00, 32*sizeof(unsigned long)); /* Must be exactly same sequence as struct user_regs_struct */ - ONEXT(®s->sa0, sa0); - ONEXT(®s->lc0, lc0); - ONEXT(®s->sa1, sa1); - ONEXT(®s->lc1, lc1); - ONEXT(®s->m0, m0); - ONEXT(®s->m1, m1); - ONEXT(®s->usr, usr); - ONEXT(®s->preds, p3_0); - ONEXT(®s->gp, gp); - ONEXT(®s->ugp, ugp); - ONEXT(&pt_elr(regs), pc); - dummy = pt_cause(regs); - ONEXT(&dummy, cause); - ONEXT(&pt_badva(regs), badva); + membuf_store(&to, regs->sa0); + membuf_store(&to, regs->lc0); + membuf_store(&to, regs->sa1); + membuf_store(&to, regs->lc1); + membuf_store(&to, regs->m0); + membuf_store(&to, regs->m1); + membuf_store(&to, regs->usr); + membuf_store(&to, regs->p3_0); + membuf_store(&to, regs->gp); + membuf_store(&to, regs->ugp); + membuf_store(&to, pt_elr(regs)); // pc + membuf_store(&to, (unsigned long)pt_cause(regs)); // cause + membuf_store(&to, pt_badva(regs)); // badva #if CONFIG_HEXAGON_ARCH_VERSION >=4 - ONEXT(®s->cs0, cs0); - ONEXT(®s->cs1, cs1); + membuf_store(&to, regs->cs0); + membuf_store(&to, regs->cs1); + return membuf_zero(&to, sizeof(unsigned long)); +#else + return membuf_zero(&to, 3 * sizeof(unsigned long)); #endif - - /* Pad the rest with zeros, if needed */ - if (!ret) - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - offsetof(struct user_regs_struct, pad1), -1); - return ret; } static int genregs_set(struct task_struct *target, @@ -159,7 +139,7 @@ static const struct user_regset hexagon_regsets[] = { .n = ELF_NGREG, .size = sizeof(unsigned long), .align = sizeof(unsigned long), - .get = genregs_get, + .get2 = genregs_get, .set = genregs_set, }, }; -- 2.11.0