Misc cleanups

-----BEGIN PGP SIGNATURE-----
 
 iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmJhYIscHG1hcmNhbmRy
 ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5W0jD/43n8PL2cv42lq6OaIS
 OYN9vfW9xgA9THZiUH4xEHYreZh+KofmY1PbJn1n7q+v6DecBiqM4fZr1LY8X3PM
 xRUH0l4gjXwYwX2cSSo5UTZ/PF248Uoo3tUE3vgMFkYghHMjKcTtaSkYEPGHf2nR
 t3m1qLG9w9YPhVg7PNCntjUKi+w2TtcrRVzP7V7XyFc1HrAoT0ys6KaBBrXMbcjz
 SxTRbcwSq+6aPjQIn0RWp8Hp1HkdNjegB98dkyqRLlVaugHZWPYDXDQTgVziQlX8
 dU8YrlvTOtDWwsNP6awWnW6/IjKuJjGR0wT3QKwi8JAZ0YV3egwEKoQRUAyHtnn2
 FkSMYgmJcF0ai1aIJFAx+3PIzCfS49lKXA0t303DtY3hRR9JKGMwaV2do9Wm2irt
 o7T1lKKN7R7R8Q3U4OsatYMYm7KYL07NEDiQCPloGvCo27ezkAWCKXAw1mRUkxKF
 jKwJPcnOUq21Jp6tpjsR8ifSw70jBSEWQSGqhXnDhZhx2C2/Qqkg2I8DagLiPger
 kYxbQ13LTG0R25YHa1r3UmzuD+HpZOM8XoLJc5yun/1UrwyR9ghHrOoxkSnRT2Ks
 QFn//xQ2SzUnGBNzNSMfTk8vzludxSWfFnOjkviF6E2Elnw3p8f/kOQRAft5dMBY
 ftgoy2yLone3HpKfjuOriicIzg==
 =0GLo
 -----END PGP SIGNATURE-----

Merge tag 'misc-pull-request' of gitlab.com:marcandre.lureau/qemu into staging

Misc cleanups

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmJhYIscHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5W0jD/43n8PL2cv42lq6OaIS
# OYN9vfW9xgA9THZiUH4xEHYreZh+KofmY1PbJn1n7q+v6DecBiqM4fZr1LY8X3PM
# xRUH0l4gjXwYwX2cSSo5UTZ/PF248Uoo3tUE3vgMFkYghHMjKcTtaSkYEPGHf2nR
# t3m1qLG9w9YPhVg7PNCntjUKi+w2TtcrRVzP7V7XyFc1HrAoT0ys6KaBBrXMbcjz
# SxTRbcwSq+6aPjQIn0RWp8Hp1HkdNjegB98dkyqRLlVaugHZWPYDXDQTgVziQlX8
# dU8YrlvTOtDWwsNP6awWnW6/IjKuJjGR0wT3QKwi8JAZ0YV3egwEKoQRUAyHtnn2
# FkSMYgmJcF0ai1aIJFAx+3PIzCfS49lKXA0t303DtY3hRR9JKGMwaV2do9Wm2irt
# o7T1lKKN7R7R8Q3U4OsatYMYm7KYL07NEDiQCPloGvCo27ezkAWCKXAw1mRUkxKF
# jKwJPcnOUq21Jp6tpjsR8ifSw70jBSEWQSGqhXnDhZhx2C2/Qqkg2I8DagLiPger
# kYxbQ13LTG0R25YHa1r3UmzuD+HpZOM8XoLJc5yun/1UrwyR9ghHrOoxkSnRT2Ks
# QFn//xQ2SzUnGBNzNSMfTk8vzludxSWfFnOjkviF6E2Elnw3p8f/kOQRAft5dMBY
# ftgoy2yLone3HpKfjuOriicIzg==
# =0GLo
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 21 Apr 2022 06:47:55 AM PDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]

* tag 'misc-pull-request' of gitlab.com:marcandre.lureau/qemu: (30 commits)
  qga: use fixed-length and GDateTime for log timestamp
  tests/fuzz: fix warning
  qga: remove need for QEMU atomic.h
  util: replace qemu_get_local_state_pathname()
  util: use qemu_create() in qemu_write_pidfile()
  util: use qemu_write_full() in qemu_write_pidfile()
  util: simplify write in signal handler
  qtest: simplify socket_send()
  qga: move qga_get_host_name()
  Move error_printf_unless_qmp() with monitor unit
  tests: run-time skip test-qga if TSAN is enabled
  compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}
  tests: remove block/qdict checks from check-qobject.c
  include: move qdict_{crumple,flatten} declarations
  include: add qemu/keyval.h
  include: move qemu_fdatasync() to osdep
  include: move qemu_msync() to osdep
  compiler.h: replace QEMU_NORETURN with G_NORETURN
  osdep.h: move qemu_build_not_reached()
  doc/style: CLang -> Clang
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-04-21 09:27:54 -07:00
commit 28298069af
110 changed files with 476 additions and 483 deletions

View File

@ -28,12 +28,12 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size,
g_assert_not_reached(); g_assert_not_reached();
} }
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu) G_NORETURN void cpu_loop_exit(CPUState *cpu)
{ {
g_assert_not_reached(); g_assert_not_reached();
} }
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc)
{ {
g_assert_not_reached(); g_assert_not_reached();
} }

View File

@ -14,8 +14,7 @@
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc,
target_ulong cs_base, uint32_t flags, target_ulong cs_base, uint32_t flags,
int cflags); int cflags);
G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
void page_init(void); void page_init(void);
void tb_htable_init(void); void tb_htable_init(void);

View File

@ -24,7 +24,7 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/accel.h" #include "qemu/accel.h"
#include "qemu-version.h" #include "qemu-version.h"

View File

@ -347,7 +347,8 @@ static int core_dump_signal(int sig)
} }
/* Abort execution with signal. */ /* Abort execution with signal. */
static void QEMU_NORETURN dump_core_and_abort(int target_sig) static G_NORETURN
void dump_core_and_abort(int target_sig)
{ {
CPUArchState *env = thread_cpu->env_ptr; CPUArchState *env = thread_cpu->env_ptr;
CPUState *cpu = env_cpu(env); CPUState *cpu = env_cpu(env);

View File

@ -522,7 +522,7 @@ documented in the GNU Compiler Collection manual starting at version 4.0.
Automatic memory deallocation Automatic memory deallocation
============================= =============================
QEMU has a mandatory dependency either the GCC or CLang compiler. As QEMU has a mandatory dependency on either the GCC or the Clang compiler. As
such it has the freedom to make use of a C language extension for such it has the freedom to make use of a C language extension for
automatically running a cleanup function when a stack variable goes automatically running a cleanup function when a stack variable goes
out of scope. This can be used to simplify function cleanup paths, out of scope. This can be used to simplify function cleanup paths,

View File

@ -48,7 +48,7 @@ file. During build, the "trace-events" file in each listed subdirectory will be
processed by the "tracetool" script to generate code for the trace events. processed by the "tracetool" script to generate code for the trace events.
The individual "trace-events" files are merged into a "trace-events-all" file, The individual "trace-events" files are merged into a "trace-events-all" file,
which is also installed into "/usr/share/qemu" with the name "trace-events". which is also installed into "/usr/share/qemu".
This merged file is to be used by the "simpletrace.py" script to later analyse This merged file is to be used by the "simpletrace.py" script to later analyse
traces in the simpletrace data format. traces in the simpletrace data format.

View File

@ -130,9 +130,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
int i; int i;
for (i = 0; i < AW_A10_NUM_USB; i++) { for (i = 0; i < AW_A10_NUM_USB; i++) {
char bus[16]; g_autofree char *bus = g_strdup_printf("usb-bus.%d", i);
sprintf(bus, "usb-bus.%d", i);
object_property_set_bool(OBJECT(&s->ehci[i]), "companion-enable", object_property_set_bool(OBJECT(&s->ehci[i]), "companion-enable",
true, &error_fatal); true, &error_fatal);

View File

@ -39,10 +39,7 @@ static void digic_init(Object *obj)
object_initialize_child(obj, "cpu", &s->cpu, ARM_CPU_TYPE_NAME("arm946")); object_initialize_child(obj, "cpu", &s->cpu, ARM_CPU_TYPE_NAME("arm946"));
for (i = 0; i < DIGIC4_NB_TIMERS; i++) { for (i = 0; i < DIGIC4_NB_TIMERS; i++) {
#define DIGIC_TIMER_NAME_MLEN 11 g_autofree char *name = g_strdup_printf("timer[%d]", i);
char name[DIGIC_TIMER_NAME_MLEN];
snprintf(name, DIGIC_TIMER_NAME_MLEN, "timer[%d]", i);
object_initialize_child(obj, name, &s->timer[i], TYPE_DIGIC_TIMER); object_initialize_child(obj, name, &s->timer[i], TYPE_DIGIC_TIMER);
} }

View File

@ -10,7 +10,6 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "qemu-common.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "migration/vmstate.h" #include "migration/vmstate.h"
#include "hw/qdev-properties.h" #include "hw/qdev-properties.h"

View File

@ -56,10 +56,6 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp)
Object *obj = OBJECT(dev); Object *obj = OBJECT(dev);
Exynos4210GicState *s = EXYNOS4210_GIC(obj); Exynos4210GicState *s = EXYNOS4210_GIC(obj);
SysBusDevice *sbd = SYS_BUS_DEVICE(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
const char cpu_prefix[] = "exynos4210-gic-alias_cpu";
const char dist_prefix[] = "exynos4210-gic-alias_dist";
char cpu_alias_name[sizeof(cpu_prefix) + 3];
char dist_alias_name[sizeof(cpu_prefix) + 3];
SysBusDevice *gicbusdev; SysBusDevice *gicbusdev;
uint32_t n = s->num_cpu; uint32_t n = s->num_cpu;
uint32_t i; uint32_t i;
@ -89,8 +85,10 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp)
*/ */
assert(n <= EXYNOS4210_GIC_NCPUS); assert(n <= EXYNOS4210_GIC_NCPUS);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
g_autofree char *cpu_alias_name = g_strdup_printf("exynos4210-gic-alias_cpu%u", i);
g_autofree char *dist_alias_name = g_strdup_printf("exynos4210-gic-alias_dist%u", i);
/* Map CPU interface per SMP Core */ /* Map CPU interface per SMP Core */
sprintf(cpu_alias_name, "%s%x", cpu_prefix, i);
memory_region_init_alias(&s->cpu_alias[i], obj, memory_region_init_alias(&s->cpu_alias[i], obj,
cpu_alias_name, cpu_alias_name,
sysbus_mmio_get_region(gicbusdev, 1), sysbus_mmio_get_region(gicbusdev, 1),
@ -100,7 +98,6 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp)
EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]); EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]);
/* Map Distributor per SMP Core */ /* Map Distributor per SMP Core */
sprintf(dist_alias_name, "%s%x", dist_prefix, i);
memory_region_init_alias(&s->dist_alias[i], obj, memory_region_init_alias(&s->dist_alias[i], obj,
dist_alias_name, dist_alias_name,
sysbus_mmio_get_region(gicbusdev, 0), sysbus_mmio_get_region(gicbusdev, 0),

View File

@ -189,7 +189,8 @@ static void wake_blocked_threads(ITCStorageCell *c)
c->blocked_threads = 0; c->blocked_threads = 0;
} }
static void QEMU_NORETURN block_thread_and_exit(ITCStorageCell *c) static G_NORETURN
void block_thread_and_exit(ITCStorageCell *c)
{ {
c->blocked_threads |= 1ULL << current_cpu->cpu_index; c->blocked_threads |= 1ULL << current_cpu->cpu_index;
current_cpu->halted = 1; current_cpu->halted = 1;

View File

@ -12,6 +12,9 @@
#include "qapi/qmp/qdict.h" #include "qapi/qmp/qdict.h"
QObject *qdict_crumple(const QDict *src, Error **errp);
void qdict_flatten(QDict *qdict);
void qdict_copy_default(QDict *dst, QDict *src, const char *key); void qdict_copy_default(QDict *dst, QDict *src, const char *key);
void qdict_set_default_str(QDict *dst, const char *key, const char *val); void qdict_set_default_str(QDict *dst, const char *key, const char *val);

View File

@ -58,10 +58,10 @@ void restore_state_to_opc(CPUArchState *env, TranslationBlock *tb,
*/ */
bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc, bool will_exit); bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc, bool will_exit);
void QEMU_NORETURN cpu_loop_exit_noexc(CPUState *cpu); G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu);
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); G_NORETURN void cpu_loop_exit(CPUState *cpu);
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
void QEMU_NORETURN cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc);
/** /**
* cpu_loop_exit_requested: * cpu_loop_exit_requested:
@ -669,9 +669,9 @@ bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set,
* Use the TCGCPUOps hook to record cpu state, do guest operating system * Use the TCGCPUOps hook to record cpu state, do guest operating system
* specific things to raise SIGSEGV, and jump to the main cpu loop. * specific things to raise SIGSEGV, and jump to the main cpu loop.
*/ */
void QEMU_NORETURN cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, G_NORETURN void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr,
MMUAccessType access_type, MMUAccessType access_type,
bool maperr, uintptr_t ra); bool maperr, uintptr_t ra);
/** /**
* cpu_loop_exit_sigbus: * cpu_loop_exit_sigbus:
@ -683,9 +683,9 @@ void QEMU_NORETURN cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr,
* Use the TCGCPUOps hook to record cpu state, do guest operating system * Use the TCGCPUOps hook to record cpu state, do guest operating system
* specific things to raise SIGBUS, and jump to the main cpu loop. * specific things to raise SIGBUS, and jump to the main cpu loop.
*/ */
void QEMU_NORETURN cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, G_NORETURN void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr,
MMUAccessType access_type, MMUAccessType access_type,
uintptr_t ra); uintptr_t ra);
#else #else
static inline void mmap_lock(void) {} static inline void mmap_lock(void) {}

