From patchwork Sun Jan 28 23:14:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 126096 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp1977618ljd; Sun, 28 Jan 2018 15:22:33 -0800 (PST) X-Google-Smtp-Source: AH8x225K4B8v+byRRQaLp1M4l1AGeQxmvMzpJm49n2NQ0lD4Hq/fByyG4xHek1HQvGlBaVLHBxDU X-Received: by 10.37.96.197 with SMTP id u188mr16063051ybb.55.1517181753625; Sun, 28 Jan 2018 15:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517181753; cv=none; d=google.com; s=arc-20160816; b=MlmANt4JnnpxETK4Sqbri592fc0ZoIsaUREomR5W7PajKKAGy5E+kBzKNXZ85xjirY 1B5VcX8paPCwueVIP79KMfF2cfk7aAOW+GWH04na0sixlmArL6UjHctKJjwoWwbQJK2q Fx1u1gHfxi0v19Gwnkfbi9n8fw/QQb+1LnT3a3LffsEq7f3LUhcWs88lymDYIP6cFlAZ vuV7Wghi82/1SdMJqPtUgqNht+t3qvmR6ovGG0cGC8Vdt7W5Q+1hDAbsd/PMadYBm0NO 8YwRa73KTvXfXIcJLKn1MFVt8HPJTlsGeA2LQ1IOP8NzXCZTpWxzCylWCQbdiiCW7Eze dfwA== 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:arc-authentication-results; bh=jWlXGhyGzuQklKuZM0jR3HHQ8HHbSqFzQDbbpF04MmY=; b=K/XK+A35oBcemkSmKVuMM31Py4hU428neJOm9KILw/Ez+Wwjw3cx4UeZzLhuLAu3gY NRgrLtcJq0i4DJuSewjdCFqTCQUeEjcvInTFnoHPI60VT+u4KcqCgOjJyElJ9gqoWFX5 Or1SrZVQo22/nOwxGahVLizeu7QxvEYeU6WBUB1wRR51oh7Tcz4YBiOE7RTb9MPqoBLN +KIEq+F0/z/wku3EHOnssIh63UT/fNzJiGZwQv47DFN8rO3Z36uqaS5VCIUIMS/RqwV3 DhTR/k26BMtuHKAkiJ1OiKyrX4vkeULzF7bfMcXldjIhwrS1cT4If4cIU3v5yb5G78lt agHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VleV4hFE; 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 w6si1780785ywc.412.2018.01.28.15.22.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 28 Jan 2018 15:22:33 -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=VleV4hFE; 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]:44936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efwHR-0006VA-2j for patch@linaro.org; Sun, 28 Jan 2018 18:22:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efwAl-0002Tc-8k for qemu-devel@nongnu.org; Sun, 28 Jan 2018 18:15:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1efwAk-00087e-BW for qemu-devel@nongnu.org; Sun, 28 Jan 2018 18:15:39 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:33768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1efwAk-000875-54 for qemu-devel@nongnu.org; Sun, 28 Jan 2018 18:15:38 -0500 Received: by mail-pg0-x241.google.com with SMTP id u1so3011557pgr.0 for ; Sun, 28 Jan 2018 15:15:38 -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=jWlXGhyGzuQklKuZM0jR3HHQ8HHbSqFzQDbbpF04MmY=; b=VleV4hFE6KgW+OTTPuKshR76BBRtxzf6EHJ/F4vifcouEsvfV+qwtEYVDoV+k3gZhL obzIjZeSA8Z9pbSDYiAh5HPWxcUa7CWVIY4XszNGDG0vD4KD17kx1R+Jtz/XgdS52fL0 GalVA+OnM2kBPV/0f2QIdGfxMZsg+617F0/Dg= 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=jWlXGhyGzuQklKuZM0jR3HHQ8HHbSqFzQDbbpF04MmY=; b=ZEz3XHnlaVVjHVO3Pp9cU1gqZjLp4Q9Or+NIrDoKHnOMbpuAG3rrozVgmp6y5OIoiq TPzBauqo2e6BhcA67+grcN/Ncg3RwNP1CJ3yfREGLQk7lj+sTw73H3CsKNNn06rFxMkK bhKnO4rpODoZ1+EY96rabFopVSYp3pGHkyaRAy/xkGzEfGIKDdPlxv6kG3DdxX2ERleo /8u5Dtoof20XG7USlxNUjiHA8iE5MesXcKcEqHAMxuqq6JstuoE8PIrI7O9wTn03P3B8 PvitFylXeGR4NwS9pNTu/i0OoNtpUi/CrGFT/GtBsuUqxYlEvf6sEEweMDVGll6pHRpm jL4w== X-Gm-Message-State: AKwxytdLiVx1bGlXBzRIoYlT2pifiWEF9bpoi4A36oC1KiHOVnnxuVmh paKMWTLpDf9taClLWsV47TwhC9T/v/A= X-Received: by 10.99.65.133 with SMTP id o127mr11020513pga.13.1517181336763; Sun, 28 Jan 2018 15:15:36 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id r27sm26949344pfj.75.2018.01.28.15.15.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2018 15:15:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 28 Jan 2018 15:14:48 -0800 Message-Id: <20180128231528.22719-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180128231528.22719-1-richard.henderson@linaro.org> References: <20180128231528.22719-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PULL v4 03/43] target/hppa: Disable gateway page emulation for system mode 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/hppa/translate.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) -- 2.14.3 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 31d9a2a31b..8e357cc60c 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1543,6 +1543,7 @@ static DisasJumpType do_ibranch(DisasContext *ctx, TCGv dest, return DISAS_NEXT; } +#ifdef CONFIG_USER_ONLY /* On Linux, page zero is normally marked execute only + gateway. Therefore normal read or write is supposed to fail, but specific offsets have kernel code mapped to raise permissions to implement @@ -1600,6 +1601,7 @@ static DisasJumpType do_page_zero(DisasContext *ctx) return DISAS_NORETURN; } } +#endif static DisasJumpType trans_nop(DisasContext *ctx, uint32_t insn, const DisasInsn *di) @@ -3787,10 +3789,13 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) int i, n; /* Execute one insn. */ +#ifdef CONFIG_USER_ONLY if (ctx->iaoq_f < TARGET_PAGE_SIZE) { ret = do_page_zero(ctx); assert(ret != DISAS_NEXT); - } else { + } else +#endif + { /* Always fetch the insn, even if nullified, so that we check the page permissions for execute. */ uint32_t insn = cpu_ldl_code(env, ctx->iaoq_f); @@ -3885,25 +3890,27 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) static void hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs) { TranslationBlock *tb = dcbase->tb; + target_ulong pc = tb->pc; - switch (tb->pc) { +#ifdef CONFIG_USER_ONLY + switch (pc) { case 0x00: qemu_log("IN:\n0x00000000: (null)\n"); - break; + return; case 0xb0: qemu_log("IN:\n0x000000b0: light-weight-syscall\n"); - break; + return; case 0xe0: qemu_log("IN:\n0x000000e0: set-thread-pointer-syscall\n"); - break; + return; case 0x100: qemu_log("IN:\n0x00000100: syscall\n"); - break; - default: - qemu_log("IN: %s\n", lookup_symbol(tb->pc)); - log_target_disas(cs, tb->pc, tb->size); - break; + return; } +#endif + + qemu_log("IN: %s\n", lookup_symbol(pc)); + log_target_disas(cs, pc, tb->size); } static const TranslatorOps hppa_tr_ops = {