From nobody Fri Nov 04 23:51:12 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N3y7h40tJz4h5xX; Fri, 4 Nov 2022 23:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N3y7h3Z1xz3Glj; Fri, 4 Nov 2022 23:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667605872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zIYqX2x7Wh86o6H9chcZF5F05xptfD1if+88SZqtX0k=; b=A96pkNSpqmJVRUQ7WqQw5n8BvEGK2RoHl3vcjy9N30MT6ytH5U3HO9oaOQ+ClLwRONmCyF /DPtFrN5NgySJI2l4LIxQfeV+P6oQCCraKYFEtNdrC6nS+7t5YsGY494e1PAanpnk46Lld D5Ubkta1u/Xg7W3zHoBczSefPiufjQngWoc3sxcM9IB/nFDCUVY+m+vfr49GBPqjEyr1Qo obDydN4tXwaGEcI+kKPwGdtENvIORmywh7RVjUeM2P2MRV5P0fQQhp781eRoavgymstUH1 24uG3CU+nrBjrNwOJo1wy9E2zWIiMUk4wjkrGEqUpWezB1uEZ7FSmkx4LArAHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N3y7h2crVzLHC; Fri, 4 Nov 2022 23:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A4NpClu016166; Fri, 4 Nov 2022 23:51:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A4NpC0n016165; Fri, 4 Nov 2022 23:51:12 GMT (envelope-from git) Date: Fri, 4 Nov 2022 23:51:12 GMT Message-Id: <202211042351.2A4NpC0n016165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Houchard Subject: git: f487dbef66a9 - stable/13 - arm64: Implement cpu_ptrace(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f487dbef66a93cff73b83935693518a685e16f5a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667605872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zIYqX2x7Wh86o6H9chcZF5F05xptfD1if+88SZqtX0k=; b=yFANJr6Q8TRL6S5sFRgsMH0T+qlu44KW4j5EvFRNuxNpOQLeNL1BtDcRBIc/zUkJaQ3vXC dsrj058HgRFzzdWDyhXS7u4ejqisqQe/7QLiI2WNWuP155tQ/dWn1sKOcn3PqCSkvutxOe 2j5epVIa/pmC5Yn+sBuntH6bDZKuigoWCGK/HtV6WDYG81zJaVRe2cQ0MyBwkms0+3zdvT j1+m4DaHm0+L8Ie740a8NVyCJalEJI1JSN0ap0qJKAdsPJGCPxaHV84zovI9KlAK/nauNS scmaVyLmClIVxk7RgtO65zxjdQhhMjZ95zmGVQowIjPQrq0gnAQ4SNGS2D8dBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667605872; a=rsa-sha256; cv=none; b=XWTts4O6MhpIJmA9A3dBk3jyum4XZeME2mh95sfb3TO1gZUawUekcuU+RCGwoeo6NGM/0L 7Gj18KPc3x4KUDOobmhYZVIhMZGHeC7PKvctk1CThzupI5lTU36xq8B2cYFK6o8Rijh1uD xJgGT8Dk6WLLuj7wmSpLce2BXv0ID+RgysIbC5HBojwg8JOtN0rsHN4h94scb6/RTvlP2Y 643+NnPzYQql1dEo6tZc9NJHLQDDogb0/riyOUiQJcFZc13dR8Nlx9Zpy2z7VKVfXBrt+x y5MMbSlvbYXHnOkQMSIiM6xkZ8kuF3OkcoQpHMDmgclHA5mJVZ925LKLhcljqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=f487dbef66a93cff73b83935693518a685e16f5a commit f487dbef66a93cff73b83935693518a685e16f5a Author: Olivier Houchard AuthorDate: 2022-10-27 21:25:59 +0000 Commit: Olivier Houchard CommitDate: 2022-11-04 23:29:09 +0000 arm64: Implement cpu_ptrace(). Add a minimal implementation of cpu_ptrace() for arm64. It is only used to get/set VFP registers for 32bits binaries, as it is apparently what we use there, instead of the MI PT_GETFPREGS/PT_SETFPREGS. PR: 267361 MFC After: 1 week (cherry picked from commit d78c2cd831d346b94c00c72b5a94a1a4f0dd3e53) Signed-off-by: Olivier Houchard --- sys/arm64/arm64/ptrace_machdep.c | 30 ++++++++++++++++++++++++++++++ sys/arm64/include/ptrace.h | 10 ++++++++++ 2 files changed, 40 insertions(+) diff --git a/sys/arm64/arm64/ptrace_machdep.c b/sys/arm64/arm64/ptrace_machdep.c index 44ca58a49156..408c67a6c396 100644 --- a/sys/arm64/arm64/ptrace_machdep.c +++ b/sys/arm64/arm64/ptrace_machdep.c @@ -49,6 +49,36 @@ __FBSDID("$FreeBSD$"); #include +/* Only used to get/set 32bits VFP regs */ +int +cpu_ptrace(struct thread *td, int req, void *arg, int data) +{ +#if defined(VFP) && defined(COMPAT_FREEBSD32) + mcontext32_vfp_t vfp; + int error; + + if (!SV_CURPROC_FLAG(SV_ILP32)) + return (EINVAL); + switch (req) { + case PT_GETVFPREGS32: + get_fpcontext32(td, &vfp); + error = copyout(&vfp, arg, sizeof(vfp)); + break; + case PT_SETVFPREGS32: + error = copyin(arg, &vfp, sizeof(vfp)); + if (error == 0) + set_fpcontext32(td, &vfp); + break; + default: + error = EINVAL; + } + + return (error); +#else + return (EINVAL); +#endif +} + #if defined(VFP) && defined(COMPAT_FREEBSD32) static bool get_arm_vfp(struct regset *rs, struct thread *td, void *buf, size_t *sizep) diff --git a/sys/arm64/include/ptrace.h b/sys/arm64/include/ptrace.h index da23dbe43a4f..0705ee6daab0 100644 --- a/sys/arm64/include/ptrace.h +++ b/sys/arm64/include/ptrace.h @@ -1 +1,11 @@ /* $FreeBSD$ */ + +#ifndef _MACHINE_PTRACE_H_ +#define _MACHINE_PTRACE_H_ + +#define __HAVE_PTRACE_MACHDEP + +#define PT_GETVFPREGS32 (PT_FIRSTMACH + 0) +#define PT_SETVFPREGS32 (PT_FIRSTMACH + 1) + +#endif /* _MACHINE_PTRACE_H_ */