1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

New ACC version.

committer: mfx <mfx> 1089731989 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2004-07-13 15:19:49 +00:00
parent 4102cd7c91
commit 435c0a9e82
5 changed files with 30 additions and 32 deletions

View File

@ -27,7 +27,7 @@
#ifndef __ACC_H_INCLUDED
#define __ACC_H_INCLUDED 1
#define ACC_VERSION 20040712L
#define ACC_VERSION 20040713L
#if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file
@ -44,6 +44,9 @@
# define __INTEL_COMPILER __ICL
#endif
#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE)
# define _ALL_SOURCE 1
#endif
/* disable pedantic warnings for undefined preprocessing symbols */
#if defined(__INTEL_COMPILER) && defined(__linux__)

View File

@ -92,7 +92,7 @@
# define HAVE_STRINGS_H 1
# if (ACC_OS_POSIX_FREEBSD || ACC_OS_POSIX_MACOSX || ACC_OS_POSIX_OPENBSD)
# undef HAVE_MALLOC_H /* deprecated */
# elif (ACC_OS_POSIX_HPUX)
# elif (ACC_OS_POSIX_HPUX || ACC_OS_POSIX_INTERIX)
# define HAVE_ALLOCA_H 1
# endif
# if (ACC_OS_POSIX_MACOSX && ACC_CC_MWERKS) && defined(__MSL__)
@ -599,6 +599,9 @@
#elif (ACC_CC_GNUC)
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && ACC_CC_MSC && (_MSC_VER >= 1400))
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#elif (ACC_OS_WIN64)
# define SIZEOF___INT64 8
# define SIZEOF_UNSIGNED___INT64 8
@ -627,7 +630,7 @@
#elif (ACC_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64))
# define SIZEOF___INT64 8
# define SIZEOF_UNSIGNED___INT64 8
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#endif

View File

@ -71,7 +71,7 @@
# define ACC_UNUSED_FUNC(func) ((void) (void (*)(void)) func)
# elif (ACC_CC_MSC && (_MSC_VER < 900))
# define ACC_UNUSED_FUNC(func) if (func) ; else
# elif (ACC_CC_MSC && (_MSC_VER >= 1400))
# elif (ACC_CC_MSC && (_MSC_VER >= 1200))
# define ACC_UNUSED_FUNC(func) ((void) (void (*)(void)) func)
# elif (ACC_CC_KEILC)
# define ACC_UNUSED_FUNC(func)

View File

@ -141,6 +141,9 @@
# elif defined(__hpux__) || defined(__hpux)
# define ACC_OS_POSIX_HPUX 1
# define ACC_INFO_OS_POSIX "hpux"
# elif defined(__INTERIX)
# define ACC_OS_POSIX_INTERIX 1
# define ACC_INFO_OS_POSIX "interix"
# elif defined(__IRIX__) || defined(__irix__)
# define ACC_OS_POSIX_IRIX 1
# define ACC_INFO_OS_POSIX "irix"

View File

@ -21,31 +21,31 @@
#if defined(acc_int32e_t)
#if ((ACC_ARCH_AMD64 || ACC_ARCH_IA32) && ACC_CC_GNUC)
# if (ACC_CC_GNUC >= 0x020000ul)
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "cc", "memory", "eax", "edx"
# else
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "ax", "dx"
# endif
#elif (ACC_ARCH_IA32 && ACC_CC_INTELC) && defined(__linux__)
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "memory", "eax", "edx"
#endif
/*************************************************************************
// read TSC
**************************************************************************/
ACCLIB_PUBLIC(int, acc_tsc_read) (acc_uint32e_t* t)
{
#if ((ACC_ARCH_AMD64 || ACC_ARCH_IA32) && ACC_CC_GNUC)
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) && defined(__ACCLIB_RDTSC_REGS)
__asm__ __volatile__(
"clc \n" ".byte 0x0f, 0x31\n"
"movl %%eax,(%0)\n" "movl %%edx,4(%0)\n"
# if (ACC_CC_GNUC >= 0x020000ul)
: : "r" (t) : "cc", "memory", "eax", "edx"
# else
: : "r" (t) : "ax", "dx"
# endif
__ACCLIB_RDTSC_REGS
);
return 0;
#elif (ACC_ARCH_IA32 && ACC_CC_INTELC) && defined(__linux__)
__asm__ __volatile__(
"clc \n" ".byte 0x0f, 0x31\n"
"movl %%eax,(%0)\n" "movl %%edx,4(%0)\n"
: : "r" (t) : "memory", "eax", "edx"
);
return 0;
#elif (ACC_ARCH_IA32 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC))
#elif (ACC_ARCH_IA32 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
ACC_UNUSED(t);
__asm {
mov ecx, t
@ -73,25 +73,14 @@ ACCLIB_PUBLIC(int, acc_tsc_read) (acc_uint32e_t* t)
ACCLIB_PUBLIC(int, acc_tsc_read_add) (acc_uint32e_t* t)
{
#if ((ACC_ARCH_AMD64 || ACC_ARCH_IA32) && ACC_CC_GNUC)
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) && defined(__ACCLIB_RDTSC_REGS)
__asm__ __volatile__(
"clc \n" ".byte 0x0f, 0x31\n"
"addl %%eax,(%0)\n" "adcl $0,%%edx\n" "addl %%edx,4(%0)\n"
# if (ACC_CC_GNUC >= 0x020000ul)
: : "r" (t) : "cc", "memory", "eax", "edx"
# else
: : "r" (t) : "ax", "dx"
# endif
__ACCLIB_RDTSC_REGS
);
return 0;
#elif (ACC_ARCH_IA32 && ACC_CC_INTELC) && defined(__linux__)
__asm__ __volatile__(
"clc \n" ".byte 0x0f, 0x31\n"
"addl %%eax,(%0)\n" "adcl $0,%%edx\n" "addl %%edx,4(%0)\n"
: : "r" (t) : "memory", "eax", "edx"
);
return 0;
#elif (ACC_ARCH_IA32 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC))
#elif (ACC_ARCH_IA32 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
ACC_UNUSED(t);
__asm {
mov ecx, t