diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2015-09-18 16:52:18 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2015-09-18 16:52:18 +0000 |
commit | 6ced37897075c1f3a11578142cc7338541b78a4d (patch) | |
tree | 2fb80fb15216ff77e75c603f9e56f4c4349ad53f /sys/arm64 | |
parent | cf8b6f76a27ed6364ec1461b487fd6c0c9977c6e (diff) | |
download | src-6ced37897075c1f3a11578142cc7338541b78a4d.tar.gz src-6ced37897075c1f3a11578142cc7338541b78a4d.zip |
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
Notes
Notes:
svn path=/head/; revision=287960
Diffstat (limited to 'sys/arm64')
-rw-r--r-- | sys/arm64/arm64/trap.c | 7 | ||||
-rw-r--r-- | sys/arm64/include/cpufunc.h | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 2a3cfb9662f3..394d6b41a39c 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -155,6 +155,13 @@ data_abort(struct trapframe *frame, uint64_t esr, int lower) 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(); diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index 5a7f08b61895..56f1acff7264 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -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) |