mirror of https://github.com/mgba-emu/mgba.git
PowerPC: Fix overflow in LOAD/STORE_64LE (fixes #1089)
This commit is contained in:
parent
7f41dd3541
commit
c353e1254a
|
@ -136,12 +136,13 @@ typedef intptr_t ssize_t;
|
|||
uint32_t lo; \
|
||||
}; \
|
||||
uint64_t b64; \
|
||||
} *bswap = (void*) &DEST; \
|
||||
} bswap; \
|
||||
const void* _ptr = (ARR); \
|
||||
__asm__( \
|
||||
"lwbrx %0, %2, %3 \n" \
|
||||
"lwbrx %1, %2, %4 \n" \
|
||||
: "=&r"(bswap->lo), "=&r"(bswap->hi) : "b"(_ptr), "r"(_addr), "r"(_addr + 4)) ; \
|
||||
: "=&r"(bswap.lo), "=&r"(bswap.hi) : "b"(_ptr), "r"(_addr), "r"(_addr + 4)) ; \
|
||||
DEST = bswap.b64; \
|
||||
}
|
||||
|
||||
#define STORE_64LE(SRC, ADDR, ARR) { \
|
||||
|
@ -152,12 +153,12 @@ typedef intptr_t ssize_t;
|
|||
uint32_t lo; \
|
||||
}; \
|
||||
uint64_t b64; \
|
||||
} *bswap = (void*) &SRC; \
|
||||
} bswap = { .b64 = SRC }; \
|
||||
const void* _ptr = (ARR); \
|
||||
__asm__( \
|
||||
"stwbrx %0, %2, %3 \n" \
|
||||
"stwbrx %1, %2, %4 \n" \
|
||||
: : "r"(bswap->hi), "r"(bswap->lo), "b"(_ptr), "r"(_addr), "r"(_addr + 4) : "memory"); \
|
||||
: : "r"(bswap.hi), "r"(bswap.lo), "b"(_ptr), "r"(_addr), "r"(_addr + 4) : "memory"); \
|
||||
}
|
||||
|
||||
#elif defined(__llvm__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
|
|
Loading…
Reference in New Issue