;; -----------------------------------------------------------------------
;;
-;; Copyright 2003-2008 H. Peter Anvin - All Rights Reserved
+;; Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
+;; Copyright 2009 Intel Corporation; author: H. Peter Anvin
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;
; Assumes DS == CS
+;
make_plain_cmdline:
push es
; ui.inc has already copied any APPEND options
mov ax,real_mode_seg
mov es,ax
- mov si,[CmdOptPtr]
mov di,[CmdLinePtr]
+ call do_ip_append
+
+ mov si,[CmdOptPtr]
call strcpy
pop es
ret
+
+;
+; Actual IPAppend strings...
+;
+%if IS_PXELINUX
+ section .data
+ alignb 2, db 0
+IPAppends dw IPOption
+ dw BOOTIFStr
+numIPAppends equ ($-IPAppends)/2
+
+%else
+numIPAppends equ 0
+IPAppends equ 0
+%endif
+
+;
+; Handle "ipappend" strings, if applicable
+;
+; Assumes DS == CS; pushes output to ES:DI
+;
+ section .text
+
+do_ip_append:
+%if numIPAppends > 0
+ push cx
+ push bx
+ push si
+
+ mov bx,IPAppends
+ mov cx,[IPAppend]
+ and cx,(1 << numIPAppends)-1
+.loop:
+ jcxz .done
+ mov si,[bx]
+ inc bx
+ inc bx
+ test cl,1
+ jz .not_this
+
+ call strcpy
+ mov byte [es:di-1],' ' ; Replace final null with space
+.not_this:
+ shr cx,1
+ jmp .loop
+.done:
+ pop si
+ pop bx
+ pop cx
+%endif
+ ret
;
; INT 22h AX=000Fh Get IPAPPEND strings
;
-%if IS_PXELINUX
comapi_ipappend:
mov P_ES,cs
mov P_CX,numIPAppends
clc
ret
- section .data
- alignb 2, db 0
-IPAppends dw IPOption
- dw BOOTIFStr
-numIPAppends equ ($-IPAppends)/2
-
-%else
-comapi_ipappend equ comapi_err
-%endif
-
- section .text
-
;
; INT 22h AX=0010h Resolve hostname
;
RebootTime resd 1 ; Reboot timeout, if set by option
StrucPtr resd 1 ; Pointer to PXENV+ or !PXE structure
APIVer resw 1 ; PXE API version found
-IPOptionLen resw 1 ; Length of IPOption
IdleTimer resw 1 ; Time to check for ARP?
LocalBootType resw 1 ; Local boot return code
PktTimeout resw 1 ; Timeout for current packet
; a couple of helper macros...
;
-; Handle "ipappend" option
-%define HAVE_SPECIAL_APPEND
-%macro SPECIAL_APPEND 0
- test byte [IPAppend],01h ; ip=
- jz .noipappend1
- mov si,IPOption
- mov cx,[IPOptionLen]
- rep movsb
- mov al,' '
- stosb
-.noipappend1:
- test byte [IPAppend],02h
- jz .noipappend2
- mov si,BOOTIFStr
- call strcpy
- mov byte [es:di-1],' ' ; Replace null with space
-.noipappend2:
-%endmacro
-
; Unload PXE stack
%define HAVE_UNLOAD_PREP
%macro UNLOAD_PREP 0
pop ax
.bad:
ret
-
+
is_pxe equ is_struc.pxe
is_pxenv equ is_struc.pxenv
stosb
mov eax,[Netmask]
call gendotquad ; Zero-terminates its output
- sub di,IPOption
- mov [IPOptionLen],di
popad
ret
;
; Hook macros, that may or may not be defined
;
-%ifndef HAVE_SPECIAL_APPEND
-%macro SPECIAL_APPEND 0
-%endmacro
-%endif
-
%ifndef HAVE_UNLOAD_PREP
%macro UNLOAD_PREP 0
%endmacro
mov al,' ' ; Space
stosb
- SPECIAL_APPEND ; Module-specific hook
+ call do_ip_append ; Handle IPAppend
mov si,[CmdOptPtr] ; Options from user input
call strcpy
SetupSecs resw 1 ; Number of setup sectors (+bootsect)
KernelVersion resw 1 ; Kernel protocol version
;
-; These
+; These are derived from the command-line parser
;
InitRDPtr resw 1 ; Pointer to initrd= option in command line
LoadFlags resb 1 ; Loadflags from kernel