From: malc <av1474@comtv.ru>
To: Richard Henderson <rth@twiddle.net>
Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/7] Add guest_start_len_valid function.
Date: Mon, 5 Apr 2010 22:15:46 +0400 (MSD) [thread overview]
Message-ID: <alpine.LNX.2.00.1004052215220.14271@linmac> (raw)
In-Reply-To: <8fab352a4e45a8412daed0adb442dc4457279ca0.1270488612.git.rth@twiddle.net>
On Mon, 5 Apr 2010, Richard Henderson wrote:
> To be used by userspace emulation to verify that the memory
> range defined by [start, start+len) is valid for the guest,
> taking into account TARGET_VIRT_ADDR_SPACE_BITS.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> cpu-all.h | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/cpu-all.h b/cpu-all.h
> index 927445c..7d31b16 100644
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -637,11 +637,21 @@ extern int have_guest_base;
>
> #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
> #define h2g_valid(x) 1
> +#define guest_start_len_valid(s,l) ({ \
> + unsigned long __s = (unsigned long)(s); \
> + unsigned long __e = __s + (l) - 1; \
> + __e >= __s; \
> +})
> #else
> #define h2g_valid(x) ({ \
> unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
> __guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS); \
> })
> +#define guest_start_len_valid(s,l) ({ \
> + unsigned long __s = (unsigned long)(s); \
> + unsigned long __e = __s + (l) - 1; \
> + __e >= __s && __e < (1ul << TARGET_VIRT_ADDR_SPACE_BITS); \
> +})
> #endif
Please do not use double leading underscore.
>
> #define h2g(x) ({ \
>
--
mailto:av1474@comtv.ru
next prev parent reply other threads:[~2010-04-05 18:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-05 17:30 [Qemu-devel] [PATCH 0/7] Fix tests for start+len address valid for guest Richard Henderson
2010-03-29 17:54 ` [Qemu-devel] [PATCH 6/7] Fix zero-length write(2) Richard Henderson
2010-05-06 4:45 ` Aurelien Jarno
2010-03-30 18:11 ` [Qemu-devel] [PATCH 1/7] target-sparc: Fix TARGET_{PHYS, VIRT}_ADDR_SPACE_BITS Richard Henderson
2010-03-30 18:49 ` [Qemu-devel] [PATCH 3/7] linux-user: Use guest_start_len_valid in msync Richard Henderson
2010-03-30 18:52 ` [Qemu-devel] [PATCH 4/7] linux-user: Use guest_start_len_valid in mremap Richard Henderson
2010-03-30 18:53 ` [Qemu-devel] [PATCH 5/7] linux-user: Use guest_start_len_valid in mmap Richard Henderson
2010-03-30 19:32 ` [Qemu-devel] [PATCH 7/7] Use guest_start_len_valid in page_check_range Richard Henderson
2010-04-05 17:24 ` [Qemu-devel] [PATCH 2/7] Add guest_start_len_valid function Richard Henderson
2010-04-05 18:15 ` malc [this message]
2010-04-05 18:31 ` Richard Henderson
2010-04-05 18:41 ` malc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.00.1004052215220.14271@linmac \
--to=av1474@comtv.ru \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).