Macroize the generation of the "insufficient DOS RAM string";
authorhpa <hpa>
Tue, 15 Apr 2003 21:28:18 +0000 (21:28 +0000)
committerhpa <hpa>
Tue, 15 Apr 2003 21:28:18 +0000 (21:28 +0000)
Actually use the 1000h segment instead of letting it go to waste;
Set comboot_seg == real_mode_seg to save 40K

NEWS
cpuinit.inc
isolinux.asm
ldlinux.asm
macros.inc
pxelinux.asm

diff --git a/NEWS b/NEWS
index ff85afc..0066378 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ Starting with 1.47, changes marked with SYSLINUX/PXELINUX/ISOLINUX
 apply to that specific program only; other changes apply to all of
 them.
 
+Changes in 2.04:
+       * ALL: Reclaim even more low memory by observing that
+       comboot_seg == real_mode_seg is perfectly fine, and by the
+       fact that the 1000h segment managed to get unused in all
+       derivatives...
+
 Changes in 2.03:
        * Actually support comment lines in the configuration file.
        * PXELINUX: Try to resolve some problems with stack switches.
index b63ae64..f64623e 100644 (file)
@@ -27,8 +27,12 @@ check_escapes:
 ;
 ; Now check that there is sufficient low (DOS) memory
 ;
+; NOTE: Linux doesn't use all of real_mode_seg, but we use the same
+; segment for COMBOOT images, which can use all 64K
+;
+dosram_k       equ (real_mode_seg+0x1000) >> 6 ; Minimum DOS memory (K)
                int 12h
-               cmp ax,(real_mode_seg+0xa00) >> 6
+               cmp ax,dosram_k
                jae enough_ram
                mov si,err_noram
                call writestr
index b4e8bac..22f7857 100644 (file)
@@ -73,10 +73,10 @@ vk_end:             equ $                   ; Should be <= vk_size
 ; Segment assignments in the bottom 640K
 ; 0000h - main code/data segment (and BIOS segment)
 ;
-real_mode_seg  equ 5000h
-vk_seg          equ 4000h              ; Virtual kernels
-xfer_buf_seg   equ 3000h               ; Bounce buffer for I/O to high mem
-comboot_seg    equ 2000h               ; COMBOOT image loading zone
+real_mode_seg  equ 3000h
+vk_seg          equ 2000h              ; Virtual kernels
+xfer_buf_seg   equ 1000h               ; Bounce buffer for I/O to high mem
+comboot_seg    equ real_mode_seg       ; COMBOOT image loading zone
 
 ;
 ; File structure.  This holds the information for each currently open file.
@@ -1502,13 +1502,15 @@ boot_prompt     db 'boot: ', 0
 wipe_char      db BS, ' ', BS, 0
 err_notfound   db 'Could not find kernel image: ',0
 err_notkernel  db CR, LF, 'Invalid or corrupt kernel image.', CR, LF, 0
-err_noram      db 'It appears your computer has less than 360K of low ("DOS")'
-               db 0Dh, 0Ah
+err_noram      db 'It appears your computer has less than '
+               asciidec dosram_k
+               db 'K of low ("DOS")'
+               db CR, LF
                db 'RAM.  Linux needs at least this amount to boot.  If you get'
-               db 0Dh, 0Ah
+               db CR, LF
                db 'this message in error, hold down the Ctrl key while'
-               db 0Dh, 0Ah
-               db 'booting, and I will take your word for it.', 0Dh, 0Ah, 0
+               db CR, LF
+               db 'booting, and I will take your word for it.', CR, LF, 0
 err_badcfg      db 'Unknown keyword in config file.', CR, LF, 0
 err_noparm      db 'Missing parameter in config file.', CR, LF, 0
 err_noinitrd    db CR, LF, 'Could not find ramdisk image: ', 0
index cb146b9..d6c2b05 100644 (file)
@@ -81,11 +81,11 @@ vk_end:             equ $                   ; Should be <= vk_size
 ;
 ; 0000h - main code/data segment (and BIOS segment)
 ;
-real_mode_seg  equ 7000h
-fat_seg                equ 5000h               ; 128K area for FAT (2x64K)
-vk_seg          equ 4000h              ; Virtual kernels
-xfer_buf_seg   equ 3000h               ; Bounce buffer for I/O to high mem
-comboot_seg    equ 2000h               ; COMBOOT image loading zone
+real_mode_seg  equ 5000h
+fat_seg                equ 3000h               ; 128K area for FAT (2x64K)
+vk_seg          equ 2000h              ; Virtual kernels
+xfer_buf_seg   equ 1000h               ; Bounce buffer for I/O to high mem
+comboot_seg    equ real_mode_seg       ; COMBOOT image loading zone
 
 ; ---------------------------------------------------------------------------
 ;   BEGIN CODE
@@ -1360,7 +1360,9 @@ boot_prompt       db 'boot: ', 0
 wipe_char      db BS, ' ', BS, 0
 err_notfound   db 'Could not find kernel image: ',0
 err_notkernel  db CR, LF, 'Invalid or corrupt kernel image.', CR, LF, 0
-err_noram      db 'It appears your computer has less than 488K of low ("DOS")'
+err_noram      db 'It appears your computer has less than '
+               asciidec dosram_k
+               db 'K of low ("DOS")'
                db CR, LF
                db 'RAM.  Linux needs at least this amount to boot.  If you get'
                db CR, LF
