xref: /linux/tools/testing/selftests/powerpc/benchmarks/exec_target.c (revision c7546e2c3cb739a3c1a2f5acaf9bb629d401afe5)
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 /*
4  * Part of fork context switch microbenchmark.
5  *
6  * Copyright 2018, Anton Blanchard, IBM Corp.
7  */
8 
9 #define _GNU_SOURCE
10 #include <sys/syscall.h>
11 
12 void _start(void)
13 {
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 	);
28 }
29