iPXE
Functions
umalloc_test.c File Reference
#include <stdio.h>
#include <ipxe/uaccess.h>
#include <ipxe/umalloc.h>
#include <ipxe/io.h>

Go to the source code of this file.

Functions

void umalloc_test (void)
 

Function Documentation

◆ umalloc_test()

void umalloc_test ( void  )

Definition at line 6 of file umalloc_test.c.

6  {
7  struct memory_map memmap;
8  userptr_t bob;
9  userptr_t fred;
10 
11  printf ( "Before allocation:\n" );
12  get_memmap ( &memmap );
13 
14  bob = umalloc ( 1234 );
15  bob = urealloc ( bob, 12345 );
16  fred = umalloc ( 999 );
17 
18  printf ( "After allocation:\n" );
19  get_memmap ( &memmap );
20 
21  ufree ( bob );
22  ufree ( fred );
23 
24  printf ( "After freeing:\n" );
25  get_memmap ( &memmap );
26 }
void get_memmap(struct memory_map *memmap)
Get memory map.
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
A memory map.
Definition: io.h:499
userptr_t urealloc(userptr_t userptr, size_t new_size)
Reallocate external memory.
static __always_inline void ufree(userptr_t userptr)
Free external memory.
Definition: umalloc.h:65
static __always_inline userptr_t umalloc(size_t size)
Allocate external memory.
Definition: umalloc.h:54
unsigned long userptr_t
A pointer to a user buffer.
Definition: uaccess.h:33

References get_memmap(), printf(), ufree(), umalloc(), and urealloc().