diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-11-12 11:44:41 +0200 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2014-12-16 17:47:35 +0530 |
commit | 1240be24357ee292f8d05aa2abfdba75dd0ca25d (patch) | |
tree | 377ce51d512e0916fc18b25b2fce85ce352e9ab4 /include/exec | |
parent | 68a5e38a7e428c05610fdbced7e7320a7aea3dc2 (diff) |
exec: add wrapper for host pointer access
host pointer accesses force pointer math, let's
add a wrapper to make them safer.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'include/exec')
-rw-r--r-- | include/exec/cpu-all.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index c085804aed..9d8d408ea6 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -313,6 +313,11 @@ typedef struct RAMBlock { int fd; } RAMBlock; +static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset) +{ + return (char *)block->host + offset; +} + typedef struct RAMList { QemuMutex mutex; /* Protected by the iothread lock. */ |