xref: /linux/tools/testing/selftests/x86/raw_syscall_helper_32.S (revision fcc8487d477a3452a1d0ccbdd4c5e0e1e3cb8bed)
1.global sys32_helper
2sys32_helper:
3	/* Args: syscall_args_32*, function pointer */
4	pushl	%ebp
5	pushl	%ebx
6	pushl	%esi
7	pushl	%edi
8	movl	5*4(%esp), %eax	/* pointer to args struct */
9
10	movl	1*4(%eax), %ebx
11	movl	2*4(%eax), %ecx
12	movl	3*4(%eax), %edx
13	movl	4*4(%eax), %esi
14	movl	5*4(%eax), %edi
15	movl	6*4(%eax), %ebp
16	movl	0*4(%eax), %eax
17
18	call	*(6*4)(%esp)	/* Do the syscall */
19
20	/* Now we need to recover without losing any reg values */
21	pushl	%eax
22	movl	6*4(%esp), %eax
23	popl	0*4(%eax)
24	movl	%ebx, 1*4(%eax)
25	movl	%ecx, 2*4(%eax)
26	movl	%edx, 3*4(%eax)
27	movl	%esi, 4*4(%eax)
28	movl	%edi, 5*4(%eax)
29	movl	%ebp, 6*4(%eax)
30
31	popl	%edi
32	popl	%esi
33	popl	%ebx
34	popl	%ebp
35	ret
36
37	.type sys32_helper, @function
38	.size sys32_helper, .-sys32_helper
39
40.global int80_and_ret
41int80_and_ret:
42	int	$0x80
43	ret
44
45	.type int80_and_ret, @function
46	.size int80_and_ret, .-int80_and_ret
47