diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index fa2faddd714..75c3eb3dfe5 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -1833,6 +1833,15 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ rt_call(native_func); + { + Label ok; + __ get_fpcr(rscratch1); + __ andr(rscratch1, rscratch1, 1 << 24); + __ cbz(rscratch1, ok); + __ stop("corrupted control word detected"); + __ bind(ok); + } + __ bind(native_return); intptr_t return_pc = (intptr_t) __ pc(); diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index c21a56972e4..7cd1553592e 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -1406,6 +1406,15 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ dmb(Assembler::ISH); } + { + Label ok; + __ get_fpcr(rscratch1); + __ andr(rscratch1, rscratch1, 1 << 24); + __ cbz(rscratch1, ok); + __ stop("corrupted control word detected"); + __ bind(ok); + } + // check for safepoint operation in progress and/or pending suspend requests { Label L, Continue;