Annotation of qemu/dyngen-exec.h, revision 1.1.1.10

1.1       root        1: /*
                      2:  *  dyngen defines for micro operation code
                      3:  *
                      4:  *  Copyright (c) 2003 Fabrice Bellard
                      5:  *
                      6:  * This library is free software; you can redistribute it and/or
                      7:  * modify it under the terms of the GNU Lesser General Public
                      8:  * License as published by the Free Software Foundation; either
                      9:  * version 2 of the License, or (at your option) any later version.
                     10:  *
                     11:  * This library is distributed in the hope that it will be useful,
                     12:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
                     13:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     14:  * Lesser General Public License for more details.
                     15:  *
                     16:  * You should have received a copy of the GNU Lesser General Public
1.1.1.7   root       17:  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
1.1       root       18:  */
                     19: #if !defined(__DYNGEN_EXEC_H__)
                     20: #define __DYNGEN_EXEC_H__
                     21: 
1.1.1.2   root       22: /* prevent Solaris from trying to typedef FILE in gcc's
                     23:    include/floatingpoint.h which will conflict with the
                     24:    definition down below */
                     25: #ifdef __sun__
                     26: #define _FILEDEFED
                     27: #endif
                     28: 
1.1       root       29: /* NOTE: standard headers should be used with special care at this
                     30:    point because host CPU registers are used as global variables. Some
                     31:    host headers do not allow that. */
                     32: #include <stddef.h>
1.1.1.7   root       33: #include <stdint.h>
1.1.1.10! root       34: #include <stdbool.h>
1.1       root       35: 
1.1.1.6   root       36: #ifdef __OpenBSD__
                     37: #include <sys/types.h>
                     38: #endif
1.1       root       39: 
1.1.1.4   root       40: /* XXX: This may be wrong for 64-bit ILP32 hosts.  */
                     41: typedef void * host_reg_t;
                     42: 
1.1.1.8   root       43: #ifdef CONFIG_BSD
1.1.1.5   root       44: typedef struct __sFILE FILE;
                     45: #else
1.1       root       46: typedef struct FILE FILE;
1.1.1.5   root       47: #endif
1.1       root       48: extern int fprintf(FILE *, const char *, ...);
1.1.1.5   root       49: extern int fputs(const char *, FILE *);
1.1       root       50: extern int printf(const char *, ...);
                     51: 
1.1.1.5   root       52: #if defined(__i386__)
1.1       root       53: #define AREG0 "ebp"
1.1.1.5   root       54: #elif defined(__x86_64__)
                     55: #define AREG0 "r14"
1.1.1.6   root       56: #elif defined(_ARCH_PPC)
1.1       root       57: #define AREG0 "r27"
1.1.1.5   root       58: #elif defined(__arm__)
1.1       root       59: #define AREG0 "r7"
1.1.1.6   root       60: #elif defined(__hppa__)
                     61: #define AREG0 "r17"
1.1.1.5   root       62: #elif defined(__mips__)
1.1.1.9   root       63: #define AREG0 "s0"
1.1.1.5   root       64: #elif defined(__sparc__)
1.1.1.8   root       65: #ifdef CONFIG_SOLARIS
1.1.1.3   root       66: #define AREG0 "g2"
                     67: #else
                     68: #ifdef __sparc_v9__
1.1.1.6   root       69: #define AREG0 "g5"
1.1.1.3   root       70: #else
1.1       root       71: #define AREG0 "g6"
1.1.1.3   root       72: #endif
                     73: #endif
1.1.1.5   root       74: #elif defined(__s390__)
1.1       root       75: #define AREG0 "r10"
1.1.1.5   root       76: #elif defined(__alpha__)
1.1       root       77: /* Note $15 is the frame pointer, so anything in op-i386.c that would
                     78:    require a frame pointer, like alloca, would probably loose.  */
                     79: #define AREG0 "$15"
1.1.1.5   root       80: #elif defined(__mc68000)
1.1       root       81: #define AREG0 "%a5"
1.1.1.5   root       82: #elif defined(__ia64__)
1.1       root       83: #define AREG0 "r7"
1.1.1.5   root       84: #else
                     85: #error unsupported CPU
1.1       root       86: #endif
                     87: 
                     88: #define xglue(x, y) x ## y
                     89: #define glue(x, y) xglue(x, y)
                     90: #define stringify(s)   tostring(s)
                     91: #define tostring(s)    #s
                     92: 
1.1.1.6   root       93: /* The return address may point to the start of the next instruction.
                     94:    Subtracting one gets us the call instruction itself.  */
1.1.1.8   root       95: #if defined(__s390__) && !defined(__s390x__)
1.1.1.6   root       96: # define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1))
1.1.1.5   root       97: #elif defined(__arm__)
1.1.1.6   root       98: /* Thumb return addresses have the low bit set, so we need to subtract two.
                     99:    This is still safe in ARM mode because instructions are 4 bytes.  */
                    100: # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2))
1.1.1.5   root      101: #else
1.1.1.6   root      102: # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1))
1.1       root      103: #endif
                    104: 
                    105: #endif /* !defined(__DYNGEN_EXEC_H__) */

unix.superglobalmegacorp.com