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