Lines Matching refs:allocation
51 struct intmem_allocation* allocation; in crisv32_intmem_alloc() local
58 list_for_each_entry_safe(allocation, tmp, &intmem_allocations, entry) { in crisv32_intmem_alloc()
59 int alignment = allocation->offset % align; in crisv32_intmem_alloc()
62 if (allocation->status == STATUS_FREE && in crisv32_intmem_alloc()
63 allocation->size >= size + alignment) { in crisv32_intmem_alloc()
64 if (allocation->size > size + alignment) { in crisv32_intmem_alloc()
68 alloc->size = allocation->size - size - in crisv32_intmem_alloc()
70 alloc->offset = allocation->offset + size + in crisv32_intmem_alloc()
72 list_add(&alloc->entry, &allocation->entry); in crisv32_intmem_alloc()
77 tmp->offset = allocation->offset; in crisv32_intmem_alloc()
80 allocation->offset += alignment; in crisv32_intmem_alloc()
82 &allocation->entry); in crisv32_intmem_alloc()
85 allocation->status = STATUS_ALLOCATED; in crisv32_intmem_alloc()
86 allocation->size = size; in crisv32_intmem_alloc()
87 ret = (void*)((int)intmem_virtual + allocation->offset); in crisv32_intmem_alloc()
96 struct intmem_allocation* allocation; in crisv32_intmem_free() local
105 list_for_each_entry_safe(allocation, tmp, &intmem_allocations, entry) { in crisv32_intmem_free()
106 if (allocation->offset == (int)(addr - intmem_virtual)) { in crisv32_intmem_free()
108 list_entry(allocation->entry.prev, in crisv32_intmem_free()
111 list_entry(allocation->entry.next, in crisv32_intmem_free()
114 allocation->status = STATUS_FREE; in crisv32_intmem_free()
118 prev->size += allocation->size; in crisv32_intmem_free()
119 list_del(&allocation->entry); in crisv32_intmem_free()
120 kfree(allocation); in crisv32_intmem_free()
121 allocation = prev; in crisv32_intmem_free()
125 allocation->size += next->size; in crisv32_intmem_free()