Libav 0.7.1
|
00001 /* 00002 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> 00003 * 00004 * This file is part of Libav. 00005 * 00006 * Libav is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * Libav is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with Libav; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef AVUTIL_X86_CPU_H 00022 #define AVUTIL_X86_CPU_H 00023 00024 #include <stdint.h> 00025 #include "config.h" 00026 00027 #if ARCH_X86_64 00028 # define OPSIZE "q" 00029 # define REG_a "rax" 00030 # define REG_b "rbx" 00031 # define REG_c "rcx" 00032 # define REG_d "rdx" 00033 # define REG_D "rdi" 00034 # define REG_S "rsi" 00035 # define PTR_SIZE "8" 00036 typedef int64_t x86_reg; 00037 00038 # define REG_SP "rsp" 00039 # define REG_BP "rbp" 00040 # define REGBP rbp 00041 # define REGa rax 00042 # define REGb rbx 00043 # define REGc rcx 00044 # define REGd rdx 00045 # define REGSP rsp 00046 00047 #elif ARCH_X86_32 00048 00049 # define OPSIZE "l" 00050 # define REG_a "eax" 00051 # define REG_b "ebx" 00052 # define REG_c "ecx" 00053 # define REG_d "edx" 00054 # define REG_D "edi" 00055 # define REG_S "esi" 00056 # define PTR_SIZE "4" 00057 typedef int32_t x86_reg; 00058 00059 # define REG_SP "esp" 00060 # define REG_BP "ebp" 00061 # define REGBP ebp 00062 # define REGa eax 00063 # define REGb ebx 00064 # define REGc ecx 00065 # define REGd edx 00066 # define REGSP esp 00067 #else 00068 typedef int x86_reg; 00069 #endif 00070 00071 #define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE)) 00072 #define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE)) 00073 00074 #if ARCH_X86_64 && defined(PIC) 00075 # define BROKEN_RELOCATIONS 1 00076 #endif 00077 00078 /* 00079 * If gcc is not set to support sse (-msse) it will not accept xmm registers 00080 * in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm 00081 * registers to be marked as clobbered and evaluates to nothing if they are 00082 * not supported, or to the list itself if they are supported. Since a clobber 00083 * list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm 00084 * registers are the only in the clobber list. 00085 * For example a list with "eax" and "xmm0" as clobbers should become: 00086 * : XMM_CLOBBERS("xmm0",) "eax" 00087 * and a list with only "xmm0" should become: 00088 * XMM_CLOBBERS_ONLY("xmm0") 00089 */ 00090 #if HAVE_XMM_CLOBBERS 00091 # define XMM_CLOBBERS(...) __VA_ARGS__ 00092 # define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__ 00093 #else 00094 # define XMM_CLOBBERS(...) 00095 # define XMM_CLOBBERS_ONLY(...) 00096 #endif 00097 00098 #endif /* AVUTIL_X86_CPU_H */