Michael Akey
2026-Jan-29 05:24 UTC
[syslinux] [PATCH] Use AX instead of CX for extended memory size using int15, 88
On Wed, Jan 28, 2026 at 12:23?AM Paul Menzel <pmenzel at molgen.mpg.de> wrote:> > Dear Michael, > > > Thank you for your patch. > > Am 28.01.26 um 07:11 schrieb Michael Akey via Syslinux: > > When booting using syslinux (extlinux) on an older computer that only reports > > its extended memory size with BIOS interrupt 15h AH=88h, only the base memory > > is detected. This appears to be because of a change introduced in version 5 > > of syslinux such that it now uses CX as the length of extended memory rather > > than AX. On the systems I have that are affected, CX is always zero so no > > extended memory is added to the memory map list. This appears to be a bug, > > as v4 and below uses AX and the current meminfo module > > (com32/modules/meminfo.c) also uses AX. > > Did you find the commit introducing the error? It looks like commit > 37b99c20 (Finish the shuffle and boot interface, and add an ELF loading > module.) [1], first in syslinux-3.40-pre13. > > ``` > diff --git a/com32/lib/syslinux/memmap.c b/com32/lib/syslinux/memmap.c > index 05b2edd6..45a5efd9 100644 > --- a/com32/lib/syslinux/memmap.c > +++ b/com32/lib/syslinux/memmap.c > [?] > /* Finally try INT 15h AH=88h */ > ireg.eax.w[0] = 0x8800; > if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) { > - me = new_movelist(0, (addr_t)1 << 20, oreg.eax.w[0] << 10); > - if (!me) > + if (syslinux_add_memmap(&mmap, (addr_t)1 << 20, oreg.ecx.w[0] << 10, > + SMT_FREE)) > goto bail; > - *mlp = me; > - mlp = &me->next; > } > - > - return ml; > + > + return mmap; > ``` > > But that would contradict your statement, that it works correctly with > v4, wouldn?t it?There were multiple issues with what I said in my original message. I did not correctly locate the commit that caused this bug. After unsuccessfully using `git blame` I reviewed source tarballs from previous major release versions, and found it to be correct in a version 'below v4.' So in hindsight what I said doesn't make sense to me, and even if I said what I intended to, would not have been accurate. What would have made a lot more sense would have been to submit this as a bug to my distro of choice with the patch and have someone who does this with regularity handle it properly. Regardless, I have included an updated patch below, hopefully a satisfactory one.>From 12da5b42d5be3e5a803880c40ff3e5d85186ca36 Mon Sep 17 00:00:00 2001From: Mike Akey <mike.akey at gmail.com> Date: Tue, 27 Jan 2026 21:44:20 -0800 Subject: [PATCH] This corrects a change introduced in commit 37b99c20 that incorrectly uses the value of the CX register for the size of extended memory when relying on int 15h,ah=88. Adam Goldman <adamg at pobox.com> on the syslinux mailing list found that multiple texts including Ralf Brown's interrupt list, Phoenix Technologies "System BIOS for IBM PCs, Compatibles, and EISA Computers" 2nd edition, and "PC Intern System Programming" all state that the value in AX should be used. Signed-off-by: Mike Akey <mike.akey at gmail.com> --- com32/mboot/mem.c | 2 +- core/bios/bios.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/com32/mboot/mem.c b/com32/mboot/mem.c index 738291e5..885c49d6 100644 --- a/com32/mboot/mem.c +++ b/com32/mboot/mem.c @@ -154,7 +154,7 @@ static int mboot_scan_memory(struct AddrRangeDesc **ardp, uint32_t * dosmem) if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) { ard[1].size = 20; ard[1].BaseAddr = 1 << 20; - ard[1].Length = oreg.ecx.w[0] << 10; + ard[1].Length = oreg.eax.w[0] << 10; ard[1].Type = 1; rv = 2; goto out; diff --git a/core/bios/bios.c b/core/bios/bios.c index 7fb37fec..fbaa16cb 100644 --- a/core/bios/bios.c +++ b/core/bios/bios.c @@ -627,7 +627,7 @@ static int bios_scan_memory(scan_memory_callback_t callback, void *data) ireg.eax.w[0] = 0x8800; __intcall(0x15, &ireg, &oreg); if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) { - rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, SMT_FREE); + rv = callback(data, (addr_t) 1 << 20, oreg.eax.w[0] << 10, SMT_FREE); if (rv) return rv; } -- 2.43.0> > > From 44d030ae5f52d973231baec34652d8dcfc2caca4 Mon Sep 17 00:00:00 2001 > > From: Mike Akey <mike.akey at gmail.com> > > Date: Tue, 27 Jan 2026 21:44:20 -0800 > > Subject: [PATCH] Use AX instead of CX for extended memory size using int15,88 > > The patch is easier to apply with `git am` if you put the description in > the commit message. (Try `git commit --amend -s`. The `-s` is for > signing it off as required by `doc/SubmittingPatches.txt`.) > > Maybe you could also add Adam?s findings. > > > --- > > com32/mboot/mem.c | 2 +- > > core/bios/bios.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/com32/mboot/mem.c b/com32/mboot/mem.c > > index 738291e5..885c49d6 100644 > > --- a/com32/mboot/mem.c > > +++ b/com32/mboot/mem.c > > @@ -154,7 +154,7 @@ static int mboot_scan_memory(struct AddrRangeDesc > > **ardp, uint32_t * dosmem) > > if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) { > > ard[1].size = 20; > > ard[1].BaseAddr = 1 << 20; > > - ard[1].Length = oreg.ecx.w[0] << 10; > > + ard[1].Length = oreg.eax.w[0] << 10; > > ard[1].Type = 1; > > rv = 2; > > goto out; > > diff --git a/core/bios/bios.c b/core/bios/bios.c > > index 7fb37fec..fbaa16cb 100644 > > --- a/core/bios/bios.c > > +++ b/core/bios/bios.c > > @@ -627,7 +627,7 @@ static int bios_scan_memory(scan_memory_callback_t > > callback, void *data) > > ireg.eax.w[0] = 0x8800; > > __intcall(0x15, &ireg, &oreg); > > if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) { > > - rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, SMT_FREE); > > + rv = callback(data, (addr_t) 1 << 20, oreg.eax.w[0] << 10, SMT_FREE); > > if (rv) > > return rv; > > } > > The diff looks good. > > > Kind regards, > > Paul > > > PS: Out of curiosity, as nobody seems to have hit this yet, what setup > did you hit this with?I encountered this issue when using a generic 486-based laptop that has a PhoenixBIOS A486 v1.03, and another person with an IBM Thinkpad 365 reported that my patch worked for them as well. Thank you, and thank you to Adam for checking your reference info.