From patchwork Mon Aug 31 16:04:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248763 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3444897ilg; Mon, 31 Aug 2020 09:12:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQTBUWhVluU5Tm6jKvJsw67gf8vi2lyoxkhKimhkQkAGxSLMLANAyvmlHJicMxrvZ/t8yf X-Received: by 2002:a25:a85:: with SMTP id 127mr3177788ybk.327.1598890324512; Mon, 31 Aug 2020 09:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598890324; cv=none; d=google.com; s=arc-20160816; b=urOiu3vyCnlrnaXOj5pIT+Pf8KI86ZTgFjeTZ+ccBXUHHBqadbPg1A0AaIKL8Q1TZM g2zrEZx0sCRExWmoYIZpBSdBFkz2V9VvqQUjbvfUt19QC2v9LIm1r2yupRKSyHQwFoRf p4fXMOqDXbHEdfvGGFm+dZvHRKo6fepuyVdXEuX3XzE9wIlP7dXl5nzPeTWLVG6MQlI2 +Ps3MvBz1qeOquqJaIEmBrcbCn15wtPP7ydUm53oY5LkOuixroStn9Lr0CG0jDVBOZUG NewrLOLauwgf8KWJXsngXTmofNlAwL3BuJFEJV789OB9sBmLqxcOZGL2ojiOE1rr2yKW hdWw== 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=oEZ6XwzSLdLUNcv14pMjAGwsjuyjSPVjObcH4wzuZHk=; b=UBYHgrhketGbExH2R2G7p4aVKYp3tCpnbJnhFa+6tVsHAQJePjHzwmgAGE4FKSl/zQ nJMcjdrh2wSA6+cT12Ife2EmxuIEW2mOUpBTYWa6ZGSjtKu1nlntF3f9Jlf63gMVg3gy ZdLQd0ilPWHqHPxuxojuo3cndypBRRSUV6J1brE/F+2rLkaKZZByMN09xtBN9Njwn6MD Ce2lnZa1eFvUNUaRMYZ4HS3pXhE7tziBwQAHP5XFnuHC6ymzlMHP3M41tKht/XUsCVgT zi5+6PEhUkFC2UAmlALvS1UZXZvDbj/maaqmdR2cPUgt8z2eX+MWyS2Y9ykhCc8w4rYu S66w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kQzf0Iun; 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 y129si8285999ybe.86.2020.08.31.09.12.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:12:04 -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=kQzf0Iun; 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]:47974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCmPb-0005bn-UO for patch@linaro.org; Mon, 31 Aug 2020 12:12:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmK4-0003fX-Iq for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:06:20 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:40489) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmK2-0005wE-Ko for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:06:20 -0400 Received: by mail-pg1-x543.google.com with SMTP id h12so830150pgm.7 for ; Mon, 31 Aug 2020 09:06:18 -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=oEZ6XwzSLdLUNcv14pMjAGwsjuyjSPVjObcH4wzuZHk=; b=kQzf0Iuna43q+d+LgkVHUuwDJJoVx3AVSb+1q/vrSq/aUnyz3XQd2BZqBirOHABM63 3DndIeKkLh6wkiA2hIEaNv4X+jb1YuNMljPm1DzG5kzlEG12RsevQvlTq2+EJXNRx4vR ITwgp0pX3Gt5cP+dSqNp/Z0WTahyeUdxvuyGjAKxPEaknXVELwaRJQIpZ6Qhi7cYEAgB 6HriZjTaHdhpo8oJC6UzXoThbbND3bMT9KPmKv93popwMAaVR9eGoCRJPYaitN4sFLRB o9myfDB9iVtgflyIJhyCfKPL1bdGxpOgeqvaF7jQ4VFa98128/tUGev7PHGjqRmmdOWN ttaw== 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=oEZ6XwzSLdLUNcv14pMjAGwsjuyjSPVjObcH4wzuZHk=; b=p0iPFGHU+zAa2YGb/9Jn7XUWKE91kqR3f7mRoTzt3v3eEkLpKfRSB3n4FOYtK/6geB GVQHKt2eZzhPFQrbPTOhVTETP9SDhakVjQHAkQpgpPLjrHyuTMSysTBWSZKoWrjpiGig zBl9IqexLqpNszppgpVV/pDyv23A9KOyvaJE9HtQetxsYarfg0TWTik25xhLTy6HrchV 317fdUmGICrWhct83lKCTnYarUE7qIwbQujm415okCLU4kKjRSw3plOkkcv1TM1EH7Fa xgLc0c7vsAvO0+N2jEVlPgUttdICWzUvzMr9YrCB+rcm6MU/slTfrZKVdTEoSPqmQs+l hV7w== X-Gm-Message-State: AOAM533RreIKy+ZwkV6Idrldx+hB8bCplxe/ruSIf46VmfLnSjDUxpNx YbWMsAOQUr5vCuS9N+BML/b4t68gOYyIpw== X-Received: by 2002:a63:2809:: with SMTP id o9mr1816144pgo.410.1598889976777; Mon, 31 Aug 2020 09:06:16 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:06:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/76] target/microblaze: Split out FSR from env->sregs Date: Mon, 31 Aug 2020 09:04:54 -0700 Message-Id: <20200831160601.833692-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831160601.833692-1-richard.henderson@linaro.org> References: <20200831160601.833692-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.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 E . Iglesias" , peter.maydell@linaro.org 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. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias 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 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]);