Defining reserved memory areas

The example below presents how to mark reserved areas in continuous memory. Memory blocks will not be allocated in them.

/*
  Memory map:
  0000:0000 - 0000:03FF - Interrupt Vectors Table (reserved)
  0000:0400 - 0000:FFFF - Used for memory allocation
  0001:0000 - 0002:FFFF - Reserved for program code (reserved)
  0003:0000 - 0009:FFFF - Used for memory allocation
  000A:0000 - 000F:FFFF - Reserved for BIOS (reserved)
*/

#include <stdio.h>
#include "ST_API.h"

int main(void)
{
  PVOID MemoryPool;

  /* Initialization */
  arInit();
  stInit();


  /* Memory area from 0x00000400 to 0x00010000 */
  MemoryPool = (PVOID) 0x00000400;
  stMemoryInit(MemoryPool, 0xFC00);

  /* Memory area from 0x00030000 to 0x00000000 */
  stMemoryExpand(MemoryPool, (PVOID) 0x00030000, 0x70000);


  /* TO DO: Write your application code here. */
  /* The memory with reserved areas is ready to use in the MemoryPool */
  /* ... */


  /* Deinitialization */
  arDeinit();

  return 0;
}
SpaceShadow documentation