Skip to content

Commit f6aac4d

Browse files
author
Fox Snowpatch
committed
1 parent 7b23713 commit f6aac4d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tools/testing/selftests/powerpc/benchmarks/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ $(OUTPUT)/context_switch: LDLIBS += -lpthread
1818

1919
$(OUTPUT)/fork: LDLIBS += -lpthread
2020

21-
$(OUTPUT)/exec_target: CFLAGS += -static -nostartfiles
21+
$(OUTPUT)/exec_target: CFLAGS += -nostartfiles

tools/testing/selftests/powerpc/benchmarks/exec_target.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@
77
*/
88

99
#define _GNU_SOURCE
10-
#include <unistd.h>
1110
#include <sys/syscall.h>
1211

1312
void _start(void)
1413
{
15-
syscall(SYS_exit, 0);
14+
asm volatile (
15+
"li %%r0, %[sys_exit];"
16+
"li %%r3, 0;"
17+
"sc;"
18+
:
19+
: [sys_exit] "i" (SYS_exit)
20+
/*
21+
* "sc" will clobber r0, r3-r13, cr0, ctr, xer and memory.
22+
* Even though sys_exit never returns, handle clobber
23+
* registers.
24+
*/
25+
: "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
26+
"r11", "r12", "r13", "cr0", "ctr", "xer", "memory"
27+
);
1628
}

0 commit comments

Comments
 (0)