MCPcopy Create free account
hub / github.com/coreboot/coreboot / free_aligned

Function free_aligned

payloads/libpayload/libc/malloc.c:463–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463static int free_aligned(void* addr, struct memory_type *type)
464{
465 struct align_region_t **prev_link = &type->align_regions;
466
467 while (*prev_link != NULL)
468 {
469 if (!addr_in_region(*prev_link, addr)) {
470 prev_link = &((*prev_link)->next);
471 continue;
472 }
473
474 if (region_is_large(*prev_link)) {
475 try_free_region(prev_link);
476 return 1;
477 }
478
479 int i = (addr-(*prev_link)->start_data)/(*prev_link)->alignment;
480 u8 *meta = (*prev_link)->start;
481 while (meta[i] == 2)
482 {
483 meta[i++] = 0;
484 (*prev_link)->free++;
485 }
486 meta[i] = 0;
487 (*prev_link)->free++;
488 try_free_region(prev_link);
489 return 1;
490 }
491 return 0;
492}
493
494static void *alloc_aligned(size_t align, size_t size, struct memory_type *type)
495{

Callers 1

freeFunction · 0.85

Calls 3

addr_in_regionFunction · 0.85
region_is_largeFunction · 0.85
try_free_regionFunction · 0.85

Tested by

no test coverage detected