View File

@ -46,7 +46,7 @@
#define dh_ctype_ptr void * #define dh_ctype_ptr void *
#define dh_ctype_cptr const void * #define dh_ctype_cptr const void *
#define dh_ctype_void void #define dh_ctype_void void
#define dh_ctype_noreturn void QEMU_NORETURN #define dh_ctype_noreturn G_NORETURN void
#define dh_ctype(t) dh_ctype_##t #define dh_ctype(t) dh_ctype_##t
#ifdef NEED_CPU_H #ifdef NEED_CPU_H

View File

@ -145,16 +145,10 @@ qemu_g_test_slow(void)
#define g_test_thorough() qemu_g_test_slow() #define g_test_thorough() qemu_g_test_slow()
#define g_test_quick() (!qemu_g_test_slow()) #define g_test_quick() (!qemu_g_test_slow())
#if GLIB_CHECK_VERSION(2,62,0)
static inline gchar *
g_date_time_format_iso8601_compat(GDateTime *datetime)
{
return g_date_time_format_iso8601(datetime);
}
#define g_date_time_format_iso8601 g_date_time_format_iso8601_compat
#endif
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#ifndef G_NORETURN
#define G_NORETURN G_GNUC_NORETURN
#endif
#endif #endif

View File

@ -1015,7 +1015,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);
*/ */
AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx); AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
G_GNUC_PRINTF(2, 3); G_GNUC_PRINTF(2, 3);
/* $(top_srcdir)/cpu.c */ /* $(top_srcdir)/cpu.c */

View File

@ -78,9 +78,9 @@ struct TCGCPUOps {
* @do_unaligned_access: Callback for unaligned access handling * @do_unaligned_access: Callback for unaligned access handling
* The callback must exit via raising an exception. * The callback must exit via raising an exception.
*/ */
void (*do_unaligned_access)(CPUState *cpu, vaddr addr, G_NORETURN void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
MMUAccessType access_type, MMUAccessType access_type,
int mmu_idx, uintptr_t retaddr) QEMU_NORETURN; int mmu_idx, uintptr_t retaddr);
/** /**
* @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM

View File

@ -5,6 +5,6 @@
#error Cannot include hw/hw.h from user emulation #error Cannot include hw/hw.h from user emulation
#endif #endif
void QEMU_NORETURN hw_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2); G_NORETURN void hw_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
#endif #endif

View File

@ -56,4 +56,7 @@ void monitor_register_hmp(const char *name, bool info,
void monitor_register_hmp_info_hrt(const char *name, void monitor_register_hmp_info_hrt(const char *name,
HumanReadableText *(*handler)(Error **errp)); HumanReadableText *(*handler)(Error **errp));
int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
#endif /* MONITOR_H */ #endif /* MONITOR_H */

View File

@ -68,7 +68,4 @@ const char *qdict_get_try_str(const QDict *qdict, const char *key);
QDict *qdict_clone_shallow(const QDict *src); QDict *qdict_clone_shallow(const QDict *src);
QObject *qdict_crumple(const QDict *src, Error **errp);
void qdict_flatten(QDict *qdict);
#endif /* QDICT_H */ #endif /* QDICT_H */

10
include/qemu-main.h Normal file
View File

@ -0,0 +1,10 @@
/*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef QEMU_MAIN_H
#define QEMU_MAIN_H
int qemu_main(int argc, char **argv, char **envp);
#endif /* QEMU_MAIN_H */

View File

@ -22,8 +22,6 @@
#define QEMU_EXTERN_C extern #define QEMU_EXTERN_C extern
#endif #endif
#define QEMU_NORETURN __attribute__ ((__noreturn__))
#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
# define QEMU_PACKED __attribute__((gcc_struct, packed)) # define QEMU_PACKED __attribute__((gcc_struct, packed))
#else #else
@ -108,6 +106,14 @@
#define __has_attribute(x) 0 /* compatibility with older GCC */ #define __has_attribute(x) 0 /* compatibility with older GCC */
#endif #endif
#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
# define QEMU_SANITIZE_ADDRESS 1
#endif
#if defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer)
# define QEMU_SANITIZE_THREAD 1
#endif
/* /*
* GCC doesn't provide __has_attribute() until GCC 5, but we know all the GCC * GCC doesn't provide __has_attribute() until GCC 5, but we know all the GCC
* versions we support have the "flatten" attribute. Clang may not have the * versions we support have the "flatten" attribute. Clang may not have the
@ -156,22 +162,6 @@
#define QEMU_ALWAYS_INLINE #define QEMU_ALWAYS_INLINE
#endif #endif
/**
* qemu_build_not_reached()
*
* The compiler, during optimization, is expected to prove that a call
* to this function cannot be reached and remove it. If the compiler
* supports QEMU_ERROR, this will be reported at compile time; otherwise
* this will be reported at link time due to the missing symbol.
*/
extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
qemu_build_not_reached_always(void);
#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
#define qemu_build_not_reached() qemu_build_not_reached_always()
#else
#define qemu_build_not_reached() g_assert_not_reached()
#endif
/** /**
* In most cases, normal "fallthrough" comments are good enough for * In most cases, normal "fallthrough" comments are good enough for
* switch-case statements, but sometimes the compiler has problems * switch-case statements, but sometimes the compiler has problems

View File

@ -129,8 +129,6 @@ static inline const char *qemu_strchrnul(const char *s, int c)
const char *qemu_strchrnul(const char *s, int c); const char *qemu_strchrnul(const char *s, int c);
#endif #endif
time_t mktimegm(struct tm *tm); time_t mktimegm(struct tm *tm);
int qemu_fdatasync(int fd);
int qemu_msync(void *addr, size_t length, int fd);
int qemu_parse_fd(const char *param); int qemu_parse_fd(const char *param);
int qemu_strtoi(const char *nptr, const char **endptr, int base, int qemu_strtoi(const char *nptr, const char **endptr, int base,
int *result); int *result);

View File

@ -32,8 +32,6 @@ void loc_set_file(const char *fname, int lno);
int error_vprintf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); int error_vprintf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
int error_printf(const char *fmt, ...) G_GNUC_PRINTF(1, 2); int error_printf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
void error_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); void error_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
void warn_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0); void warn_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);

View File

@ -10,9 +10,4 @@
"See <https://qemu.org/contribute/report-a-bug> for how to report bugs.\n" \ "See <https://qemu.org/contribute/report-a-bug> for how to report bugs.\n" \
"More information on the QEMU project at <https://qemu.org>." "More information on the QEMU project at <https://qemu.org>."
/* main function, renamed */
#if defined(CONFIG_COCOA)
int qemu_main(int argc, char **argv, char **envp);
#endif
#endif #endif

