Message ID | 20210228232321.322053-6-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp2911929jap; Sun, 28 Feb 2021 15:24:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyv7VBhyNPZPsayAeBIQSaWATp2kFzI3CIeQ0QywGP9NAm1afQdV9Sv9x1nKpl3d0aYSVVw X-Received: by 2002:a05:6602:2355:: with SMTP id r21mr10877245iot.62.1614554646747; Sun, 28 Feb 2021 15:24:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614554646; cv=none; d=google.com; s=arc-20160816; b=BuxJWvLg9BALBKgOcOJJJNhsmRrusX2aXoSf8TcjMBR0B1a/4eLPbihf/DTOizy0uW 23grJCjOAdLGDXW6Hc0ngirBg22+sWsWpZB5kdMLuM88r8ErcKU7q62b3C2N8otA/JQ9 4vUoku8iihN4lRBg0Zv0LHb7zIGqSAGeN2NtcLNvQyf6psD15suYCMcYJOCd90xAZU+W Gv+EKddtdnyDlZvTyJFmDp3ofRS7QZMPjfFVdQ+A3IRqHWkwmDY6G3n/dGr/vM0erDcR e9n3wclONgdv1wBqOmJbQoEahGF7vm1Ju7cZy/l3z5I+ua1g3qSjnF5qx/Qx3DoO6KRV MMlg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NEaEZZZxi9u9Mpvj5euEgFjoVxLuL6VRMYmG/p0WBKQ=; b=Tpf2d60PhEP3k2dxHVxmTJddG250Z2slEebiNF2IjIe/po5w891DYj72EbbtVKyDwP ouHeR2vcV+Jcet/bbND5xOCWBY5Og+GaIzKY9oFctLj2D/lqCZGFJxISWvOFxQ6EVmKO m8hs9XhGIfTrE0eiC+vEa/ZyjO3RimQNs77Ok/BvF+Qjy+u92wisK+wN7sYpJv1nVooG GsFvg1/DW83hmeO1GjU4HXaOzNDejhtq1x0zpK3x0SIhOl9IeL7A7PathvvVJ7SyHRnc JI3sqcga2rjGXQQBlCIeGJy0XjVL38mwlCsph4qQiZS11u1LR1kzcdqNVU9LfwwnNdes qOuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wMvU1SFY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f6si16100892ila.108.2021.02.28.15.24.06 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Feb 2021 15:24:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wMvU1SFY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1lGVPy-0005Mz-56 for patch@linaro.org; Sun, 28 Feb 2021 18:24:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1lGVPP-0005Lp-Lp for qemu-devel@nongnu.org; Sun, 28 Feb 2021 18:23:33 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:32805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1lGVPM-0007fX-Qv for qemu-devel@nongnu.org; Sun, 28 Feb 2021 18:23:31 -0500 Received: by mail-pl1-x632.google.com with SMTP id b8so5946898plh.0 for <qemu-devel@nongnu.org>; Sun, 28 Feb 2021 15:23:28 -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 :mime-version:content-transfer-encoding; bh=NEaEZZZxi9u9Mpvj5euEgFjoVxLuL6VRMYmG/p0WBKQ=; b=wMvU1SFYqvML0Yvvpnz4MDtxEmy5RbGliZXWkKWWfACJC3iygiW4mJNHX8xvTdDgTn vM+gh+lRGFcGpBsQF0qWHjVDgotfip7cBc5+4dH/Uxe1jnnRhRPnrrJ8ql/yhunu/CZS 5+SH4fptblL3JBttyLlVtz8mLovQ1EgpCYnt5a+NFUPvXJ43nC2wgnfUjxRU0OCZYXRA 7LHM5LRuOmI2FfrZgweWL3YcUKW4RxrPo2B1745wULObCIaT0Ezqw3cO0YYaK+WdPyfh dXUAzZIV+LjHvCsf1prCMpHB+n5y77lqpWLN/AKV8hx1EpEuruxMHUXVSlK19G9cCbJ1 KCgg== 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:mime-version:content-transfer-encoding; bh=NEaEZZZxi9u9Mpvj5euEgFjoVxLuL6VRMYmG/p0WBKQ=; b=hXWMYCSf4cWCShIut4tjxSWGynA+NxBQeiI7APYrPSxgQ2f0s5TzEs1/jc8V09A6aa pEkJEN+i/qADieJRNfuEhGhs4pDRwUg+vAWMqRrxwMKuTPAjFC4nxRmEWYJr744SCfms qFhwu0N2ID6PWOkKU9FNaCnl61XCuN3XzTE2TnGwrCaOBZIcMEsiPPKVrgDvEoGWR/Ca C7PdjJJ7Lf94OGBsgk/BeX6Wz8CB9JjU3zfU1AxBHAUoed5sNZ8ybCzLal54PfuHJ+YX 6gaGtfGYi59hyq+nj7otiSZf2SuX4oM68p0wEfgS+gRNnnmB+RNMjYFiUwwnwSa0AM2G terQ== X-Gm-Message-State: AOAM533QvX9ZbUXU1CfrpIKuHYTdkOHAThGX1Fd08FfHEqtb4Wr6YbxI uN/EsTK/RGxHoLk+vWmPTr4SbW26K6b6lQ== X-Received: by 2002:a17:902:e8c4:b029:e2:b7d3:4fd7 with SMTP id v4-20020a170902e8c4b02900e2b7d34fd7mr12405476plg.73.1614554607551; Sun, 28 Feb 2021 15:23:27 -0800 (PST) Received: from localhost.localdomain (174-21-84-25.tukw.qwest.net. [174.21.84.25]) by smtp.gmail.com with ESMTPSA id d24sm16257400pfn.54.2021.02.28.15.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Feb 2021 15:23:27 -0800 (PST) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Subject: [PATCH 05/50] target/i386: Split out check_iopl Date: Sun, 28 Feb 2021 15:22:36 -0800 Message-Id: <20210228232321.322053-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210228232321.322053-1-richard.henderson@linaro.org> References: <20210228232321.322053-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: cfontana@suse.de Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
i386 cleanup part 3
|
expand
|
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 75ee87fe84..176c95c02b 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1302,6 +1302,16 @@ static bool check_vm86_iopl(DisasContext *s) return false; } +/* Check for iopl allowing access; if not, raise #GP and return false. */ +static bool check_iopl(DisasContext *s) +{ + if (s->vm86 ? s->iopl == 3 : s->cpl <= s->iopl) { + return true; + } + gen_exception_gpf(s); + return false; +} + /* if d == OR_TMP0, it means memory operand (address in A0) */ static void gen_op(DisasContext *s1, int op, MemOp ot, int d) { @@ -7089,28 +7099,16 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) break; #endif case 0xfa: /* cli */ - if (!s->vm86) { - if (s->cpl <= s->iopl) { - gen_helper_cli(cpu_env); - } else { - gen_exception_gpf(s); - } - } else { - if (s->iopl == 3) { - gen_helper_cli(cpu_env); - } else { - gen_exception_gpf(s); - } + if (check_iopl(s)) { + gen_helper_cli(cpu_env); } break; case 0xfb: /* sti */ - if (s->vm86 ? s->iopl == 3 : s->cpl <= s->iopl) { + if (check_iopl(s)) { gen_helper_sti(cpu_env); /* interruptions are enabled only the first insn after sti */ gen_jmp_im(s, s->pc - s->cs_base); gen_eob_inhibit_irq(s, true); - } else { - gen_exception_gpf(s); } break; case 0x62: /* bound */
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- target/i386/tcg/translate.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) -- 2.25.1