Skip to content

Commit

Permalink
memdisk/setup: Allow suffix processing on mem= parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
geneC committed Feb 8, 2011
1 parent d3c03fe commit 79c5db6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions memdisk/Makefile
Expand Up @@ -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
Expand All @@ -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

Expand Down
12 changes: 10 additions & 2 deletions memdisk/setup.c
Expand Up @@ -14,6 +14,8 @@
* ----------------------------------------------------------------------- */

#include <stdint.h>
#include <minmax.h>
#include <suffix_number.h>
#include "bda.h"
#include "dskprobe.h"
#include "e820.h"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions memdisk/suffix_number.c
@@ -0,0 +1 @@
#include "../com32/libutil/suffix_number.c"

0 comments on commit 79c5db6

Please sign in to comment.