14
include/qemu/keyval.h Normal file
View File

@ -0,0 +1,14 @@
/*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef KEYVAL_H_
#define KEYVAL_H_
QDict *keyval_parse_into(QDict *qdict, const char *params, const char *implied_key,
bool *p_help, Error **errp);
QDict *keyval_parse(const char *params, const char *implied_key,
bool *help, Error **errp);
void keyval_merge(QDict *old, const QDict *new, Error **errp);
#endif /* KEYVAL_H_ */

View File

@ -144,12 +144,6 @@ void qemu_opts_print_help(QemuOptsList *list, bool print_caption);
void qemu_opts_free(QemuOptsList *list); void qemu_opts_free(QemuOptsList *list);
QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list); QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list);
QDict *keyval_parse_into(QDict *qdict, const char *params, const char *implied_key,
bool *p_help, Error **errp);
QDict *keyval_parse(const char *params, const char *implied_key,
bool *help, Error **errp);
void keyval_merge(QDict *old, const QDict *new, Error **errp);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuOpts, qemu_opts_del) G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuOpts, qemu_opts_del)
#endif #endif

View File

@ -169,6 +169,23 @@ extern "C" {
#define assert(x) g_assert(x) #define assert(x) g_assert(x)
#endif #endif
/**
* qemu_build_not_reached()
*
* The compiler, during optimization, is expected to prove that a call
* to this function cannot be reached and remove it. If the compiler
* supports QEMU_ERROR, this will be reported at compile time; otherwise
* this will be reported at link time due to the missing symbol.
*/
extern G_NORETURN
void QEMU_ERROR("code path is reachable")
qemu_build_not_reached_always(void);
#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
#define qemu_build_not_reached() qemu_build_not_reached_always()
#else
#define qemu_build_not_reached() g_assert_not_reached()
#endif
/* /*
* According to waitpid man page: * According to waitpid man page:
* WCOREDUMP * WCOREDUMP
@ -539,16 +556,13 @@ void qemu_set_cloexec(int fd);
void fips_set_state(bool requested); void fips_set_state(bool requested);
bool fips_get_state(void); bool fips_get_state(void);
/* Return a dynamically allocated pathname denoting a file or directory that is /* Return a dynamically allocated directory path that is appropriate for storing
* appropriate for storing local state. * local state.
*
* @relative_pathname need not start with a directory separator; one will be
* added automatically.
* *
* The caller is responsible for releasing the value returned with g_free() * The caller is responsible for releasing the value returned with g_free()
* after use. * after use.
*/ */
char *qemu_get_local_state_pathname(const char *relative_pathname); char *qemu_get_local_state_dir(void);
/* Find program directory, and save it for later usage with /* Find program directory, and save it for later usage with
* qemu_get_exec_dir(). * qemu_get_exec_dir().
@ -624,15 +638,20 @@ static inline void qemu_reset_optind(void)
#endif #endif
} }
int qemu_fdatasync(int fd);
/** /**
* qemu_get_host_name: * Sync changes made to the memory mapped file back to the backing
* @errp: Error object * storage. For POSIX compliant systems this will fallback
* to regular msync call. Otherwise it will trigger whole file sync
* (including the metadata case there is no support to skip that otherwise)
* *
* Operating system agnostic way of querying host name. * @addr - start of the memory area to be synced
* * @length - length of the are to be synced
* Returns allocated hostname (caller should free), NULL on failure. * @fd - file descriptor for the file to be synced
* (mandatory only for POSIX non-compliant systems)
*/ */
char *qemu_get_host_name(Error **errp); int qemu_msync(void *addr, size_t length, int fd);
/** /**
* qemu_get_host_physmem: * qemu_get_host_physmem:

View File

@ -188,7 +188,7 @@ void qemu_thread_create(QemuThread *thread, const char *name,
void *qemu_thread_join(QemuThread *thread); void *qemu_thread_join(QemuThread *thread);
void qemu_thread_get_self(QemuThread *thread); void qemu_thread_get_self(QemuThread *thread);
bool qemu_thread_is_self(QemuThread *thread); bool qemu_thread_is_self(QemuThread *thread);
void qemu_thread_exit(void *retval) QEMU_NORETURN; G_NORETURN void qemu_thread_exit(void *retval);
void qemu_thread_naming(bool enable); void qemu_thread_naming(bool enable);
struct Notifier; struct Notifier;

View File

@ -72,8 +72,8 @@ void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
#else #else
void QEMU_NORETURN helper_unaligned_ld(CPUArchState *env, target_ulong addr); G_NORETURN void helper_unaligned_ld(CPUArchState *env, target_ulong addr);
void QEMU_NORETURN helper_unaligned_st(CPUArchState *env, target_ulong addr); G_NORETURN void helper_unaligned_st(CPUArchState *env, target_ulong addr);
#endif /* CONFIG_SOFTMMU */ #endif /* CONFIG_SOFTMMU */
#endif /* TCG_LDST_H */ #endif /* TCG_LDST_H */

View File

@ -398,7 +398,7 @@ typedef TCGv_ptr TCGv_env;
#define TCG_CALL_NO_WRITE_GLOBALS 0x0002 #define TCG_CALL_NO_WRITE_GLOBALS 0x0002
/* Helper can be safely suppressed if the return value is not used. */ /* Helper can be safely suppressed if the return value is not used. */
#define TCG_CALL_NO_SIDE_EFFECTS 0x0004 #define TCG_CALL_NO_SIDE_EFFECTS 0x0004
/* Helper is QEMU_NORETURN. */ /* Helper is G_NORETURN. */
#define TCG_CALL_NO_RETURN 0x0008 #define TCG_CALL_NO_RETURN 0x0008
/* convenience version of most used call flags */ /* convenience version of most used call flags */

View File

@ -18,7 +18,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/accel.h" #include "qemu/accel.h"
#include "qemu-version.h" #include "qemu-version.h"

View File

@ -725,7 +725,8 @@ void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr,
} }
/* abort execution with signal */ /* abort execution with signal */
static void QEMU_NORETURN dump_core_and_abort(int target_sig) static G_NORETURN
void dump_core_and_abort(int target_sig)
{ {
CPUState *cpu = thread_cpu; CPUState *cpu = thread_cpu;
CPUArchState *env = cpu->env_ptr; CPUArchState *env = cpu->env_ptr;

View File

@ -64,7 +64,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg5, abi_long arg6, abi_long arg7, abi_long arg5, abi_long arg6, abi_long arg7,
abi_long arg8); abi_long arg8);
extern __thread CPUState *thread_cpu; extern __thread CPUState *thread_cpu;
void QEMU_NORETURN cpu_loop(CPUArchState *env); G_NORETURN void cpu_loop(CPUArchState *env);
const char *target_strerror(int err); const char *target_strerror(int err);
int get_osversion(void); int get_osversion(void);
void init_qemu_uname_release(void); void init_qemu_uname_release(void);

View File

