mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 11:46:58 +00:00
tcg: Increase minimum alignment from tcg_malloc to 8
For a 64-bit ILP32 host, aligning to sizeof(long) is not enough. Guess the minimum for any host is 8, as that covers uint64_t. Qemu doesn't use a host long double or host vectors, except in extremely limited circumstances. Fixes a bus error for a sparc v8plus host. Backports commit 13aaef678ed377b12b76dc7fb9e615b2f2f9047b from qemu
This commit is contained in:
parent
29ea0681d0
commit
b33f2b40e8
|
@ -1058,7 +1058,10 @@ void tcg_optimize(TCGContext *s);
|
||||||
static inline void *tcg_malloc(TCGContext *s, int size)
|
static inline void *tcg_malloc(TCGContext *s, int size)
|
||||||
{
|
{
|
||||||
uint8_t *ptr, *ptr_end;
|
uint8_t *ptr, *ptr_end;
|
||||||
size = (size + sizeof(long) - 1) & ~(sizeof(long) - 1);
|
|
||||||
|
/* ??? This is a weak placeholder for minimum malloc alignment. */
|
||||||
|
size = QEMU_ALIGN_UP(size, 8);
|
||||||
|
|
||||||
ptr = s->pool_cur;
|
ptr = s->pool_cur;
|
||||||
ptr_end = ptr + size;
|
ptr_end = ptr + size;
|
||||||
if (unlikely(ptr_end > s->pool_end)) {
|
if (unlikely(ptr_end > s->pool_end)) {
|
||||||
|
|
Loading…
Reference in a new issue