From 1240be24357ee292f8d05aa2abfdba75dd0ca25d Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 12 Nov 2014 11:44:41 +0200 Subject: 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 Reviewed-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Amos Kong Signed-off-by: Amit Shah --- include/exec/cpu-all.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/exec') 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. */ -- cgit 1.4.1