multiboot
E. Almqvist 3 years ago
parent 69ef138748
commit 9074026332
  1. 8
      kernel/memory.c
  2. 2
      kernel/memory.h

@ -113,15 +113,15 @@ pointer pm_malloc(uint block_count) {
lower = find_free(block_count);
if( lower < 0 )
println("--! OUT OF MEMORY !--", URGENT_COLOR);
println("malloc: OUT OF MEMORY", URGENT_COLOR);
// do some out-of-memory interupt
return 0x0;
// allocate those blocks
uint i;
for( i = lower; i <= lower + block_count - 1; i++ ) {
for( i = lower; i <= lower + block_count - 1; i++ )
block_alloc(i);
}
// return pointer to start of first block
return BLOCK_TO_MEMP(lower);
}

@ -16,9 +16,9 @@ void mod_bitmap(uint bit, uint flag);
pointer block_alloc(uint blockidx); // allocate a block
void block_free(uint blockidx); // free a block
bool check_block_range(uint start, uint end);
int find_free(uint block_count);
bool check_block_range(uint start, uint end);
void pm_malloc_range(ulong start, ulong end, bool force); // allocate a range of memory
pointer pm_malloc(uint block_count); // allocate some blocks

Loading…
Cancel
Save