[syslinux] NASM 0.99.06 miscompiles SYSLINUX 3.53-pre5

H. Peter Anvin hpa at zytor.com
Thu Nov 15 07:57:46 PST 2007


Luciano Rocha wrote:
> On Wed, Nov 14, 2007 at 11:35:09PM -0800, H. Peter Anvin wrote:
> <snip>
>> Please try out 3.53-pre5 if you have the chance.  I would like to 
>> release 3.53 some time between Friday and Monday (Nov 16-19).
> 
> isolinux still locks under qemu.
> 
> nasm: NASM version 0.99.06 compiled on Nov 15 2007
>       git nasm-0.99.06-42-gdbb1828
> 

Apparently this version of NASM mis-assembles syslinux, specifically the 
following code (configinit.inc):

                 ; Initialize the .config section
                 mov si,section..config.start
                 mov di,section..config.vstart
                 mov cx,section..config.end.start
                 sub cx,di
                 shr cx,2
                 rep movsd

The values for di and cx are totally wrong.

The official image, assembled with NASM 0.98.39, does not appear to have 
that problem:

00009B00  BE9CAB            mov si,0xab9c
00009B03  BF804B            mov di,0x4b80
00009B06  B9A44B            mov cx,0x4ba4
00009B09  29F9              sub cx,di
00009B0B  C1E902            shr cx,0x2
00009B0E  F366A5            rep movsd

I have confirmed that current top-of-tree NASM has the same bug:

00009B00  BE9CAB            mov si,0xab9c
00009B03  BFD00A            mov di,0xad0
00009B06  B9F40A            mov cx,0xaf4
00009B09  29F9              sub cx,di
00009B0B  C1E902            shr cx,0x2
00009B0E  F366A5            rep movsd

Specifically, it looks like NASM 0.99.x botches a large RESB directive:

    600                              <1>                 section .earlybss
    601                              <1> trackbufsize    equ 8192
    602 00000800 <res 00002000>      <1> trackbuf        resb 
trackbufsize       ; Track buffer goes here
    603 00002800 <res 00002000>      <1> getcbuf         resb trackbufsize
    604                              <1> ;               ends at 4800h

... looks reasonable enough, but then, in the mapfile ...

---- Section .earlybss 
--------------------------------------------------------

class:     nobits
length:                  12 **** !!!!! ****
start:                  800
align:     not defined
follows:   not defined
vstart:                 800
valign:    not defined
vfollows:  not defined

---- Section .earlybss 
--------------------------------------------------------

Real              Virtual           Name
              800               800  trackbuf
             2800              2800  getcbuf
             4800              4800  EntryPoint
             4804              4804  A20Test
             4806              4806  A20Tries
             4807              4807  TrampolineBuf
             485C              485C  DummyTSS

In other words, the addresses in the section are what they should be, 
but the length of the section (and therefore the addresses of subsequent 
sections) is completely botched.

I'll try to get a chance to bisect this later today.

	-hpa






More information about the Syslinux mailing list