From 79c5db6df34806d082fbf7d7c40e249f6a10d823 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Mon, 7 Feb 2011 20:53:13 -0500 Subject: [PATCH] memdisk/setup: Allow suffix processing on mem= parameter --- memdisk/Makefile | 4 ++-- memdisk/setup.c | 12 ++++++++++-- memdisk/suffix_number.c | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 memdisk/suffix_number.c diff --git a/memdisk/Makefile b/memdisk/Makefile index 0f519b2..73305d5 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -15,7 +15,7 @@ topdir = .. include $(topdir)/MCONFIG.embedded -include $(topdir)/version.mk -INCLUDES = -I$(topdir)/com32/include +INCLUDES = -I$(topdir)/com32/include -I$(topdir)/com32/libutil/include CFLAGS += -D__MEMDISK__ -DDATE='"$(DATE)"' LDFLAGS = $(GCCOPT) -g NASM = nasm @@ -39,7 +39,7 @@ endif OBJS16 = init.o16 init32.o OBJS32 = start32.o setup.o msetup.o e820func.o conio.o memcpy.o memset.o \ memmove.o unzip.o dskprobe.o eltorito.o \ - ctypes.o strntoumax.o strtoull.o \ + ctypes.o strntoumax.o strtoull.o suffix_number.o \ memdisk_chs_512.o memdisk_edd_512.o \ memdisk_iso_512.o memdisk_iso_2048.o diff --git a/memdisk/setup.c b/memdisk/setup.c index 7286210..8317971 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -14,6 +14,8 @@ * ----------------------------------------------------------------------- */ #include +#include +#include #include "bda.h" #include "dskprobe.h" #include "e820.h" @@ -710,11 +712,17 @@ static int stack_needed(void) * Adds a reservation to data in INT15h to prevent access to the top of RAM * if there's any above the point specified. */ -void int15maxres(uint32_t restop) +void int15maxres(unsigned long long restop_ull) { + uint32_t restop; struct e820range *ep; const int int15restype = 2; + /* insertrange() works on uint32_t */ + restop = min(restop_ull, UINT32_MAX); + /* printf(" int15maxres '%08x%08x' => %08x\n", + (unsigned int)(restop_ull>>32), (unsigned int)restop_ull, restop); */ + for (ep = ranges; ep->type != -1U; ep++) { if (ep->type == 1) { /* Only if available */ if (ep->start >= restop) { @@ -968,7 +976,7 @@ void setup(const struct real_mode_args *rm_args_ptr) } if ((p = getcmditem("mem")) != CMD_NOTFOUND) { - int15maxres(atou(p)); + int15maxres(suffix_number(p)); } /* The size is given by hptr->total_size plus the size of the E820 diff --git a/memdisk/suffix_number.c b/memdisk/suffix_number.c new file mode 100644 index 0000000..dd26642 --- /dev/null +++ b/memdisk/suffix_number.c @@ -0,0 +1 @@ +#include "../com32/libutil/suffix_number.c" -- 2.7.4