aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-04-06 13:59:47 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-04-06 13:59:47 -0700
commit873c97c6baff4dd75675cd59b925fc4428c72811 (patch)
tree4ea30c1eb53970cb2c24746b51f860639d038cbd
parent2a9ddeceec1176a3da5a702997b0a0feb3d0cfb8 (diff)
downloadsyslinux.git-873c97c6baff4dd75675cd59b925fc4428c72811.tar.gz
syslinux.git-873c97c6baff4dd75675cd59b925fc4428c72811.tar.xz
syslinux.git-873c97c6baff4dd75675cd59b925fc4428c72811.zip
ipappend: clean up ipappend code; add ipappend to plain cmdline
ipappend information is needed for the plain cmdline too, since it may be used by linux.c32. While we're at it, clean up the handling of ipappend lines -- we can rather obviously use a loop for them. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/cmdline.inc59
-rw-r--r--core/comboot.inc13
-rw-r--r--core/pxelinux.asm24
-rw-r--r--core/runkernel.inc9
4 files changed, 60 insertions, 45 deletions
diff --git a/core/cmdline.inc b/core/cmdline.inc
index 5d5b3c22..9b3533e6 100644
--- a/core/cmdline.inc
+++ b/core/cmdline.inc
@@ -1,6 +1,7 @@
;; -----------------------------------------------------------------------
;;
-;; 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
@@ -20,14 +21,17 @@
;
; 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
@@ -36,3 +40,54 @@ make_plain_cmdline:
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
diff --git a/core/comboot.inc b/core/comboot.inc
index a9760f83..c76f96bc 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -687,7 +687,6 @@ comapi_configfile:
;
; INT 22h AX=000Fh Get IPAPPEND strings
;
-%if IS_PXELINUX
comapi_ipappend:
mov P_ES,cs
mov P_CX,numIPAppends
@@ -695,18 +694,6 @@ comapi_ipappend:
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
;
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index 82240226..370cc2bb 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -206,7 +206,6 @@ PXEStack resd 1 ; Saved stack during PXE call
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
@@ -795,25 +794,6 @@ config_scan:
; 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
@@ -966,7 +946,7 @@ is_struc:
pop ax
.bad:
ret
-
+
is_pxe equ is_struc.pxe
is_pxenv equ is_struc.pxenv
@@ -2564,8 +2544,6 @@ genipopt:
stosb
mov eax,[Netmask]
call gendotquad ; Zero-terminates its output
- sub di,IPOption
- mov [IPOptionLen],di
popad
ret
diff --git a/core/runkernel.inc b/core/runkernel.inc
index e74e7a6e..44c00289 100644
--- a/core/runkernel.inc
+++ b/core/runkernel.inc
@@ -20,11 +20,6 @@
;
; 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
@@ -88,7 +83,7 @@ construct_cmdline:
mov al,' ' ; Space
stosb
- SPECIAL_APPEND ; Module-specific hook
+ call do_ip_append ; Handle IPAppend
mov si,[CmdOptPtr] ; Options from user input
call strcpy
@@ -689,7 +684,7 @@ CmdLineEnd resw 1 ; End of the command line in real_mode_seg
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