#include <ipxe/init.h>
#include <ipxe/io.h>
#include <ipxe/memmap.h>
-#include <ipxe/hidemem.h>
/** Set to true if you want to test a fake E820 map */
#define FAKE_E820 0
}
/**
- * Hide umalloc() region
+ * Hide .text and .data
*
*/
-void hide_umalloc ( physaddr_t start, physaddr_t end ) {
- assert ( end <= virt_to_phys ( _textdata ) );
- hide_region ( &hidemem_umalloc, start, end );
+void hide_textdata ( void ) {
+ hide_region ( &hidemem_textdata, virt_to_phys ( _textdata ),
+ virt_to_phys ( _etextdata ) );
}
/**
- * Hide .text and .data
+ * Synchronise in-use regions with the externally visible system memory map
*
*/
-void hide_textdata ( void ) {
- hide_region ( &hidemem_textdata, virt_to_phys ( _textdata ),
- virt_to_phys ( _etextdata ) );
+static void int15_sync ( void ) {
+ physaddr_t start;
+ size_t size;
+
+ /* Besides our fixed base memory and textdata regions, we
+ * support hiding only a single in-use memory region (the
+ * umalloc region), which must be placed before the hidden
+ * textdata region (even if zero-length).
+ */
+ start = umalloc_used.start;
+ size = umalloc_used.size;
+ if ( ! size )
+ start = virt_to_phys ( _textdata );
+ hide_region ( &hidemem_umalloc, start, ( start + size ) );
}
/**
/* Initialise the hidden regions */
hide_basemem();
- hide_umalloc ( virt_to_phys ( _textdata ), virt_to_phys ( _textdata ) );
hide_textdata();
+ int15_sync();
/* Some really moronic BIOSes bring up the PXE stack via the
* UNDI loader entry point and then don't bother to unload it
.startup = hide_etherboot,
.shutdown = unhide_etherboot,
};
+
+PROVIDE_MEMMAP ( int15, memmap_sync, int15_sync );
#include <string.h>
#include <errno.h>
#include <ipxe/uaccess.h>
-#include <ipxe/hidemem.h>
#include <ipxe/io.h>
#include <ipxe/memblock.h>
+#include <ipxe/memmap.h>
#include <ipxe/umalloc.h>
/** Maximum usable address for external allocated memory */
/** Remaining space on heap */
static size_t heap_size;
+/** In-use memory region */
+struct used_region umalloc_used __used_region = {
+ .name = "umalloc",
+};
+
+/**
+ * Hide umalloc() region
+ *
+ * @v start Start of region
+ * @v end End of region
+ */
+static void hide_umalloc ( physaddr_t start, physaddr_t end ) {
+
+ memmap_use ( &umalloc_used, start, ( end - start ) );
+}
+
/**
* Find largest usable memory region
*