@ -308,8 +308,8 @@ void help_cmd(Monitor *mon, const char *name)
static const char *pch; static const char *pch;
static sigjmp_buf expr_env; static sigjmp_buf expr_env;
static void G_GNUC_PRINTF(2, 3) QEMU_NORETURN static G_NORETURN G_GNUC_PRINTF(2, 3)
expr_error(Monitor *mon, const char *fmt, ...) void expr_error(Monitor *mon, const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

View File

@ -286,6 +286,16 @@ int error_vprintf_unless_qmp(const char *fmt, va_list ap)
return -1; return -1;
} }
int error_printf_unless_qmp(const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = error_vprintf_unless_qmp(fmt, ap);
va_end(ap);
return ret;
}
static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = { static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = {
/* Limit guest-triggerable events to 1 per second */ /* Limit guest-triggerable events to 1 per second */

View File

@ -28,7 +28,7 @@
#include "qapi/qmp/qnum.h" #include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h" #include "qapi/qmp/qstring.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/option.h" #include "qemu/keyval.h"
typedef struct StackObject { typedef struct StackObject {
const char *name; /* Name of @obj in its parent, if any */ const char *name; /* Name of @obj in its parent, if any */

View File

@ -25,7 +25,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include <getopt.h> #include <getopt.h>
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qemu/qemu-progress.h" #include "qemu/qemu-progress.h"
#include "qemu-version.h" #include "qemu-version.h"
#include "qapi/error.h" #include "qapi/error.h"
@ -100,7 +100,8 @@ static void format_print(void *opaque, const char *name)
printf(" %s", name); printf(" %s", name);
} }
static void QEMU_NORETURN G_GNUC_PRINTF(1, 2) error_exit(const char *fmt, ...) static G_NORETURN G_GNUC_PRINTF(1, 2)
void error_exit(const char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -112,18 +113,21 @@ static void QEMU_NORETURN G_GNUC_PRINTF(1, 2) error_exit(const char *fmt, ...)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
static void QEMU_NORETURN missing_argument(const char *option) static G_NORETURN
void missing_argument(const char *option)
{ {
error_exit("missing argument for option '%s'", option); error_exit("missing argument for option '%s'", option);
} }
static void QEMU_NORETURN unrecognized_option(const char *option) static G_NORETURN
void unrecognized_option(const char *option)
{ {
error_exit("unrecognized option '%s'", option); error_exit("unrecognized option '%s'", option);
} }
/* Please keep in synch with docs/tools/qemu-img.rst */ /* Please keep in synch with docs/tools/qemu-img.rst */
static void QEMU_NORETURN help(void) static G_NORETURN
void help(void)
{ {
const char *help_msg = const char *help_msg =
QEMU_IMG_VERSION QEMU_IMG_VERSION

View File

@ -15,7 +15,7 @@
#include <termios.h> #include <termios.h>
#endif #endif
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-io.h" #include "qemu-io.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"

View File

@ -21,7 +21,7 @@
#include <libgen.h> #include <libgen.h>
#include <pthread.h> #include <pthread.h>
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "sysemu/block-backend.h" #include "sysemu/block-backend.h"

View File

@ -18,4 +18,15 @@ GuestFileHandle *guest_file_handle_find(int64_t id, Error **errp);
GuestFileRead *guest_file_read_unsafe(GuestFileHandle *gfh, GuestFileRead *guest_file_read_unsafe(GuestFileHandle *gfh,
int64_t count, Error **errp); int64_t count, Error **errp);
/**
* qga_get_host_name:
* @errp: Error object
*
* Operating system agnostic way of querying host name.
* Compared to g_get_host_name(), it doesn't cache the result.
*
* Returns allocated hostname (caller should free), NULL on failure.
*/
char *qga_get_host_name(Error **errp);
#endif #endif

View File

@ -3278,3 +3278,38 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)
return NULL; return NULL;
} }
#ifndef HOST_NAME_MAX
# ifdef _POSIX_HOST_NAME_MAX
# define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
# else
# define HOST_NAME_MAX 255
# endif
#endif
char *qga_get_host_name(Error **errp)
{
long len = -1;
g_autofree char *hostname = NULL;
#ifdef _SC_HOST_NAME_MAX
len = sysconf(_SC_HOST_NAME_MAX);
#endif /* _SC_HOST_NAME_MAX */
if (len < 0) {
len = HOST_NAME_MAX;
}
/* Unfortunately, gethostname() below does not guarantee a
* NULL terminated string. Therefore, allocate one byte more
* to be sure. */
hostname = g_new0(char, len + 1);
if (gethostname(hostname, len) < 0) {
error_setg_errno(errp, errno,
"cannot get hostname");
return NULL;
}
return g_steal_pointer(&hostname);
}

View File

@ -2519,3 +2519,16 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)
} }
return head; return head;
} }
char *qga_get_host_name(Error **errp)
{
wchar_t tmp[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = G_N_ELEMENTS(tmp);
if (GetComputerNameW(tmp, &size) == 0) {
error_setg_win32(errp, GetLastError(), "failed close handle");
return NULL;
}
return g_utf16_to_utf8(tmp, size, NULL, NULL, NULL);
}

View File

@ -18,7 +18,6 @@
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "qemu/base64.h" #include "qemu/base64.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/atomic.h"
#include "commands-common.h" #include "commands-common.h"
/* Maximum captured guest-exec out_data/err_data - 16MB */ /* Maximum captured guest-exec out_data/err_data - 16MB */
@ -162,13 +161,12 @@ GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error **errp)
ges = g_new0(GuestExecStatus, 1); ges = g_new0(GuestExecStatus, 1);
bool finished = qatomic_mb_read(&gei->finished); bool finished = gei->finished;
/* need to wait till output channels are closed /* need to wait till output channels are closed
* to be sure we captured all output at this point */ * to be sure we captured all output at this point */
if (gei->has_output) { if (gei->has_output) {
finished = finished && qatomic_mb_read(&gei->out.closed); finished &= gei->out.closed && gei->err.closed;
finished = finished && qatomic_mb_read(&gei->err.closed);
} }
ges->exited = finished; ges->exited = finished;
@ -270,7 +268,7 @@ static void guest_exec_child_watch(GPid pid, gint status, gpointer data)
(int32_t)gpid_to_int64(pid), (uint32_t)status); (int32_t)gpid_to_int64(pid), (uint32_t)status);
gei->status = status; gei->status = status;
qatomic_mb_set(&gei->finished, true); gei->finished = true;
g_spawn_close_pid(pid); g_spawn_close_pid(pid);
} }
@ -326,7 +324,7 @@ static gboolean guest_exec_input_watch(GIOChannel *ch,
done: done:
g_io_channel_shutdown(ch, true, NULL); g_io_channel_shutdown(ch, true, NULL);
g_io_channel_unref(ch); g_io_channel_unref(ch);
qatomic_mb_set(&p->closed, true); p->closed = true;
g_free(p->data); g_free(p->data);
return false; return false;
@ -380,7 +378,7 @@ static gboolean guest_exec_output_watch(GIOChannel *ch,
close: close:
g_io_channel_shutdown(ch, true, NULL); g_io_channel_shutdown(ch, true, NULL);
g_io_channel_unref(ch); g_io_channel_unref(ch);
qatomic_mb_set(&p->closed, true); p->closed = true;
return false; return false;
} }
@ -511,7 +509,7 @@ int ga_parse_whence(GuestFileWhence *whence, Error **errp)
GuestHostName *qmp_guest_get_host_name(Error **errp) GuestHostName *qmp_guest_get_host_name(Error **errp)
{ {
GuestHostName *result = NULL; GuestHostName *result = NULL;
g_autofree char *hostname = qemu_get_host_name(errp); g_autofree char *hostname = qga_get_host_name(errp);
/* /*
* We want to avoid using g_get_host_name() because that * We want to avoid using g_get_host_name() because that

View File

@ -18,7 +18,7 @@
#include <syslog.h> #include <syslog.h>
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qapi/qmp/json-parser.h" #include "qapi/qmp/json-parser.h"
#include "qapi/qmp/qdict.h" #include "qapi/qmp/qdict.h"
#include "qapi/qmp/qjson.h" #include "qapi/qmp/qjson.h"
@ -129,12 +129,12 @@ static void stop_agent(GAState *s, bool requested);
static void static void
init_dfl_pathnames(void) init_dfl_pathnames(void)
{ {
g_autofree char *state = qemu_get_local_state_dir();
g_assert(dfl_pathnames.state_dir == NULL); g_assert(dfl_pathnames.state_dir == NULL);
g_assert(dfl_pathnames.pidfile == NULL); g_assert(dfl_pathnames.pidfile == NULL);
dfl_pathnames.state_dir = qemu_get_local_state_pathname( dfl_pathnames.state_dir = g_build_filename(state, QGA_STATE_RELATIVE_DIR, NULL);
QGA_STATE_RELATIVE_DIR); dfl_pathnames.pidfile = g_build_filename(state, QGA_STATE_RELATIVE_DIR, "qemu-ga.pid", NULL);
dfl_pathnames.pidfile = qemu_get_local_state_pathname(
QGA_STATE_RELATIVE_DIR G_DIR_SEPARATOR_S "qemu-ga.pid");
} }
static void quit_handler(int sig) static void quit_handler(int sig)
@ -328,11 +328,9 @@ static void ga_log(const gchar *domain, GLogLevelFlags level,
#else #else
if (level & s->log_level) { if (level & s->log_level) {
#endif #endif
gint64 t = g_get_real_time(); g_autoptr(GDateTime) now = g_date_time_new_now_utc();
fprintf(s->log_file, g_autofree char *nowstr = g_date_time_format(now, "%s.%f");
"%" G_GINT64_FORMAT ".%" G_GINT64_FORMAT fprintf(s->log_file, "%s: %s: %s\n", nowstr, level_str, msg);
": %s: %s\n", t / G_USEC_PER_SEC, t % G_USEC_PER_SEC,
level_str, msg);
fflush(s->log_file); fflush(s->log_file);
} }
} }
@ -610,7 +608,7 @@ static gboolean channel_event_cb(GIOCondition condition, gpointer data)
* host-side chardev. sleep a bit to mitigate this * host-side chardev. sleep a bit to mitigate this
*/ */
if (s->virtio) { if (s->virtio) {
usleep(100 * 1000); g_usleep(G_USEC_PER_SEC / 10);
} }
return true; return true;
default: default:

View File

@ -17,6 +17,7 @@
#include "qemu/qemu-print.h" #include "qemu/qemu-print.h"
#include "qapi/opts-visitor.h" #include "qapi/opts-visitor.h"
#include "qemu/config-file.h" #include "qemu/config-file.h"
#include "qemu/keyval.h"
bool user_creatable_complete(UserCreatable *uc, Error **errp) bool user_creatable_complete(UserCreatable *uc, Error **errp)
{ {

View File

@ -46,7 +46,6 @@ grep_include() {
} }
echo Found $(find . -name "*.d" | wc -l) object files echo Found $(find . -name "*.d" | wc -l) object files
echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
echo $(grep_include -F 'hw/hw.h') files include hw/hw.h echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
echo $(grep_include 'target/[a-z0-9]*/cpu\.h') files include cpu.h echo $(grep_include 'target/[a-z0-9]*/cpu\.h') files include cpu.h
echo $(grep_include -F 'qapi-types.h') files include qapi-types.h echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
@ -86,9 +85,6 @@ analyze() {
echo osdep.h: echo osdep.h:
analyze ../include/qemu/osdep.h analyze ../include/qemu/osdep.h
echo qemu-common.h:
analyze -include ../include/qemu/osdep.h ../include/qemu-common.h
echo hw/hw.h: echo hw/hw.h:
analyze -include ../include/qemu/osdep.h ../include/hw/hw.h analyze -include ../include/qemu/osdep.h ../include/hw/hw.h

View File

@ -223,7 +223,7 @@ our $Sparse = qr{
our $Attribute = qr{ our $Attribute = qr{
const| const|
volatile| volatile|
QEMU_NORETURN| G_NORETURN|
G_GNUC_WARN_UNUSED_RESULT| G_GNUC_WARN_UNUSED_RESULT|
G_GNUC_NULL_TERMINATED| G_GNUC_NULL_TERMINATED|
QEMU_PACKED| QEMU_PACKED|

View File

@ -19,7 +19,7 @@
*/ */
/* From qemu/compiler.h */ /* From qemu/compiler.h */
#define QEMU_NORETURN __attribute__ ((__noreturn__)) #define G_NORETURN __attribute__ ((__noreturn__))
#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#define G_GNUC_NULL_TERMINATED __attribute__((sentinel)) #define G_GNUC_NULL_TERMINATED __attribute__((sentinel))

View File

@ -36,7 +36,7 @@
#include <mpath_persist.h> #include <mpath_persist.h>
#endif #endif
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
@ -77,8 +77,10 @@ static int gid = -1;
static void compute_default_paths(void) static void compute_default_paths(void)
{ {
socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock"); g_autofree char *state = qemu_get_local_state_dir();
pidfile = qemu_get_local_state_pathname("run/qemu-pr-helper.pid");
socket_path = g_build_filename(state, "run", "qemu-pr-helper.sock", NULL);
pidfile = g_build_filename(state, "run", "qemu-pr-helper.pid", NULL);
} }
static void usage(const char *name) static void usage(const char *name)

View File

@ -23,28 +23,14 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu-common.h" #include "qemu-main.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#ifdef CONFIG_SDL #ifdef CONFIG_SDL
#if defined(__APPLE__) || defined(main)
#include <SDL.h> #include <SDL.h>
static int qemu_main(int argc, char **argv, char **envp);
int main(int argc, char **argv)
{
return qemu_main(argc, argv, NULL);
}
#undef main
#define main qemu_main
#endif #endif
#endif /* CONFIG_SDL */
#ifdef CONFIG_COCOA int qemu_main(int argc, char **argv, char **envp)
#undef main
#define main qemu_main
#endif /* CONFIG_COCOA */
int main(int argc, char **argv, char **envp)
{ {
qemu_init(argc, argv, envp); qemu_init(argc, argv, envp);
qemu_main_loop(); qemu_main_loop();
@ -52,3 +38,10 @@ int main(int argc, char **argv, char **envp)
return 0; return 0;
} }
#ifndef CONFIG_COCOA
int main(int argc, char **argv)
{
return qemu_main(argc, argv, NULL);
}
#endif

View File

@ -23,7 +23,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qemu/datadir.h" #include "qemu/datadir.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "exec/cpu-common.h" #include "exec/cpu-common.h"
@ -125,9 +125,11 @@
#include "qapi/qapi-visit-qom.h" #include "qapi/qapi-visit-qom.h"
#include "qapi/qapi-commands-ui.h" #include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qdict.h" #include "qapi/qmp/qdict.h"
#include "block/qdict.h"
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "sysemu/iothread.h" #include "sysemu/iothread.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "qemu/keyval.h"
#include "config-host.h" #include "config-host.h"

View File

@ -42,7 +42,7 @@
#include "qapi/qmp/qstring.h" #include "qapi/qmp/qstring.h"
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "qemu-common.h" #include "qemu/help-texts.h"
#include "qemu-version.h" #include "qemu-version.h"
#include "qemu/config-file.h" #include "qemu/config-file.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"

View File

@ -1,5 +1,6 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "monitor/monitor.h"
int error_vprintf(const char *fmt, va_list ap) int error_vprintf(const char *fmt, va_list ap)
{ {

View File

@ -434,8 +434,8 @@ void alpha_translate_init(void);
#define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU #define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU
void alpha_cpu_list(void); void alpha_cpu_list(void);
void QEMU_NORETURN dynamic_excp(CPUAlphaState *, uintptr_t, int, int); G_NORETURN void dynamic_excp(CPUAlphaState *, uintptr_t, int, int);
void QEMU_NORETURN arith_excp(CPUAlphaState *, uintptr_t, int, uint64_t); G_NORETURN void arith_excp(CPUAlphaState *, uintptr_t, int, uint64_t);
uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env); uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env);
void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val); void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val);
@ -452,9 +452,9 @@ void alpha_cpu_record_sigbus(CPUState *cs, vaddr address,
bool alpha_cpu_tlb_fill(CPUState *cs, vaddr address, int size, bool alpha_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr); bool probe, uintptr_t retaddr);
void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, G_NORETURN void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
vaddr addr, unsigned size, vaddr addr, unsigned size,
MMUAccessType access_type, MMUAccessType access_type,

View File

@ -514,7 +514,7 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags)
/* This should only be called from translate, via gen_excp. /* This should only be called from translate, via gen_excp.
We expect that ENV->PC has already been updated. */ We expect that ENV->PC has already been updated. */
void QEMU_NORETURN helper_excp(CPUAlphaState *env, int excp, int error) G_NORETURN void helper_excp(CPUAlphaState *env, int excp, int error)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -524,8 +524,8 @@ void QEMU_NORETURN helper_excp(CPUAlphaState *env, int excp, int error)
} }
/* This may be called from any of the helpers to set up EXCEPTION_INDEX. */ /* This may be called from any of the helpers to set up EXCEPTION_INDEX. */
void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, G_NORETURN void dynamic_excp(CPUAlphaState *env, uintptr_t retaddr,
int excp, int error) int excp, int error)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -539,8 +539,8 @@ void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr,
cpu_loop_exit(cs); cpu_loop_exit(cs);
} }
void QEMU_NORETURN arith_excp(CPUAlphaState *env, uintptr_t retaddr, G_NORETURN void arith_excp(CPUAlphaState *env, uintptr_t retaddr,
int exc, uint64_t mask) int exc, uint64_t mask)
{ {
env->trap_arg0 = exc; env->trap_arg0 = exc;
env->trap_arg1 = mask; env->trap_arg1 = mask;

View File

@ -102,13 +102,13 @@ FIELD(V7M_EXCRET, RES1, 7, 25) /* including the must-be-1 prefix */
* and target exception level. This should be called from helper functions, * and target exception level. This should be called from helper functions,
* and never returns because we will longjump back up to the CPU main loop. * and never returns because we will longjump back up to the CPU main loop.
*/ */
void QEMU_NORETURN raise_exception(CPUARMState *env, uint32_t excp, G_NORETURN void raise_exception(CPUARMState *env, uint32_t excp,
uint32_t syndrome, uint32_t target_el); uint32_t syndrome, uint32_t target_el);
/* /*
* Similarly, but also use unwinding to restore cpu state. * Similarly, but also use unwinding to restore cpu state.
*/ */
void QEMU_NORETURN raise_exception_ra(CPUARMState *env, uint32_t excp, G_NORETURN void raise_exception_ra(CPUARMState *env, uint32_t excp,
uint32_t syndrome, uint32_t target_el, uint32_t syndrome, uint32_t target_el,
uintptr_t ra); uintptr_t ra);
@ -606,9 +606,9 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);
bool arm_s1_regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx); bool arm_s1_regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx);
/* Raise a data fault alignment exception for the specified virtual address */ /* Raise a data fault alignment exception for the specified virtual address */
void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, G_NORETURN void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
MMUAccessType access_type, MMUAccessType access_type,
int mmu_idx, uintptr_t retaddr) QEMU_NORETURN; int mmu_idx, uintptr_t retaddr);
/* arm_cpu_do_transaction_failed: handle a memory system error response /* arm_cpu_do_transaction_failed: handle a memory system error response
* (eg "no device/memory present at address") by raising an external abort * (eg "no device/memory present at address") by raising an external abort

View File

@ -382,8 +382,8 @@ static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data)
return pauth_original_ptr(ptr, param); return pauth_original_ptr(ptr, param);
} }
static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el, static G_NORETURN
uintptr_t ra) void pauth_trap(CPUARMState *env, int target_el, uintptr_t ra)
{ {
raise_exception_ra(env, EXCP_UDEF, syn_pactrap(), target_el, ra); raise_exception_ra(env, EXCP_UDEF, syn_pactrap(), target_el, ra);
} }

View File

@ -79,9 +79,10 @@ static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi,
return fsr; return fsr;
} }
static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, static G_NORETURN
MMUAccessType access_type, void arm_deliver_fault(ARMCPU *cpu, vaddr addr,
int mmu_idx, ARMMMUFaultInfo *fi) MMUAccessType access_type,
int mmu_idx, ARMMMUFaultInfo *fi)
{ {
CPUARMState *env = &cpu->env; CPUARMState *env = &cpu->env;
int target_el; int target_el;

View File

@ -34,9 +34,10 @@
#define SF_MANTBITS 23 #define SF_MANTBITS 23
/* Exceptions processing helpers */ /* Exceptions processing helpers */
static void QEMU_NORETURN do_raise_exception_err(CPUHexagonState *env, static G_NORETURN
uint32_t exception, void do_raise_exception_err(CPUHexagonState *env,
uintptr_t pc) uint32_t exception,
uintptr_t pc)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
qemu_log_mask(CPU_LOG_INT, "%s: %d\n", __func__, exception); qemu_log_mask(CPU_LOG_INT, "%s: %d\n", __func__, exception);
@ -44,7 +45,7 @@ static void QEMU_NORETURN do_raise_exception_err(CPUHexagonState *env,
cpu_loop_exit_restore(cs, pc); cpu_loop_exit_restore(cs, pc);
} }
void QEMU_NORETURN HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp) G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp)
{ {
do_raise_exception_err(env, excp, 0); do_raise_exception_err(env, excp, 0);
} }

