Untested M-systems fix for SYSLINUX... syslinux-1.49-0x38609533
authorhpa <hpa>
Wed, 22 Dec 1999 09:08:53 +0000 (09:08 +0000)
committerhpa <hpa>
Wed, 22 Dec 1999 09:08:53 +0000 (09:08 +0000)
NEWS
ldlinux.asm
pxelinux.asm

diff --git a/NEWS b/NEWS
index a1869f9..5c0fa24 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,14 @@
+Starting with 1.47, changes marked with SYSLINUX/PXELINUX apply to
+that specific program only; other changes apply to both.
+
+Changes in 1.49:
+       * SYSLINUX: Implement a hack for BIOS drivers which hog significant
+         chunks of low memory during boot.  (Note: PXELINUX already
+         had this modification.  SYSLINUX does still require that the
+         low 512K is available; PXELINUX requires 384K.  Machines
+         with a physical memory hole in the low 640K cannot boot
+         Linux no matter what.)
+
 Changes in 1.48:
        * PXELINUX: Workaround for PXE ROMs based on the Intel PXE PDK
          3.0 build 071 and earlier: missing !PXE structure pointer.
index ea8bbc0..af70d77 100644 (file)
@@ -52,7 +52,11 @@ syslinux_id  equ 031h                ; SYSLINUX (3) version 1.x (1)
 ;
 ; Segments used by Linux
 ;
-real_mode_seg  equ 9000h
+; Note: the real_mode_seg is supposed to be 9000h, but some device drivers
+; hog some of high memory.  Therefore, we load it at 7000:0000h and copy
+; it before starting the Linux kernel.
+;
+real_mode_seg  equ 5000h
                struc real_mode_seg_t
                resb 20h-($-$$)         ; org 20h
 kern_cmd_magic resw 1                  ; Magic # for command line
@@ -136,12 +140,15 @@ vk_end:           equ $                   ; Should be <= vk_size
 
 ;
 ; Segment assignments in the bottom 640K
+; Stick to the low 512K in case we're using something like M-systems flash
+; which load a driver into low RAM (evil!!)
+;
 ; 0000h - main code/data segment (and BIOS segment)
-; 9000h - real_mode_seg
+; 7000h - real_mode_seg
 ;
-vk_seg          equ 8000h              ; This is where we stick'em
-xfer_buf_seg   equ 7000h               ; Bounce buffer for I/O to high mem
-fat_seg                equ 5000h               ; 128K area for FAT (2x64K)
+vk_seg          equ 6000h              ; This is where we stick'em
+xfer_buf_seg   equ 5000h               ; Bounce buffer for I/O to high mem
+fat_seg                equ 3000h               ; 128K area for FAT (2x64K)
 comboot_seg    equ 2000h               ; COMBOOT image loading zone
 
 ;
@@ -347,6 +354,7 @@ NextCharJump    resw 1                      ; Routine to interpret next print char
 SetupSecs      resw 1                  ; Number of setup sectors
 SavedSP                resw 1                  ; Our SP while running a COMBOOT image
 A20Test                resw 1                  ; Counter for testing status of A20
+CmdLineLen     resw 1                  ; Length of command line including null
 TextAttrBX      equ $
 TextAttribute   resb 1                 ; Text attribute for message file
 TextPage        resb 1                 ; Active display page
@@ -1128,11 +1136,10 @@ not_386:
 is_386:
                ; Now we know it's a 386 or higher
 ;
-; Now check that there is at least 608K of low (DOS) memory
-; (608K = 9800h segments)
+; Now check that there is at least 512K of low (DOS) memory
 ;
                int 12h
-               cmp ax,608
+               cmp ax,512
                jae enough_ram
                mov si,err_noram
                call writestr
@@ -1925,6 +1932,8 @@ is_mem_cmd:
 cmdline_end:
                 push ss                         ; Restore standard DS
                 pop ds
+               sub di,cmd_line_here
+               mov [CmdLineLen],di             ; Length including final null
 ;
 ; Now check if we have a large kernel, which needs to be loaded high
 ;
@@ -2070,6 +2079,26 @@ high_load_done:
                 call abort_check               ; Last chance!!
 
 ;
+; Copy real_mode stuff up to 90000h
+;
+               cli                             ; In case of hooked interrupts
+               mov ax,real_mode_seg
+               mov fs,ax
+               mov ax,9000h
+               mov es,ax
+               mov cx,[SetupSecs]
+               inc cx                          ; Setup + boot sector
+               shl cx,7                        ; Sectors -> dwords
+               xor si,si
+               xor di,di
+               fs rep movsd                    ; Copy setup + boot sector
+               mov si,cmd_line_here
+               mov di,si
+               mov cx,[CmdLineLen]
+               add cx,byte 3
+               shr cx,2                        ; Convert to dwords
+               fs rep movsd
+;
 ; Some kernels in the 1.2 ballpark but pre-bzImage have more than 4
 ; setup sectors, but the boot protocol had not yet been defined.  They
 ; rely on a signature to figure out if they need to copy stuff from
@@ -2149,15 +2178,14 @@ kill_motor:
 ;
 ; Set up segment registers and the Linux real-mode stack
 ;
-               mov ax,real_mode_seg
+               cli
+               mov ax,9000h
                mov ds,ax
                 mov es,ax
                mov fs,ax
                mov gs,ax
-               cli
                mov ss,ax
                mov sp,linux_stack
-               sti
 ;
 ; We're done... now RUN THAT KERNEL!!!!
 ;
@@ -3562,7 +3590,7 @@ err_not386        db 'It appears your computer uses a 286 or lower CPU.'
                db 'down the Ctrl key while booting, and I will take your'
                db 0Dh, 0Ah
                db 'word for it.', 0Dh, 0Ah, 0
-err_noram      db 'It appears your computer has less than 608K of low ("DOS")'
+err_noram      db 'It appears your computer has less than 512K of low ("DOS")'
                db 0Dh, 0Ah
                db 'RAM.  Linux needs at least this amount to boot.  If you get'
                db 0Dh, 0Ah
index d52edec..3411243 100644 (file)
@@ -341,10 +341,10 @@ InitRDCNameLen  resw 1                    ; Length of unmangled initrd name
 NextCharJump    resw 1                 ; Routine to interpret next print char
 SetupSecs      resw 1                  ; Number of setup sectors
 A20Test                resw 1                  ; Counter for testing status of A20
+CmdLineLen     resw 1                  ; Length of command line including null
 ServerPort     resw 1                  ; TFTP server port
 ConfigFile     resw 1                  ; Socket for config file
 PktTimeout     resw 1                  ; Timeout for current packet
-CmdLineLen     resw 1                  ; Length of command line including null
 KernelExtPtr   resw 1                  ; During search, final null pointer
 TextAttrBX      equ $
 TextAttribute   resb 1                 ; Text attribute for message file
@@ -1682,7 +1682,7 @@ nk_noinitrd:
 ;
 ; Copy real_mode stuff up to 90000h
 ;
-               cli                             ; In case UNDI didn't unload
+               cli                             ; In case of hooked interrupts
                mov ax,real_mode_seg
                mov fs,ax
                mov ax,9000h