2 * Copyright (C) 2008 Daniel Verkamp <daniel@drv.nu>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 FILE_LICENCE ( GPL2_OR_LATER )
26 .globl com32_farcall_wrapper
27 com32_farcall_wrapper:
29 movl $com32_farcall, %eax
33 .globl com32_cfarcall_wrapper
34 com32_cfarcall_wrapper:
36 movl $com32_cfarcall, %eax
40 .globl com32_intcall_wrapper
41 com32_intcall_wrapper:
43 movl $com32_intcall, %eax
44 /*jmp com32_wrapper*/ /* fall through */
49 /* Switch to internal virtual address space */
52 mov %eax, (com32_helper_function)
54 /* Save external COM32 stack pointer */
55 movl %esp, (com32_external_esp)
57 /* Copy arguments to caller-save registers */
62 /* Switch to internal stack */
63 movl (com32_internal_esp), %esp
65 /* Copy arguments to internal stack */
70 call *(com32_helper_function)
75 /* Save internal stack pointer and restore external stack pointer */
76 movl %esp, (com32_internal_esp)
77 movl (com32_external_esp), %esp
79 /* Switch to external flat physical address space */
88 /* Internal iPXE virtual address space %esp */
89 .globl com32_internal_esp
90 .lcomm com32_internal_esp, 4
92 /* External flat physical address space %esp */
93 .globl com32_external_esp
94 .lcomm com32_external_esp, 4
96 /* Function pointer of helper to call */
97 .lcomm com32_helper_function, 4