rem: if (alignment < WALL_MIN_ALIGN) alignment = WALL_MIN_ALIGN;
add: if (alignment > 0) {  while (alignment < sizeof(struct front_wall)) alignment *= 2; }
context: memalign(size_t alignment, size_t size){	void *address = NULL;	int bin_index;	unsigned int i;	struct heap_page *page;	TRACE(("memalign(alignment = %lu, size = %lu\n", alignment, size));#if DEBUG	if (!is_valid_alignment(alignment))		panic("memalign() with an alignment which is not a power of 2\n");#endif	if (!kernel_startup && !are_interrupts_enabled())		panic("malloc: called with interrupts disabled\n");	mutex_lock(&heap_lock);#if USE_WALL	// The wall uses 4 bytes to store the actual length of the requested	// block, 4 bytes for the alignment offset, WALL_SIZE, and eventually	// a list_link in case USE_CHECKING_WALL is defined	if (alignment < WALL_MIN_ALIGN)		alignment = WALL_MIN_ALIGN;#if USE_CHECKING_WALL	size += sizeof(struct list_link);#endif	size += 2*WALL_SIZE + 8 + 2*alignment;#else	// ToDo: that code "aligns" the buffer because the bins are always	//	aligned on their bin size	if (size < alignment)		size = alignment;#endif	for (bin_index = 0; bin_index < bin_count; bin_index++)		if (size <= bins[bin_index].element_size)			break;	if (bin_index == bin_count) {		// XXX fix the raw alloc later.		//address = raw_alloc(size, bin_index);		panic("malloc: asked to allocate too much for now (%lu bytes)!\n", size);		goto out;	} else {		if (bins[bin_index].free_list != NULL) {			address = bins[bin_index].free_list;			bins[bin_index].free_list = (void *)(*(unsigned int *)bins[bin_index].free_list);			bins[bin_index].free_count--;		} else {			if (bins[bin_index].raw_count == 0) {				bins[bin_index].raw_list = raw_alloc(bins[bin_index].grow_size, bin_index);				bins[bin_index].raw_count = bins[bin_index].grow_size / bins[bin_index].element_size;			}			bins[bin_index].raw_count--;			address = bins[bin_index].raw_list;			bins[bin_index].raw_list += bins[bin_index].element_size;		}		bins[bin_index].alloc_count++;		page = &heap_alloc_table[((unsigned int)address - heap_base) / B_PAGE_SIZE];		page[0].free_count--;		TRACE(("kmalloc0: page %p: bin_index %d, free_count %d\n", page, page->bin_index, page->free_count));		for(i = 1; i < bins[bin_index].element_size / B_PAGE_SIZE; i++) {			page[i].free_count--;			TRACE(("kmalloc1: page 0x%x: bin_index %d, free_count %d\n", page[i], page[i].bin_index, page[i].free_count));		}	}out:	mutex_unlock(&heap_lock);	TRACE(("kmalloc: asked to allocate size %d, returning ptr = %p\n", size, address));#if PARANOID_KMALLOC	memset(address, 0xcc, size);#endif#if PARANOID_POINTER_CHECK	ptrchecklist_store(address);#endif#if USE_WALL	address = add_wall(address, size, alignment);#endif	return address;}