mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
This commit is contained in:
parent
e34fd722ca
commit
588ff0748f
|
@ -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
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue