aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/core/qdev-properties-system.c8
-rw-r--r--nbd/client.c13
-rw-r--r--target-i386/cpu.c3
-rw-r--r--target-i386/kvm.c2
-rw-r--r--target-i386/machine.c4
-rw-r--r--vl.c10
6 files changed, 22 insertions, 18 deletions
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index c35f0f59d6..1b7ea50e9f 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -200,18 +200,14 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
}
s = qemu_chr_find(str);
- g_free(str);
if (s == NULL) {
error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(obj), prop->name, str);
- return;
- }
-
- if (!qemu_chr_fe_init(be, s, errp)) {
+ } else if (!qemu_chr_fe_init(be, s, errp)) {
error_prepend(errp, "Property '%s.%s' can't take value '%s': ",
object_get_typename(obj), prop->name, str);
- return;
}
+ g_free(str);
}
static void release_chr(Object *obj, const char *name, void *opaque)
diff --git a/nbd/client.c b/nbd/client.c
index 7db4301d29..ffb0743bce 100644
--- a/nbd/client.c
+++ b/nbd/client.c
@@ -90,20 +90,21 @@ static QTAILQ_HEAD(, NBDExport) exports = QTAILQ_HEAD_INITIALIZER(exports);
* the amount of bytes consumed. */
static ssize_t drop_sync(QIOChannel *ioc, size_t size)
{
- ssize_t ret, dropped = size;
+ ssize_t ret = 0;
char small[1024];
char *buffer;
buffer = sizeof(small) < size ? small : g_malloc(MIN(65536, size));
while (size > 0) {
- ret = read_sync(ioc, buffer, MIN(65536, size));
- if (ret < 0) {
+ ssize_t count = read_sync(ioc, buffer, MIN(65536, size));
+
+ if (count <= 0) {
goto cleanup;
}
- assert(ret <= size);
- size -= ret;
+ assert(count <= size);
+ size -= count;
+ ret += count;
}
- ret = dropped;
cleanup:
if (buffer != small) {
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 14c5186fe7..6eec5dc86d 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -3721,6 +3721,9 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
cc->vmsd = &vmstate_x86_cpu;
#endif
+ /* CPU_NB_REGS * 2 = general regs + xmm regs
+ * 25 = eip, eflags, 6 seg regs, st[0-7], fctrl,...,fop, mxcsr.
+ */
cc->gdb_num_core_regs = CPU_NB_REGS * 2 + 25;
#ifndef CONFIG_USER_ONLY
cc->debug_excp_handler = breakpoint_handler;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 1c0864ed16..f62264a7a8 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -2855,7 +2855,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run)
if (run->flags & KVM_RUN_X86_SMM) {
env->hflags |= HF_SMM_MASK;
} else {
- env->hflags &= HF_SMM_MASK;
+ env->hflags &= ~HF_SMM_MASK;
}
if (run->if_flag) {
env->eflags |= IF_MASK;
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 48037f1575..760f82b6c7 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -709,6 +709,10 @@ static bool hyperv_runtime_enable_needed(void *opaque)
X86CPU *cpu = opaque;
CPUX86State *env = &cpu->env;
+ if (!cpu->hyperv_runtime) {
+ return false;
+ }
+
return env->msr_hv_runtime != 0;
}
diff --git a/vl.c b/vl.c
index 319f6413f2..d77dd862f9 100644
--- a/vl.c
+++ b/vl.c
@@ -4063,6 +4063,11 @@ int main(int argc, char **argv, char **envp)
os_daemonize();
+ if (pid_file && qemu_create_pidfile(pid_file) != 0) {
+ error_report("could not acquire pid file: %s", strerror(errno));
+ exit(1);
+ }
+
if (qemu_init_main_loop(&main_loop_err)) {
error_report_err(main_loop_err);
exit(1);
@@ -4340,11 +4345,6 @@ int main(int argc, char **argv, char **envp)
}
#endif
- if (pid_file && qemu_create_pidfile(pid_file) != 0) {
- error_report("could not acquire pid file: %s", strerror(errno));
- exit(1);
- }
-
if (qemu_opts_foreach(qemu_find_opts("device"),
device_help_func, NULL, NULL)) {
exit(0);