xref: /xnu-8792.41.9/tools/tests/execperf/exit-asm.S (revision 5c2921b07a2480ab43ec66f5b9e41cb872bc554f)
1*5c2921b0SApple OSS Distributions.text
2*5c2921b0SApple OSS Distributions	.align 2
3*5c2921b0SApple OSS Distributions	.globl _main
4*5c2921b0SApple OSS Distributions_main:
5*5c2921b0SApple OSS Distributions#if defined(__x86_64__)
6*5c2921b0SApple OSS Distributions	pushq $0
7*5c2921b0SApple OSS Distributions	mov %rsp, %rbp
8*5c2921b0SApple OSS Distributions	andq $0xfffffffffffffff0, %rsp
9*5c2921b0SApple OSS Distributions	movl $42, %edi
10*5c2921b0SApple OSS Distributions	movl $0x2000001, %eax
11*5c2921b0SApple OSS Distributions	movl $0, %ecx
12*5c2921b0SApple OSS Distributions	movq %rcx, %r10
13*5c2921b0SApple OSS Distributions	syscall
14*5c2921b0SApple OSS Distributions	jmp 1f
15*5c2921b0SApple OSS Distributions1:
16*5c2921b0SApple OSS Distributions	hlt
17*5c2921b0SApple OSS Distributions	nop
18*5c2921b0SApple OSS Distributions	nop
19*5c2921b0SApple OSS Distributions	nop
20*5c2921b0SApple OSS Distributions	nop
21*5c2921b0SApple OSS Distributions#elif defined(__i386__)
22*5c2921b0SApple OSS Distributions	pushl $0
23*5c2921b0SApple OSS Distributions	mov %esp, %ebp
24*5c2921b0SApple OSS Distributions	andl $0xfffffff0, %esp
25*5c2921b0SApple OSS Distributions	subl $12, %esp
26*5c2921b0SApple OSS Distributions	pushl $42
27*5c2921b0SApple OSS Distributions	mov $0x40001, %eax
28*5c2921b0SApple OSS Distributions	call _sysenter_trap
29*5c2921b0SApple OSS Distributions	jmp 1f
30*5c2921b0SApple OSS Distributions1:
31*5c2921b0SApple OSS Distributions	hlt
32*5c2921b0SApple OSS Distributions	nop
33*5c2921b0SApple OSS Distributions	nop
34*5c2921b0SApple OSS Distributions	nop
35*5c2921b0SApple OSS Distributions	nop
36*5c2921b0SApple OSS Distributions_sysenter_trap:
37*5c2921b0SApple OSS Distributions	pop %edx
38*5c2921b0SApple OSS Distributions	mov %esp, %ecx
39*5c2921b0SApple OSS Distributions	sysenter
40*5c2921b0SApple OSS Distributions	nop
41*5c2921b0SApple OSS Distributions#elif defined(__arm64__)
42*5c2921b0SApple OSS Distributions	movz	x0, #42
43*5c2921b0SApple OSS Distributions	movz	x16, #1
44*5c2921b0SApple OSS Distributions	svc	#0x80
45*5c2921b0SApple OSS Distributions	b.cc	1f
46*5c2921b0SApple OSS Distributions1:
47*5c2921b0SApple OSS Distributions	nop
48*5c2921b0SApple OSS Distributions#else
49*5c2921b0SApple OSS Distributions#error Unsupported architecture
50*5c2921b0SApple OSS Distributions#endif
51