From 291eb19419200db2b565bf3c7c36e52ba4b65111 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 21 Jun 2019 09:47:25 +0200 Subject: [PATCH] Dasm: Perform unaligned stores through unaligned pointers --- ext/opcache/jit/dynasm/dasm_x86.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/opcache/jit/dynasm/dasm_x86.h b/ext/opcache/jit/dynasm/dasm_x86.h index bf5b729633..32874b40b9 100644 --- a/ext/opcache/jit/dynasm/dasm_x86.h +++ b/ext/opcache/jit/dynasm/dasm_x86.h @@ -354,10 +354,12 @@ int dasm_link(Dst_DECL, size_t *szp) #define dasmb(x) *cp++ = (unsigned char)(x) #ifndef DASM_ALIGNED_WRITES +typedef ZEND_SET_ALIGNED(1, unsigned short unaligned_short); +typedef ZEND_SET_ALIGNED(1, unsigned int unaligned_int); #define dasmw(x) \ - do { *((unsigned short *)cp) = (unsigned short)(x); cp+=2; } while (0) + do { *((unaligned_short *)cp) = (unsigned short)(x); cp+=2; } while (0) #define dasmd(x) \ - do { *((unsigned int *)cp) = (unsigned int)(x); cp+=4; } while (0) + do { *((unaligned_int *)cp) = (unsigned int)(x); cp+=4; } while (0) #else #define dasmw(x) do { dasmb(x); dasmb((x)>>8); } while (0) #define dasmd(x) do { dasmw(x); dasmw((x)>>16); } while (0) -- 2.40.0