1
0

mm.c/h -> frames.c/h: Naming indicating dealing with physical not virtual memory

This commit is contained in:
2013-01-01 23:42:45 -05:00
parent e279d83d7d
commit 806d00f471
9 changed files with 79 additions and 66 deletions

View File

@ -19,7 +19,7 @@
*/
#include <kmalloc.h>
#include <mm.h>
#include <frames.h>
#include <list.h>
#include <print.h>
@ -96,12 +96,12 @@ coalesce:
void *_kmalloc(unsigned int bytes, unsigned int tries);
void *grow_and_retry(unsigned int bytes, unsigned int tries) {
struct page *p;
struct frame *f;
if ((p = mm_get_free_pages(curr_page_power))) {
struct kmalloc_region *region = (struct kmalloc_region *)p->address;
//TODO don't throw away p, but keep it in a list (allocate a little at the beginning of this chunk for a list element), so we can free pages later if we want to
region->end = (char *)region + MM_PAGE_SIZE * (1 << curr_page_power) - 1;
if ((f = get_free_frames(curr_page_power))) {
struct kmalloc_region *region = (struct kmalloc_region *)f->address;
//TODO don't throw away f, but keep it in a list (allocate a little at the beginning of this chunk for a list element), so we can free pages later if we want to
region->end = (char *)region + CONFIG_PAGE_SIZE * (1 << curr_page_power) - 1;
add_region(region);
curr_page_power++;
return _kmalloc(bytes, tries);