Skip to content

Commit 7a7142f

Browse files
zbalatonrth7680
authored andcommitted
memory: Log access direction for invalid accesses
In memory_region_access_valid() invalid accesses are logged to help debugging but the log message does not say if it was a read or write. Log that too to better identify the access causing the problem. Reviewed-by: David Hildenbrand <[email protected]> Signed-off-by: BALATON Zoltan <[email protected]> Message-Id: <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent ee26ce6 commit 7a7142f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

softmmu/memory.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,17 +1378,17 @@ bool memory_region_access_valid(MemoryRegion *mr,
13781378
{
13791379
if (mr->ops->valid.accepts
13801380
&& !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs)) {
1381-
qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
1382-
"0x%" HWADDR_PRIX ", size %u, "
1383-
"region '%s', reason: rejected\n",
1381+
qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
1382+
", size %u, region '%s', reason: rejected\n",
1383+
is_write ? "write" : "read",
13841384
addr, size, memory_region_name(mr));
13851385
return false;
13861386
}
13871387

13881388
if (!mr->ops->valid.unaligned && (addr & (size - 1))) {
1389-
qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
1390-
"0x%" HWADDR_PRIX ", size %u, "
1391-
"region '%s', reason: unaligned\n",
1389+
qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
1390+
", size %u, region '%s', reason: unaligned\n",
1391+
is_write ? "write" : "read",
13921392
addr, size, memory_region_name(mr));
13931393
return false;
13941394
}
@@ -1400,10 +1400,10 @@ bool memory_region_access_valid(MemoryRegion *mr,
14001400

14011401
if (size > mr->ops->valid.max_access_size
14021402
|| size < mr->ops->valid.min_access_size) {
1403-
qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
1404-
"0x%" HWADDR_PRIX ", size %u, "
1405-
"region '%s', reason: invalid size "
1406-
"(min:%u max:%u)\n",
1403+
qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
1404+
", size %u, region '%s', reason: invalid size "
1405+
"(min:%u max:%u)\n",
1406+
is_write ? "write" : "read",
14071407
addr, size, memory_region_name(mr),
14081408
mr->ops->valid.min_access_size,
14091409
mr->ops->valid.max_access_size);

0 commit comments

Comments
 (0)