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:
@@ -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);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
||||
Reference in New Issue
Block a user