From patchwork Fri Dec 7 10:36:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153133 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp352833ljp; Fri, 7 Dec 2018 03:00:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/XwAVSO9Corfh7uWBPQKoShkZ/b5PqtON14b0q8mXuVxpH00oG0kjU7u0j3k4Yc1Wz5VTEf X-Received: by 2002:a37:4953:: with SMTP id w80mr1360255qka.238.1544180438193; Fri, 07 Dec 2018 03:00:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544180438; cv=none; d=google.com; s=arc-20160816; b=NPBBNLk+5fhRZpof3eE648sFWoP5TOnlw40Pe8fUZo3AfxwcdDP/ZBlg/GB6gQ06Ld T7lO1/NMJF+wGJu7l5ovJaO+CQrCW43xgI0IKvnWG5/mwpGTRBVcDiAtxWlKAmDhFsF3 4r5/Kndj1WYY1AFWqLoU0qbOec7KmGQ6bIIdyzyXZaq7FZQ2ktW4NeYyJueqB2SJEPnc 08DwjNkvO4KEe9vz2a6n8e8tYvsv+KA+r2aqk3bJOr6cqT5hrEK8r8uAQ3d6+U11GNEb Tzd4sPt6udSlMb1Er86QsKvp3A0vnij6GV9rK9jdSjSPlipLwwxqaCDQYo+uaBBp1NXy vd/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=5yu4uyPHL3e78QtSCoAY0ppDIHvd0b6Uk3Mi12v7j8w=; b=OIjmYi1fj2EjaAMIAqHZrCKbOkm+0nTA5694azv66651vygKlplgS3pcUWgcgeIOJd 92nbm9zh3Ih+pAyT1a7EezH3J4N/PH590Vt/5NeNphQ6eABHGTfO4ETGfFptj4YAHMHE q9TtgvOfWdBgVf53R/8hBQhwNqdy+RLjToF8vJw/pYOH0f/iy7wKGdNa98TzXLXRHjze 4CuvgwQIQRjmOkdtHN65ckyaQuMZu1rHEHdrKQcbHLWXBYn3RgMgLFa3t69Z9PdBpDSE IpIc6l6JWsbI5A3d15WsL3K+TXvqYI5BYdJJR7bs8RVAoaBV0g7MGb11Jw6x/TgUtLMu fXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OVo9lW1c; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f3si1450230qtd.85.2018.12.07.03.00.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 07 Dec 2018 03:00:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OVo9lW1c; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVDs5-00038y-Eb for patch@linaro.org; Fri, 07 Dec 2018 06:00:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVDVN-0008J8-0z for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:37:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVDVJ-0007uU-D2 for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:37:08 -0500 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]:43649) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gVDVJ-0007tb-7O for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:37:05 -0500 Received: by mail-oi1-x244.google.com with SMTP id u18so2982962oie.10 for ; Fri, 07 Dec 2018 02:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5yu4uyPHL3e78QtSCoAY0ppDIHvd0b6Uk3Mi12v7j8w=; b=OVo9lW1cP5dzowO6NYScgmp7x7q3pFMv2rp/V3EckNWpDpD49g808zmYvSTJlQJ7KC IptwsYnQlE/542fyQ8OHtmKNeaqxouu1TPBmUOUS2NvUy0QEE5OWK8LvsqqAp1XipaBl ePnbceGXPjsCYsLlj559kM/DK6IjYSWaVQ78c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5yu4uyPHL3e78QtSCoAY0ppDIHvd0b6Uk3Mi12v7j8w=; b=VuxgXae1Xpdkgw7kbawSKZnXGbNRNihJhmSOEi2IkdsCjKact5kzsAwS/A95EBGC7/ 73MYkIbebvm5Qv1ua1nzGEiwpILqWSCadKILWpKnU7w/JHPlWtj6nVIsHpVNSs+U7wq3 KUVTwi6kJDeygC3POa482XtNVcHPWcYi18hXJqEj61F7rvGBF98zWSUeNgmGz3le3G45 9AEUXhewGnfd3sg/IEE8jJIJ/A97eXJGNrb9DLAPbqiV46S07HMQQOhpWOvzYGo451VS s29/aDeB4jiIqS8uiVBRQ6tLAOPB3+LoUMHODTmOrCdNSv7ajjw2Ey5vMc+R+PEl6oZr uctQ== X-Gm-Message-State: AA+aEWbzXVTQxUgyFVbqdVrlQsBnzGwQKTOereh1OJGc8llAYSr8/GPz Ng5Ph0rQkhakj1HgAKvCi8rPKANcwWU= X-Received: by 2002:aca:b2c4:: with SMTP id b187mr939690oif.245.1544179023968; Fri, 07 Dec 2018 02:37:03 -0800 (PST) Received: from cloudburst.twiddle.net (172.189-204-159.bestel.com.mx. [189.204.159.172]) by smtp.gmail.com with ESMTPSA id c19sm2037594otl.16.2018.12.07.02.37.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Dec 2018 02:37:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Dec 2018 04:36:24 -0600 Message-Id: <20181207103631.28193-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181207103631.28193-1-richard.henderson@linaro.org> References: <20181207103631.28193-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::244 Subject: [Qemu-devel] [PATCH 19/26] target/arm: Implement pauth_strip X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ramana.radhakrishnan@arm.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Stripping out the authentication data does not require any crypto, it merely requires the virtual address parameters. Signed-off-by: Richard Henderson --- target/arm/helper-a64.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 2.17.2 diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 0818fd5451..8860704720 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -1069,15 +1069,27 @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier, g_assert_not_reached(); /* FIXME */ } +static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param) +{ + uint64_t extfield = -param.select; + int bot_pac_bit = 64 - param.tsz; + int top_pac_bit = 64 - 8 * param.tbi; + + return deposit64(ptr, bot_pac_bit, top_pac_bit - bot_pac_bit, extfield); +} + static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier, uint64_t *key, bool data, int keynumber) { g_assert_not_reached(); /* FIXME */ } -static uint64_t pauth_strip(CPUARMState *env, uint64_t a, bool data) +static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data) { - g_assert_not_reached(); /* FIXME */ + ARMMMUIdx mmu_idx = arm_mmu_idx(env); + ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data); + + return pauth_original_ptr(ptr, param); } static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el,