From patchwork Sat Mar 23 19:09:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160962 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2181348jan; Sat, 23 Mar 2019 12:24:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyl84cefNf3bLdVfysOTkLbUdsTy1SlQqCvYWcnAfAoN+XbSu1nXUtlpgt2Do1aAonPIxUd X-Received: by 2002:a81:140a:: with SMTP id 10mr14336400ywu.340.1553369089876; Sat, 23 Mar 2019 12:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553369089; cv=none; d=google.com; s=arc-20160816; b=kuMH4YQyj6Q7ssmoQWz/sy9YanTLaWyJivEEACFqzWYiP32Sg2o6q4mUeV2WvgaVBD iBb+q2RQvcsXK8ycY7gp8DhcMpnxnuWjqjciAnG8ft8E1kuL/qNT5cDKPg23ptBbrJDG qLw4gX+LsOqMKE7Y2qLrVe6h2WbKDXZ0Pe9cn/1kWjLnVbx9Cz9wfXmJ2pnOUGfrKuC+ gwKfjqVlp0E5fE9lhusWNxoL6tKcNIq2rKZnSEqk3Vqg+zyaK8D1B00v1NPesn8Vz65F /YxuaEQXIdyI3EDwTsFxkcm09TDuB1mfbbbRTlxq2aop+dvVDLAMPliJwt0Ot3nKc5LO xiIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=ApbFZS6DpYhE5xEE0O/E5tcmvpqfyWB5+0+vfJXwSWs=; b=XAnWuvlTeBwvBJwlAJ7fcrCsy02OGgQbyl2VD751Hi2Io9/IR2s/XQcxGKZzck8UzX YIRzst6PvFqn/RYRIb2I+lzabdXm9npsaZOSlpw1E0hwF6wLHunWqDoWwd9y6zB1684j ySitv+oSHoV7bmjMceqTt2+hyDfW0Lt3lzQhU4o/w8jQBzyF2DOVJ0l1GER/fZtSsun0 oDtjuNXwjbx3gCW92Q8qUMcyILzOY455u9z+oTkLz31Pge271BC3LG/0RkYPmpWQ8maz TzKpsDgA5+qxAPnsnBTOD6XRQ23q0/SznfGI3mzjETWL90M4IpZBR6DVlQFihbstI9EX UWFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ouhs8Gge; 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 l124si6331703ywb.40.2019.03.23.12.24.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 23 Mar 2019 12:24:49 -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=Ouhs8Gge; 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 ([127.0.0.1]:46937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7mG9-0008E4-6w for patch@linaro.org; Sat, 23 Mar 2019 15:24:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7mFb-0007mr-Nd for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7m2c-0007bF-30 for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:10:52 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:34288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h7m2Z-00078d-IE for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:10:48 -0400 Received: by mail-pg1-x536.google.com with SMTP id v12so3726671pgq.1 for ; Sat, 23 Mar 2019 12:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ApbFZS6DpYhE5xEE0O/E5tcmvpqfyWB5+0+vfJXwSWs=; b=Ouhs8GgeKBXzgpdnmqr+aCnQu8G8NykRNK9misKHYXw4niO27Grbe69X2NChqJ5ioJ 5DMjogKH57UWI+Om8UnZE/2evibqW51uatCV5A1QmXWiWTWXrAPpXrZCffC4/WkpGQl7 Vi69o3YcT42GFYySBvDSNnXuBaizCT2Cl6HDOcbD4FJQcFqHC9EyfmO3TpOA1hgQJQDS dhxTWLvY/FHj+CrD9qazgFqqntD6kX2hx67EUYul7vKP9hiiDp9mzPNVfvj7rxsHNUM9 uj3vAPZs/EecGCUafgu7pkY64JN+r0WbFaV54AwSENdUkpNkR5g4fq9yN6q+1XjWioQA SIjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=ApbFZS6DpYhE5xEE0O/E5tcmvpqfyWB5+0+vfJXwSWs=; b=ICEWSjpHgsbDFkLpoKue7d8HL1kNGyDty9MK5Hw6HpJFwQeV6PYD+4CGSa0b8PwX+y IfO1y3CxkYfzeu7B6Iy2K9VbSmVxy0TR+C/y4AcZXF5MG2FDHSA9NLEuRx0R9LH12E9v bseja2BkVBXHOTDscLRsBdpgRVQG1nZlQTwjhBlZ1zx0Csd6ETphoNF04QK4nqI73PpQ r9Exg0YCq8W8IP3K/C255Ha4GkGmUl5FkL33Z65jyDk5z2biIYYuGOBj5oOIysUB5uLJ cNkE8fLYzza5/gbKwc5QOdY/18Q+767b2s27//Uilnf35dSQIjksC+4G9+HrO60TuOT7 Qg4A== X-Gm-Message-State: APjAAAVAjEQ86GfKmw7agmc26SbGLzkdmiYNv0uxUHHWn3zzOQHeX/9U yWJCgzNPM9v0QIdxbPGhPR9oGOyzic8= X-Received: by 2002:a62:39d6:: with SMTP id u83mr15848558pfj.161.1553368206187; Sat, 23 Mar 2019 12:10:06 -0700 (PDT) Received: from localhost.localdomain (174-21-5-201.tukw.qwest.net. [174.21.5.201]) by smtp.gmail.com with ESMTPSA id h184sm25990703pfc.78.2019.03.23.12.10.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 12:10:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 23 Mar 2019 12:09:20 -0700 Message-Id: <20190323190925.21324-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190323190925.21324-1-richard.henderson@linaro.org> References: <20190323190925.21324-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::536 Subject: [Qemu-devel] [PATCH 30/35] cpu: Introduce CPUNegativeOffsetState 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Nothing in there so far, but all of the plumbing done within the target ArchCPU state. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 24 ++++++++++++++++++++++++ include/exec/cpu-defs.h | 8 ++++++++ target/alpha/cpu.h | 1 + target/arm/cpu.h | 1 + target/cris/cpu.h | 1 + target/hppa/cpu.h | 1 + target/i386/cpu.h | 1 + target/lm32/cpu.h | 1 + target/m68k/cpu.h | 1 + target/microblaze/cpu.h | 5 +++-- target/mips/cpu.h | 1 + target/moxie/cpu.h | 1 + target/nios2/cpu.h | 2 ++ target/openrisc/cpu.h | 2 +- target/ppc/cpu.h | 2 ++ target/riscv/cpu.h | 1 + target/s390x/cpu.h | 1 + target/sh4/cpu.h | 1 + target/sparc/cpu.h | 1 + target/tilegx/cpu.h | 1 + target/tricore/cpu.h | 1 + target/unicore32/cpu.h | 1 + target/xtensa/cpu.h | 1 + 23 files changed, 57 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 0951fd9053..2a9d113c37 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -393,4 +393,28 @@ static inline CPUState *env_cpu(CPUArchState *env) return &env_archcpu(env)->parent_obj; } +/** + * env_neg(env) + * @env: The architecture environment + * + * Return the CPUNegativeOffsetState associated with the environment. + */ +static inline CPUNegativeOffsetState *env_neg(CPUArchState *env) +{ + ArchCPU *arch_cpu = container_of(env, ArchCPU, env); + return &arch_cpu->neg; +} + +/** + * cpu_neg(cpu) + * @cpu: The generic CPUState + * + * Return the CPUNegativeOffsetState associated with the cpu. + */ +static inline CPUNegativeOffsetState *cpu_neg(CPUState *cpu) +{ + /* ??? The env_ptr can probably now be eliminated using ArchCPU. */ + return env_neg(cpu->env_ptr); +} + #endif /* CPU_ALL_H */ diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index fbe8945606..ad97991faf 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -227,4 +227,12 @@ typedef struct CPUTLB { #endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ +/* + * This structure must be placed in ArchCPU immedately + * before CPUArchState, as a field named "neg". + */ +typedef struct CPUNegativeOffsetState { + /* Empty */ +} CPUNegativeOffsetState; + #endif diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index 93919bbaa2..c63fa929f6 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -267,6 +267,7 @@ struct AlphaCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUAlphaState env; /* This alarm doesn't exist in real hardware; we wish it did. */ diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 41b76eed4e..ccae75355e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -711,6 +711,7 @@ struct ARMCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUARMState env; /* Coprocessor information */ diff --git a/target/cris/cpu.h b/target/cris/cpu.h index b87a559137..9191553cd7 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -180,6 +180,7 @@ struct CRISCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUCRISState env; }; diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 65986dacbf..21395c115c 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -218,6 +218,7 @@ struct HPPACPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUHPPAState env; QEMUTimer *alarm_timer; }; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index c5351bea7e..239f907f76 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1366,6 +1366,7 @@ struct X86CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUX86State env; bool hyperv_vapic; diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index deb83153b3..ff5c6893bc 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -186,6 +186,7 @@ struct LM32CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPULM32State env; uint32_t revision; diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 2b180cf18d..087e73f9e2 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -160,6 +160,7 @@ struct M68kCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUM68KState env; }; diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index ff3abb61af..618fc8ff1f 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -287,6 +287,9 @@ struct MicroBlazeCPU { /*< public >*/ + CPUNegativeOffsetState neg; + CPUMBState env; + /* Microblaze Configuration Settings */ struct { bool stackprot; @@ -306,8 +309,6 @@ struct MicroBlazeCPU { char *version; uint8_t pvr; } cfg; - - CPUMBState env; }; diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 49c226b587..0cb8c94be5 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1048,6 +1048,7 @@ struct MIPSCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUMIPSState env; }; diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h index 00b1486659..9be228c383 100644 --- a/target/moxie/cpu.h +++ b/target/moxie/cpu.h @@ -87,6 +87,7 @@ typedef struct MoxieCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUMoxieState env; } MoxieCPU; diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 39a2471b18..875daa2d55 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -181,7 +181,9 @@ typedef struct Nios2CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUNios2State env; + bool mmu_present; uint32_t pid_num_bits; uint32_t tlb_num_ways; diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index ad2118b599..20bc673dda 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -313,8 +313,8 @@ typedef struct OpenRISCCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUOpenRISCState env; - } OpenRISCCPU; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 038e2499ed..f2f5a498a4 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1172,7 +1172,9 @@ struct PowerPCCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUPPCState env; + int vcpu_id; uint32_t compat_pvr; PPCVirtualHypervisor *vhyp; diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 9e71297ca7..dd5d6a59ee 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -208,6 +208,7 @@ typedef struct RISCVCPU { /*< private >*/ CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPURISCVState env; } RISCVCPU; diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 3a6a5ada86..6020de558e 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -156,6 +156,7 @@ struct S390CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUS390XState env; S390CPUModel *model; /* needed for live migration */ diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 02269c09b8..249b11bda2 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -204,6 +204,7 @@ struct SuperHCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUSH4State env; }; diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 02e40d381b..3c2b849b5a 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -529,6 +529,7 @@ struct SPARCCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUSPARCState env; }; diff --git a/target/tilegx/cpu.h b/target/tilegx/cpu.h index 643b7dbd17..deb3e836ea 100644 --- a/target/tilegx/cpu.h +++ b/target/tilegx/cpu.h @@ -135,6 +135,7 @@ typedef struct TileGXCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUTLGState env; } TileGXCPU; diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index 9e60ef981b..8106c4be37 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -205,6 +205,7 @@ struct TriCoreCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUTriCoreState env; }; diff --git a/target/unicore32/cpu.h b/target/unicore32/cpu.h index 12b8268f7b..83f9f36058 100644 --- a/target/unicore32/cpu.h +++ b/target/unicore32/cpu.h @@ -73,6 +73,7 @@ struct UniCore32CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUUniCore32State env; }; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 6fddac3a2b..8cb041c93d 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -526,6 +526,7 @@ struct XtensaCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUXtensaState env; };