Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
url = git://anongit.freedesktop.org/pixman
[submodule "dtc"]
path = dtc
url = git://git.qemu-project.org/dtc.git
url = https://gitlab.com/qemu-project/dtc.git
[submodule "roms/u-boot"]
path = roms/u-boot
url = git://git.qemu-project.org/u-boot.git
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

12 changes: 6 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ for opt do
case "$opt" in
--help|-h) show_help=yes
;;
--version|-V) exec cat $source_path/VERSION
--version|-V) exec cat $source_path/QEMU_VERSION
;;
--prefix=*) prefix="$optarg"
;;
Expand Down Expand Up @@ -1413,7 +1413,7 @@ fi

# Consult white-list to determine whether to enable werror
# by default. Only enable by default for git builds
z_version=`cut -f3 -d. $source_path/VERSION`
z_version=`cut -f3 -d. $source_path/QEMU_VERSION`

if test -z "$werror" ; then
if test -d "$source_path/.git" -a \
Expand Down Expand Up @@ -3615,7 +3615,7 @@ fi
# check if memfd is supported
memfd=no
cat > $TMPC << EOF
#include <sys/memfd.h>
#include <sys/mman.h>

int main(void)
{
Expand Down Expand Up @@ -4647,7 +4647,7 @@ if test "$guest_agent_msi" = "yes"; then
fi

if test "$QEMU_GA_VERSION" = ""; then
QEMU_GA_VERSION=`cat $source_path/VERSION`
QEMU_GA_VERSION=`cat $source_path/QEMU_VERSION`
fi

QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin"
Expand Down Expand Up @@ -4900,7 +4900,7 @@ if test "$bigendian" = "yes" ; then
fi
if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=y" >> $config_host_mak
rc_version=`cat $source_path/VERSION`
rc_version=`cat $source_path/QEMU_VERSION`
version_major=${rc_version%%.*}
rc_version=${rc_version#*.}
version_minor=${rc_version%%.*}
Expand Down Expand Up @@ -5008,7 +5008,7 @@ fi
if test "$xfs" = "yes" ; then
echo "CONFIG_XFS=y" >> $config_host_mak
fi
qemu_version=`head $source_path/VERSION`
qemu_version=`head $source_path/QEMU_VERSION`
echo "VERSION=$qemu_version" >>$config_host_mak
echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
Expand Down
1 change: 1 addition & 0 deletions cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr)
#endif /* DEBUG_DISAS */

cpu->can_do_io = !use_icount;
qemu_thread_jit_execute();
next_tb = tcg_qemu_tb_exec(env, tb_ptr);
cpu->can_do_io = 1;
trace_exec_tb_exit((void *) (next_tb & ~TB_EXIT_MASK),
Expand Down
1 change: 1 addition & 0 deletions hw/arm/stm32f2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "hw/ssi.h"
#include "hw/block/flash.h"
#include "sysemu/blockdev.h" // drive_get
#include "sysemu/sysemu.h"

static const char *stm32f2xx_periph_name_arr[] = {
ENUM_STRING(STM32_UART1),
Expand Down
1 change: 1 addition & 0 deletions hw/arm/stm32f4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "hw/ssi.h"
#include "hw/block/flash.h"
#include "sysemu/blockdev.h" // drive_get
#include "sysemu/sysemu.h"

static const char *stm32f4xx_periph_name_arr[] = {
ENUM_STRING(STM32_UART1),
Expand Down
1 change: 1 addition & 0 deletions hw/arm/stm32f7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "hw/ssi.h"
#include "hw/block/flash.h"
#include "sysemu/blockdev.h" // drive_get
#include "sysemu/sysemu.h"

static const char *stm32f7xx_periph_name_arr[] = {
ENUM_STRING(STM32_UART1),
Expand Down
1 change: 1 addition & 0 deletions include/exec/exec-all.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,
{
/* NOTE: this test is only needed for thread safety */
if (!tb->jmp_next[n]) {
qemu_thread_jit_write();
/* patch the native jump address */
tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr);

Expand Down
23 changes: 23 additions & 0 deletions include/qemu/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
#include "sysemu/os-posix.h"
#endif

#ifdef CONFIG_DARWIN
#include <AvailabilityMacros.h>
#include <pthread.h>
#endif

#include "qapi/error.h"

#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
Expand Down Expand Up @@ -315,4 +320,22 @@ int qemu_read_password(char *buf, int buf_size);
*/
pid_t qemu_fork(Error **errp);

#if defined(CONFIG_DARWIN) && defined(__aarch64__)
static inline void qemu_thread_jit_execute(void)
{
if (__builtin_available(macOS 11.0, *)) {
pthread_jit_write_protect_np(true);
}
}
static inline void qemu_thread_jit_write(void)
{
if (__builtin_available(macOS 11.0, *)) {
pthread_jit_write_protect_np(false);
}
}
#else
static inline void qemu_thread_jit_execute(void) {}
static inline void qemu_thread_jit_write(void) {}
#endif

#endif
1 change: 1 addition & 0 deletions tcg/tcg.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ void tcg_prologue_init(TCGContext *s)
s->code_gen_prologue = buf0;

/* Generate the prologue. */
qemu_thread_jit_write();
tcg_target_qemu_prologue(s);
buf1 = s->code_ptr;
flush_icache_range((uintptr_t)buf0, (uintptr_t)buf1);
Expand Down
13 changes: 13 additions & 0 deletions translate-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ static inline void *alloc_code_gen_buffer(void)
# endif
# endif

#if defined(CONFIG_DARWIN) && defined(__aarch64__)
// A change to mprotect in macOS 11.2 on Apple Silicon prevents the call from working on
// regions without the MAP_JIT flag. There's also some manual switching required between
// RW and RX perms needed - see calls to qemu_thread_jit_(write|execute).
flags |= MAP_JIT;
#endif

buf = mmap((void *)start, size + qemu_real_host_page_size,
PROT_NONE, flags, -1, 0);
if (buf == MAP_FAILED) {
Expand Down Expand Up @@ -975,6 +982,8 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
tb_page_addr_t phys_pc;
TranslationBlock *tb1, *tb2;

qemu_thread_jit_write();

/* remove the TB from the hash list */
phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
h = tb_phys_hash_func(phys_pc);
Expand Down Expand Up @@ -1022,6 +1031,8 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
tb->jmp_first = (TranslationBlock *)((uintptr_t)tb | 2); /* fail safe */

tcg_ctx.tb_ctx.tb_phys_invalidate_count++;

qemu_thread_jit_execute();
}

static void build_page_bitmap(PageDesc *p)
Expand Down Expand Up @@ -1068,6 +1079,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
int64_t ti;
#endif

qemu_thread_jit_write();

phys_pc = get_page_addr_code(env, pc);
if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) {
cflags |= CF_USE_ICOUNT;
Expand Down
4 changes: 1 addition & 3 deletions util/memfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@

#include "qemu/memfd.h"

#ifdef CONFIG_MEMFD
#include <sys/memfd.h>
#elif defined CONFIG_LINUX
#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
#include <sys/syscall.h>
#include <asm/unistd.h>

Expand Down