watch_mem_write: implement 8-byte accesses
PATCH 1/1 watch_mem_write: implement 8-byte accesses
Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should always turn into atomic 8-byte writes on the host, however a write write watchpoint would end up tearing the 8-byte write into two 4-byte writes in access_with_adjusted_size().
--- exec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
exec.c +16 -0
@@ -2503,6 +2503,9 @@ static MemTxResult watch_mem_read(void *opaque, hwaddr addr, uint64_t *pdata,case 4 : data =address_space_ldl (as, addr, attrs, &res);break ; +case 8 : + data =address_space_ldq (as, addr, attrs, &res); +break ;default :abort (); } *pdata = data;
@@ -2528,6 +2531,9 @@ static MemTxResult watch_mem_write(void *opaque, hwaddr addr,case 4 :address_space_stl (as, addr, val, attrs, &res);break ; +case 8 : +address_space_stq (as, addr, val, attrs, &res); +break ;default :abort (); }return res;
@@ -2537,6 +2543,16 @@ static const MemoryRegionOps watch_mem_ops = { .read_with_attrs = watch_mem_read, .write_with_attrs = watch_mem_write, .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 1, + .max_access_size = 8, + .unaligned = false, + }, + .impl = { + .min_access_size = 1, + .max_access_size = 8, + .unaligned = false, + }, }; static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
Signature · 1 line
2.14.2
Quoted 10 lines · Paolo Bonzini
Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should always turn into atomic 8-byte writes on the host, however a write write watchpoint would end up tearing the 8-byte write into two 4-byte writes in
access_with_adjusted_size().Reported-by Andrew Baumann <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
r~
Quoted 3 lines · Paolo Bonzini
Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should always turn into atomic 8-byte writes on the host, however a write write watchpoint would end up tearing the 8-byte write into two 4-byte
s/write\nwrite/write/
Quoted 4 lines
writes in
access_with_adjusted_size().Reported-by Andrew Baumann <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>
E.
Quoted 7 lines · Paolo Bonzini
Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should always turn into atomic 8-byte writes on the host, however a write write watchpoint would end up tearing the 8-byte write into two 4-byte writes in
access_with_adjusted_size().Reported-by Andrew Baumann <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>
Quoted 46 lines
--- exec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)exec.c +16
-0@@ -2503,6 +2503,9 @@ static MemTxResult watch_mem_read(void *opaque, hwaddr addr, uint64_t *pdata,case 4 : data =address_space_ldl (as, addr, attrs, &res);break ; +case 8 : + data =address_space_ldq (as, addr, attrs, &res); +break ;default :abort (); } *pdata = data;@@ -2528,6 +2531,9 @@ static MemTxResult watch_mem_write(void *opaque, hwaddr addr,case 4 :address_space_stl (as, addr, val, attrs, &res);break ; +case 8 : +address_space_stq (as, addr, val, attrs, &res); +break ;default :abort (); }return res;@@ -2537,6 +2543,16 @@ static const MemoryRegionOps watch_mem_ops = { .read_with_attrs = watch_mem_read, .write_with_attrs = watch_mem_write, .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 1, + .max_access_size = 8, + .unaligned = false, + }, + .impl = { + .min_access_size = 1, + .max_access_size = 8, + .unaligned = false, + }, }; static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,