From 7733463e65f30166759d5ef1186abd1d333d0b96 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Tue, 4 Mar 2014 22:49:33 -0800 Subject: [PATCH] commit 1a428de189eb9456695429adc11b606936218924 introduced a bug by using a signed enum in a bitfield, the value of which is then used in a ldmxcsr instruction. The sign-extension corrupts the value, causing an exception by attempting to load mxcsr with an invalid value. --- Source/Core/Common/FPURoundMode.h | 5 +++-- Source/Core/Core/PowerPC/Gekko.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/FPURoundMode.h b/Source/Core/Common/FPURoundMode.h index ebed4cbe96..7971c009f9 100644 --- a/Source/Core/Common/FPURoundMode.h +++ b/Source/Core/Common/FPURoundMode.h @@ -8,14 +8,15 @@ namespace FPURoundMode { - enum RoundModes + enum RoundModes : u32 { ROUND_NEAR = 0, ROUND_CHOP = 1, ROUND_UP = 2, ROUND_DOWN = 3 }; - enum PrecisionModes { + enum PrecisionModes : u32 + { PREC_24 = 0, PREC_53 = 1, PREC_64 = 2 diff --git a/Source/Core/Core/PowerPC/Gekko.h b/Source/Core/Core/PowerPC/Gekko.h index 0d3b87e695..7855cee809 100644 --- a/Source/Core/Core/PowerPC/Gekko.h +++ b/Source/Core/Core/PowerPC/Gekko.h @@ -390,7 +390,7 @@ union UReg_FPSCR struct { // Rounding mode (towards: nearest, zero, +inf, -inf) - enum FPURoundMode::RoundModes RN : 2; + FPURoundMode::RoundModes RN : 2; // Non-IEEE mode enable (aka flush-to-zero) u32 NI : 1; // Inexact exception enable