/[qemu]/qemu/thunk.h
ViewVC logotype

Diff of /qemu/thunk.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by bellard, Thu Jun 5 01:52:19 2003 UTC revision 1.9 by bellard, Sun Jun 15 19:52:54 2003 UTC
# Line 61  Line 61 
61    
62  #endif  #endif
63    
64  #ifdef WORDS_BIGENDIAN  #if defined(WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
65  #define BSWAP_NEEDED  #define BSWAP_NEEDED
66  #endif  #endif
67    
68  /* XXX: autoconf */  /* XXX: autoconf */
 #define TARGET_I386  
69  #define TARGET_LONG_BITS 32  #define TARGET_LONG_BITS 32
70    
   
71  #if defined(__alpha__) || defined (__ia64__)  #if defined(__alpha__) || defined (__ia64__)
72  #define HOST_LONG_BITS 64  #define HOST_LONG_BITS 64
73  #else  #else
# Line 239  void thunk_register_struct_direct(int id Line 237  void thunk_register_struct_direct(int id
237  const argtype *thunk_convert(void *dst, const void *src,  const argtype *thunk_convert(void *dst, const void *src,
238                               const argtype *type_ptr, int to_host);                               const argtype *type_ptr, int to_host);
239    
240    extern StructEntry struct_entries[];
241    
242    static inline int thunk_type_size(const argtype *type_ptr, int is_host)
243    {
244        int type, size;
245        const StructEntry *se;
246    
247        type = *type_ptr;
248        switch(type) {
249        case TYPE_CHAR:
250            return 1;
251        case TYPE_SHORT:
252            return 2;
253        case TYPE_INT:
254            return 4;
255        case TYPE_LONGLONG:
256        case TYPE_ULONGLONG:
257            return 8;
258        case TYPE_LONG:
259        case TYPE_ULONG:
260        case TYPE_PTRVOID:
261        case TYPE_PTR:
262            if (is_host) {
263                return HOST_LONG_SIZE;
264            } else {
265                return TARGET_LONG_SIZE;
266            }
267            break;
268        case TYPE_ARRAY:
269            size = type_ptr[1];
270            return size * thunk_type_size(type_ptr + 2, is_host);
271        case TYPE_STRUCT:
272            se = struct_entries + type_ptr[1];
273            return se->size[is_host];
274        default:
275            return -1;
276        }
277    }
278    
279    static inline int thunk_type_align(const argtype *type_ptr, int is_host)
280    {
281        int type;
282        const StructEntry *se;
283    
284        type = *type_ptr;
285        switch(type) {
286        case TYPE_CHAR:
287            return 1;
288        case TYPE_SHORT:
289            return 2;
290        case TYPE_INT:
291            return 4;
292        case TYPE_LONGLONG:
293        case TYPE_ULONGLONG:
294            return 8;
295        case TYPE_LONG:
296        case TYPE_ULONG:
297        case TYPE_PTRVOID:
298        case TYPE_PTR:
299            if (is_host) {
300                return HOST_LONG_SIZE;
301            } else {
302                return TARGET_LONG_SIZE;
303            }
304            break;
305        case TYPE_ARRAY:
306            return thunk_type_align(type_ptr + 2, is_host);
307        case TYPE_STRUCT:
308            se = struct_entries + type_ptr[1];
309            return se->align[is_host];
310        default:
311            return -1;
312        }
313    }
314    
315  unsigned int target_to_host_bitmask(unsigned int x86_mask,  unsigned int target_to_host_bitmask(unsigned int x86_mask,
316                                      bitmask_transtbl * trans_tbl);                                      bitmask_transtbl * trans_tbl);
317  unsigned int host_to_target_bitmask(unsigned int alpha_mask,  unsigned int host_to_target_bitmask(unsigned int alpha_mask,

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26