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>
This commit is contained in:
Michael S. Tsirkin 2014-11-12 11:44:41 +02:00 committed by Amit Shah
parent 68a5e38a7e
commit 1240be2435
2 changed files with 10 additions and 5 deletions

View file

@ -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. */