Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2024 04:00:34 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 588ff0748f4a - main - loader: Simplify build a little
Message-ID:  <202402160400.41G40Yqx019335@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=588ff0748f4acf8e00395f86e4956f184c7d3795

commit 588ff0748f4acf8e00395f86e4956f184c7d3795
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-16 03:55:05 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-16 03:59:23 +0000

    loader: Simplify build a little
    
    Confine -DDISK_DEBUG to biosdisc.c, the only file it affects.
    Use modern variable arrays instead of alloca and add a sanity
    size minimum for biospnp nodes. These nodes are tiny enough that
    we needn't do a malloc/free pair: the stack is fine.
    
    Sponsored by:           Netflix
    Reviewed by:            tsoome
    Differential Revision:  https://reviews.freebsd.org/D43914
---
 stand/i386/libi386/Makefile  | 8 ++------
 stand/i386/libi386/biospnp.c | 3 ++-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/stand/i386/libi386/Makefile b/stand/i386/libi386/Makefile
index 0bc0efd35f22..fcba20fa26c4 100644
--- a/stand/i386/libi386/Makefile
+++ b/stand/i386/libi386/Makefile
@@ -23,7 +23,7 @@ CFLAGS+=	-DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
 
 .ifdef(BOOT_BIOSDISK_DEBUG)
 # Make the disk code more talkative
-CFLAGS+= -DDISK_DEBUG
+CFLAGS.biosdisk.c+= -DDISK_DEBUG
 .endif
 
 # terminal emulation
@@ -35,11 +35,7 @@ CFLAGS.teken.c+= -I${SRCTOP}/sys/teken
 CFLAGS.bootinfo.c+= -I${SRCTOP}/sys/teken -I${SRCTOP}/contrib/pnglite
 CFLAGS.vbe.c+= -I${SRCTOP}/sys/teken -I${SRCTOP}/contrib/pnglite
 
-# XXX: make alloca() useable
-CFLAGS+= -Dalloca=__builtin_alloca
-
-CFLAGS+=	-I${BOOTSRC}/ficl -I${BOOTSRC}/ficl/i386 \
-		-I${LDRSRC} -I${BOOTSRC}/i386/common \
+CFLAGS+=	-I${LDRSRC} -I${BOOTSRC}/i386/common \
 		-I${SYSDIR}/contrib/dev/acpica/include
 
 # Handle FreeBSD specific %b and %D printf format specifiers
diff --git a/stand/i386/libi386/biospnp.c b/stand/i386/libi386/biospnp.c
index 7e3bc97a35ee..a26c0d4d52d8 100644
--- a/stand/i386/libi386/biospnp.c
+++ b/stand/i386/libi386/biospnp.c
@@ -155,6 +155,7 @@ biospnp_enumerate(void)
 {
     uint8_t		Node;
     struct pnp_devNode	*devNodeBuffer;
+    uint8_t		buffer[max(pnp_NodeSize, sizeof(*devNodeBuffer))];
     int			result;
     struct pnpinfo	*pi;
     int			count;
@@ -163,7 +164,7 @@ biospnp_enumerate(void)
     if (biospnp_init())
 	return;
 
-    devNodeBuffer = (struct pnp_devNode *)alloca(pnp_NodeSize);
+    devNodeBuffer = (struct pnp_devNode *)buffer;
     Node = 0;
     count = 1000;
     while((Node != 0xff) && (count-- > 0)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402160400.41G40Yqx019335>