[syslinux] extlinux: missing text on serial output

Ferenc Wagner wferi at niif.hu
Sun Jun 22 16:06:23 PDT 2008


"H. Peter Anvin" <hpa at zytor.com> writes:

> Ferenc Wagner wrote:
>
>> There's no file named linux on the floppy image, so both syslinux and
>> extlinux complain: "Could not find kernel image: linux".  However,
>> syslinux does this instantly, while extlinux "waits" for a couple of
>> seconds (running under QEMU) before printing this message.  If I
>> enable DEBUG_TRACERS (a wonderful debugging aid, thanks for putting it
>> into place!) extlinux floods my terminal with 288 kB of 'H's before
>> outputting the message.  Those seem to come from cache.inc.  I doubt
>> this would be normal.  What do you think?
>
> Hm... I haven't seen this behaviour with extlinux myself.
>
> 'H' here means HIT, meaning that it's trying to read a sector that is 
> already in the cache.

Hi,

Seems like the end of the config file is mistreated.  getc invokes
getfssec with file_bytesleft==0, which it doesn't check for but reads
nevertheless, then underflows.  The following most ugly patch fixes it
for me:

diff --git a/core/extlinux.asm b/core/extlinux.asm
index c416541..1e2f2c7 100644
--- a/core/extlinux.asm
+++ b/core/extlinux.asm
@@ -1452,10 +1452,16 @@ getfssec:
                push edi
 
                movzx ecx,cx
-               push ecx                        ; Sectors requested read
                mov eax,[si+file_bytesleft]
                add eax,SECTOR_SIZE-1
                shr eax,SECTOR_SHIFT
+               test eax,eax
+               jnz .cont
+               xor ecx,ecx
+               stc
+               jmp .exit          
+.cont:
+               push ecx                        ; Sectors requested read
                cmp ecx,eax                     ; Number of sectors left
                jbe .lenok
                mov cx,ax
@@ -1510,6 +1516,7 @@ getfssec:
                ; Did we run out of file?
                cmp dword [si+file_bytesleft],1
                ; CF set if [SI] < 1, i.e. == 0
+.exit:
                pop edi
                pop edx
                pop eax

But maybe this check whould be better done by getc itself.  Or maybe
it does, but the info is lost somewhere...  What's the concept of EOF
handling?
-- 
Thanks,
Feri.




More information about the Syslinux mailing list