View File

@ -73,10 +73,10 @@ static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info)
} }
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
static void QEMU_NORETURN static G_NORETURN
hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) uintptr_t retaddr)
{ {
HPPACPU *cpu = HPPA_CPU(cs); HPPACPU *cpu = HPPA_CPU(cs);
CPUHPPAState *env = &cpu->env; CPUHPPAState *env = &cpu->env;

View File

@ -339,6 +339,6 @@ extern const VMStateDescription vmstate_hppa_cpu;
void hppa_cpu_alarm_timer(void *); void hppa_cpu_alarm_timer(void *);
int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr); int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr);
#endif #endif
void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra); G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra);
#endif /* HPPA_CPU_H */ #endif /* HPPA_CPU_H */

View File

@ -28,7 +28,7 @@
#include "fpu/softfloat.h" #include "fpu/softfloat.h"
#include "trace.h" #include "trace.h"
void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp) G_NORETURN void HELPER(excp)(CPUHPPAState *env, int excp)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -36,7 +36,7 @@ void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp)
cpu_loop_exit(cs); cpu_loop_exit(cs);
} }
void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra) G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);

View File

@ -22,7 +22,7 @@
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "helper-tcg.h" #include "helper-tcg.h"
void QEMU_NORETURN helper_single_step(CPUX86State *env) G_NORETURN void helper_single_step(CPUX86State *env)
{ {
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
check_hw_breakpoints(env, true); check_hw_breakpoints(env, true);

View File

@ -25,13 +25,13 @@
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "helper-tcg.h" #include "helper-tcg.h"
void QEMU_NORETURN helper_raise_interrupt(CPUX86State *env, int intno, G_NORETURN void helper_raise_interrupt(CPUX86State *env, int intno,
int next_eip_addend) int next_eip_addend)
{ {
raise_interrupt(env, intno, 1, 0, next_eip_addend); raise_interrupt(env, intno, 1, 0, next_eip_addend);
} }
void QEMU_NORETURN helper_raise_exception(CPUX86State *env, int exception_index) G_NORETURN void helper_raise_exception(CPUX86State *env, int exception_index)
{ {
raise_exception(env, exception_index); raise_exception(env, exception_index);
} }
@ -87,10 +87,11 @@ static int check_exception(CPUX86State *env, int intno, int *error_code,
* env->eip value AFTER the interrupt instruction. It is only relevant if * env->eip value AFTER the interrupt instruction. It is only relevant if
* is_int is TRUE. * is_int is TRUE.
*/ */
static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno, static G_NORETURN
int is_int, int error_code, void raise_interrupt2(CPUX86State *env, int intno,
int next_eip_addend, int is_int, int error_code,
uintptr_t retaddr) int next_eip_addend,
uintptr_t retaddr)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -111,31 +112,31 @@ static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno,
/* shortcuts to generate exceptions */ /* shortcuts to generate exceptions */
void QEMU_NORETURN raise_interrupt(CPUX86State *env, int intno, int is_int, G_NORETURN void raise_interrupt(CPUX86State *env, int intno, int is_int,
int error_code, int next_eip_addend) int error_code, int next_eip_addend)
{ {
raise_interrupt2(env, intno, is_int, error_code, next_eip_addend, 0); raise_interrupt2(env, intno, is_int, error_code, next_eip_addend, 0);
} }
void QEMU_NORETURN raise_exception_err(CPUX86State *env, int exception_index, G_NORETURN void raise_exception_err(CPUX86State *env, int exception_index,
int error_code) int error_code)
{ {
raise_interrupt2(env, exception_index, 0, error_code, 0, 0); raise_interrupt2(env, exception_index, 0, error_code, 0, 0);
} }
void QEMU_NORETURN raise_exception_err_ra(CPUX86State *env, int exception_index, G_NORETURN void raise_exception_err_ra(CPUX86State *env, int exception_index,
int error_code, uintptr_t retaddr) int error_code, uintptr_t retaddr)
{ {
raise_interrupt2(env, exception_index, 0, error_code, 0, retaddr); raise_interrupt2(env, exception_index, 0, error_code, 0, retaddr);
} }
void QEMU_NORETURN raise_exception(CPUX86State *env, int exception_index) G_NORETURN void raise_exception(CPUX86State *env, int exception_index)
{ {
raise_interrupt2(env, exception_index, 0, 0, 0, 0); raise_interrupt2(env, exception_index, 0, 0, 0, 0);
} }
void QEMU_NORETURN raise_exception_ra(CPUX86State *env, int exception_index, G_NORETURN void raise_exception_ra(CPUX86State *env, int exception_index,
uintptr_t retaddr) uintptr_t retaddr)
{ {
raise_interrupt2(env, exception_index, 0, 0, 0, retaddr); raise_interrupt2(env, exception_index, 0, 0, 0, retaddr);
} }

View File

@ -69,27 +69,27 @@ static inline target_long lshift(target_long x, int n)
void tcg_x86_init(void); void tcg_x86_init(void);
/* excp_helper.c */ /* excp_helper.c */
void QEMU_NORETURN raise_exception(CPUX86State *env, int exception_index); G_NORETURN void raise_exception(CPUX86State *env, int exception_index);
void QEMU_NORETURN raise_exception_ra(CPUX86State *env, int exception_index, G_NORETURN void raise_exception_ra(CPUX86State *env, int exception_index,
uintptr_t retaddr); uintptr_t retaddr);
void QEMU_NORETURN raise_exception_err(CPUX86State *env, int exception_index, G_NORETURN void raise_exception_err(CPUX86State *env, int exception_index,
int error_code); int error_code);
void QEMU_NORETURN raise_exception_err_ra(CPUX86State *env, int exception_index, G_NORETURN void raise_exception_err_ra(CPUX86State *env, int exception_index,
int error_code, uintptr_t retaddr); int error_code, uintptr_t retaddr);
void QEMU_NORETURN raise_interrupt(CPUX86State *nenv, int intno, int is_int, G_NORETURN void raise_interrupt(CPUX86State *nenv, int intno, int is_int,
int error_code, int next_eip_addend); int error_code, int next_eip_addend);
/* cc_helper.c */ /* cc_helper.c */
extern const uint8_t parity_table[256]; extern const uint8_t parity_table[256];
/* misc_helper.c */ /* misc_helper.c */
void cpu_load_eflags(CPUX86State *env, int eflags, int update_mask); void cpu_load_eflags(CPUX86State *env, int eflags, int update_mask);
void do_pause(CPUX86State *env) QEMU_NORETURN; G_NORETURN void do_pause(CPUX86State *env);
/* sysemu/svm_helper.c */ /* sysemu/svm_helper.c */
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
void QEMU_NORETURN cpu_vmexit(CPUX86State *nenv, uint32_t exit_code, G_NORETURN void cpu_vmexit(CPUX86State *nenv, uint32_t exit_code,
uint64_t exit_info_1, uintptr_t retaddr); uint64_t exit_info_1, uintptr_t retaddr);
void do_vmexit(CPUX86State *env); void do_vmexit(CPUX86State *env);
#endif #endif

View File

@ -81,7 +81,7 @@ void helper_rdtscp(CPUX86State *env)
env->regs[R_ECX] = (uint32_t)(env->tsc_aux); env->regs[R_ECX] = (uint32_t)(env->tsc_aux);
} }
void QEMU_NORETURN helper_rdpmc(CPUX86State *env) G_NORETURN void helper_rdpmc(CPUX86State *env)
{ {
if (((env->cr[4] & CR4_PCE_MASK) == 0 ) && if (((env->cr[4] & CR4_PCE_MASK) == 0 ) &&
((env->hflags & HF_CPL_MASK) != 0)) { ((env->hflags & HF_CPL_MASK) != 0)) {
@ -94,7 +94,7 @@ void QEMU_NORETURN helper_rdpmc(CPUX86State *env)
raise_exception_err(env, EXCP06_ILLOP, 0); raise_exception_err(env, EXCP06_ILLOP, 0);
} }
void QEMU_NORETURN do_pause(CPUX86State *env) G_NORETURN void do_pause(CPUX86State *env)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -103,7 +103,7 @@ void QEMU_NORETURN do_pause(CPUX86State *env)
cpu_loop_exit(cs); cpu_loop_exit(cs);
} }
void QEMU_NORETURN helper_pause(CPUX86State *env, int next_eip_addend) G_NORETURN void helper_pause(CPUX86State *env, int next_eip_addend)
{ {
cpu_svm_check_intercept_param(env, SVM_EXIT_PAUSE, 0, GETPC()); cpu_svm_check_intercept_param(env, SVM_EXIT_PAUSE, 0, GETPC());
env->eip += next_eip_addend; env->eip += next_eip_addend;

View File

@ -471,7 +471,8 @@ void helper_flush_page(CPUX86State *env, target_ulong addr)
tlb_flush_page(env_cpu(env), addr); tlb_flush_page(env_cpu(env), addr);
} }
static void QEMU_NORETURN do_hlt(CPUX86State *env) static G_NORETURN
void do_hlt(CPUX86State *env)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -481,7 +482,7 @@ static void QEMU_NORETURN do_hlt(CPUX86State *env)
cpu_loop_exit(cs); cpu_loop_exit(cs);
} }
void QEMU_NORETURN helper_hlt(CPUX86State *env, int next_eip_addend) G_NORETURN void helper_hlt(CPUX86State *env, int next_eip_addend)
{ {
cpu_svm_check_intercept_param(env, SVM_EXIT_HLT, 0, GETPC()); cpu_svm_check_intercept_param(env, SVM_EXIT_HLT, 0, GETPC());
env->eip += next_eip_addend; env->eip += next_eip_addend;
@ -498,7 +499,7 @@ void helper_monitor(CPUX86State *env, target_ulong ptr)
cpu_svm_check_intercept_param(env, SVM_EXIT_MONITOR, 0, GETPC()); cpu_svm_check_intercept_param(env, SVM_EXIT_MONITOR, 0, GETPC());
} }
void QEMU_NORETURN helper_mwait(CPUX86State *env, int next_eip_addend) G_NORETURN void helper_mwait(CPUX86State *env, int next_eip_addend)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);

