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., 675 Mass Ave, Cambridge, MA 02139, USA.
23 .globl com32_farcall_wrapper
24 com32_farcall_wrapper:
26 movl $com32_farcall, %eax
30 .globl com32_cfarcall_wrapper
31 com32_cfarcall_wrapper:
33 movl $com32_cfarcall, %eax
37 .globl com32_intcall_wrapper
38 com32_intcall_wrapper:
40 movl $com32_intcall, %eax
41 /*jmp com32_wrapper*/ /* fall through */
45 /* Switch to internal virtual address space */
48 mov %eax, (com32_helper_function)
50 /* Save external COM32 stack pointer */
51 movl %esp, (com32_external_esp)
53 /* Copy arguments to caller-save registers */
58 /* Switch to internal stack */
59 movl (com32_internal_esp), %esp
61 /* Copy arguments to internal stack */
66 call *(com32_helper_function)
71 /* Save internal stack pointer and restore external stack pointer */
72 movl %esp, (com32_internal_esp)
73 movl (com32_external_esp), %esp
75 /* Switch to external flat physical address space */
83 /* Internal gPXE virtual address space %esp */
84 .globl com32_internal_esp
85 .lcomm com32_internal_esp, 4
87 /* External flat physical address space %esp */
88 .globl com32_external_esp
89 .lcomm com32_external_esp, 4
91 /* Function pointer of helper to call */
92 .lcomm com32_helper_function, 4