From 270421ccc3e0ac998a55cdac786f63b712bc0ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 14 Jan 2020 00:00:00 +0000 Subject: [PATCH] arm: sevl_wfe.S example --- README.adoc | 1 + .../arch/aarch64/freestanding/linux/sevl_wfe.S | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 userland/arch/aarch64/freestanding/linux/sevl_wfe.S diff --git a/README.adoc b/README.adoc index b7c4c0e..ec0c170 100644 --- a/README.adoc +++ b/README.adoc @@ -18645,6 +18645,7 @@ Concrete examples of the instruction can be seen at: * link:userland/arch/aarch64/nostartfiles/wfe.S[] * link:userland/arch/aarch64/freestanding/linux/wfe.S[] +* link:userland/arch/aarch64/freestanding/linux/sevl_wfe.S[] * link:userland/arch/aarch64/freestanding/linux/wfe_wfe.S[]: run WFE twice, because gem5 390a74f59934b85d91489f8a563450d8321b602d does not sleep on the first, see also: <> * link:baremetal/arch/aarch64/no_bootloader/wfe_loop.S[], see: <> * link:userland/arch/aarch64/inline_asm/wfe_sev.cpp[]: one Linux thread runs WFE and the other runs SEV to wake it up diff --git a/userland/arch/aarch64/freestanding/linux/sevl_wfe.S b/userland/arch/aarch64/freestanding/linux/sevl_wfe.S new file mode 100644 index 0000000..c2a3897 --- /dev/null +++ b/userland/arch/aarch64/freestanding/linux/sevl_wfe.S @@ -0,0 +1,14 @@ +/* https://cirosantilli.com/linux-kernel-module-cheat#arm-wfe-and-sev-instructions */ + +.text +.global _start +_start: +asm_main_after_prologue: + sevl + /* Shoul not sleep due to above sevl. */ + wfe + + /* exit */ + mov x0, 0 /* exit status */ + mov x8, 93 /* syscall number */ + svc 0