Revision 897fa7cf
b/memory.c | ||
---|---|---|
831 | 831 |
|
832 | 832 |
static bool memory_region_access_valid(MemoryRegion *mr, |
833 | 833 |
target_phys_addr_t addr, |
834 |
unsigned size) |
|
834 |
unsigned size, |
|
835 |
bool is_write) |
|
835 | 836 |
{ |
837 |
if (mr->ops->valid.accepts |
|
838 |
&& !mr->ops->valid.accepts(mr->opaque, addr, size, is_write)) { |
|
839 |
return false; |
|
840 |
} |
|
841 |
|
|
836 | 842 |
if (!mr->ops->valid.unaligned && (addr & (size - 1))) { |
837 | 843 |
return false; |
838 | 844 |
} |
... | ... | |
856 | 862 |
MemoryRegion *mr = _mr; |
857 | 863 |
uint64_t data = 0; |
858 | 864 |
|
859 |
if (!memory_region_access_valid(mr, addr, size)) { |
|
865 |
if (!memory_region_access_valid(mr, addr, size, false)) {
|
|
860 | 866 |
return -1U; /* FIXME: better signalling */ |
861 | 867 |
} |
862 | 868 |
|
... | ... | |
880 | 886 |
{ |
881 | 887 |
MemoryRegion *mr = _mr; |
882 | 888 |
|
883 |
if (!memory_region_access_valid(mr, addr, size)) { |
|
889 |
if (!memory_region_access_valid(mr, addr, size, true)) {
|
|
884 | 890 |
return; /* FIXME: better signalling */ |
885 | 891 |
} |
886 | 892 |
|
b/memory.h | ||
---|---|---|
71 | 71 |
* accesses throw machine checks. |
72 | 72 |
*/ |
73 | 73 |
bool unaligned; |
74 |
/* |
|
75 |
* If present, and returns #false, the transaction is not accepted |
|
76 |
* by the device (and results in machine dependent behaviour such |
|
77 |
* as a machine check exception). |
|
78 |
*/ |
|
79 |
bool (*accepts)(void *opaque, target_phys_addr_t addr, |
|
80 |
unsigned size, bool is_write); |
|
74 | 81 |
} valid; |
75 | 82 |
/* Internal implementation constraints: */ |
76 | 83 |
struct { |
Also available in: Unified diff