xref: /linux/tools/testing/selftests/powerpc/benchmarks/exec_target.c (revision a6021aa24f6417416d93318bbfa022ab229c33c8)
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