[Nasm-bugs] [Bug 3392721] New: Problems with very large resb and times counts

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Fri Oct 30 12:06:37 PDT 2020


https://bugzilla.nasm.us/show_bug.cgi?id=3392721

            Bug ID: 3392721
           Summary: Problems with very large resb and times counts
           Product: NASM
           Version: 2.15.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: pushbx at ulukai.org
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Built from git using configure

Both resb and times fail in a panic if given a count of at least 8000_0000h. I
made a workaround to use a %rep loop around individual statements which are
given counts below the limit.

Times needs 40 times the duration needed by resb. Even though resb is
technically only for reserving uninitialised space, I'm using it to
zero-initialise large runs of space in one of my programs. I disabled the
zeroing warning around this use of resb.

Source for both aspects can be found at
https://hg.ulukai.org/ecm/bootimg/file/69c5556a61a6/bootimg.asm#l124

Here's some tests. Note that I aborted the -DTIMES=7FFF_FFFFh (2 GiB) run
because it took much longer (more than 20 minutes, 60 times the duration of the
-D_TIMES=800_0000h (128 MiB) run) and appeared not to finish. In an earlier run
I did (not shown here) I let it run for more than 500 minutes without it
terminating.

(I'm aware NASM is not intended to create multi-GiB output files but apart from
these problems it woks fine.)

$ nasm -v
NASM version 2.15.03rc1 compiled on Sep 30 2020
$ (cd ~/proj/nasm; git describe)
nasm-2.15.01-53-g91bc5188
$ cat test.asm

%ifdef TIMES
 times TIMES db 0
%endif

%ifdef RESB
 resb RESB
%endif
$ time nasm test.asm -DRESB=8000_0000h
panic: test.asm:7: assertion data.inslen >= 0 failed at asm/assemble.c:880

real    0m0.005s
user    0m0.002s
sys     0m0.003s
$ time nasm test.asm -DTIMES=8000_0000h
panic: test.asm:3: assertion instruction->times > 0 failed at asm/nasm.c:1581

real    0m0.003s
user    0m0.001s
sys     0m0.003s
$ time nasm test.asm -DRESB=7FFF_FFFFh
test.asm:7: warning: uninitialized space declared in .text section: zeroing
[-w+zer
oing]

real    0m11.082s
user    0m0.527s
sys     0m5.507s
$ time nasm test.asm -DTIMES=800_0000h

real    0m19.312s
user    0m18.613s
sys     0m0.519s
$ time nasm test.asm -DTIMES=7FFF_FFFFh
^C
real    21m10.861s
user    20m58.930s
sys     0m1.347s

$ time nasm test.asm -DRESB=800_0000h
test.asm:7: warning: uninitialized space declared in .text section: zeroing
[-w+zer
oing]

real    0m0.364s
user    0m0.032s
sys     0m0.320s
$

-- 
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.


More information about the Nasm-bugs mailing list