aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2011-02-05 16:56:21 -0500
committerGene Cumm <gene.cumm@gmail.com>2011-02-05 16:56:21 -0500
commit3db568e482918d54739cf6d27955a3a5d3d5cd12 (patch)
treedf72cb0dd9b0f1edade3a4a8fdb21ae8624c00bb /memdisk
parent558087bfd62e8f74f58157e885cecc00feba836a (diff)
downloadsyslinux-3db568e482918d54739cf6d27955a3a5d3d5cd12.tar.gz
syslinux-3db568e482918d54739cf6d27955a3a5d3d5cd12.tar.xz
syslinux-3db568e482918d54739cf6d27955a3a5d3d5cd12.zip
memdisk: New parameter (int15maxres) for specifying maximum RAM
Add a new parameter, int15maxres, for specifying (in decimal bytes) the maximum amount of free RAM that different calls will return. The RAM is tagged in INT15h AXe820h as reserved in order to satisfy this.
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/setup.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 43151898..bf3d5d63 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -705,6 +705,39 @@ static int stack_needed(void)
return v;
}
+/*
+ * Specify max RAM by reservation
+ * 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)
+{
+ uint32_t ramtop;
+
+ if (high_mem) {
+ ramtop = high_mem + (1<<24);
+ } else if (low_mem) {
+ ramtop = low_mem + (1<<20);
+ } else {
+ ramtop = 0;
+ }
+
+ /* printf(" TOP RAM-%08x RES-%08x", ramtop, restop); */
+ if (restop < ramtop) {
+ /* printf(" (A)"); */
+ insertrange(restop, (ramtop - restop), 3);
+ parse_mem();
+ }
+ if (high_mem) {
+ ramtop = high_mem + (1<<24);
+ } else if (low_mem) {
+ ramtop = low_mem + (1<<20);
+ } else {
+ ramtop = 0;
+ }
+ /* printf(" NOW RAM-%08x\n", ramtop); */
+}
+
struct real_mode_args rm_args;
/*
@@ -737,6 +770,7 @@ void setup(const struct real_mode_args *rm_args_ptr)
int no_bpt; /* No valid BPT presented */
uint32_t boot_seg = 0; /* Meaning 0000:7C00 */
uint32_t boot_len = 512; /* One sector */
+ const char *p;
/* We need to copy the rm_args into their proper place */
memcpy(&rm_args, rm_args_ptr, sizeof rm_args);
@@ -942,6 +976,10 @@ void setup(const struct real_mode_args *rm_args_ptr)
pptr->cd_pkt.geom3 = (uint8_t)(pptr->heads);
}
+ if ((p = getcmditem("int15maxres")) != CMD_NOTFOUND) {
+ int15maxres(atou(p));
+ }
+
/* The size is given by hptr->total_size plus the size of the E820
map -- 12 bytes per range; we may need as many as 2 additional
ranges (each insertrange() can worst-case turn 1 area into 3)