|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCHv4 3/5] exec: Introduce helper to set dirty flags.
On Tue, 19 Feb 2013, Alex Bligh wrote:
> This new helper/hook is used in the next patch to add an extra call in a
> single
> place.
>
> Backport of 51d7a9eb2b64e787c90bea1027308087eac22065
>
> Signed-off-by: Alex Bligh <alex@xxxxxxxxxxx>
> ---
> exec.c | 45 +++++++++++++++++----------------------------
> 1 files changed, 17 insertions(+), 28 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index 6c206ff..511777b 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3951,6 +3951,18 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong
> addr,
> }
>
> #else
> +
> +static void invalidate_and_set_dirty(target_phys_addr_t addr,
> + target_phys_addr_t length)
> +{
> + if (!cpu_physical_memory_is_dirty(addr)) {
> + /* invalidate code */
> + tb_invalidate_phys_page_range(addr, addr + length, 0);
> + /* set dirty bit */
> + cpu_physical_memory_set_dirty_flags(addr, (0xff & ~CODE_DIRTY_FLAG));
> + }
> +}
> +
> void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
> int len, int is_write)
> {
> @@ -4003,13 +4015,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr,
> uint8_t *buf,
> /* RAM case */
> ptr = qemu_get_ram_ptr(addr1);
> memcpy(ptr, buf, l);
> - if (!cpu_physical_memory_is_dirty(addr1)) {
> - /* invalidate code */
> - tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
> - /* set dirty bit */
> - cpu_physical_memory_set_dirty_flags(
> - addr1, (0xff & ~CODE_DIRTY_FLAG));
> - }
> + invalidate_and_set_dirty(addr1, l);
> qemu_put_ram_ptr(ptr);
> }
> } else {
> @@ -4081,6 +4087,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t
> addr,
> /* ROM/RAM case */
> ptr = qemu_get_ram_ptr(addr1);
> memcpy(ptr, buf, l);
> + invalidate_and_set_dirty(addr1, l);
> qemu_put_ram_ptr(ptr);
> }
> len -= l;
In QEMU the code style is spaces for indentation.
Moreover the right way of doing the backport here would be firstly to
backport 0b57e287, then 51d7a9eb2b64e787c90bea1027308087eac22065 should
just apply.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |