summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/firmware/pcbios/hidemem.c
diff options
context:
space:
mode:
authorMichael Brown2008-09-25 04:34:26 +0200
committerMichael Brown2008-09-25 04:34:26 +0200
commitc24bc349ead939d90b5784dbff3cd9fdb9d83ba8 (patch)
tree3680245fec0489b4a05423fc471081eefccfda66 /src/arch/i386/firmware/pcbios/hidemem.c
parent[crypto] Remove spurious #include "config.h" (diff)
downloadipxe-c24bc349ead939d90b5784dbff3cd9fdb9d83ba8.tar.gz
ipxe-c24bc349ead939d90b5784dbff3cd9fdb9d83ba8.tar.xz
ipxe-c24bc349ead939d90b5784dbff3cd9fdb9d83ba8.zip
[pcbios] Add facility for testing arbitrary E820 memory maps
We seem to be having issues with various E820 memory maps. These problems are often difficult to reproduce, requiring access to the specific system exhibiting the problem. Add a facility for hooking in a fake E820 map generator, using an arbitrary map defined in a C array, solely in order to be able to test the map-mangling code against arbitrary E820 maps.
Diffstat (limited to 'src/arch/i386/firmware/pcbios/hidemem.c')
-rw-r--r--src/arch/i386/firmware/pcbios/hidemem.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/arch/i386/firmware/pcbios/hidemem.c b/src/arch/i386/firmware/pcbios/hidemem.c
index 202081b6..c9df7bd0 100644
--- a/src/arch/i386/firmware/pcbios/hidemem.c
+++ b/src/arch/i386/firmware/pcbios/hidemem.c
@@ -19,10 +19,14 @@
#include <realmode.h>
#include <biosint.h>
#include <basemem.h>
+#include <fakee820.h>
#include <gpxe/init.h>
#include <gpxe/memmap.h>
#include <gpxe/hidemem.h>
+/** Set to true if you want to test a fake E820 map */
+#define FAKE_E820 0
+
/** Alignment for hidden memory regions */
#define ALIGN_HIDDEN 4096 /* 4kB page alignment should be enough */
@@ -135,6 +139,13 @@ static void hide_etherboot ( void ) {
DBG ( "Hiding gPXE from system memory map\n" );
get_memmap ( &memmap );
+ /* Hook in fake E820 map, if we're testing one */
+ if ( FAKE_E820 ) {
+ DBG ( "Hooking in fake E820 map\n" );
+ fake_e820();
+ get_memmap ( &memmap );
+ }
+
/* Initialise the hidden regions */
hide_basemem();
hide_umalloc ( virt_to_phys ( _text ), virt_to_phys ( _text ) );
@@ -194,6 +205,10 @@ static void unhide_etherboot ( int flags __unused ) {
*/
unhook_bios_interrupt ( 0x15, ( unsigned int ) int15,
&int15_vector );
+
+ /* Unhook fake E820 map, if used */
+ if ( FAKE_E820 )
+ unfake_e820();
}
/** Hide Etherboot startup function */