xref: /freebsd/sys/i386/bios/smapi_bios.S (revision fe75646a0234a261c0013bf1840fdac4acaf0cec)
1#include <machine/asm.h>
2/*
3 * This is cribbed from the Linux thinkpad-4.1 driver by
4 * Thomas Hood.
5 */
6
7smapi32_entry:					/* far pointer to SMAPI entry */
8	.globl	smapi32_offset
9smapi32_offset:		.long	0x00000000	/* set by caller */
10smapi32_segment:	.word	0x0000		/* %cs stored here */
11
12	.text
13/*
14 * smapi32(input_param, output_param)
15 *	struct smapi_bios_parameter *input_parm;
16 *	struct smapi_bios_parameter *output_parm;
17 *
18 *	stack frame:
19 *		0x00 : saved ebp
20 *		0x04 : return EIP
21 *		0x08 : input_parm
22 *		0x0c : output_parm
23 */
24ENTRY(smapi32)
25	pushl	%ebp			/* Save frame */
26	movl	%esp,%ebp
27
28	pushl	%ds
29	pushl	0x0c(%ebp)		/* Output Param */
30	pushl	%ds
31	pushl	0x08(%ebp)		/* Input Param */
32
33	movl	$0,%eax			/* Clear EAX (return 0) */
34	movw	%cs,smapi32_segment	/* Save CS */
35	lcall	*(smapi32_offset)
36
37	leave
38	ret
39END(smapi32)
40