iPXE
Functions
basemem.h File Reference

Base memory allocation. More...

#include <stdint.h>
#include <realmode.h>
#include <bios.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static unsigned int get_fbms (void)
 Read the BIOS free base memory counter.
void set_fbms (unsigned int new_fbms)
 Set the BIOS free base memory counter.
void hide_basemem (void)
 Hide used base memory.

Detailed Description

Base memory allocation.

Definition in file basemem.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static unsigned int get_fbms ( void  ) [inline, static]

Read the BIOS free base memory counter.

Return values:
fbmsFree base memory counter (in kB)

Definition at line 21 of file basemem.h.

References BDA_FBMS, BDA_SEG, and get_real.

Referenced by basememsize(), com32_exec_loop(), comboot_init_psp(), hide_basemem(), hide_etherboot(), undi_load(), and undi_unload().

                                             {
        uint16_t fbms;

        get_real ( fbms, BDA_SEG, BDA_FBMS );
        return fbms;
}
void set_fbms ( unsigned int  new_fbms)

Set the BIOS free base memory counter.

Parameters:
new_fbmsNew free base memory counter (in kB)

Definition at line 43 of file basemem.c.

References BDA_FBMS, BDA_SEG, hide_basemem(), and put_real.

Referenced by undi_load(), and undi_unload().

                                        {
        uint16_t fbms = new_fbms;

        /* Update the BIOS memory counter */
        put_real ( fbms, BDA_SEG, BDA_FBMS );

        /* Update our hidden memory region map */
        hide_basemem();
}
void hide_basemem ( void  )

Hide used base memory.

Definition at line 107 of file hidemem.c.

References get_fbms(), and hidemem_base.

Referenced by hide_etherboot(), and set_fbms().

                           {
        /* Hide from the top of free base memory to 640kB.  Don't use
         * hide_region(), because we don't want this rounded to the
         * nearest page boundary.
         */
        hidemem_base.start = ( get_fbms() * 1024 );
}