From patchwork Wed May 19 18:30:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 442462 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1580615jac; Wed, 19 May 2021 11:32:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwPMJM8wWm3im2cBcJj/BL3pchpM7pUcjaCdzNT12WDI2VM+DBAnYSVyLOsxfekn3Zmzm7 X-Received: by 2002:a5e:cb45:: with SMTP id h5mr815848iok.207.1621449164577; Wed, 19 May 2021 11:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621449164; cv=none; d=google.com; s=arc-20160816; b=NntdsdYEDzxyyekmH5Zcj9qHtEo3Y9YR2RXdwX3GUujMaojLSx2amkaclIHigbvLEw Cczgxo6yW2WGNKPPOcWZoCD6WhGLyo1nTaed5+cDHt0ZWZQiANlhowZwYE5vaww0nacW HvOnEEqR/EG1oGqjKviYGxIeJ5tbmfPUE7eohpQ2L6KrIhhGXx9F62uCGqFLPn5NYDy2 BFtnT0oZrmI51Lm3MPuhTHG/zlFNN4xIBQ5nsf+y926GBKsRaOGWTxg0LwCRq9jB1d0v Zhn0pzpGomiRS75nUEeuOwTvJnrABuvCp0OaYnh365mU7DSfFf9+8yLii5iAiJYX5rrd W93g== 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=XkpdcvdsMOsMLR49VnhnztK5w7qTf2fMwT/yaQmjNjQ=; b=RsMFP02HD2a9Z61fGUgOntFpcUmm/M+KXv4gHmiCL+gMiNQCtsR4qUwSzjQIYkEwem IA7ZWOxuvEa4Z+YXliLpXZ5xiPvKajErcRlYLzfFgmb8jT3DYaYpNCOjbjqcO5IUrYg7 zLGXnPUYcbVUraUpqrtPUjsXwq5O7N1c2JfkxaeYPlfZHqUQ+VBMpuuG9Dd63VUTGWYN 4OTicOWq27LSwUKe6wM+ZbtiPPxwmYlbA/k1+J5nM2hYiZQe50l/ULp3PvCl2M2wcWe9 M267QutswNYtiq+pcNijs0jd3WW7pO9IRScReL4qBB93cSajnIUX3QJ8SRP+GSTNFmcJ zbEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGYfwyeE; 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: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f10si445096ilu.68.2021.05.19.11.32.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 May 2021 11:32:44 -0700 (PDT) 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=PGYfwyeE; 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]:33230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljQzr-0003Py-VE for patch@linaro.org; Wed, 19 May 2021 14:32:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljQyB-0003OB-Kd for qemu-devel@nongnu.org; Wed, 19 May 2021 14:30:59 -0400 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]:37648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljQyA-0005Va-0S for qemu-devel@nongnu.org; Wed, 19 May 2021 14:30:59 -0400 Received: by mail-oi1-x22a.google.com with SMTP id h9so14023128oih.4 for ; Wed, 19 May 2021 11:30:57 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=XkpdcvdsMOsMLR49VnhnztK5w7qTf2fMwT/yaQmjNjQ=; b=PGYfwyeE5W/Maowyoxk7yRgI+MyA0LH3O1jgGh5lukm01XKYxrWo3pJFEXAqy7Vyyr o6UaQpPX3VIsH90aimDOiHdaY1n/RFxzeP5EbB2/XT5LwiZHcS148v6SGVvr8Rb3DyIP Nr0FdzYx2lizBJ7ojdTf52gCGJa2iGyActDiUrvBAwvNZ83WRjdDocOsgxdh86n6gyY6 NnqKi3UvgMd9m8UTPid5f3R8AsPas2+c7oiAWx/VX3/qCIPqSji1bX7LTWzE+1OtcbTJ atCY6DLWhyaLLpEdMYbtr/7MUzWPKnNJ+HLGS83F/9CHca7e2Lt9QKGaEZY3g+hECOkR GgGA== 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=XkpdcvdsMOsMLR49VnhnztK5w7qTf2fMwT/yaQmjNjQ=; b=VsyTXiyx67csLNkQhmrqmr21gKhwumRxpdJ2L5HyrrgaPROD+U9TO1lEIjlkvtkWdn 9N7a9Gouwc0OpNLBqZk966TUFzEf+YED54EQoKSmTatBgRwnF7Em6pX2JcHb4VhaO2ih H03CwtfVaWC8JI+O6xgHyQ3Nb2iGubjnX+TbM/Y2rlnUTZmrwsDbkbV92c9yFkicbY28 eKslVHOyz2wXKRwrucLsGeoALcTZv98uTab4X2U3vX4+zoB4n6Csrt5NQ95oMQRmoaPJ mL7LhCyhZflUMc39lEt+kB/g5V47k+sCg0jFUL5uf83l6b1+xttSgb+QFS+xRXSQss4N LOOA== X-Gm-Message-State: AOAM532Tx8Y31WuRHrpco1TafITR9wrZRix/PVngOUoT4XxJhmwI+SGN kOvSBpIv4OLv+hYQejZsWAhhhrcw6yI5CDZf X-Received: by 2002:aca:f5c5:: with SMTP id t188mr384221oih.25.1621449055902; Wed, 19 May 2021 11:30:55 -0700 (PDT) Received: from localhost.localdomain ([45.235.253.15]) by smtp.gmail.com with ESMTPSA id l9sm28428oou.43.2021.05.19.11.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 11:30:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/50] target/i386: Unify code paths for IRET Date: Wed, 19 May 2021 13:30:03 -0500 Message-Id: <20210519183050.875453-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519183050.875453-1-richard.henderson@linaro.org> References: <20210519183050.875453-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22a; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22a.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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In vm86 mode, we use the same helper as real-mode, but with an extra check for IOPL. All non-exceptional paths set EFLAGS. Signed-off-by: Richard Henderson Reviewed-by: Paolo Bonzini Message-Id: <20210514151342.384376-4-richard.henderson@linaro.org> --- target/i386/tcg/translate.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 61b30117a3..0a15662949 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -6577,22 +6577,18 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) goto do_lret; case 0xcf: /* iret */ gen_svm_check_intercept(s, pc_start, SVM_EXIT_IRET); - if (!s->pe) { - /* real mode */ - gen_helper_iret_real(cpu_env, tcg_const_i32(dflag - 1)); - set_cc_op(s, CC_OP_EFLAGS); - } else if (s->vm86) { - if (s->iopl != 3) { + if (!s->pe || s->vm86) { + /* real mode or vm86 mode */ + if (s->vm86 && s->iopl != 3) { gen_exception_gpf(s); - } else { - gen_helper_iret_real(cpu_env, tcg_const_i32(dflag - 1)); - set_cc_op(s, CC_OP_EFLAGS); + break; } + gen_helper_iret_real(cpu_env, tcg_const_i32(dflag - 1)); } else { gen_helper_iret_protected(cpu_env, tcg_const_i32(dflag - 1), tcg_const_i32(s->pc - s->cs_base)); - set_cc_op(s, CC_OP_EFLAGS); } + set_cc_op(s, CC_OP_EFLAGS); gen_eob(s); break; case 0xe8: /* call im */