Rename libcom32gpl.c32 to libgpl.c32
[syslinux/sherbszt.git] / core / com32.inc
blob9c565f1d23389945e953de4d82ebbce7fbd033b6
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;;   Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
4 ;;   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
5 ;;
6 ;;   This program is free software; you can redistribute it and/or modify
7 ;;   it under the terms of the GNU General Public License as published by
8 ;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ;;   Boston MA 02111-1307, USA; either version 2 of the License, or
10 ;;   (at your option) any later version; incorporated herein by reference.
12 ;; -----------------------------------------------------------------------
15 ;; com32.inc
17 ;; Common code for running a COM32 image
20                 extern pm_api_vector
23 ; Load a COM32 image.  A COM32 image is the 32-bit analogue to a DOS
24 ; .com file.  A COM32 image is loaded at address 0x101000, with %esp
25 ; set to the high end of usable memory.
27 ; A COM32 image should begin with the magic bytes:
28 ; B8 FF 4C CD 21, which is "mov eax,0x21cd4cff" in 32-bit mode and
29 ; "mov ax,0x4cff; int 0x21" in 16-bit mode.  This will abort the
30 ; program with an error if run in 16-bit mode.
32 com32_entry     equ     free_high_memory
34                 bits 16
35                 section .data16
37                 ; Ersatz com32 invocation structure, to make libcom32
38                 ; code run the same if linked to the core.  This is in
39                 ; the .data16 segment so HighMemSize can live here.
40                 ;
41                 ; Danger, Will Robinson: it's not clear the use of
42                 ; core_xfer_buf is safe here.
43                 global __com32:data hidden
44                 alignz 4
45 __entry_esp:
46                 dd 0                            ; Dummy to avoid _exit issues
47 __com32:
48                 dd 9                            ; Argument count
49                 dd 0                            ; No command line
50                 dd core_intcall                 ; Intcall entry point
51                 dd 0                            ; Bounce buffer address
52                 dd 0                            ; 64K bounce buffer
53                 dd core_farcall                 ; Farcall entry point
54                 dd core_cfarcall                ; Cfarcall entry point
55 HighMemSize     dd 0                            ; End of memory pointer (bytes)
56                 dd 0                            ; No module name
57                 dd pm_api_vector                ; Protected mode functions
59                 section .uibss
60 Com32Name       resb FILENAME_MAX
62                 section .text16