linux-user: take RESERVED_VA into account for g2h_valid()

When running with -R (RESERVED_VA > 0) all guest virtual addresses
are within the [0..RESERVED_VA] range. Reflect this with g2h_valid()
too so we can safely check for boundaries of our guest address space.

This is required to have the /proc/self/maps code not show maps that
aren't accessible from the guest process's point of view.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
Alexander Graf 2012-02-02 03:14:18 +01:00 committed by Riku Voipio
parent 20249ae189
commit 39879bbbea
1 changed files with 2 additions and 1 deletions

View File

@ -204,7 +204,8 @@ extern unsigned long reserved_va;
#else
#define h2g_valid(x) ({ \
unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS); \
(__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
(!RESERVED_VA || (__guest < RESERVED_VA)); \
})
#endif