From patchwork Fri May 14 15:13:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 438951 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp458648jam; Fri, 14 May 2021 08:51:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFnLxgIgaStgJuL+m3WbC0NXi5YS60IECEHM6TBuRQ06YyCghoX65mXVhS1PTJh4c1c1hz X-Received: by 2002:a02:cbac:: with SMTP id v12mr44495745jap.51.1621007512015; Fri, 14 May 2021 08:51:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621007512; cv=none; d=google.com; s=arc-20160816; b=v/kaKA92jpw47G47oo2cfKQdk/oidC1jog5PdmK0fPCvg0RWGkxXdjSx/11P5HBpde nE+C0Wqabbck2VYKFwMjdpNwmWX+F0PS8jeNJkmt7mDhGdR4shKGdmO+p6jGxLDyFaBv BXT9rGBOVaWqFIq0qjapxvzlllWbGaG8G/Xo1NR80ALvKU+ArAondoe1hC+7H16aC8rN FoKyQM8SX0WiYMnPhEq0MK2ZCKDCfcB0mn8YaucjOlUdwLm4MHkRZ84tWviAw0zzL5mv noQdS38nyafUu7dfs/0Iy3eU+FawFgfGdBvjLgOQagcXAEyJaBI48gKFrMeyuzH9P1sV ZPzQ== 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=JxgXRwC3DPI+6mt093LWUSFLNKSWuwiSEOIYntw4KwM=; b=tFsPO8nAoL0VlAmu2IQ/7gaNBDD8JnlaPrhF8+3re1WYTyVRC2c9fLWc3Txk7nB7qB OMlyaRH8qou2hk8/5KDyje39UCAuIatwDy7rYeXiNkPN3wui6N7sCifFoC8DzyzUmkK5 GXr96N3eeiqgXFWAzrJp4ZuWJ8cBP+695PuKzj5h2fxGclqpLYomJ4khc3z8/Xt+oxIY IFvxEMP2eEycfZv1poJyWa7zktGbgwsvPvp0F0j8L5D3E+sEKl5FJ1e+FYSbhdSLj2wD 0fyrK3LPgZV9vsVR8xUkzQOODwIWqZWNEGpKy0Dv4Cg3SxLoX+7PbpPYxJ5O7xvRzcGR hcdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SmIwXFNv; 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=fail (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 s3si7789938ioc.57.2021.05.14.08.51.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 May 2021 08:51:52 -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=fail header.i=@linaro.org header.s=google header.b=SmIwXFNv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lha6R-00060Q-Ev for patch@linaro.org; Fri, 14 May 2021 11:51:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhZZ6-0003JJ-N2 for qemu-devel@nongnu.org; Fri, 14 May 2021 11:17:24 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:39839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhZZ4-0000Co-RR for qemu-devel@nongnu.org; Fri, 14 May 2021 11:17:24 -0400 Received: by mail-qt1-x832.google.com with SMTP id f8so18264845qth.6 for ; Fri, 14 May 2021 08:17:22 -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=JxgXRwC3DPI+6mt093LWUSFLNKSWuwiSEOIYntw4KwM=; b=SmIwXFNvb2R3E2Zx+mrboG+BzCziQz5FmVG0iQoaQTwAKi0+WUAE+CfxJcoe4C+iZX c1X7aC56H4PlRjhICu4jK2qA9TypTC4vJuoG8i7uSYKIC+GboKIxatAWi+V4DkW1xD5K IDLbU2u5I4KKPFTOzDXFflKL6sCxpy+gfFXvXOSLfOlBe9vRlpRgYOPTKmuFvZ7gI0hz md9YWCCzt6CL17CUl2H5E7OAIVaH0eamY0xihLbY+ZjmhnCohisJYUmD7L/4AUj41r7X BLI3GISYpUC6GUF0Tu6PbioQRKHmUOWzC++754O0rCsjbp/UoLufGNqcqgrNy7qMYYk4 hZ4A== 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=JxgXRwC3DPI+6mt093LWUSFLNKSWuwiSEOIYntw4KwM=; b=f2EkM7AMH8+FZHrfkn8v1BB2u1MyhO7u/Uu4/BwVhlh6CVu7PnaljZm/Wt+ZWP7FjI RD6w+0YuxcncXVXxyXsL7H5K3zd02LQTPHzebQeZOFEzAbE4z/uWJpJQ4cEjHbPrXOZc sA/SHn6jh+WO2Va1hQQDPhOY5Iup2aAHjjuH3cCd01mvQWjopmE+9TXbB08H0ihBWbZg o2G6FETUMaIR/aw/cxuTbj4wqomzsugqmH77/N06rtkk0zZZq7uhzTkIGwfy3P3JYEgo 0Bd/up5vTg57Gj9tEa2tKv2/Frwk3GixiF1H7dLFjnMooLnSboZdkbkk45pRJ6z+Ij7S Ot4Q== X-Gm-Message-State: AOAM532hHiDCqnQgEy96PI7k/Wq+zr7TMVcRWKSDOas3ufgrDAo5brvs YexLNWCsnjQLmJwfnOeOhKvpvjNEqFwB4FTDH98= X-Received: by 2002:a05:622a:164a:: with SMTP id y10mr4486525qtj.97.1621005441835; Fri, 14 May 2021 08:17:21 -0700 (PDT) Received: from localhost.localdomain (163.189-204-200.bestelclientes.com.mx. [189.204.200.163]) by smtp.gmail.com with ESMTPSA id p190sm5181972qke.13.2021.05.14.08.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 08:17:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 40/50] target/i386: Pass env to do_pause and do_hlt Date: Fri, 14 May 2021 10:13:32 -0500 Message-Id: <20210514151342.384376-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210514151342.384376-1-richard.henderson@linaro.org> References: <20210514151342.384376-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::832; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x832.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: pbonzini@redhat.com, f4bug@amsat.org, ehabkost@redhat.com, cfontana@suse.de Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Having the callers upcast to X86CPU is a waste, since we don't need it. We even have to recover env in do_hlt. Signed-off-by: Richard Henderson --- target/i386/tcg/misc_helper.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) -- 2.25.1 Reviewed-by: Paolo Bonzini diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c index 931dbd9db0..23287b330e 100644 --- a/target/i386/tcg/misc_helper.c +++ b/target/i386/tcg/misc_helper.c @@ -101,19 +101,18 @@ void QEMU_NORETURN helper_rdpmc(CPUX86State *env) raise_exception_err(env, EXCP06_ILLOP, 0); } -static QEMU_NORETURN void do_pause(X86CPU *cpu) +static void QEMU_NORETURN do_pause(CPUX86State *env) { - CPUState *cs = CPU(cpu); + CPUState *cs = env_cpu(env); /* Just let another CPU run. */ cs->exception_index = EXCP_INTERRUPT; cpu_loop_exit(cs); } -static QEMU_NORETURN void do_hlt(X86CPU *cpu) +static void QEMU_NORETURN do_hlt(CPUX86State *env) { - CPUState *cs = CPU(cpu); - CPUX86State *env = &cpu->env; + CPUState *cs = env_cpu(env); env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ cs->halted = 1; @@ -123,12 +122,10 @@ static QEMU_NORETURN void do_hlt(X86CPU *cpu) void QEMU_NORETURN helper_hlt(CPUX86State *env, int next_eip_addend) { - X86CPU *cpu = env_archcpu(env); - cpu_svm_check_intercept_param(env, SVM_EXIT_HLT, 0, GETPC()); env->eip += next_eip_addend; - do_hlt(cpu); + do_hlt(env); } void helper_monitor(CPUX86State *env, target_ulong ptr) @@ -143,7 +140,6 @@ void helper_monitor(CPUX86State *env, target_ulong ptr) void QEMU_NORETURN helper_mwait(CPUX86State *env, int next_eip_addend) { CPUState *cs = env_cpu(env); - X86CPU *cpu = env_archcpu(env); if ((uint32_t)env->regs[R_ECX] != 0) { raise_exception_ra(env, EXCP0D_GPF, GETPC()); @@ -153,20 +149,18 @@ void QEMU_NORETURN helper_mwait(CPUX86State *env, int next_eip_addend) /* XXX: not complete but not completely erroneous */ if (cs->cpu_index != 0 || CPU_NEXT(cs) != NULL) { - do_pause(cpu); + do_pause(env); } else { - do_hlt(cpu); + do_hlt(env); } } void QEMU_NORETURN helper_pause(CPUX86State *env, int next_eip_addend) { - X86CPU *cpu = env_archcpu(env); - cpu_svm_check_intercept_param(env, SVM_EXIT_PAUSE, 0, GETPC()); env->eip += next_eip_addend; - do_pause(cpu); + do_pause(env); } void QEMU_NORETURN helper_debug(CPUX86State *env)