]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tcg/tci/tcg-target.inc.c
tci: Make direct jump patching thread-safe
[mirror_qemu.git] / tcg / tci / tcg-target.inc.c
index e2fc52a167507e856b21f9edfe8e74cc2f810b57..85eeb5de246ae67c4f1a8f1d8168ab5cf29d10b5 100644 (file)
@@ -556,6 +556,8 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
         if (s->tb_jmp_offset) {
             /* Direct jump method. */
             tcg_debug_assert(args[0] < ARRAY_SIZE(s->tb_jmp_offset));
+            /* Align for atomic patching and thread safety */
+            s->code_ptr = QEMU_ALIGN_PTR_UP(s->code_ptr, 4);
             s->tb_jmp_offset[args[0]] = tcg_current_code_size(s);
             tcg_out32(s, 0);
         } else {