new free_contig() and changes to make drivers use it; so now we

have malloc/free, alloc_contig/free_contig and mmap/munmap nicely
paired up.

memory uses malloc/free instead of mmap/munmap as it doesn't have
to be contiguous for the ramdisks (and it might help if it doesn't!).
This commit is contained in:
Ben Gras
2010-02-10 13:56:26 +00:00
parent 49284caf2a
commit f08f2bd88c
6 changed files with 18 additions and 31 deletions
+2 -4
View File
@@ -20,9 +20,7 @@ char *flt_malloc(size_t size, char *sbuf, size_t ssize)
if (size <= ssize)
return sbuf;
p = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_PREALLOC | MAP_CONTIG | MAP_ANON, -1, 0);
if (p == MAP_FAILED)
if(!(p = alloc_contig(size, 0, NULL)))
panic(__FILE__, "out of memory", size);
return p;
@@ -37,7 +35,7 @@ void flt_free(char *buf, size_t size, char *sbuf)
*/
if(buf != sbuf)
munmap(buf, size);
free_contig(buf, size);
}
/*===========================================================================*