]> git.proxmox.com Git - qemu.git/blobdiff - thunk.h
Use global properties to emulate -no-kvm-pit-reinjection
[qemu.git] / thunk.h
diff --git a/thunk.h b/thunk.h
index 42fd96f3a39c7bb083929f6ad7515c5b3729376a..87025c3b04dd91e78008830281fbbced24e133f6 100644 (file)
--- a/thunk.h
+++ b/thunk.h
@@ -1,6 +1,6 @@
 /*
  *  Generic thunking code to convert data between host and target CPU
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -14,8 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef THUNK_H
 #define THUNK_H
@@ -38,6 +37,7 @@ typedef enum argtype {
     TYPE_PTR,
     TYPE_ARRAY,
     TYPE_STRUCT,
+    TYPE_OLDDEVT,
 } argtype;
 
 #define MK_PTR(type) TYPE_PTR, type
@@ -68,13 +68,17 @@ typedef struct bitmask_transtbl {
 } bitmask_transtbl;
 
 void thunk_register_struct(int id, const char *name, const argtype *types);
-void thunk_register_struct_direct(int id, const char *name, StructEntry *se1);
-const argtype *thunk_convert(void *dst, const void *src, 
+void thunk_register_struct_direct(int id, const char *name,
+                                  const StructEntry *se1);
+const argtype *thunk_convert(void *dst, const void *src,
                              const argtype *type_ptr, int to_host);
 #ifndef NO_THUNK_TYPE_SIZE
 
 extern StructEntry struct_entries[];
 
+int thunk_type_size_array(const argtype *type_ptr, int is_host);
+int thunk_type_align_array(const argtype *type_ptr, int is_host);
+
 static inline int thunk_type_size(const argtype *type_ptr, int is_host)
 {
     int type, size;
@@ -96,14 +100,39 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
     case TYPE_PTRVOID:
     case TYPE_PTR:
         if (is_host) {
-            return HOST_LONG_SIZE;
+            return sizeof(void *);
+        } else {
+            return TARGET_ABI_BITS / 8;
+        }
+        break;
+    case TYPE_OLDDEVT:
+        if (is_host) {
+#if defined(HOST_X86_64)
+            return 8;
+#elif defined(HOST_ALPHA) || defined(HOST_IA64) || defined(HOST_MIPS) || \
+      defined(HOST_PARISC) || defined(HOST_SPARC64)
+            return 4;
+#elif defined(HOST_PPC)
+            return sizeof(void *);
+#else
+            return 2;
+#endif
         } else {
-            return TARGET_LONG_SIZE;
+#if defined(TARGET_X86_64)
+            return 8;
+#elif defined(TARGET_ALPHA) || defined(TARGET_IA64) || defined(TARGET_MIPS) || \
+      defined(TARGET_PARISC) || defined(TARGET_SPARC64)
+            return 4;
+#elif defined(TARGET_PPC)
+            return TARGET_ABI_BITS / 8;
+#else
+            return 2;
+#endif
         }
         break;
     case TYPE_ARRAY:
         size = type_ptr[1];
-        return size * thunk_type_size(type_ptr + 2, is_host);
+        return size * thunk_type_size_array(type_ptr + 2, is_host);
     case TYPE_STRUCT:
         se = struct_entries + type_ptr[1];
         return se->size[is_host];
@@ -133,13 +162,15 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
     case TYPE_PTRVOID:
     case TYPE_PTR:
         if (is_host) {
-            return HOST_LONG_SIZE;
+            return sizeof(void *);
         } else {
-            return TARGET_LONG_SIZE;
+            return TARGET_ABI_BITS / 8;
         }
         break;
+    case TYPE_OLDDEVT:
+        return thunk_type_size(type_ptr, is_host);
     case TYPE_ARRAY:
-        return thunk_type_align(type_ptr + 2, is_host);
+        return thunk_type_align_array(type_ptr + 2, is_host);
     case TYPE_STRUCT:
         se = struct_entries + type_ptr[1];
         return se->align[is_host];
@@ -150,9 +181,9 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
 
 #endif /* NO_THUNK_TYPE_SIZE */
 
-unsigned int target_to_host_bitmask(unsigned int x86_mask, 
-                                    bitmask_transtbl * trans_tbl);
-unsigned int host_to_target_bitmask(unsigned int alpha_mask, 
-                                    bitmask_transtbl * trans_tbl);
+unsigned int target_to_host_bitmask(unsigned int x86_mask,
+                                    const bitmask_transtbl * trans_tbl);
+unsigned int host_to_target_bitmask(unsigned int alpha_mask,
+                                    const bitmask_transtbl * trans_tbl);
 
 #endif