]> pd.if.org Git - pdclib.old/blob - platform/gandr/functions/_PDCLIB/_PDCLIB_allocpages.c
[gandr]: implement /_PDCLIB_(alloc|free)pages/
[pdclib.old] / platform / gandr / functions / _PDCLIB / _PDCLIB_allocpages.c
1 /* $Id$ */
2
3 /* _PDCLIB_allocpages( int const )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdint.h>
10 #include <stddef.h>
11 #include <_PDCLIB_glue.h>
12 #include <errno.h>
13 #include <gd_bal.h>
14
15 void * _PDCLIB_allocpages( size_t n )
16 {
17     void *p = NULL;
18     int rv = gd_alloc_pages( gd_loader_data, &p, n );
19
20     if (rv) {
21         errno = rv;
22         return NULL;
23     } else {
24         return p;
25     }
26 }
27
28 #ifdef TEST
29 #include <_PDCLIB_test.h>
30
31 int main( void )
32 {
33     return TEST_RESULTS;
34 }
35
36 #endif