translate-all: Adjust 256mb testing for mips64

Make sure we preserve the high 32-bits when masking for mips64.

Backports commit 7ba6a512ae439c98c0c1f0f4348c079d90f9dd9d from qemu
This commit is contained in:
Richard Henderson 2018-02-23 20:46:59 -05:00 committed by Lioncash
parent de17843702
commit bb0b055a99
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -523,7 +523,7 @@ static inline size_t size_code_gen_buffer(struct uc_struct *uc, size_t tb_size)
that the buffer not cross a 256MB boundary. */
static inline bool cross_256mb(void *addr, size_t size)
{
return ((uintptr_t)addr ^ ((uintptr_t)addr + size)) & 0xf0000000;
return ((uintptr_t)addr ^ ((uintptr_t)addr + size)) & ~0x0ffffffful;
}
/* We weren't able to allocate a buffer without crossing that boundary,
@ -531,7 +531,7 @@ static inline bool cross_256mb(void *addr, size_t size)
Returns the new base of the buffer, and adjusts code_gen_buffer_size. */
static inline void *split_cross_256mb(struct uc_struct *uc, void *buf1, size_t size1)
{
void *buf2 = (void *)(((uintptr_t)buf1 + size1) & 0xf0000000);
void *buf2 = (void *)(((uintptr_t)buf1 + size1) & ~0x0ffffffful);
size_t size2 = buf1 + size1 - buf2;
TCGContext *tcg_ctx = uc->tcg_ctx;