View File

@ -359,9 +359,9 @@ struct ArchCPU {
void mb_cpu_do_interrupt(CPUState *cs); void mb_cpu_do_interrupt(CPUState *cs);
bool mb_cpu_exec_interrupt(CPUState *cs, int int_req); bool mb_cpu_exec_interrupt(CPUState *cs, int int_req);
#endif /* !CONFIG_USER_ONLY */ #endif /* !CONFIG_USER_ONLY */
void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
MMUAccessType access_type, MMUAccessType access_type,
int mmu_idx, uintptr_t retaddr) QEMU_NORETURN; int mmu_idx, uintptr_t retaddr);
void mb_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void mb_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
MemTxAttrs *attrs); MemTxAttrs *attrs);

View File

@ -18,18 +18,19 @@
void mips_tcg_init(void); void mips_tcg_init(void);
void mips_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); void mips_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb);
void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, G_NORETURN void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
const char *mips_exception_name(int32_t exception); const char *mips_exception_name(int32_t exception);
void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env, uint32_t exception, G_NORETURN void do_raise_exception_err(CPUMIPSState *env, uint32_t exception,
int error_code, uintptr_t pc); int error_code, uintptr_t pc);
static inline void QEMU_NORETURN do_raise_exception(CPUMIPSState *env, static inline G_NORETURN
uint32_t exception, void do_raise_exception(CPUMIPSState *env,
uintptr_t pc) uint32_t exception,
uintptr_t pc)
{ {
do_raise_exception_err(env, exception, 0, pc); do_raise_exception_err(env, exception, 0, pc);
} }

