xref: /linux/tools/testing/selftests/x86/raw_syscall_helper_32.S (revision cdd38c5f1ce4398ec58fec95904b75824daab7b5)
1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
204235c00SAndy Lutomirski.global sys32_helper
304235c00SAndy Lutomirskisys32_helper:
404235c00SAndy Lutomirski	/* Args: syscall_args_32*, function pointer */
504235c00SAndy Lutomirski	pushl	%ebp
604235c00SAndy Lutomirski	pushl	%ebx
704235c00SAndy Lutomirski	pushl	%esi
804235c00SAndy Lutomirski	pushl	%edi
904235c00SAndy Lutomirski	movl	5*4(%esp), %eax	/* pointer to args struct */
1004235c00SAndy Lutomirski
1104235c00SAndy Lutomirski	movl	1*4(%eax), %ebx
1204235c00SAndy Lutomirski	movl	2*4(%eax), %ecx
1304235c00SAndy Lutomirski	movl	3*4(%eax), %edx
1404235c00SAndy Lutomirski	movl	4*4(%eax), %esi
1504235c00SAndy Lutomirski	movl	5*4(%eax), %edi
1604235c00SAndy Lutomirski	movl	6*4(%eax), %ebp
1704235c00SAndy Lutomirski	movl	0*4(%eax), %eax
1804235c00SAndy Lutomirski
1904235c00SAndy Lutomirski	call	*(6*4)(%esp)	/* Do the syscall */
2004235c00SAndy Lutomirski
2104235c00SAndy Lutomirski	/* Now we need to recover without losing any reg values */
2204235c00SAndy Lutomirski	pushl	%eax
2304235c00SAndy Lutomirski	movl	6*4(%esp), %eax
2404235c00SAndy Lutomirski	popl	0*4(%eax)
2504235c00SAndy Lutomirski	movl	%ebx, 1*4(%eax)
2604235c00SAndy Lutomirski	movl	%ecx, 2*4(%eax)
2704235c00SAndy Lutomirski	movl	%edx, 3*4(%eax)
2804235c00SAndy Lutomirski	movl	%esi, 4*4(%eax)
2904235c00SAndy Lutomirski	movl	%edi, 5*4(%eax)
3004235c00SAndy Lutomirski	movl	%ebp, 6*4(%eax)
3104235c00SAndy Lutomirski
3204235c00SAndy Lutomirski	popl	%edi
3304235c00SAndy Lutomirski	popl	%esi
3404235c00SAndy Lutomirski	popl	%ebx
3504235c00SAndy Lutomirski	popl	%ebp
3604235c00SAndy Lutomirski	ret
3704235c00SAndy Lutomirski
3804235c00SAndy Lutomirski	.type sys32_helper, @function
3904235c00SAndy Lutomirski	.size sys32_helper, .-sys32_helper
4004235c00SAndy Lutomirski
4104235c00SAndy Lutomirski.global int80_and_ret
4204235c00SAndy Lutomirskiint80_and_ret:
4304235c00SAndy Lutomirski	int	$0x80
4404235c00SAndy Lutomirski	ret
4504235c00SAndy Lutomirski
4604235c00SAndy Lutomirski	.type int80_and_ret, @function
4704235c00SAndy Lutomirski	.size int80_and_ret, .-int80_and_ret
48*aeaaf005SAndy Lutomirski
49*aeaaf005SAndy Lutomirski.section .note.GNU-stack,"",%progbits
50