memmap.h File Reference

Memory mapping. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  memory_region
 A usable memory region. More...
struct  memory_map
 A memory map. More...

Defines

#define MAX_MEMORY_REGIONS   8
 Maximum number of memory regions we expect to encounter.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void get_memmap (struct memory_map *memmap)
 Get memory map.


Detailed Description

Memory mapping.

Definition in file memmap.h.


Define Documentation

#define MAX_MEMORY_REGIONS   8

Maximum number of memory regions we expect to encounter.

Definition at line 24 of file memmap.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

void get_memmap ( struct memory_map memmap  ) 

Get memory map.

Parameters:
memmap Memory map to fill in

Definition at line 285 of file memmap.c.

References basememsize(), memory_map::count, DBG, memory_region::end, extmemsize(), meme820(), memset(), memory_map::regions, and memory_region::start.

Referenced by com32_exec(), hide_etherboot(), init_eheap(), int13_boot(), multiboot_build_memmap(), phys_ram_within_limit(), prep_segment(), relocate(), and umalloc_test().

00285                                               {
00286         unsigned int basemem, extmem;
00287         int rc;
00288 
00289         DBG ( "Fetching system memory map\n" );
00290 
00291         /* Clear memory map */
00292         memset ( memmap, 0, sizeof ( *memmap ) );
00293 
00294         /* Get base and extended memory sizes */
00295         basemem = basememsize();
00296         DBG ( "FBMS base memory size %d kB [0,%x)\n",
00297               basemem, ( basemem * 1024 ) );
00298         extmem = extmemsize();
00299         
00300         /* Try INT 15,e820 first */
00301         if ( ( rc = meme820 ( memmap ) ) == 0 ) {
00302                 DBG ( "Obtained system memory map via INT 15,e820\n" );
00303                 return;
00304         }
00305 
00306         /* Fall back to constructing a map from basemem and extmem sizes */
00307         DBG ( "INT 15,e820 failed; constructing map\n" );
00308         memmap->regions[0].end = ( basemem * 1024 );
00309         memmap->regions[1].start = 0x100000;
00310         memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
00311         memmap->count = 2;
00312 }


Generated on Tue Apr 6 20:01:51 2010 for gPXE by  doxygen 1.5.7.1