From patchwork Mon Jun 10 02:02:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 166260 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp472864ilk; Sun, 9 Jun 2019 19:22:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJkw56mM8DQioa6NtZI2njO8zlUBzSViFZRSvlk3M+3VTqcOik951kCKkZhYU4T9K8PgQd X-Received: by 2002:ac8:2537:: with SMTP id 52mr57360553qtm.5.1560133335410; Sun, 09 Jun 2019 19:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560133335; cv=none; d=google.com; s=arc-20160816; b=TkUoWk89WbP8SKoKRuTwWULhZB+wWx7FbiWs5hs4vgj9p68+teb1YSIKdFui9v6RcH zclhDNjlGm9sAcuXWq0toLO4o5qJmnmGbAULXJI9cEfXDg+CTghf5TmJxUKBktUweLVe vo1ZyFlhv0CD+lILZADL72vP/waNeUcw6A6G6faPz3NmptU+YkTS+PI7Q0TPnGkqfEZK HD04XFHWiF6bxMt1Z+8MggXddEL7twUqqBy97JtCUAVjVuD6Ks+rmhPs48uvkp5zy0iq elYphRVnjrQirC3/eUcZKGfL1vea61V5/S8IdKr+K6v+IkIANgZ9eKBAjCic9yrZyTtq p3fw== 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; bh=tSiI4G5J5ouiA/gsVkWkdNcl9+jS6pdNMYuFN+MKcoA=; b=jFJCxBwxBbc/kFPMnm2HZvACftVt5QJDNiYWJPABdK90LgESq2kS2gxco0L+VIWfxP JsXdLoQEgWsVRk1Y3CrJfZOLiHEXWTr+AKEqWn+ValEkhAbZf+joFq6Ge5Lm++XL8r4d AdIL9rMm8BCgRlgB6KX6hA3cpvG1HyNOlKWJY2fxvmfBUvlR4JvcWtNK4g/YuTmoDEGf QnAhIUxY5GJm/BhcyAWGgI8xCLTLiJOET0qaFw2Jodf8zw9ODGi/409ArWyuXcRIgxpW Dd7X0clIGW/zDOB31K6k+b63yM01uw7roEBuP1R33L47FprGFIw1KP+KPkAXHqRAZDkK wwAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SXLJIA4Z; 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 o28si6389945qvf.100.2019.06.09.19.22.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 19:22:15 -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=SXLJIA4Z; 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]:39736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9wp-0007xU-9L for patch@linaro.org; Sun, 09 Jun 2019 22:22:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53168) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9e5-0006RO-5f for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha9e4-0001mb-3Z for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:49 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:33933) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ha9e3-0001mA-T1 for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:48 -0400 Received: by mail-pl1-x630.google.com with SMTP id i2so2995322plt.1 for ; Sun, 09 Jun 2019 19:02:47 -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; bh=tSiI4G5J5ouiA/gsVkWkdNcl9+jS6pdNMYuFN+MKcoA=; b=SXLJIA4Zp8CwkFQXbHy2sNyMHnzkXtWeKzkUthau8uS/Qj9jDwmLpdG7JTsHBIaFUq Cg5UH4dVHDh7Y3b9koizvXP9smdjnlK7FMogijxFgdW+bOTMBDYx3kPi7K+Yh4mIg/9X VHzGJlZPLVOkqyCRJ5YVxMguKCppJH6fflxdbQuI6biWDpa6nAV4200sO3uXuMLoK6aP Ofuhgavc55dIqtrtayxVX9HRRTK8xN3xJEQTLj0whZWl9JLPLsF+J34lC5iXA1qaMAZ1 eIE25SC1b8doAMadG71/MZsFeBNvd3YSy8IugqKzYct2UQvK7yrSSPu0242kt1vxIS/a 7hYg== 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=tSiI4G5J5ouiA/gsVkWkdNcl9+jS6pdNMYuFN+MKcoA=; b=aT7x+cdERKevOjHVtwSIsFyMHhmFReyagnzpCbI0OokGGs0lWuGw0p8LK4R1vU4Ioz Sg2Coeq8dYzvEu7LOMIEMaW3puJ5x6bD+9x0/4ap5zBiAGhbiV0BVk+bnsdm2wAUvICj wIdCc0IF/kyVsp8kKeUZUaZ1PHYDsIt9LLQ9u0xKnLRFtgQ/+FVZCy2IVk03Wd4j0gRH rAs0qacZEXxaQICPfBXpM79cVnNJYFoWYJPNmcbvd/lWgUtzdJhiyKkjePbviCglrhNC ZnaMXrl/ZAmn8qn62o8laxKg3mSXYI4qMrlREoeUr0qF0/LbMjNEhZkhOd4L2u10nxcO dIwg== X-Gm-Message-State: APjAAAW3tonVIh5KxGKxSlZ1hPPeHYr9cxXgt2UC5UTvDd2myasUYhsW I552b/Zwd5egMu+8AswCwXSQqadrDKw= X-Received: by 2002:a17:902:70c4:: with SMTP id l4mr32324942plt.171.1560132166184; Sun, 09 Jun 2019 19:02:46 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id l63sm9749013pfl.181.2019.06.09.19.02.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 19:02:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2019 19:02:00 -0700 Message-Id: <20190610020218.9228-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610020218.9228-1-richard.henderson@linaro.org> References: <20190610020218.9228-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::630 Subject: [Qemu-devel] [PULL 21/39] target/openrisc: Use env_cpu, env_archcpu 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cleanup in the boilerplate that each target must define. Replace openrisc_env_get_cpu with env_archcpu. The combination CPU(openrisc_env_get_cpu) should have used ENV_GET_CPU to begin; use env_cpu now. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 5 ----- linux-user/openrisc/cpu_loop.c | 2 +- target/openrisc/exception_helper.c | 5 ++--- target/openrisc/sys_helper.c | 8 ++++---- 4 files changed, 7 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 50f79d540b..9e46ac5266 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -317,11 +317,6 @@ typedef struct OpenRISCCPU { } OpenRISCCPU; -static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env) -{ - return container_of(env, OpenRISCCPU, env); -} - #define ENV_OFFSET offsetof(OpenRISCCPU, env) void cpu_openrisc_list(void); diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index f496e4b48a..4b8165b261 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -23,7 +23,7 @@ void cpu_loop(CPUOpenRISCState *env) { - CPUState *cs = CPU(openrisc_env_get_cpu(env)); + CPUState *cs = env_cpu(env); int trapnr; abi_long ret; target_siginfo_t info; diff --git a/target/openrisc/exception_helper.c b/target/openrisc/exception_helper.c index 0797cc9d38..d02a1cf0aa 100644 --- a/target/openrisc/exception_helper.c +++ b/target/openrisc/exception_helper.c @@ -25,15 +25,14 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); + OpenRISCCPU *cpu = env_archcpu(env); raise_exception(cpu, excp); } static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUState *cs = env_cpu(env); cs->exception_index = EXCP_RANGE; cpu_loop_exit_restore(cs, pc); diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 05f66c455b..8f11cb8202 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -30,8 +30,8 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) { #ifndef CONFIG_USER_ONLY - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + OpenRISCCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); target_ulong mr; int idx; @@ -194,8 +194,8 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, target_ulong spr) { #ifndef CONFIG_USER_ONLY - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + OpenRISCCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); int idx; switch (spr) {