diff mbox

[11/14] target-i386: Update BNDSTATUS for exceptions raised by BOUND

Message ID 1436429849-18052-12-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson July 9, 2015, 8:17 a.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-i386/mem_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/target-i386/mem_helper.c b/target-i386/mem_helper.c
index 1aec8a5..c8d5fac 100644
--- a/target-i386/mem_helper.c
+++ b/target-i386/mem_helper.c
@@ -91,6 +91,9 @@  void helper_boundw(CPUX86State *env, target_ulong a0, int v)
     high = cpu_ldsw_data(env, a0 + 2);
     v = (int16_t)v;
     if (v < low || v > high) {
+        if (env->hflags & HF_MPX_EN_MASK) {
+            env->bndcs_regs.sts = 0;
+        }
         raise_exception(env, EXCP05_BOUND);
     }
 }
@@ -102,6 +105,9 @@  void helper_boundl(CPUX86State *env, target_ulong a0, int v)
     low = cpu_ldl_data(env, a0);
     high = cpu_ldl_data(env, a0 + 4);
     if (v < low || v > high) {
+        if (env->hflags & HF_MPX_EN_MASK) {
+            env->bndcs_regs.sts = 0;
+        }
         raise_exception(env, EXCP05_BOUND);
     }
 }