]> pd.if.org Git - pdclib.old/blobdiff - platform/gandr/functions/_PDCLIB/_PDCLIB_allocpages.c
[gandr]: implement /_PDCLIB_(alloc|free)pages/
[pdclib.old] / platform / gandr / functions / _PDCLIB / _PDCLIB_allocpages.c
index bdcd525ca3ece71ab92d2e63829c357113eb58b2..485177914b3709ff0e07939b5581f953223e4c64 100644 (file)
@@ -6,18 +6,23 @@
    Permission is granted to use, modify, and / or redistribute at will.
 */
 
-/* This is a stub implementation of _PDCLIB_allocpages
-*/
-
 #include <stdint.h>
 #include <stddef.h>
 #include <_PDCLIB_glue.h>
 #include <errno.h>
+#include <gd_bal.h>
 
 void * _PDCLIB_allocpages( size_t n )
 {
-    errno = ENOTSUP;
-    return NULL;
+    void *p = NULL;
+    int rv = gd_alloc_pages( gd_loader_data, &p, n );
+
+    if (rv) {
+        errno = rv;
+        return NULL;
+    } else {
+        return p;
+    }
 }
 
 #ifdef TEST