1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Machine specific APM BIOS functions for generic.
7 #ifndef _ASM_X86_MACH_DEFAULT_APM_H
8 #define _ASM_X86_MACH_DEFAULT_APM_H
11 # define APM_DO_ZERO_SEGS \
14 "xorl %%edx, %%edx\n\t" \
15 "mov %%dx, %%ds\n\t" \
16 "mov %%dx, %%es\n\t" \
17 "mov %%dx, %%fs\n\t" \
19 # define APM_DO_POP_SEGS \
23 # define APM_DO_ZERO_SEGS
24 # define APM_DO_POP_SEGS
27 static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
28 u32 *eax, u32 *ebx, u32 *ecx,
32 * N.B. We do NOT need a cld after the BIOS call
33 * because we always save and restore the flags.
35 __asm__ __volatile__(APM_DO_ZERO_SEGS
38 "lcall *%%cs:apm_bios_entry\n\t"
43 : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx),
45 : "a" (func), "b" (ebx_in), "c" (ecx_in)
49 static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
56 * N.B. We do NOT need a cld after the BIOS call
57 * because we always save and restore the flags.
59 __asm__ __volatile__(APM_DO_ZERO_SEGS
62 "lcall *%%cs:apm_bios_entry\n\t"
67 : "=a" (*eax), "=b" (error), "=c" (cx), "=d" (dx),
69 : "a" (func), "b" (ebx_in), "c" (ecx_in)
74 #endif /* _ASM_X86_MACH_DEFAULT_APM_H */