Skip to content
Snippets Groups Projects
  • Peter Maydell's avatar
    27266271
    exec.c: Factor out before/after actions for notdirty memory writes · 27266271
    Peter Maydell authored
    
    The function notdirty_mem_write() has a sequence of actions
    it has to do before and after the actual business of writing
    data to host RAM to ensure that dirty flags are correctly
    updated and we flush any TCG translations for the region.
    We need to do this also in other places that write directly
    to host RAM, most notably the TCG atomic helper functions.
    Pull out the before and after pieces into their own functions.
    
    We use an API where the prepare function stashes the various
    bits of information about the write into a struct for the
    complete function to use, because in the calls for the atomic
    helpers the place where the complete function will be called
    doesn't have the information to hand.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-id: 1511201308-23580-2-git-send-email-peter.maydell@linaro.org
    27266271
    History
    exec.c: Factor out before/after actions for notdirty memory writes
    Peter Maydell authored
    
    The function notdirty_mem_write() has a sequence of actions
    it has to do before and after the actual business of writing
    data to host RAM to ensure that dirty flags are correctly
    updated and we flush any TCG translations for the region.
    We need to do this also in other places that write directly
    to host RAM, most notably the TCG atomic helper functions.
    Pull out the before and after pieces into their own functions.
    
    We use an API where the prepare function stashes the various
    bits of information about the write into a struct for the
    complete function to use, because in the calls for the atomic
    helpers the place where the complete function will be called
    doesn't have the information to hand.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-id: 1511201308-23580-2-git-send-email-peter.maydell@linaro.org
exec.c 107.85 KiB
/*
 *  Virtual page mapping
 *
 *  Copyright (c) 2003 Fabrice Bellard
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#ifndef _WIN32
#endif

#include "qemu/cutils.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/target_page.h"
#include "tcg.h"
#include "hw/qdev-core.h"
#include "hw/qdev-properties.h"
#if !defined(CONFIG_USER_ONLY)
#include "hw/boards.h"
#include "hw/xen/xen.h"
#endif
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
#include "qemu/timer.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#if defined(CONFIG_USER_ONLY)
#include "qemu.h"
#else /* !CONFIG_USER_ONLY */
#include "hw/hw.h"
#include "exec/memory.h"
#include "exec/ioport.h"
#include "sysemu/dma.h"
#include "sysemu/numa.h"
#include "sysemu/hw_accel.h"
#include "exec/address-spaces.h"
#include "sysemu/xen-mapcache.h"
#include "trace-root.h"

#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
#include <fcntl.h>
#include <linux/falloc.h>
#endif

#endif
#include "qemu/rcu_queue.h"
#include "qemu/main-loop.h"
#include "translate-all.h"
#include "sysemu/replay.h"

#include "exec/memory-internal.h"
#include "exec/ram_addr.h"
#include "exec/log.h"

#include "migration/vmstate.h"

#include "qemu/range.h"