View File

@ -194,9 +194,9 @@ void nios2_cpu_do_interrupt(CPUState *cs);
void dump_mmu(CPUNios2State *env); void dump_mmu(CPUNios2State *env);
void nios2_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void nios2_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
hwaddr nios2_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); hwaddr nios2_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, G_NORETURN void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
void do_nios2_semihosting(CPUNios2State *env); void do_nios2_semihosting(CPUNios2State *env);

View File

@ -22,7 +22,7 @@
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exception.h" #include "exception.h"
void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp) G_NORETURN void raise_exception(OpenRISCCPU *cpu, uint32_t excp)
{ {
CPUState *cs = CPU(cpu); CPUState *cs = CPU(cpu);

View File

@ -22,6 +22,6 @@
#include "cpu.h" #include "cpu.h"
void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp); G_NORETURN void raise_exception(OpenRISCCPU *cpu, uint32_t excp);
#endif /* TARGET_OPENRISC_EXCEPTION_H */ #endif /* TARGET_OPENRISC_EXCEPTION_H */

View File

@ -30,7 +30,8 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp)
raise_exception(cpu, excp); raise_exception(cpu, excp);
} }
static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) static G_NORETURN
void do_range(CPUOpenRISCState *env, uintptr_t pc)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);

View File

@ -2492,13 +2492,13 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
} }
#endif #endif
void QEMU_NORETURN raise_exception(CPUPPCState *env, uint32_t exception); G_NORETURN void raise_exception(CPUPPCState *env, uint32_t exception);
void QEMU_NORETURN raise_exception_ra(CPUPPCState *env, uint32_t exception, G_NORETURN void raise_exception_ra(CPUPPCState *env, uint32_t exception,
uintptr_t raddr); uintptr_t raddr);
void QEMU_NORETURN raise_exception_err(CPUPPCState *env, uint32_t exception, G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception,
uint32_t error_code); uint32_t error_code);
void QEMU_NORETURN raise_exception_err_ra(CPUPPCState *env, uint32_t exception, G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception,
uint32_t error_code, uintptr_t raddr); uint32_t error_code, uintptr_t raddr);
/* PERFM EBB helper*/ /* PERFM EBB helper*/
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)

View File

@ -286,9 +286,9 @@ void ppc_cpu_record_sigsegv(CPUState *cs, vaddr addr,
bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size, bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr); bool probe, uintptr_t retaddr);
void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, G_NORETURN void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
#endif #endif
#endif /* PPC_INTERNAL_H */ #endif /* PPC_INTERNAL_H */

View File

@ -451,9 +451,9 @@ void riscv_cpu_set_virt_enabled(CPURISCVState *env, bool enable);
bool riscv_cpu_two_stage_lookup(int mmu_idx); bool riscv_cpu_two_stage_lookup(int mmu_idx);
int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch); int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch);
hwaddr riscv_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); hwaddr riscv_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr, G_NORETURN void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr); bool probe, uintptr_t retaddr);
@ -487,8 +487,8 @@ void riscv_cpu_set_aia_ireg_rmw_fn(CPURISCVState *env, uint32_t priv,
void riscv_cpu_set_mode(CPURISCVState *env, target_ulong newpriv); void riscv_cpu_set_mode(CPURISCVState *env, target_ulong newpriv);
void riscv_translate_init(void); void riscv_translate_init(void);
void QEMU_NORETURN riscv_raise_exception(CPURISCVState *env, G_NORETURN void riscv_raise_exception(CPURISCVState *env,
uint32_t exception, uintptr_t pc); uint32_t exception, uintptr_t pc);
target_ulong riscv_cpu_get_fflags(CPURISCVState *env); target_ulong riscv_cpu_get_fflags(CPURISCVState *env);
void riscv_cpu_set_fflags(CPURISCVState *env, target_ulong); void riscv_cpu_set_fflags(CPURISCVState *env, target_ulong);

View File

@ -24,8 +24,8 @@
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
/* Exceptions processing helpers */ /* Exceptions processing helpers */
void QEMU_NORETURN riscv_raise_exception(CPURISCVState *env, G_NORETURN void riscv_raise_exception(CPURISCVState *env,
uint32_t exception, uintptr_t pc) uint32_t exception, uintptr_t pc)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
cs->exception_index = exception; cs->exception_index = exception;

View File

@ -24,8 +24,9 @@
#include "exec/cpu_ldst.h" #include "exec/cpu_ldst.h"
#include "fpu/softfloat.h" #include "fpu/softfloat.h"
static inline void QEMU_NORETURN raise_exception(CPURXState *env, int index, static inline G_NORETURN
uintptr_t retaddr); void raise_exception(CPURXState *env, int index,
uintptr_t retaddr);
static void _set_psw(CPURXState *env, uint32_t psw, uint32_t rte) static void _set_psw(CPURXState *env, uint32_t psw, uint32_t rte)
{ {
@ -418,8 +419,9 @@ uint32_t helper_divu(CPURXState *env, uint32_t num, uint32_t den)
} }
/* exception */ /* exception */
static inline void QEMU_NORETURN raise_exception(CPURXState *env, int index, static inline G_NORETURN
uintptr_t retaddr) void raise_exception(CPURXState *env, int index,
uintptr_t retaddr)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -427,22 +429,22 @@ static inline void QEMU_NORETURN raise_exception(CPURXState *env, int index,
cpu_loop_exit_restore(cs, retaddr); cpu_loop_exit_restore(cs, retaddr);
} }
void QEMU_NORETURN helper_raise_privilege_violation(CPURXState *env) G_NORETURN void helper_raise_privilege_violation(CPURXState *env)
{ {
raise_exception(env, 20, GETPC()); raise_exception(env, 20, GETPC());
} }
void QEMU_NORETURN helper_raise_access_fault(CPURXState *env) G_NORETURN void helper_raise_access_fault(CPURXState *env)
{ {
raise_exception(env, 21, GETPC()); raise_exception(env, 21, GETPC());
} }
void QEMU_NORETURN helper_raise_illegal_instruction(CPURXState *env) G_NORETURN void helper_raise_illegal_instruction(CPURXState *env)
{ {
raise_exception(env, 23, GETPC()); raise_exception(env, 23, GETPC());
} }
void QEMU_NORETURN helper_wait(CPURXState *env) G_NORETURN void helper_wait(CPURXState *env)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -451,12 +453,12 @@ void QEMU_NORETURN helper_wait(CPURXState *env)
raise_exception(env, EXCP_HLT, 0); raise_exception(env, EXCP_HLT, 0);
} }
void QEMU_NORETURN helper_rxint(CPURXState *env, uint32_t vec) G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec)
{ {
raise_exception(env, 0x100 + vec, 0); raise_exception(env, 0x100 + vec, 0);
} }
void QEMU_NORETURN helper_rxbrk(CPURXState *env) G_NORETURN void helper_rxbrk(CPURXState *env)
{ {
raise_exception(env, 0x100, 0); raise_exception(env, 0x100, 0);
} }

View File

@ -280,9 +280,9 @@ void s390_cpu_record_sigbus(CPUState *cs, vaddr address,
bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
bool probe, uintptr_t retaddr); bool probe, uintptr_t retaddr);
void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr, G_NORETURN void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
#endif #endif

View File

@ -34,8 +34,8 @@
#include "hw/boards.h" #include "hw/boards.h"
#endif #endif
void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env, G_NORETURN void tcg_s390_program_interrupt(CPUS390XState *env,
uint32_t code, uintptr_t ra) uint32_t code, uintptr_t ra)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
@ -46,8 +46,8 @@ void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env,
cpu_loop_exit(cs); cpu_loop_exit(cs);
} }
void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc, G_NORETURN void tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
uintptr_t ra) uintptr_t ra)
{ {
g_assert(dxc <= 0xff); g_assert(dxc <= 0xff);
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
@ -63,8 +63,8 @@ void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
tcg_s390_program_interrupt(env, PGM_DATA, ra); tcg_s390_program_interrupt(env, PGM_DATA, ra);
} }
void QEMU_NORETURN tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc, G_NORETURN void tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc,
uintptr_t ra) uintptr_t ra)
{ {
g_assert(vxc <= 0xff); g_assert(vxc <= 0xff);
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
@ -88,7 +88,8 @@ void HELPER(data_exception)(CPUS390XState *env, uint32_t dxc)
* this is only for the atomic operations, for which we want to raise a * this is only for the atomic operations, for which we want to raise a
* specification exception. * specification exception.
*/ */
static void QEMU_NORETURN do_unaligned_access(CPUState *cs, uintptr_t retaddr) static G_NORETURN
void do_unaligned_access(CPUState *cs, uintptr_t retaddr)
{ {
S390CPU *cpu = S390_CPU(cs); S390CPU *cpu = S390_CPU(cs);
CPUS390XState *env = &cpu->env; CPUS390XState *env = &cpu->env;
@ -620,9 +621,10 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
do_unaligned_access(cs, retaddr); do_unaligned_access(cs, retaddr);
} }
static void QEMU_NORETURN monitor_event(CPUS390XState *env, static G_NORETURN
uint64_t monitor_code, void monitor_event(CPUS390XState *env,
uint8_t monitor_class, uintptr_t ra) uint64_t monitor_code,
uint8_t monitor_class, uintptr_t ra)
{ {
/* Store the Monitor Code and the Monitor Class Number into the lowcore */ /* Store the Monitor Code and the Monitor Class Number into the lowcore */
stq_phys(env_cpu(env)->as, stq_phys(env_cpu(env)->as,

View File

@ -14,11 +14,11 @@
#define TCG_S390X_H #define TCG_S390X_H
void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque); void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque);
void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env, G_NORETURN void tcg_s390_program_interrupt(CPUS390XState *env,
uint32_t code, uintptr_t ra); uint32_t code, uintptr_t ra);
void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc, G_NORETURN void tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
uintptr_t ra); uintptr_t ra);
void QEMU_NORETURN tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc, G_NORETURN void tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc,
uintptr_t ra); uintptr_t ra);
#endif /* TCG_S390X_H */ #endif /* TCG_S390X_H */

