2003-12-24 23:17:27 +00:00
|
|
|
/*
|
|
|
|
* Wine porting definitions
|
|
|
|
*
|
|
|
|
* Copyright 1996 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* 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
|
2014-01-26 21:55:59 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-07-22 04:30:14 +00:00
|
|
|
*/
|
2003-12-24 23:17:27 +00:00
|
|
|
|
|
|
|
#ifndef __WINE_WINE_PORT_H
|
|
|
|
#define __WINE_WINE_PORT_H
|
|
|
|
|
|
|
|
#ifndef __WINE_CONFIG_H
|
|
|
|
# error You must include config.h to use this header
|
|
|
|
#endif
|
|
|
|
|
2014-01-26 21:55:59 +00:00
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
# define _GNU_SOURCE /* for pread/pwrite, isfinite */
|
|
|
|
#endif
|
2003-12-24 23:17:27 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#ifdef HAVE_DIRECT_H
|
|
|
|
# include <direct.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
# include <io.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PROCESS_H
|
|
|
|
# include <process.h>
|
|
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
* Type definitions
|
|
|
|
*/
|
|
|
|
|
2008-03-05 08:06:17 +00:00
|
|
|
#if !defined(_MSC_VER) && !defined(__int64)
|
|
|
|
# if defined(__x86_64__) || defined(_WIN64)
|
|
|
|
# define __int64 long
|
|
|
|
# else
|
|
|
|
# define __int64 long long
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2011-06-25 19:25:54 +00:00
|
|
|
#if !defined(HAVE_MODE_T) && !defined(_MODE_T)
|
2003-12-24 23:17:27 +00:00
|
|
|
typedef int mode_t;
|
|
|
|
#endif
|
2011-06-25 19:25:54 +00:00
|
|
|
#if !defined(HAVE_OFF_T) && !defined(_OFF_T)
|
2003-12-24 23:17:27 +00:00
|
|
|
typedef long off_t;
|
|
|
|
#endif
|
2011-06-25 19:25:54 +00:00
|
|
|
#if !defined(HAVE_PID_T) && !defined(_PID_T)
|
2003-12-24 23:17:27 +00:00
|
|
|
typedef int pid_t;
|
|
|
|
#endif
|
2011-06-25 19:25:54 +00:00
|
|
|
#if !defined(HAVE_SIZE_T) && !defined(_SIZE_T)
|
2003-12-24 23:17:27 +00:00
|
|
|
typedef unsigned int size_t;
|
|
|
|
#endif
|
2011-06-25 19:25:54 +00:00
|
|
|
#if !defined(HAVE_SSIZE_T) && !defined(_SSIZE_T)
|
2003-12-24 23:17:27 +00:00
|
|
|
typedef int ssize_t;
|
|
|
|
#endif
|
2004-09-04 21:44:30 +00:00
|
|
|
//#ifndef HAVE_SOCKLEN_T
|
|
|
|
//typedef unsigned int socklen_t;
|
|
|
|
//#endif
|
2003-12-24 23:17:27 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_STATFS
|
|
|
|
# ifdef __BEOS__
|
|
|
|
# define HAVE_STRUCT_STATFS_F_BFREE
|
|
|
|
struct statfs {
|
|
|
|
long f_bsize; /* block_size */
|
|
|
|
long f_blocks; /* total_blocks */
|
|
|
|
long f_bfree; /* free_blocks */
|
|
|
|
};
|
|
|
|
# else /* defined(__BEOS__) */
|
|
|
|
struct statfs;
|
|
|
|
# endif /* defined(__BEOS__) */
|
|
|
|
#endif /* !defined(HAVE_STATFS) */
|
|
|
|
|
2024-05-12 19:47:18 +03:00
|
|
|
struct stat;
|
2003-12-24 23:17:27 +00:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
* Macro definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_DLFCN_H
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#else
|
|
|
|
#define RTLD_LAZY 0x001
|
|
|
|
#define RTLD_NOW 0x002
|
|
|
|
#define RTLD_GLOBAL 0x100
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_FTRUNCATE) && defined(HAVE_CHSIZE)
|
|
|
|
#define ftruncate chsize
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
|
|
|
|
#define popen _popen
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
|
|
|
|
#define pclose _pclose
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
|
2003-08-22 23:34:30 +00:00
|
|
|
#define snprintf _snprintf
|
2003-12-24 23:17:27 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
|
|
|
|
#define vsnprintf _vsnprintf
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISLNK
|
|
|
|
# define S_ISLNK(mod) (0)
|
|
|
|
#endif /* S_ISLNK */
|
|
|
|
|
|
|
|
/* So we open files in 64 bit access mode on Linux */
|
|
|
|
#ifndef O_LARGEFILE
|
|
|
|
# define O_LARGEFILE 0
|
|
|
|
#endif
|
|
|
|
|
2008-02-07 17:27:25 +00:00
|
|
|
#ifndef O_BINARY
|
|
|
|
# define O_BINARY 0
|
|
|
|
#endif
|
2003-12-24 23:17:27 +00:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef M_PI_2
|
|
|
|
#define M_PI_2 1.570796326794896619
|
|
|
|
#endif
|
|
|
|
|
2011-01-29 19:00:15 +00:00
|
|
|
#ifndef M_PI_4
|
|
|
|
#define M_PI_4 0.785398163397448309616
|
|
|
|
#endif
|
2003-12-24 23:17:27 +00:00
|
|
|
|
2012-08-21 09:29:11 +00:00
|
|
|
#ifndef INFINITY
|
|
|
|
static inline float __port_infinity(void)
|
|
|
|
{
|
|
|
|
static const unsigned __inf_bytes = 0x7f800000;
|
|
|
|
return *(const float *)&__inf_bytes;
|
|
|
|
}
|
|
|
|
#define INFINITY __port_infinity()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NAN
|
|
|
|
static inline float __port_nan(void)
|
|
|
|
{
|
|
|
|
static const unsigned __nan_bytes = 0x7fc00000;
|
|
|
|
return *(const float *)&__nan_bytes;
|
|
|
|
}
|
|
|
|
#define NAN __port_nan()
|
|
|
|
#endif
|
|
|
|
|
2003-12-24 23:17:27 +00:00
|
|
|
/* Constructor functions */
|
|
|
|
|
2012-08-01 23:25:06 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# define DECL_GLOBAL_CONSTRUCTOR(func) /* nothing */
|
|
|
|
#elif defined(__GNUC__)
|
2003-12-24 23:17:27 +00:00
|
|
|
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
|
|
|
static void func(void) __attribute__((constructor)); \
|
|
|
|
static void func(void)
|
|
|
|
#elif defined(__i386__)
|
|
|
|
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
|
|
|
static void __dummy_init_##func(void) { \
|
|
|
|
asm(".section .init,\"ax\"\n\t" \
|
|
|
|
"call " #func "\n\t" \
|
|
|
|
".previous"); } \
|
|
|
|
static void func(void)
|
|
|
|
#elif defined(__sparc__)
|
|
|
|
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
|
|
|
static void __dummy_init_##func(void) { \
|
|
|
|
asm("\t.section \".init\",#alloc,#execinstr\n" \
|
|
|
|
"\tcall " #func "\n" \
|
|
|
|
"\tnop\n" \
|
|
|
|
"\t.section \".text\",#alloc,#execinstr\n" ); } \
|
|
|
|
static void func(void)
|
2011-06-26 22:26:42 +00:00
|
|
|
#elif defined(_M_AMD64)
|
|
|
|
#pragma message("You must define the DECL_GLOBAL_CONSTRUCTOR macro for amd64")
|
2003-12-24 23:17:27 +00:00
|
|
|
#else
|
|
|
|
# error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Register functions */
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
#define DEFINE_REGS_ENTRYPOINT( name, fn, args, pop_args ) \
|
|
|
|
__ASM_GLOBAL_FUNC( name, \
|
|
|
|
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
|
|
|
|
".long " __ASM_NAME(#fn) "\n\t" \
|
|
|
|
".byte " #args "," #pop_args )
|
|
|
|
/* FIXME: add support for other CPUs */
|
|
|
|
#endif /* __i386__ */
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
* Function definitions (only when using libwine_port)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NO_LIBWINE_PORT
|
|
|
|
|
|
|
|
#ifndef HAVE_GETOPT_LONG
|
|
|
|
extern char *optarg;
|
|
|
|
extern int optind;
|
|
|
|
extern int opterr;
|
|
|
|
extern int optopt;
|
|
|
|
struct option;
|
|
|
|
|
|
|
|
#ifndef HAVE_STRUCT_OPTION_NAME
|
|
|
|
struct option
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int has_arg;
|
|
|
|
int *flag;
|
|
|
|
int val;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern int getopt_long (int ___argc, char *const *___argv,
|
|
|
|
const char *__shortopts,
|
|
|
|
const struct option *__longopts, int *__longind);
|
|
|
|
extern int getopt_long_only (int ___argc, char *const *___argv,
|
|
|
|
const char *__shortopts,
|
|
|
|
const struct option *__longopts, int *__longind);
|
|
|
|
#endif /* HAVE_GETOPT_LONG */
|
|
|
|
|
|
|
|
#ifndef HAVE_GETPAGESIZE
|
|
|
|
size_t getpagesize(void);
|
|
|
|
#endif /* HAVE_GETPAGESIZE */
|
|
|
|
|
2014-01-26 21:55:59 +00:00
|
|
|
#if !defined(HAVE_ISFINITE) && !defined(isfinite)
|
|
|
|
int isfinite(double x);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_ISINF) && !defined(isinf)
|
2012-05-01 17:20:47 +00:00
|
|
|
int isinf(double x);
|
|
|
|
#endif
|
|
|
|
|
2014-01-26 21:55:59 +00:00
|
|
|
#if !defined(HAVE_ISNAN) && !defined(isnan)
|
2012-05-01 17:20:47 +00:00
|
|
|
int isnan(double x);
|
|
|
|
#endif
|
|
|
|
|
2003-12-24 23:17:27 +00:00
|
|
|
#ifndef HAVE_LSTAT
|
|
|
|
int lstat(const char *file_name, struct stat *buf);
|
|
|
|
#endif /* HAVE_LSTAT */
|
|
|
|
|
|
|
|
#ifndef HAVE_MEMMOVE
|
|
|
|
void *memmove(void *dest, const void *src, size_t len);
|
|
|
|
#endif /* !defined(HAVE_MEMMOVE) */
|
|
|
|
|
2003-12-26 17:07:26 +00:00
|
|
|
#ifndef __REACTOS__
|
2003-12-24 23:17:27 +00:00
|
|
|
#ifndef HAVE_PREAD
|
|
|
|
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
|
|
|
|
#endif /* HAVE_PREAD */
|
|
|
|
|
|
|
|
#ifndef HAVE_PWRITE
|
|
|
|
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
|
|
|
|
#endif /* HAVE_PWRITE */
|
2003-12-26 17:07:26 +00:00
|
|
|
#endif /* __REACTOS__ */
|
2003-12-24 23:17:27 +00:00
|
|
|
|
2014-05-10 14:33:37 +00:00
|
|
|
#ifdef _WIN32
|
2003-12-24 23:17:27 +00:00
|
|
|
#ifndef HAVE_SIGSETJMP
|
|
|
|
# include <setjmp.h>
|
|
|
|
typedef jmp_buf sigjmp_buf;
|
|
|
|
int sigsetjmp( sigjmp_buf buf, int savesigs );
|
|
|
|
void siglongjmp( sigjmp_buf buf, int val );
|
|
|
|
#endif /* HAVE_SIGSETJMP */
|
2004-01-05 20:01:17 +00:00
|
|
|
#endif
|
2003-12-24 23:17:27 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_STATFS
|
|
|
|
int statfs(const char *name, struct statfs *info);
|
|
|
|
#endif /* !defined(HAVE_STATFS) */
|
|
|
|
|
|
|
|
#ifndef HAVE_STRNCASECMP
|
|
|
|
# ifndef HAVE__STRNICMP
|
|
|
|
int strncasecmp(const char *str1, const char *str2, size_t n);
|
|
|
|
# else
|
|
|
|
# define strncasecmp _strnicmp
|
|
|
|
# endif
|
|
|
|
#endif /* !defined(HAVE_STRNCASECMP) */
|
|
|
|
|
|
|
|
#ifndef HAVE_STRERROR
|
|
|
|
const char *strerror(int err);
|
|
|
|
#endif /* !defined(HAVE_STRERROR) */
|
|
|
|
|
|
|
|
#ifndef HAVE_STRCASECMP
|
|
|
|
# ifndef HAVE__STRICMP
|
|
|
|
int strcasecmp(const char *str1, const char *str2);
|
|
|
|
# else
|
|
|
|
# define strcasecmp _stricmp
|
|
|
|
# endif
|
|
|
|
#endif /* !defined(HAVE_STRCASECMP) */
|
|
|
|
|
2007-10-15 03:56:58 +00:00
|
|
|
#if !defined(HAVE_USLEEP) && !defined(__CYGWIN__)
|
2003-12-24 23:17:27 +00:00
|
|
|
int usleep (unsigned int useconds);
|
|
|
|
#endif /* !defined(HAVE_USLEEP) */
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
static inline void *memcpy_unaligned( void *dst, const void *src, size_t size )
|
|
|
|
{
|
|
|
|
return memcpy( dst, src, size );
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
extern void *memcpy_unaligned( void *dst, const void *src, size_t size );
|
|
|
|
#endif /* __i386__ */
|
|
|
|
|
|
|
|
extern int mkstemps(char *template, int suffix_len);
|
|
|
|
|
|
|
|
/* Process creation flags */
|
|
|
|
#ifndef _P_WAIT
|
|
|
|
# define _P_WAIT 0
|
|
|
|
# define _P_NOWAIT 1
|
|
|
|
# define _P_OVERLAY 2
|
|
|
|
# define _P_NOWAITO 3
|
|
|
|
# define _P_DETACH 4
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_SPAWNVP
|
|
|
|
extern int spawnvp(int mode, const char *cmdname, const char * const argv[]);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Interlocked functions */
|
|
|
|
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
#define interlocked_cmpxchg InterlockedCompareExchange
|
2014-05-08 14:08:20 +00:00
|
|
|
#define interlocked_cmpxchg_ptr InterlockedCompareExchangePointer
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
#define interlocked_xchg InterlockedExchange
|
2014-05-08 14:08:20 +00:00
|
|
|
#define interlocked_xchg_ptr InterlockedExchangePointer
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
#define interlocked_xchg_add InterlockedExchangeAdd
|
2003-12-24 23:17:27 +00:00
|
|
|
|
2017-10-27 23:55:59 +01:00
|
|
|
#if defined(_MSC_VER) && !defined(__clang__)
|
2011-06-20 13:15:58 +00:00
|
|
|
__forceinline
|
|
|
|
int
|
|
|
|
ffs(int mask)
|
|
|
|
{
|
|
|
|
long index;
|
|
|
|
if (_BitScanForward(&index, mask) == 0) return 0;
|
|
|
|
return index;
|
|
|
|
}
|
2013-07-30 16:06:38 +00:00
|
|
|
#else
|
|
|
|
#define ffs __builtin_ffs
|
2011-06-20 13:15:58 +00:00
|
|
|
#endif
|
|
|
|
|
2003-12-24 23:17:27 +00:00
|
|
|
#else /* NO_LIBWINE_PORT */
|
|
|
|
|
|
|
|
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
|
|
|
|
|
|
|
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
|
|
|
|
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
|
|
|
|
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)
|
|
|
|
#define lstat __WINE_NOT_PORTABLE(lstat)
|
|
|
|
#define memcpy_unaligned __WINE_NOT_PORTABLE(memcpy_unaligned)
|
|
|
|
#define memmove __WINE_NOT_PORTABLE(memmove)
|
|
|
|
#define pread __WINE_NOT_PORTABLE(pread)
|
|
|
|
#define pwrite __WINE_NOT_PORTABLE(pwrite)
|
|
|
|
#define spawnvp __WINE_NOT_PORTABLE(spawnvp)
|
|
|
|
#define statfs __WINE_NOT_PORTABLE(statfs)
|
|
|
|
#define strcasecmp __WINE_NOT_PORTABLE(strcasecmp)
|
|
|
|
#define strerror __WINE_NOT_PORTABLE(strerror)
|
|
|
|
#define strncasecmp __WINE_NOT_PORTABLE(strncasecmp)
|
|
|
|
#define usleep __WINE_NOT_PORTABLE(usleep)
|
|
|
|
|
|
|
|
#endif /* NO_LIBWINE_PORT */
|
2003-07-22 04:30:14 +00:00
|
|
|
|
2003-12-24 23:17:27 +00:00
|
|
|
#endif /* !defined(__WINE_WINE_PORT_H) */
|