# Linux Kernel Module Cheat

###### 33.10.3.1.1. ARM WFE global monitor events

Examples:

- userland/arch/aarch64/inline_asm/wfe_ldxr_stxr.cpp

- userland/arch/aarch64/inline_asm/wfe_ldxr_str.cpp

- userland/arch/aarch64/inline_asm/futex_ldxr_stxr.c: tests that ldxr and stxr do not interact with futexes. This was leading to problems in gem5 syscall emulation mode at one point: https://gem5.atlassian.net/browse/GEM5-537

  Correct outcome: gem5 simulate() limit reached.

  Incorrect behaviour due to: https://gem5.atlassian.net/browse/GEM5-537: Exits successfully.

SEV is not the only thing that can wake up a WFE, it is only an explicit software way to do it.

Notably, global monitor operations on memory accesses of regions marked by LDAXR and STLXR instructions can also wake up a WFE sleeping core.

This is done to allow spinlocks opens to automatically wake up WFE sleeping cores at free time without the need for a explicit SEV.

In the shown in the `wfe_ldxr_stxr.cpp` example, which can only terminate in gem5 user mode simulation because due to this event.

Note that that program still terminates when running on top of the Linux kernel as explained at: WFE from userland.