qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thayne Harbaugh <thayne@c2.net>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH] efault - update __get_user() __put_user()
Date: Wed, 31 Oct 2007 16:35:36 -0600	[thread overview]
Message-ID: <1193870136.19343.43.camel@phantasm.home.enterpriseandprosperity.com> (raw)
In-Reply-To: <1193869827.19343.38.camel@phantasm.home.enterpriseandprosperity.com>

[-- Attachment #1: Type: text/plain, Size: 103 bytes --]

This patch is a minor update to __get_user() and __put_user() to
emphasize that they take host points.

[-- Attachment #2: 06_efault.patch.1.2 --]
[-- Type: text/x-patch, Size: 2072 bytes --]

Index: qemu/linux-user/qemu.h
===================================================================
--- qemu.orig/linux-user/qemu.h	2007-10-31 11:03:03.000000000 -0600
+++ qemu/linux-user/qemu.h	2007-10-31 11:04:04.000000000 -0600
@@ -188,22 +188,22 @@
 #define access_ok(type,addr,size) \
     (page_check_range((target_ulong)addr,size,(type==VERIFY_READ)?PAGE_READ:PAGE_WRITE)==0)
 
-/* NOTE get_user and put_user use host addresses.  */
-#define __put_user(x,ptr)\
+/* NOTE __get_user and __put_user use host pointers and don't check access. */
+#define __put_user(x, hptr)\
 ({\
-    int size = sizeof(*ptr);\
+    int size = sizeof(*hptr);\
     switch(size) {\
     case 1:\
-        *(uint8_t *)(ptr) = (typeof(*ptr))(x);\
+        *(uint8_t *)(hptr) = (typeof(*hptr))(x);\
         break;\
     case 2:\
-        *(uint16_t *)(ptr) = tswap16((typeof(*ptr))(x));\
+        *(uint16_t *)(hptr) = tswap16((typeof(*hptr))(x));\
         break;\
     case 4:\
-        *(uint32_t *)(ptr) = tswap32((typeof(*ptr))(x));\
+        *(uint32_t *)(hptr) = tswap32((typeof(*hptr))(x));\
         break;\
     case 8:\
-        *(uint64_t *)(ptr) = tswap64((typeof(*ptr))(x));\
+        *(uint64_t *)(hptr) = tswap64((typeof(*hptr))(x));\
         break;\
     default:\
         abort();\
@@ -211,21 +211,21 @@
     0;\
 })
 
-#define __get_user(x, ptr) \
+#define __get_user(x, hptr) \
 ({\
-    int size = sizeof(*ptr);\
+    int size = sizeof(*hptr);\
     switch(size) {\
     case 1:\
-        x = (typeof(*ptr))*(uint8_t *)(ptr);\
+        x = (typeof(*hptr))*(uint8_t *)(hptr);\
         break;\
     case 2:\
-        x = (typeof(*ptr))tswap16(*(uint16_t *)(ptr));\
+        x = (typeof(*hptr))tswap16(*(uint16_t *)(hptr));\
         break;\
     case 4:\
-        x = (typeof(*ptr))tswap32(*(uint32_t *)(ptr));\
+        x = (typeof(*hptr))tswap32(*(uint32_t *)(hptr));\
         break;\
     case 8:\
-        x = (typeof(*ptr))tswap64(*(uint64_t *)(ptr));\
+        x = (typeof(*hptr))tswap64(*(uint64_t *)(hptr));\
         break;\
     default:\
         abort();\

  reply	other threads:[~2007-10-31 22:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31 22:30 [Qemu-devel] [PATCH] efault - verify pages are in cache and are read/write Thayne Harbaugh
2007-10-31 22:35 ` Thayne Harbaugh [this message]
2007-10-31 22:43   ` [Qemu-devel] Re: [PATCH] efault - add data type to put_user()/get_user() Thayne Harbaugh
2007-11-02 23:26     ` Thayne Harbaugh
2007-11-03 15:56       ` Thiemo Seufer
2007-11-03 19:05       ` Fabrice Bellard
2007-11-05 20:22         ` Thayne Harbaugh
2007-11-05 20:43           ` Thayne Harbaugh
2007-11-05 21:42           ` Fabrice Bellard
2007-11-05 23:00             ` Thayne Harbaugh
2007-11-05 23:33               ` Fabrice Bellard
2007-10-31 22:49 ` [Qemu-devel] Re: [PATCH] efault Thayne Harbaugh

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=1193870136.19343.43.camel@phantasm.home.enterpriseandprosperity.com \
    --to=thayne@c2.net \
    --cc=qemu-devel@nongnu.org \
    /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).