View File

@ -210,9 +210,9 @@ void superh_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
int superh_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int superh_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, G_NORETURN void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
void sh4_translate_init(void); void sh4_translate_init(void);
void sh4_cpu_list(void); void sh4_cpu_list(void);

View File

@ -57,8 +57,9 @@ void helper_ldtlb(CPUSH4State *env)
#endif #endif
} }
static inline void QEMU_NORETURN raise_exception(CPUSH4State *env, int index, static inline G_NORETURN
uintptr_t retaddr) void raise_exception(CPUSH4State *env, int index,
uintptr_t retaddr)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);

View File

@ -575,11 +575,11 @@ void sparc_cpu_do_interrupt(CPUState *cpu);
hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
int sparc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int sparc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, G_NORETURN void sparc_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, MMUAccessType access_type,
int mmu_idx, int mmu_idx,
uintptr_t retaddr); uintptr_t retaddr);
void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t) QEMU_NORETURN; G_NORETURN void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t);
#ifndef NO_CPU_IO_DEFS #ifndef NO_CPU_IO_DEFS
/* cpu_init.c */ /* cpu_init.c */

View File

@ -925,10 +925,10 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
} }
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, G_NORETURN void sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
MMUAccessType access_type, MMUAccessType access_type,
int mmu_idx, int mmu_idx,
uintptr_t retaddr) uintptr_t retaddr)
{ {
SPARCCPU *cpu = SPARC_CPU(cs); SPARCCPU *cpu = SPARC_CPU(cs);
CPUSPARCState *env = &cpu->env; CPUSPARCState *env = &cpu->env;

View File

@ -25,9 +25,9 @@
/* Exception helpers */ /* Exception helpers */
static void QEMU_NORETURN static G_NORETURN
raise_exception_sync_internal(CPUTriCoreState *env, uint32_t class, int tin, void raise_exception_sync_internal(CPUTriCoreState *env, uint32_t class, int tin,
uintptr_t pc, uint32_t fcd_pc) uintptr_t pc, uint32_t fcd_pc)
{ {
CPUState *cs = env_cpu(env); CPUState *cs = env_cpu(env);
/* in case we come from a helper-call we need to restore the PC */ /* in case we come from a helper-call we need to restore the PC */

View File

@ -581,9 +581,9 @@ void xtensa_count_regs(const XtensaConfig *config,
unsigned *n_regs, unsigned *n_core_regs); unsigned *n_regs, unsigned *n_core_regs);
int xtensa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int xtensa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, G_NORETURN void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, int mmu_idx, MMUAccessType access_type, int mmu_idx,
uintptr_t retaddr) QEMU_NORETURN; uintptr_t retaddr);
#define cpu_list xtensa_cpu_list #define cpu_list xtensa_cpu_list

View File

@ -320,7 +320,8 @@ static void set_jmp_reset_offset(TCGContext *s, int which)
} }
/* Signal overflow, starting over with fewer guest insns. */ /* Signal overflow, starting over with fewer guest insns. */
static void QEMU_NORETURN tcg_raise_tb_overflow(TCGContext *s) static G_NORETURN
void tcg_raise_tb_overflow(TCGContext *s)
{ {
siglongjmp(s->jmp_trans, -2); siglongjmp(s->jmp_trans, -2);
} }

View File

@ -545,7 +545,8 @@ static int round_name_to_mode(const char *name)
return -1; return -1;
} }
static void QEMU_NORETURN die_host_rounding(enum rounding rounding) static G_NORETURN
void die_host_rounding(enum rounding rounding)
{ {
fprintf(stderr, "fatal: '%s' rounding not supported on this host\n", fprintf(stderr, "fatal: '%s' rounding not supported on this host\n",
round_names[rounding]); round_names[rounding]);

View File

@ -921,7 +921,8 @@ static void parse_args(int argc, char *argv[])
} }
} }
static void QEMU_NORETURN run_test(void) static G_NORETURN
void run_test(void)
{ {
unsigned int i; unsigned int i;

View File

@ -743,14 +743,12 @@ static void usage(void)
static int locate_fuzz_memory_regions(Object *child, void *opaque) static int locate_fuzz_memory_regions(Object *child, void *opaque)
{ {
const char *name;
MemoryRegion *mr; MemoryRegion *mr;
if (object_dynamic_cast(child, TYPE_MEMORY_REGION)) { if (object_dynamic_cast(child, TYPE_MEMORY_REGION)) {
mr = MEMORY_REGION(child); mr = MEMORY_REGION(child);
if ((memory_region_is_ram(mr) || if ((memory_region_is_ram(mr) ||
memory_region_is_ram_device(mr) || memory_region_is_ram_device(mr) ||
memory_region_is_rom(mr)) == false) { memory_region_is_rom(mr)) == false) {
name = object_get_canonical_path_component(child);
/* /*
* We don't want duplicate pointers to the same MemoryRegion, so * We don't want duplicate pointers to the same MemoryRegion, so
* try to remove copies of the pointer, before adding it. * try to remove copies of the pointer, before adding it.

View File

@ -414,21 +414,9 @@ void qtest_quit(QTestState *s)
static void socket_send(int fd, const char *buf, size_t size) static void socket_send(int fd, const char *buf, size_t size)
{ {
size_t offset; size_t res = qemu_write_full(fd, buf, size);
offset = 0; assert(res == size);
while (offset < size) {
ssize_t len;
len = write(fd, buf + offset, size - offset);
if (len == -1 && errno == EINTR) {
continue;
}
g_assert_cmpint(len, >, 0);
offset += len;
}
} }
static void qtest_client_socket_send(QTestState *s, const char *buf) static void qtest_client_socket_send(QTestState *s, const char *buf)

View File

@ -178,7 +178,6 @@ static void qobject_is_equal_list_test(void)
static void qobject_is_equal_dict_test(void) static void qobject_is_equal_dict_test(void)
{ {
g_autoptr(QDict) dict_cloned = NULL; g_autoptr(QDict) dict_cloned = NULL;
g_autoptr(QDict) dict_crumpled = NULL;
g_autoptr(QDict) dict_0 = qdict_new(); g_autoptr(QDict) dict_0 = qdict_new();
g_autoptr(QDict) dict_1 = qdict_new(); g_autoptr(QDict) dict_1 = qdict_new();
g_autoptr(QDict) dict_different_key = qdict_new(); g_autoptr(QDict) dict_different_key = qdict_new();
@ -236,12 +235,6 @@ static void qobject_is_equal_dict_test(void)
dict_different_null_key, dict_longer, dict_shorter, dict_different_null_key, dict_longer, dict_shorter,
dict_nested); dict_nested);
dict_crumpled = qobject_to(QDict, qdict_crumple(dict_1, &error_abort));
check_equal(dict_crumpled, dict_nested);
qdict_flatten(dict_nested);
check_equal(dict_0, dict_nested);
/* Containing an NaN value will make this dict compare unequal to /* Containing an NaN value will make this dict compare unequal to
* itself */ * itself */
qdict_put(dict_0, "NaN", qnum_from_double(NAN)); qdict_put(dict_0, "NaN", qnum_from_double(NAN));

View File

@ -27,6 +27,7 @@
#include "qom/object.h" #include "qom/object.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/keyval.h"
#include "qemu/config-file.h" #include "qemu/config-file.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"

View File

@ -153,7 +153,7 @@ if have_system
endif endif
endif endif
if have_ga and targetos == 'linux' and 'CONFIG_TSAN' not in config_host if have_ga and targetos == 'linux'
tests += {'test-qga': ['../qtest/libqtest.c']} tests += {'test-qga': ['../qtest/libqtest.c']}
test_deps += {'test-qga': qga} test_deps += {'test-qga': qga}
endif endif

View File

@ -15,7 +15,7 @@
#include "qapi/qmp/qobject.h" #include "qapi/qmp/qobject.h"
#include "qapi/qmp/qdict.h" #include "qapi/qmp/qdict.h"
#include "test-qapi-visit.h" #include "test-qapi-visit.h"
#include "qemu/option.h" #include "qemu/keyval.h"
typedef bool GenericVisitor (Visitor *, const char *, void **, Error **); typedef bool GenericVisitor (Visitor *, const char *, void **, Error **);
#define CAST_VISIT_TYPE(fn) ((GenericVisitor *)(fn)) #define CAST_VISIT_TYPE(fn) ((GenericVisitor *)(fn))

View File

@ -19,7 +19,7 @@
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "test-qapi-visit.h" #include "test-qapi-visit.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/option.h" #include "qemu/keyval.h"
static void test_keyval_parse(void) static void test_keyval_parse(void)
{ {

View File

@ -969,6 +969,13 @@ int main(int argc, char **argv)
TestFixture fix; TestFixture fix;
int ret; int ret;
#ifdef QEMU_SANITIZE_THREAD
{
g_test_skip("tsan enabled, https://github.com/google/sanitizers/issues/1116");
return 0;
}
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
g_test_init(&argc, &argv, NULL); g_test_init(&argc, &argv, NULL);
fixture_setup(&fix, NULL, NULL); fixture_setup(&fix, NULL, NULL);

View File

@ -901,10 +901,12 @@ static bool fv_socket_lock(struct fuse_session *se)
{ {
g_autofree gchar *sk_name = NULL; g_autofree gchar *sk_name = NULL;
g_autofree gchar *pidfile = NULL; g_autofree gchar *pidfile = NULL;
g_autofree gchar *state = NULL;
g_autofree gchar *dir = NULL; g_autofree gchar *dir = NULL;
Error *local_err = NULL; Error *local_err = NULL;
dir = qemu_get_local_state_pathname("run/virtiofsd"); state = qemu_get_local_state_dir();
dir = g_build_filename(state, "run", "virtiofsd", NULL);
if (g_mkdir_with_parents(dir, S_IRWXU) < 0) { if (g_mkdir_with_parents(dir, S_IRWXU) < 0) {
fuse_log(FUSE_LOG_ERR, "%s: Failed to create directory %s: %s\n", fuse_log(FUSE_LOG_ERR, "%s: Failed to create directory %s: %s\n",

Some files were not shown because too many files have changed in this diff Show More