index f12ff3f..3702d4c 100644 (file)
@@ -1,7 +1,7 @@
 ;; $Id$
 ;; -----------------------------------------------------------------------
 ;;   
-;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
+;;   Copyright 1994-2003 H. Peter Anvin - All Rights Reserved
 ;;
 ;;   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
 
 ;
 ; Macros similar to res[bwd], but which works in the code segment (after
-; section .text)
+; section .text) or the data segment (section .data)
 ;
-%macro zb      1
+%macro zb      1.nolist
        times %1 db 0
 %endmacro
 
-%macro zw      1
+%macro zw      1.nolist
        times %1 dw 0
 %endmacro
 
-%macro zd      1
+%macro zd      1.nolist
        times %1 dd 0
 %endmacro
 
 ;
+; Macro to emit an unsigned decimal number as a string
+;
+%macro asciidec        1.nolist
+%if %1 >= 1000000000
+       db ((%1/1000000000) % 10) + '0'
+%endif
+%if %1 >= 100000000
+       db ((%1/100000000) % 10) + '0'
+%endif
+%if %1 >= 10000000
+       db ((%1/10000000) % 10) + '0'
+%endif
+%if %1 >= 1000000
+       db ((%1/1000000) % 10) + '0'
+%endif
+%if %1 >= 100000
+       db ((%1/100000) % 10) + '0'
+%endif
+%if %1 >= 10000
+       db ((%1/10000) % 10) + '0'
+%endif
+%if %1 >= 1000
+       db ((%1/1000) % 10) + '0'
+%endif
+%if %1 >= 100
+       db ((%1/100) % 10) + '0'
+%endif
+%if %1 >= 10
+       db ((%1/10) % 10) + '0'
+%endif
+       db (%1 % 10) + '0'
+%endmacro
+
+;
 ; Macros for network byte order of constants
 ;
 %define htons(x)  ( ( ((x) & 0FFh) << 8 ) + ( ((x) & 0FF00h) >> 8 ) )
index f95fd04..a306473 100644 (file)
@@ -35,7 +35,7 @@ FILENAME_MAX  equ (1 << FILENAME_MAX_LG2)
 NULLFILE       equ 0                   ; Zero byte == null file name
 REBOOT_TIME    equ 5*60                ; If failure, time until full reset
 %assign HIGHMEM_SLOP 128*1024          ; Avoid this much memory near the top
-MAX_SOCKETS_LG2        equ 6                   ; log2(Max number of open sockets)
+MAX_SOCKETS_LG2        equ 5                   ; log2(Max number of open sockets)
 MAX_SOCKETS    equ (1 << MAX_SOCKETS_LG2)
 TFTP_PORT      equ htons(69)           ; Default TFTP port 
 PKT_RETRY      equ 6                   ; Packet transmit retry count
@@ -89,10 +89,11 @@ vk_end:             equ $                   ; Should be <= vk_size
 ; Segment assignments in the bottom 640K
 ; 0000h - main code/data segment (and BIOS segment)
 ;
-real_mode_seg  equ 5000h
-vk_seg          equ 4000h              ; Virtual kernels
-xfer_buf_seg   equ 3000h               ; Bounce buffer for I/O to high mem
-comboot_seg    equ 2000h               ; COMBOOT image loading zone
+real_mode_seg  equ 4000h
+vk_seg          equ 3000h              ; Virtual kernels
+xfer_buf_seg   equ 2000h               ; Bounce buffer for I/O to high mem
+tftp_buf_seg   equ 1000h               ; Packet buffers segments
+comboot_seg    equ real_mode_seg       ; COMBOOT image loading zone
 
 ;
 ; BOOTP/DHCP packet pattern
@@ -129,6 +130,10 @@ tftp_remoteport    resw 1                  ; Remote port number
 tftp_remoteip  resd 1                  ; Remote IP address
 tftp_filepos   resd 1                  ; Position within file
 tftp_filesize  resd 1                  ; Total file size
+tftp_pktbuf    resw 1                  ; Packet buffer offset
+tftp_dataptr   resw 1                  ; Pointer to available data
+tftp_bytesleft resw 1                  ; Unclaimed data bytes
+               resw 5                  ; Currently unusued
                endstruc
 
 %ifndef DEPEND
@@ -2069,13 +2074,15 @@ boot_prompt     db 'boot: ', 0
 wipe_char      db BS, ' ', BS, 0
 err_notfound   db 'Could not find kernel image: ',0
 err_notkernel  db CR, LF, 'Invalid or corrupt kernel image.', CR, LF, 0
-err_noram      db 'It appears your computer has less than 384K of low ("DOS")'
-               db 0Dh, 0Ah
+err_noram      db 'It appears your computer has less than '
+               asciidec dosram_k
+               db 'K of low ("DOS")'
+               db CR, LF
                db 'RAM.  Linux needs at least this amount to boot.  If you get'
-               db 0Dh, 0Ah
+               db CR, LF
                db 'this message in error, hold down the Ctrl key while'
-               db 0Dh, 0Ah
-               db 'booting, and I will take your word for it.', 0Dh, 0Ah, 0
+               db CR, LF
+               db 'booting, and I will take your word for it.', CR, LF, 0
 err_badcfg      db 'Unknown keyword in config file.', CR, LF, 0
 err_noparm      db 'Missing parameter in config file.', CR, LF, 0
 err_noinitrd    db CR, LF, 'Could not find ramdisk image: ', 0