From da900b66fdec8f6c4609df2ce72881bd3f6987a8 Mon Sep 17 00:00:00 2001 From: hpa Date: Wed, 4 Aug 2004 06:14:12 +0000 Subject: [PATCH] Clean up memory management and command-line creation --- isolinux.asm | 11 ++++++----- ldlinux.asm | 3 ++- pxelinux.asm | 11 ++++++----- runkernel.inc | 3 +-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/isolinux.asm b/isolinux.asm index 0e7d75f..203d5ea 100644 --- a/isolinux.asm +++ b/isolinux.asm @@ -216,6 +216,10 @@ TextColorReg resb 17 ; VGA color registers for text mode VGAFileBuf resb FILENAME_MAX ; Unmangled VGA image name VGAFileBufEnd equ $ VGAFileMBuf resb FILENAME_MAX ; Mangled VGA image name + alignb 4 ; For the good of REP MOVSD +command_line resb max_cmd_len+2 ; Command line buffer + alignb 4 +default_cmd resb max_cmd_len+1 ; "default" command line alignb open_file_t_size Files resb MAX_OPEN*open_file_t_size @@ -1712,11 +1716,8 @@ linuxauto_cmd db 'linux auto',0 linuxauto_len equ $-linuxauto_cmd boot_image db 'BOOT_IMAGE=' boot_image_len equ $-boot_image - align 4, db 0 ; For the good of REP MOVSD -command_line equ $ -default_cmd equ $+(max_cmd_len+2) -ldlinux_end equ default_cmd+(max_cmd_len+1) -kern_cmd_len equ ldlinux_end-command_line +ldlinux_end equ $ + ; ; Put the getcbuf right after the code, aligned on a sector boundary ; diff --git a/ldlinux.asm b/ldlinux.asm index b58211b..366ed18 100644 --- a/ldlinux.asm +++ b/ldlinux.asm @@ -216,8 +216,8 @@ VGAFileBufEnd equ $ VGAFileMBuf resb 11 ; Mangled VGA image name alignb 4 ; For the good of REP MOVSD command_line resb max_cmd_len+2 ; Command line buffer + alignb 4 default_cmd resb max_cmd_len+1 ; "default" command line -kern_cmd_len equ $-command_line section .text org 7C00h @@ -1356,6 +1356,7 @@ lc_ret: ret %include "font.inc" ; VGA font stuff %include "graphics.inc" ; VGA graphics %include "highmem.inc" ; High memory sizing +%include "strcpy.inc" ; strcpy() ; ----------------------------------------------------------------------------- ; Begin data section diff --git a/pxelinux.asm b/pxelinux.asm index 2140d5b..6885cd9 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -300,6 +300,10 @@ TextColorReg resb 17 ; VGA color registers for text mode VGAFileBuf resb FILENAME_MAX ; Unmangled VGA image name VGAFileBufEnd equ $ VGAFileMBuf resb FILENAME_MAX ; Mangled VGA image name + alignb 4 ; For the good of REP MOVSD +command_line resb max_cmd_len+2 ; Command line buffer + alignb 4 +default_cmd resb max_cmd_len+1 ; "default" command line ; ; PXE packets which don't need static initialization @@ -2560,11 +2564,8 @@ linuxauto_cmd db 'linux auto',0 linuxauto_len equ $-linuxauto_cmd boot_image db 'BOOT_IMAGE=' boot_image_len equ $-boot_image - align 4, db 0 ; For the good of REP MOVSD -command_line equ $ -default_cmd equ $+(max_cmd_len+2) -ldlinux_end equ default_cmd+(max_cmd_len+1) -kern_cmd_len equ ldlinux_end-command_line +ldlinux_end equ $ + ; ; Put the getcbuf right after the code, aligned on a sector boundary ; diff --git a/runkernel.inc b/runkernel.inc index 5ad10d5..2c51b7f 100644 --- a/runkernel.inc +++ b/runkernel.inc @@ -122,8 +122,7 @@ construct_cmdline: SPECIAL_APPEND ; Module-specific hook mov si,[CmdOptPtr] ; Options from user input - mov cx,(kern_cmd_len+3) >> 2 - rep movsd + call strcpy ; ; Scan through the command line for anything that looks like we might be -- 2.7.4