Minor malloc-debug fixes
This commit is contained in:
parent
2a736d0c2e
commit
292f98dc29
@ -126,7 +126,7 @@ static struct block *block_alloc(size_t size)
|
|||||||
read_tsc_64(&tsc);
|
read_tsc_64(&tsc);
|
||||||
totalsize = block_get_totalsize(size);
|
totalsize = block_get_totalsize(size);
|
||||||
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
|
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
|
||||||
page_index = rem64u(tsc, page_index_max);
|
page_index = (page_index_max > 0) ? (tsc.lo % page_index_max) : 0;
|
||||||
ptr = ptr_min + page_index * PAGE_SIZE;
|
ptr = ptr_min + page_index * PAGE_SIZE;
|
||||||
|
|
||||||
/* allocate block */
|
/* allocate block */
|
||||||
@ -143,7 +143,7 @@ static struct block *block_alloc(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* block may not be at the requested location if that is in use */
|
/* block may not be at the requested location if that is in use */
|
||||||
if (ptr_min < (u8_t *) block)
|
if (ptr_min > (u8_t *) block)
|
||||||
ptr_min = (u8_t *) block;
|
ptr_min = (u8_t *) block;
|
||||||
|
|
||||||
if (ptr_max < (u8_t *) block)
|
if (ptr_max < (u8_t *) block)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user