|
@@ -0,0 +1,26 @@
|
|
1
|
+#include <vsprintf.h>
|
|
2
|
+#include <gpxe/uaccess.h>
|
|
3
|
+#include <gpxe/emalloc.h>
|
|
4
|
+#include <gpxe/memmap.h>
|
|
5
|
+
|
|
6
|
+void emalloc_test ( void ) {
|
|
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 = emalloc ( 1234 );
|
|
15
|
+ bob = erealloc ( bob, 12345 );
|
|
16
|
+ fred = emalloc ( 999 );
|
|
17
|
+
|
|
18
|
+ printf ( "After allocation:\n" );
|
|
19
|
+ get_memmap ( &memmap );
|
|
20
|
+
|
|
21
|
+ efree ( bob );
|
|
22
|
+ efree ( fred );
|
|
23
|
+
|
|
24
|
+ printf ( "After freeing:\n" );
|
|
25
|
+ get_memmap ( &memmap );
|
|
26
|
+}
|