diff mbox series

[v3] syscalls/signal06: loop being clobbered by syscall on clang

Message ID 20220819232706.2009052-1-edliaw@google.com
State Accepted
Headers show
Series [v3] syscalls/signal06: loop being clobbered by syscall on clang | expand

Commit Message

Edward Liaw Aug. 19, 2022, 11:27 p.m. UTC
Indicate to the compiler that the syscall will modify registers rcx
and r11 to prevent loop from getting clobbered.

Signed-off-by: Edward Liaw <edliaw@google.com>

---
I added an output operand for the result so that the compiler would know
that rax is clobbered as well.
---
 testcases/kernel/syscalls/signal/signal06.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Cyril Hrubis Aug. 24, 2022, 8:25 a.m. UTC | #1
Hi!
Applied, thanks.
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/signal/signal06.c b/testcases/kernel/syscalls/signal/signal06.c
index 64f886ee3..cf0706ea4 100644
--- a/testcases/kernel/syscalls/signal/signal06.c
+++ b/testcases/kernel/syscalls/signal/signal06.c
@@ -72,8 +72,8 @@  void test(void)
 	while (D == VALUE && loop < LOOPS) {
 		/* sys_tkill(pid, SIGHUP); asm to avoid save/reload
 		 * fp regs around c call */
-		asm ("" : : "a"(__NR_tkill), "D"(pid), "S"(SIGHUP));
-		asm ("syscall" : : : "ax");
+		int unused;
+		asm volatile ("syscall" : "=a"(unused) : "a"(__NR_tkill), "D"(pid), "S"(SIGHUP) : "rcx", "r11");
 
 		loop++;
 	}