Author: kib
Date: Fri Sep 18 16:52:18 2015
New Revision: 287960
URL: https://svnweb.freebsd.org/changeset/base/287960

Log:
  Clear exclusive monitors when handling data aborts, the monitors are
  in unknown state per spec.
  
  Reviewed by:  andrew (previous version)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D3668

Modified:
  head/sys/arm64/arm64/trap.c
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/trap.c
==============================================================================
--- head/sys/arm64/arm64/trap.c Fri Sep 18 13:44:15 2015        (r287959)
+++ head/sys/arm64/arm64/trap.c Fri Sep 18 16:52:18 2015        (r287960)
@@ -155,6 +155,13 @@ data_abort(struct trapframe *frame, uint
        uint64_t far;
        int error, sig, ucode;
 
+       /*
+        * According to the ARMv8-A rev. A.g, B2.10.5 "Load-Exclusive
+        * and Store-Exclusive instruction usage restrictions", state
+        * of the exclusive monitors after data abort exception is unknown.
+        */
+       clrex();
+
 #ifdef KDB
        if (kdb_active) {
                kdb_reenter();

Modified: head/sys/arm64/include/cpufunc.h
==============================================================================
--- head/sys/arm64/include/cpufunc.h    Fri Sep 18 13:44:15 2015        
(r287959)
+++ head/sys/arm64/include/cpufunc.h    Fri Sep 18 16:52:18 2015        
(r287960)
@@ -108,6 +108,17 @@ get_mpidr(void)
        return (mpidr);
 }
 
+static __inline void
+clrex(void)
+{
+
+       /*
+        * Ensure compiler barrier, otherwise the monitor clear might
+        * occur too late for us ?
+        */
+       __asm __volatile("clrex" : : : "memory");
+}
+
 #define        cpu_nullop()                    arm64_nullop()
 #define        cpufunc_nullop()                arm64_nullop()
 #define        cpu_setttb(a)                   arm64_setttb(a)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to