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. More...
 
void set_fbms (unsigned int new_fbms)
 Set the BIOS free base memory counter. More...
 
void hide_basemem (void)
 Hide used base memory. More...
 

Detailed Description

Base memory allocation.

Definition in file basemem.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ get_fbms()

static unsigned int get_fbms ( void  )
inlinestatic

Read the BIOS free base memory counter.

Return values
fbmsFree base memory counter (in kB)

Definition at line 21 of file basemem.h.

21  {
22  uint16_t fbms;
23 
24  get_real ( fbms, BDA_SEG, BDA_FBMS );
25  return fbms;
26 }
unsigned short uint16_t
Definition: stdint.h:11
#define BDA_FBMS
Definition: bios.h:14
#define get_real
Definition: libkir.h:151
#define BDA_SEG
Definition: bios.h:6

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().

◆ set_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.

43  {
44  uint16_t fbms = new_fbms;
45 
46  /* Update the BIOS memory counter */
47  put_real ( fbms, BDA_SEG, BDA_FBMS );
48 
49  /* Update our hidden memory region map */
50  hide_basemem();
51 }
unsigned short uint16_t
Definition: stdint.h:11
#define BDA_FBMS
Definition: bios.h:14
#define put_real
Definition: libkir.h:150
#define BDA_SEG
Definition: bios.h:6
void hide_basemem(void)
Hide used base memory.
Definition: hidemem.c:107

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

Referenced by undi_load(), and undi_unload().

◆ hide_basemem()

void hide_basemem ( void  )

Hide used base memory.

Definition at line 107 of file hidemem.c.

107  {
108  /* Hide from the top of free base memory to 640kB. Don't use
109  * hide_region(), because we don't want this rounded to the
110  * nearest page boundary.
111  */
112  hidemem_base.start = ( get_fbms() * 1024 );
113 }
static unsigned int get_fbms(void)
Read the BIOS free base memory counter.
Definition: basemem.h:21
#define hidemem_base
Definition: hidemem.c:58

References get_fbms(), and hidemem_base.

Referenced by hide_etherboot(), and set_fbms().