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