2 ;; -----------------------------------------------------------------------
4 ;; Copyright 1994-2004 H. Peter Anvin - All Rights Reserved
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 ;; -----------------------------------------------------------------------
17 ;; Configuration file operations
24 pc_default: mov di,default_cmd
26 mov byte [di-1],0 ; null-terminate
32 pc_ontimeout: mov di,Ontimeout
34 sub di,Ontimeout+1 ; Don't need final space
41 pc_onerror: mov di,Onerror
50 pc_append: cmp word [VKernelCtr],byte 0
55 .app1: mov [AppendLen],di
57 .vk: mov di,VKernelBuf+vk_append ; "append" command (vkernel)
59 sub di,VKernelBuf+vk_append
62 cmp byte [VKernelBuf+vk_append],'-'
64 xor di,di ; If "append -" -> null string
65 .app2: mov [VKernelBuf+vk_appendlen],di
69 ; "ipappend" command (PXELINUX only)
72 pc_ipappend: call getint
74 cmp word [VKernelCtr], byte 0
78 .vk: mov [VKernelBuf+vk_ipappend],bl
83 ; "localboot" command (PXELINUX, ISOLINUX)
85 %if IS_PXELINUX || IS_ISOLINUX
86 pc_localboot: call getint
87 cmp word [VKernelCtr],byte 0 ; ("label" section only)
89 mov di,VKernelBuf+vk_rname
92 rep stosb ; Null kernel name
93 mov [VKernelBuf+vk_rname+1], bx ; Return type
99 pc_kernel: cmp word [VKernelCtr],byte 0
100 je .err ; ("label" section only)
102 mov di,VKernelBuf+vk_rname
109 pc_timeout: call getint
111 mov ax,0D215h ; There are approx 1.D215h
112 mul bx ; clock ticks per 1/10 s
118 ; Generic integer variable setting commands:
119 ; "prompt", "implicit"
130 ; Generic file-processing commands:
131 ; "display", "font", "kbdmap"
133 pc_filecmd: push ax ; Function to tailcall
139 call searchdir ; tailcall
141 pop ax ; Drop the successor function
142 .ok: ret ; Tailcall if OK, error return
147 pc_serial: call getint
149 push bx ; Serial port #
157 mov [FlowControl], word 0 ; Default to no flow control
164 call getint ; Hardware flow control?
167 xor bx,bx ; Default -> no flow control
169 and bh,0Fh ; FlowIgnore
173 and bx,0F003h ; Valid bits
176 jmp short .parse_baud
178 mov ebx,DEFAULT_BAUD ; No baud rate given
180 pop di ; Serial port #
182 jb .err ; < 75 baud == bogus
187 push ax ; Baud rate divisor
189 ja .port_is_io ; If port > 3 then port is I/O addr
191 mov di,[di+serial_base] ; Get the I/O port from the BIOS
194 lea dx,[di+3] ; DX -> LCR
195 mov al,83h ; Enable DLAB
203 mov al,03h ; Disable DLAB
204 add dx,byte 2 ; DX -> LCR
206 in al,dx ; Read back LCR (detect missing hw)
207 cmp al,03h ; If nothing here we'll read 00 or FF
208 jne .serial_port_bad ; Assume serial port busted
209 sub dx,byte 2 ; DX -> IER
210 xor al,al ; IRQ disable
213 add dx,byte 3 ; DX -> MCR
215 or al,[FlowOutput] ; Assert bits
219 mov si,syslinux_banner
220 call write_serial_str
222 call write_serial_str
226 mov [SerialPort], word 0
235 call mangle_name ; Mangle file name
241 pc_label: call commit_vk ; Commit any current vkernel
242 mov di,VKernelBuf ; Erase the vkernelbuf for better compression
247 mov di,VKernelBuf+vk_vname
248 call mangle_name ; Mangle virtual name
249 inc word [VKernelCtr] ; One more vkernel
250 mov si,VKernelBuf+vk_vname ; By default, rname == vname
251 mov di,VKernelBuf+vk_rname
254 mov si,AppendBuf ; Default append==global append
255 mov di,VKernelBuf+vk_append
257 mov [VKernelBuf+vk_appendlen],cx
259 %if IS_PXELINUX ; PXELINUX only
260 mov al,[IPAppend] ; Default ipappend==global ipappend
261 mov [VKernelBuf+vk_ipappend],al
268 pc_say: call pc_getline ; "say" command
275 pc_comment equ pc_getline ; Get a line and discard
278 ; Common subroutine: load line into trackbuf; returns with SI -> trackbuf
280 pc_getline: mov di,trackbuf
284 stosb ; Null-terminate
289 ; Main loop for configuration file parsing
293 jnc parse_config ; If not EOF do it again
295 ; The fall through to commit_vk to commit any final
299 ; commit_vk: Store the current VKernelBuf into buffer segment
302 ; For better compression, clean up the append field
303 mov ax,[VKernelBuf+vk_appendlen]
304 mov di,VKernelBuf+vk_append
311 cmp word [VKernelCtr],byte 0
312 je cvk_ret ; No VKernel = return
313 cmp word [VKernelCtr],max_vk ; Above limit?
319 mov cx,(vk_size >> 2)
323 rep movsd ; Copy to buffer segment
326 cvk_overflow: mov word [VKernelCtr],max_vk ; No more than max_vk, please
329 %include "rllpack.inc"