From patchwork Sat Mar 24 09:26:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 132372 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1583798ljb; Sat, 24 Mar 2018 02:26:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/cj1f+MOEy5AhXyv+8/snk3qLmv2HxEczWHzYjLbutF7FAgCCd+wV+DTWuXsBDHoRPrAoE X-Received: by 10.200.48.58 with SMTP id f55mr15072111qte.140.1521883611026; Sat, 24 Mar 2018 02:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521883611; cv=none; d=google.com; s=arc-20160816; b=gl0mWgmH5tZhtLqlDifR7OBvb7Vkrg0hJNwHqfiNT/rYmm2H6pbX0vhNxqgR7lcbiy kY2ADPbuBf+qfRHMpi/8dkBS2ehqevKyEKXTdMmtjK6zN7i4WifrGfY8+KEqCYlbe3ah h/1GvqL0GhHILuVLbxjwPj59rUi9rLgWrKSHD5DVXG8VLUBFXpubUTVBRdr2fTqfKBoT 5S/65fL+xvbqa3lfHjh/8D6cpYNPj3/t1VUbSaN/rOaFW3A1wI3mZ8H7nW1m6yCokxfS BQjpVqk5t+3FNlqQiaUhBZuokZChM82cV9ijjQRGLodQVtCMd9kJcC3b0tCcAWIX+8OP uKjQ== 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:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=qUiTSSsq6c5rGqFbHBLcrdZhVbeg08PITJeEu1yNaMg=; b=SF0NaDqrtYjELYUIDr+diasTipIRbhD/wGk2SWRXKd5ZyRWNWhNq+9mBDaMr9RO/LX cO1XAuidK1ZlmQI1hq3/Do6GR1fmS/WvmrLvd5aULD6tqVFI4NOa2Q5z3dAB5Qzqjvq5 EqSkrTc0iDMFK5LrG/Un0zCW9QFy6ftMx6Qnw21AfEoCJwNfnia0lQqF8zI1Bc2L877Q G5CNh/HPn1rSdoKWJ4PCS93TZAvklj7efNQ/FwFSCr93pV3CMo9ropNKxYIW45U0CZPi fw9tggDxj4TiQIdy6ERf/wiztOjzPhgT1QDYpxWAlWZnUS7bzRUMM6yCeqlLTfBzRdZP CAIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fLCY1g1v; 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 j89si3781829qtd.177.2018.03.24.02.26.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 24 Mar 2018 02:26:51 -0700 (PDT) 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=fLCY1g1v; 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]:41698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezfRq-0005xY-Hq for patch@linaro.org; Sat, 24 Mar 2018 05:26:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezfRZ-0005xK-Qz for qemu-devel@nongnu.org; Sat, 24 Mar 2018 05:26:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezfRV-0003UO-4m for qemu-devel@nongnu.org; Sat, 24 Mar 2018 05:26:33 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:39546) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezfRU-0003UB-Ux for qemu-devel@nongnu.org; Sat, 24 Mar 2018 05:26:29 -0400 Received: by mail-pl0-x242.google.com with SMTP id k22-v6so8894177pls.6 for ; Sat, 24 Mar 2018 02:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=qUiTSSsq6c5rGqFbHBLcrdZhVbeg08PITJeEu1yNaMg=; b=fLCY1g1vgkjVyoqvhR+ZLn4WWMsF/fYO7FzNH29dRDkVbZ9WYatORwWYOXDnFs5rd7 sh7uM1yesq9cjgyx1dnMKUKDKecqUfS2nRbVMqizzvEVqMGgidiL9vPLiFGEvjyQEXuY GI8kIuMYv7a5SPvMpRk1MFGwD76ZJnbDBFsUk= 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; bh=qUiTSSsq6c5rGqFbHBLcrdZhVbeg08PITJeEu1yNaMg=; b=KdbfOklDuReo2H0I8Fhx2ZLAQzeDV4YrM8z+bfEy8iiCDnHkdZ3CdrMR5QqxlUxbDj s+0j1UcjT3EnLdIYW2XFnJqujOTxXZYwgHxqJPrEoqrEyaJhMf4Yl4yAIPAS4YE+s2kF lD7oZlr+EobfWEZbCupnrolxL1zaPop7AK9taSOHGMW6KqaikAY7GK5yY4YVU4fPKnXL mV17bxc+sv5QLMSryzXqBCXOWYI72wmapoONLgeBvM5EvHyq8Ex2ONfg6dRH+/TiLDXA B8xhheROR2P/kZIYTEPBE1e5oRMZ3QpR/acpl9VT7BEqS9uw7AU3ajDrkQbLeYFlUyvj m9Jg== X-Gm-Message-State: AElRT7G9QYt39+8IktvbitbLVeJ09Aj26FbFgxsWRg2eJGjWXNTgAHSd HwySLHIgYNAYeMSYlXA+OZebpghwx4A= X-Received: by 2002:a17:902:6ac1:: with SMTP id i1-v6mr29449923plt.152.1521883587239; Sat, 24 Mar 2018 02:26:27 -0700 (PDT) Received: from cloudburst.twiddle.net ([116.212.193.82]) by smtp.gmail.com with ESMTPSA id b5sm19937957pfc.87.2018.03.24.02.26.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 24 Mar 2018 02:26:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 24 Mar 2018 17:26:14 +0800 Message-Id: <20180324092614.6176-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH for-2.12] target/hppa: Include priv level in user-only iaoq 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: deller@gmx.de, dave.anglin@bell.net, law@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" A recent glibc change relies on the fact that the priv level in the iaoq must be 3, and computes an address based on that. QEMU had been ignoring the priv level for user-only, which produced an incorrect address. Reported-by: John David Anglin Signed-off-by: Richard Henderson --- I have not set up everything in order to test this vs current glibc, but since I'm forcing the value upon starting translation, I expect it to work. It does at least work with my current sysroot. r~ --- target/hppa/cpu.h | 4 ++-- target/hppa/translate.c | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) -- 2.14.3 diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 19dd12a93e..861bbb1f16 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -305,8 +305,8 @@ static inline void cpu_get_tb_cpu_state(CPUHPPAState *env, target_ulong *pc, incomplete virtual address. This also means that we must separate out current cpu priviledge from the low bits of IAOQ_F. */ #ifdef CONFIG_USER_ONLY - *pc = env->iaoq_f; - *cs_base = env->iaoq_b; + *pc = env->iaoq_f & -4; + *cs_base = env->iaoq_b & -4; #else /* ??? E, T, H, L, B, P bits need to be here, when implemented. */ flags |= env->psw & (PSW_W | PSW_C | PSW_D); diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 6499b392f9..c532889b1f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1909,9 +1909,6 @@ static DisasJumpType do_ibranch(DisasContext *ctx, TCGv_reg dest, */ static TCGv_reg do_ibranch_priv(DisasContext *ctx, TCGv_reg offset) { -#ifdef CONFIG_USER_ONLY - return offset; -#else TCGv_reg dest; switch (ctx->privilege) { case 0: @@ -1931,7 +1928,6 @@ static TCGv_reg do_ibranch_priv(DisasContext *ctx, TCGv_reg offset) break; } return dest; -#endif } #ifdef CONFIG_USER_ONLY @@ -1967,7 +1963,7 @@ static DisasJumpType do_page_zero(DisasContext *ctx) goto do_sigill; } - switch (ctx->iaoq_f) { + switch (ctx->iaoq_f & -4) { case 0x00: /* Null pointer call */ gen_excp_1(EXCP_IMP); return DISAS_NORETURN; @@ -1978,7 +1974,7 @@ static DisasJumpType do_page_zero(DisasContext *ctx) case 0xe0: /* SET_THREAD_POINTER */ tcg_gen_st_reg(cpu_gr[26], cpu_env, offsetof(CPUHPPAState, cr[27])); - tcg_gen_mov_reg(cpu_iaoq_f, cpu_gr[31]); + tcg_gen_ori_reg(cpu_iaoq_f, cpu_gr[31], 3); tcg_gen_addi_reg(cpu_iaoq_b, cpu_iaoq_f, 4); return DISAS_IAQ_N_UPDATED; @@ -4697,8 +4693,8 @@ static int hppa_tr_init_disas_context(DisasContextBase *dcbase, #ifdef CONFIG_USER_ONLY ctx->privilege = MMU_USER_IDX; ctx->mmu_idx = MMU_USER_IDX; - ctx->iaoq_f = ctx->base.pc_first; - ctx->iaoq_b = ctx->base.tb->cs_base; + ctx->iaoq_f = ctx->base.pc_first | MMU_USER_IDX; + ctx->iaoq_b = ctx->base.tb->cs_base | MMU_USER_IDX; #else ctx->privilege = (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; ctx->mmu_idx = (ctx->tb_flags & PSW_D ? ctx->privilege : MMU_PHYS_IDX);