From patchwork Fri Aug 28 14:18:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248519 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1126620ilg; Fri, 28 Aug 2020 07:24:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmowd9HD7g2jPvF58jlRa1jUFzggu7S1ieVXJAYczUSBaH5qmhQYLjvTNBGS1wnbRdK/os X-Received: by 2002:a25:7141:: with SMTP id m62mr2650750ybc.443.1598624675684; Fri, 28 Aug 2020 07:24:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598624675; cv=none; d=google.com; s=arc-20160816; b=rKkYQsIPKFjpSMf1W1AInpQRC/7WRiciDDl890L2miB0s0VdeSAmf3jSXCL+0Vd6id CChoUs3o/OTNnSQeyKjtev3RzMqAiBz5pK8n9A6ogFCCmvwV+HJqz36xfmdJDuh3pD1M MClzT1ZejA5qaN0ugX/XWnW0i+Lk9QitAB2fzGLiP2m5B4aMBMUll9QHQ8ecNyh+n844 RqfsoW8qVAZdzG5xvOxUBdIkXgH1kPjkcpcFz8nTRa1Ny3kd13u6IVt0KH8LFNFVdXgo qSag9QtWNKIJj+TZ6chZkBWYzPEVitVD07uIgLrjq/pdUULYajmKFELOw45Too1VoIaV sRag== 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=v5cOPITpAORhIDF2PS7d5r/AWbCGGzSRkZP2Jde8Lx4=; b=OBBJ1ukANqO5mRCrhqMoEF5DTBvnlwkKpBJUtiGecvmdkgCnN+KpocnnS05VuJ2t0O fLFYjo49ISV+50zfFNhrC2JhZRLj8tP7SZjw18zizxM+RpHm+ycR3e+RZyLGwgj9cHyx Ks08Irv/T5ok45T3FeQL2ljBPTR4PBgB+R2k+8nHTBlKT4BnqpaQHxlGsBOLBVvzjLpN D/G1ZIBMJR1AaWveNvLzQ15KE25Ss9A1t/Yv6NRCoApH10Fxe7kklT5t/7Ld72qivnoF wLMDRS9wP6M5aEsec14Xry4kdSk7WRyDwz34m7iz+IuFPYvEAOYJjwEYimixEiTvZFaY WgvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uSGx6BGp; 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 c126si1152970yba.27.2020.08.28.07.24.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Aug 2020 07:24:35 -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=uSGx6BGp; 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]:44712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBfIx-0001IY-3K for patch@linaro.org; Fri, 28 Aug 2020 10:24:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBfEJ-00089i-3p for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:19:47 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:38248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBfEH-00054D-5X for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:19:46 -0400 Received: by mail-pf1-x443.google.com with SMTP id d22so737828pfn.5 for ; Fri, 28 Aug 2020 07:19:44 -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=v5cOPITpAORhIDF2PS7d5r/AWbCGGzSRkZP2Jde8Lx4=; b=uSGx6BGpp5j/Yn57I1X47HsttAD19+mYAj7sfjJCjnRtz04XHE1ts2cDpRipt72Wi5 l+WTGU0aE1Wp4GRrqFX8Y5hLbOzOXPlG//l2b2YJ3imJb15AC2+RH1xfntglZzmfgycq X7H7c1APmGDouqfQ7cY/aL2FDXQiUyoAMwAIjFyWe8++KTfVTu3xu8tawoCS6h6n1QD6 kP9FpiySnpHSwrLa8THQIF4ryZ0ekHsTGjzBv+Y70HBCdb05P4bAAD1xtunRZv1NSs4X SCpWqxl2whKZjsEGSVL8uBlNtv3jBeZfqZlmMzLhhuNx9FYQUhbDjrWdz1iA1CYRD7ou DGKA== 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=v5cOPITpAORhIDF2PS7d5r/AWbCGGzSRkZP2Jde8Lx4=; b=mYuner+8NYBcufgJC+IN4USH87YZPfyD9g2iwgQSYXGmNHcbiweeXPEbyj+Hw2KN29 NrHSwR/cZ09N66F1xRbOvYN2KGVOFw1RwXUqJkD8hprbg88yhr65wOaBndkP1XUFfYI0 I9lKK8TITqntMb0m+rz566f6eQJ+cDN9wMGP6jueByYKa4AQux/Habylvmc9UN1DKg0m guF4Xbx8RD8p5/hbeIv9rkkbmZ+Nozf/gC7UdYS2cxfZU0RAv38SNDA7QPUL01S5RVE/ jvTXYc9lqFa/vk+/M4u5oF4vBB/q0SvTEUNFLvpR0qu2tmxGxr9sRIGJ84NNEXqfQEFV sv3w== X-Gm-Message-State: AOAM5321+SF0GnPQfOe03HyIp9iovQCFgjvYoLla0UGyU4iiczDD7oW+ 2npWXYYTK15g9vukG3RI1V+ZGNhk/ydyHw== X-Received: by 2002:a65:6545:: with SMTP id a5mr1454011pgw.43.1598624383339; Fri, 28 Aug 2020 07:19:43 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id j3sm1403080pjw.23.2020.08.28.07.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:19:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/76] target/microblaze: Split out FSR from env->sregs Date: Fri, 28 Aug 2020 07:18:22 -0700 Message-Id: <20200828141929.77854-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200828141929.77854-1-richard.henderson@linaro.org> References: <20200828141929.77854-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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: edgar.iglesias@xilinx.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Continue eliminating the sregs array in favor of individual members. Does not correct the width of FSR, yet. Signed-off-by: Richard Henderson --- target/microblaze/cpu.h | 1 + linux-user/microblaze/cpu_loop.c | 4 ++-- target/microblaze/gdbstub.c | 4 ++-- target/microblaze/op_helper.c | 8 ++++---- target/microblaze/translate.c | 6 ++++-- 5 files changed, 13 insertions(+), 10 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 7d94af43ed..bcafef99b0 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -240,6 +240,7 @@ struct CPUMBState { uint64_t msr; uint64_t ear; uint64_t esr; + uint64_t fsr; uint64_t sregs[14]; float_status fp_status; /* Stack protectors. Yes, it's a hw feature. */ diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index c10e3e0261..da5e98b784 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -96,10 +96,10 @@ void cpu_loop(CPUMBState *env) case ESR_EC_FPU: info.si_signo = TARGET_SIGFPE; info.si_errno = 0; - if (env->sregs[SR_FSR] & FSR_IO) { + if (env->fsr & FSR_IO) { info.si_code = TARGET_FPE_FLTINV; } - if (env->sregs[SR_FSR] & FSR_DZ) { + if (env->fsr & FSR_DZ) { info.si_code = TARGET_FPE_FLTDIV; } info._sifields._sigfault._addr = 0; diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index 05e22f233d..2634ce49fc 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -71,7 +71,7 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) val = env->esr; break; case GDB_FSR: - val = env->sregs[SR_FSR]; + val = env->fsr; break; case GDB_BTR: val = env->sregs[SR_BTR]; @@ -127,7 +127,7 @@ int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) env->esr = tmp; break; case GDB_FSR: - env->sregs[SR_FSR] = tmp; + env->fsr = tmp; break; case GDB_BTR: env->sregs[SR_BTR] = tmp; diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index f01cf9be64..ae57d45536 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -175,19 +175,19 @@ static void update_fpu_flags(CPUMBState *env, int flags) int raise = 0; if (flags & float_flag_invalid) { - env->sregs[SR_FSR] |= FSR_IO; + env->fsr |= FSR_IO; raise = 1; } if (flags & float_flag_divbyzero) { - env->sregs[SR_FSR] |= FSR_DZ; + env->fsr |= FSR_DZ; raise = 1; } if (flags & float_flag_overflow) { - env->sregs[SR_FSR] |= FSR_OF; + env->fsr |= FSR_OF; raise = 1; } if (flags & float_flag_underflow) { - env->sregs[SR_FSR] |= FSR_UF; + env->fsr |= FSR_UF; raise = 1; } if (raise diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 411c7b6e49..c58c49ea8f 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1810,7 +1810,7 @@ void mb_cpu_dump_state(CPUState *cs, FILE *f, int flags) "debug=%x imm=%x iflags=%x fsr=%" PRIx64 " " "rbtr=%" PRIx64 "\n", env->msr, env->esr, env->ear, - env->debug, env->imm, env->iflags, env->sregs[SR_FSR], + env->debug, env->imm, env->iflags, env->fsr, env->sregs[SR_BTR]); qemu_fprintf(f, "btaken=%d btarget=%" PRIx64 " mode=%s(saved=%s) " "eip=%d ie=%d\n", @@ -1877,8 +1877,10 @@ void mb_tcg_init(void) tcg_global_mem_new_i64(cpu_env, offsetof(CPUMBState, ear), "rear"); cpu_SR[SR_ESR] = tcg_global_mem_new_i64(cpu_env, offsetof(CPUMBState, esr), "resr"); + cpu_SR[SR_FSR] = + tcg_global_mem_new_i64(cpu_env, offsetof(CPUMBState, fsr), "rfsr"); - for (i = SR_ESR + 1; i < ARRAY_SIZE(cpu_SR); i++) { + for (i = SR_FSR + 1; i < ARRAY_SIZE(cpu_SR); i++) { cpu_SR[i] = tcg_global_mem_new_i64(cpu_env, offsetof(CPUMBState, sregs[i]), special_regnames[i]);