pxe, tftp: make TimeoutTable static
[syslinux.git] / core / diskfs.inc
blob24f7e38cd08b938bd892add9cbabdd2ec7606cb5
1 ; -*- fundamental -*- (asm-mode sucks)
2 ; -----------------------------------------------------------------------
3 ;   
4 ;   Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
5 ;   Copyright 2009-2011 Intel Corporation; author: H. Peter Anvin
7 ;   This program is free software; you can redistribute it and/or modify
8 ;   it under the terms of the GNU General Public License as published by
9 ;   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
10 ;   Boston MA 02110-1301, USA; either version 2 of the License, or
11 ;   (at your option) any later version; incorporated herein by reference.
13 ; -----------------------------------------------------------------------
16 ; diskfs.inc
18 ; Common code for conventional disk-based filesystems
22 ; Some semi-configurable constants... change on your own risk.
24 NULLFILE        equ 0                   ; Null character == empty filename
25 NULLOFFSET      equ 0                   ; Position in which to look
26 retry_count     equ 16                  ; How patient are we with the disk?
27 %assign HIGHMEM_SLOP 0                  ; Avoid this much memory near the top
28 LDLINUX_MAGIC   equ 0x3eb202fe          ; A random number to identify ourselves with
30 ; This indicates the general format of the last few bytes in the boot sector
31 BS_MAGIC_VER    equ 0x1b << 9
33 MIN_SECTOR_SHIFT        equ 9
34 MIN_SECTOR_SIZE         equ (1 << MIN_SECTOR_SHIFT)
36 ; ---------------------------------------------------------------------------
37 ;   BEGIN CODE
38 ; ---------------------------------------------------------------------------
41 ; Memory below this point is reserved for the BIOS and the MBR
43                 section .earlybss
44                 global trackbuf
45 trackbufsize    equ 8192
46 trackbuf        resb trackbufsize       ; Track buffer goes here
47                 ; ends at 2800h
50 ; Common bootstrap code for disk-based derivatives
52 %include "diskstart.inc"
56 ; Now, everything is "up and running"... patch kaboom for more
57 ; verbosity and using the full screen system
59                 ; E9 = JMP NEAR
60                 mov di,kaboom.patch
61                 mov al,0e9h
62                 stosb
63                 mov ax,kaboom2-2
64                 sub ax,di
65                 stosw
68 ; Now we're all set to start with our *real* business.  First load the
69 ; configuration file (if any) and parse it.
71 ; In previous versions I avoided using 32-bit registers because of a
72 ; rumour some BIOSes clobbered the upper half of 32-bit registers at
73 ; random.  I figure, though, that if there are any of those still left
74 ; they probably won't be trying to install Linux on them...
76 ; The code is still ripe with 16-bitisms, though.  Not worth the hassle
77 ; to take'm out.  In fact, we may want to put them back if we're going
78 ; to boot ELKS at some point.
82 ; Load configuration file
84                 pm_call pm_load_config
85                 jz no_config_file
88 ; Now we have the config file open.  Parse the config file and
89 ; run the user interface.
91 %include "ui.inc"
95 ; kaboom2: once everything is loaded, replace the part of kaboom
96 ;          starting with "kaboom.patch" with this part
98 kaboom2:
99                 mov si,err_bootfailed
100                 call writestr
101                 cmp byte [kaboom.again+1],18h   ; INT 18h version?
102                 je .int18
103                 call getchar
104                 call vgaclearmode
105                 int 19h                 ; And try once more to boot...
106 .norge:         jmp short .norge        ; If int 19h returned; this is the end
107 .int18:
108                 call vgaclearmode
109                 int 18h
110 .noreg:         jmp short .noreg        ; Nynorsk
112 ; -----------------------------------------------------------------------------
113 ;  Common modules
114 ; -----------------------------------------------------------------------------
116 %include "common.inc"           ; Universal modules
117 %include "plaincon.inc"         ; writechr
118 %include "writestr.inc"         ; String output
119 %include "writehex.inc"         ; Hexadecimal output
120 %include "localboot.inc"        ; Disk-based local boot
122 ; -----------------------------------------------------------------------------
123 ;  Begin data section
124 ; -----------------------------------------------------------------------------
126                 section .data16
127 copyright_str   db ' Copyright (C) 1994-'
128                 asciidec YEAR
129                 db ' H. Peter Anvin et al', CR, LF, 0
130 err_bootfailed  db CR, LF, 'Boot failed: please change disks and press '
131                 db 'a key to continue.', CR, LF, 0
134 ; Config file keyword table
136 %include "keywords.inc"
139 ; Extensions to search for (in *forward* order).
141                 alignz 4
142 exten_table:    db '.cbt'               ; COMBOOT (specific)
143 %if IS_SYSLINUX
144                 db '.bss'               ; Boot sector (add superblock)
145 %endif
146                 db '.bs', 0             ; Boot sector
147                 db '.com'               ; COMBOOT (same as DOS)
148                 db '.c32'               ; COM32
149 exten_table_end:
150                 dd 0, 0                 ; Need 8 null bytes here
153 ; Misc initialized (data) variables
155 %ifdef debug                            ; This code for debugging only
156 debug_magic     dw 0D00Dh               ; Debug code sentinel
157 %endif