Sync to trunk r38250

svn path=/branches/ros-amd64-bringup/; revision=38496
This commit is contained in:
Timo Kreuzer
2009-01-01 13:32:17 +00:00
96 changed files with 2652 additions and 619 deletions
+2 -4
View File
@@ -1,6 +1,5 @@
#include <stdio.h>
//#include <time.h>
#include <sys/time.h>
#include <time.h>
#include <winsock.h>
#include "fake.h"
#include "prototypes.h"
@@ -308,13 +307,12 @@ int access(const char *filename, int accessmethod)
#define EPOCHFILETIME (116444736000000000LL)
#endif
int gettimeofday(struct timeval *tv, void *tz0)
int gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
LARGE_INTEGER li;
__int64 t;
static int tzflag;
struct timezone *tz = tz0;
if (tv)
{
+6 -1
View File
@@ -9,4 +9,9 @@
#define strcasecmp strcmp
#define strncasecmp strnicmp
void __cdecl _tzset(void);
struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct timezone *tz);
@@ -2,7 +2,7 @@
#include "fake.h"
#include "prototypes.h"
#include <setjmp.h>
#include <sys/time.h>
#include <time.h>
//typedef void (*Sig_t)(int);
@@ -191,11 +191,12 @@ BOOL exists_path(LPCTSTR path);
#else // __STDC_WANT_SECURE_LIB__
#define strcpy_s(d, l, s) strcpy(d, s)
#define _tcscpy_s(d, l, s) _tcscpy(d, s)
#define wcscpy_s(d, l, s) wcscpy(d, s)
#define wcsncpy_s(d, l, s, n) wcsncpy(d, s, n)
#define _stprintf_s1(b, l, f, p1) _stprintf(b, f, p1)
#define _stprintf_s2(b, l, f, p1,p2) _stprintf(b, f, p1,p2)
#define _tsplitpath_s(f, d,dl, p,pl, n,nl, e,el) _tsplitpath(f, d, p, n, e)
#define _wsplitpath_s(f, d,dl, p,pl, n,nl, e,el) _wsplitpath(f, d, p, n, e)
#define _splitpath_s(f, d,dl, p,pl, n,nl, e,el) _splitpath(f, d, p, n, e)
#endif // __STDC_WANT_SECURE_LIB__
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="dxtn" type="win32dll" entrypoint="0" installbase="system32" installname="dxtn.dll" allowwarnings="true">
<module name="dxtn" type="win32dll" entrypoint="0" installbase="system32" installname="dxtn.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="dxtn.def" />
<include base="dxtn">.</include>
<define name="__USE_W32API" />
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="mesa32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_MESA32}" installbase="system32" installname="mesa32.dll" allowwarnings="true">
<module name="mesa32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_MESA32}" installbase="system32" installname="mesa32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="src/drivers/windows/icd/mesa.def" />
<linkerflag>-enable-stdcall-fixup</linkerflag>
<library>ntdll</library>
+3 -1
View File
@@ -155,7 +155,9 @@ WelcomeDlgProc(HWND hwndDlg,
first[1] = L'\0';
first = wcsrchr(pContext->szDescription, L'.');
first[0] = L'\0';
if(first)
first[0] = L'\0';
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="yes">
<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="desk.spec" />
<include base="desk">.</include>
<define name="_WIN32" />
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes">
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="intl.spec" />
<include base="intl">.</include>
<library>kernel32</library>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="main" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MAIN}" installbase="system32" installname="main.cpl" unicode="yes">
<module name="main" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MAIN}" installbase="system32" installname="main.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="main.spec" />
<include base="main">.</include>
<library>kernel32</library>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="mmsys" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MMSYS}" installbase="system32" installname="mmsys.cpl" unicode="yes">
<module name="mmsys" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MMSYS}" installbase="system32" installname="mmsys.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="mmsys.spec" />
<include base="mmsys">.</include>
<library>kernel32</library>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes">
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="usrmgr.spec" />
<include base="usrmgr">.</include>
<library>kernel32</library>
+208 -6
View File
@@ -472,18 +472,125 @@ HRESULT WINAPI IDirect3DDevice9Base_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PA
return D3D_OK;
}
/*++
* @name IDirect3DDevice9::Present
* @implemented
*
* The function IDirect3DDevice9Base_Present displays the content of the next
* back buffer in sequence for the device.
*
* @param LPDIRECT3D iface
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice().
*
* @param CONST RECT* pSourceRect
* A pointer to a RECT structure representing an area of the back buffer to display where
* NULL means the whole back buffer. This parameter MUST be NULL unless the back buffer
* was created with the D3DSWAPEFFECT_COPY flag.
*
* @param CONST RECT* pDestRect
* A pointer to a RECT structure representing an area of the back buffer where the content
* will be displayed where NULL means the whole back buffer starting at (0,0).
* This parameter MUST be NULL unless the back buffer was created with the D3DSWAPEFFECT_COPY flag.
*
* @param HWND hDestWindowOverride
* A destination window where NULL means the window specified in the hWndDeviceWindow of the
* D3DPRESENT_PARAMETERS structure.
*
* @param CONST RGNDATA* pDirtyRegion
* A pointer to a RGNDATA structure representing an area of the back buffer to display where
* NULL means the whole back buffer. This parameter MUST be NULL unless the back buffer
* was created with the D3DSWAPEFFECT_COPY flag. This is an opimization region only.
*
* @return HRESULT
* If the method successfully displays the back buffer content, the return value is D3D_OK.
* If no swap chains are available, the return value will be D3DERR_INVALIDCALL.
*/
HRESULT WINAPI IDirect3DDevice9Base_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
{
UNIMPLEMENTED
UINT i;
UINT iNumSwapChains;
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
LOCK_D3DDEVICE9();
iNumSwapChains = IDirect3DDevice9Base_GetNumberOfSwapChains(iface);
if (0 == iNumSwapChains)
{
DPRINT1("Not enough swap chains, Present() fails");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
for (i = 0; i < iNumSwapChains; i++)
{
HRESULT hResult;
IDirect3DSwapChain9* pSwapChain;
IDirect3DDevice9Base_GetSwapChain(iface, i, &pSwapChain);
hResult = IDirect3DSwapChain9_Present(pSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0);
if (FAILED(hResult))
{
UNLOCK_D3DDEVICE9();
return hResult;
}
}
UNLOCK_D3DDEVICE9();
return D3D_OK;
}
/*++
* @name IDirect3DDevice9::GetBackBuffer
* @implemented
*
* The function IDirect3DDevice9Base_GetBackBuffer retrieves the back buffer
* for the specified swap chain.
*
* @param LPDIRECT3D iface
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice().
*
* @param UINT iSwapChain
* Swap chain index to get object for.
* The maximum value for this is the value returned by IDirect3DDevice9::GetNumberOfSwapChains() - 1.
*
* @param UINT iBackBuffer
* Back buffer index to get object for.
* The maximum value for this is the the total number of back buffers - 1, as indexing starts at 0.
*
* @param IDirect3DSurface9** ppBackBuffer
* Pointer to a IDirect3DSurface9* to receive the back buffer object
*
* @return HRESULT
* If the method successfully sets the ppBackBuffer pointer, the return value is D3D_OK.
* If iSwapChain or iBackBuffer is out of range, Type is invalid or ppBackBuffer is a bad pointer,
* the return value will be D3DERR_INVALIDCALL.
*/
HRESULT WINAPI IDirect3DDevice9Base_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer)
{
UNIMPLEMENTED
HRESULT hResult;
IDirect3DSwapChain9* pSwapChain = NULL;
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
LOCK_D3DDEVICE9();
return D3D_OK;
IDirect3DDevice9Base_GetSwapChain(iface, iSwapChain, &pSwapChain);
if (NULL == pSwapChain)
{
DPRINT1("Invalid iSwapChain parameter specified");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
if (NULL == ppBackBuffer)
{
DPRINT1("Invalid ppBackBuffer parameter specified");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
hResult = IDirect3DSwapChain9_GetBackBuffer(pSwapChain, iBackBuffer, Type, ppBackBuffer);
UNLOCK_D3DDEVICE9();
return hResult;
}
/*++
@@ -503,6 +610,10 @@ HRESULT WINAPI IDirect3DDevice9Base_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT
* @param D3DRASTER_STATUS* pRasterStatus
* Pointer to a D3DRASTER_STATUS to receive the raster information
*
* @return HRESULT
* If the method successfully fills the pRasterStatus structure, the return value is D3D_OK.
* If iSwapChain is out of range or pRasterStatus is a bad pointer, the return value
* will be D3DERR_INVALIDCALL.
*/
HRESULT WINAPI IDirect3DDevice9Base_GetRasterStatus(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus)
{
@@ -539,9 +650,57 @@ HRESULT WINAPI IDirect3DDevice9Base_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface, BO
return D3D_OK;
}
/*++
* @name IDirect3DDevice9::SetGammaRamp
* @implemented
*
* The function IDirect3DDevice9Base_SetGammaRamp sets the gamma correction ramp values
* for the specified swap chain.
*
* @param LPDIRECT3D iface
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice().
*
* @param UINT iSwapChain
* Swap chain index to get object for.
* The maximum value for this is the value returned by IDirect3DDevice9::GetNumberOfSwapChains() - 1.
*
* @param UINT Flags
* Can be on of the following:
* D3DSGR_CALIBRATE - Detects if a gamma calibrator is installed and if so modifies the values to correspond to
* the monitor and system settings before sending them to the display device.
* D3DSGR_NO_CALIBRATION - The gamma calibrations values are sent directly to the display device without
* any modification.
*
* @param CONST D3DGAMMARAMP* pRamp
* Pointer to a D3DGAMMARAMP representing the gamma correction ramp values to be set.
*
*/
VOID WINAPI IDirect3DDevice9Base_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp)
{
UNIMPLEMENTED
IDirect3DSwapChain9* pSwapChain = NULL;
Direct3DSwapChain9_INT* pSwapChain_INT;
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
LOCK_D3DDEVICE9();
IDirect3DDevice9Base_GetSwapChain(iface, iSwapChain, &pSwapChain);
if (NULL == pSwapChain)
{
DPRINT1("Invalid iSwapChain parameter specified");
UNLOCK_D3DDEVICE9();
return;
}
if (NULL == pRamp)
{
DPRINT1("Invalid pRamp parameter specified");
UNLOCK_D3DDEVICE9();
return;
}
pSwapChain_INT = IDirect3DSwapChain9ToImpl(pSwapChain);
Direct3DSwapChain9_SetGammaRamp(pSwapChain_INT, Flags, pRamp);
UNLOCK_D3DDEVICE9();
}
/*++
@@ -721,11 +880,54 @@ HRESULT WINAPI IDirect3DDevice9Base_GetRenderTargetData(LPDIRECT3DDEVICE9 iface,
return D3D_OK;
}
/*++
* @name IDirect3DDevice9::GetFrontBufferData
* @implemented
*
* The function IDirect3DDevice9Base_GetFrontBufferData copies the content of
* the display device's front buffer in a system memory surface buffer.
*
* @param LPDIRECT3D iface
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice().
*
* @param UINT iSwapChain
* Swap chain index to get object for.
* The maximum value for this is the value returned by IDirect3DDevice9::GetNumberOfSwapChains() - 1.
*
* @param IDirect3DSurface9* pDestSurface
* Pointer to a IDirect3DSurface9 to receive front buffer content
*
* @return HRESULT
* If the method successfully fills the pDestSurface buffer, the return value is D3D_OK.
* If iSwapChain is out of range or pDestSurface is a bad pointer, the return value
* will be D3DERR_INVALIDCALL.
*/
HRESULT WINAPI IDirect3DDevice9Base_GetFrontBufferData(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface)
{
UNIMPLEMENTED
HRESULT hResult;
IDirect3DSwapChain9* pSwapChain = NULL;
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
LOCK_D3DDEVICE9();
return D3D_OK;
IDirect3DDevice9Base_GetSwapChain(iface, iSwapChain, &pSwapChain);
if (NULL == pSwapChain)
{
DPRINT1("Invalid iSwapChain parameter specified");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
if (NULL == pDestSurface)
{
DPRINT1("Invalid pDestSurface parameter specified");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
hResult = IDirect3DSwapChain9_GetFrontBufferData(pSwapChain, pDestSurface);
UNLOCK_D3DDEVICE9();
return hResult;
}
HRESULT WINAPI IDirect3DDevice9Base_StretchRect(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter)
@@ -249,3 +249,8 @@ VOID Direct3DSwapChain9_GetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, D3D
{
memcpy(pRamp, &pThisSwapChain->GammaRamp, sizeof(D3DGAMMARAMP));
}
VOID Direct3DSwapChain9_SetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp)
{
UNIMPLEMENTED
}
@@ -78,5 +78,6 @@ VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D
HRESULT Direct3DSwapChain9_Init(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters);
HRESULT Direct3DSwapChain9_Reset(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters);
VOID Direct3DSwapChain9_GetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, D3DGAMMARAMP* pRamp);
VOID Direct3DSwapChain9_SetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp);
#endif // _D3D9_SWAPCHAIN_H_
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="ddraw" type="win32dll" installbase="system32" installname="ddraw.dll" allowwarnings ="true" unicode="yes">
<module name="ddraw" type="win32dll" installbase="system32" installname="ddraw.dll" allowwarnings ="true" unicode="yes" crt="msvcrt">
<importlibrary definition="ddraw.spec" />
<include base="ddraw">.</include>
<library>kernel32</library>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="dsound" type="win32dll" baseaddress="${BASEADDRESS_DSOUND}" installbase="system32" installname="dsound.dll" allowwarnings ="true">
<module name="dsound" type="win32dll" baseaddress="${BASEADDRESS_DSOUND}" installbase="system32" installname="dsound.dll" allowwarnings ="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="dsound.spec" />
<include base="dsound">.</include>
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="wined3d" type="win32dll" installbase="system32" installname="wined3d.dll" allowwarnings ="true">
<module name="wined3d" type="win32dll" installbase="system32" installname="wined3d.dll" allowwarnings ="true" crt="msvcrt">
<importlibrary definition="wined3d.def" />
<include base="wined3d">.</include>
<include base="ReactOS">include/reactos/wine</include>
+1 -1
View File
@@ -1461,7 +1461,7 @@ LookupPrivilegeValueW(LPCWSTR SystemName,
for (Priv = 0; Priv < sizeof(DefaultPrivNames) / sizeof(DefaultPrivNames[0]); Priv++)
{
if (0 == wcsicmp(PrivName, DefaultPrivNames[Priv]))
if (0 == _wcsicmp(PrivName, DefaultPrivNames[Priv]))
{
Luid->LowPart = Priv + SE_MIN_WELL_KNOWN_PRIVILEGE;
Luid->HighPart = 0;
+4 -1
View File
@@ -1,4 +1,4 @@
<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll" allowwarnings="true">
<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="crypt32.spec" />
<include base="crypt32">.</include>
<include base="ReactOS">include/reactos/wine</include>
@@ -10,6 +10,7 @@
<library>kernel32</library>
<library>ntdll</library>
<library>imagehlp</library>
<library>pseh</library>
<file>base64.c</file>
<file>cert.c</file>
<file>chain.c</file>
@@ -35,4 +36,6 @@
<file>ctl.c</file>
<file>message.c</file>
<file>crypt32.rc</file>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>
+2 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="dbghelp" type="win32dll" baseaddress="${BASEADDRESS_DBGHELP}" installbase="system32" installname="dbghelp.dll" allowwarnings="true">
<module name="dbghelp" type="win32dll" baseaddress="${BASEADDRESS_DBGHELP}" installbase="system32" installname="dbghelp.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="dbghelp.spec" />
<include base="dbghelp">.</include>
<include base="ReactOS">include/reactos/wine</include>
@@ -31,5 +31,6 @@
<library>kernel32</library>
<library>version</library>
<library>ntdll</library>
<library>pseh</library>
</module>
</group>
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="dnsapi" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_DNSAPI}" installbase="system32" installname="dnsapi.dll">
<module name="dnsapi" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_DNSAPI}" installbase="system32" installname="dnsapi.dll" crt="msvcrt">
<importlibrary definition="dnsapi.def" />
<include base="dnsapi">include</include>
<include base="adns">src</include>
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="gdi32" type="win32dll" baseaddress="${BASEADDRESS_GDI32}" installbase="system32" installname="gdi32.dll" unicode="yes" allowwarnings="true">
<module name="gdi32" type="win32dll" baseaddress="${BASEADDRESS_GDI32}" installbase="system32" installname="gdi32.dll" unicode="yes" crt="dll" allowwarnings="true">
<importlibrary definition="gdi32.spec" />
<include base="gdi32">include</include>
<define name="_DISABLE_TIDENTS" />
+23 -23
View File
@@ -12,7 +12,7 @@ TextOutA(
int nXStart,
int nYStart,
LPCSTR lpString,
int cbString)
int cchString)
{
ANSI_STRING StringA;
UNICODE_STRING StringU;
@@ -25,7 +25,7 @@ TextOutA(
} else
StringU.Buffer = NULL;
ret = TextOutW(hdc, nXStart, nYStart, StringU.Buffer, cbString);
ret = TextOutW(hdc, nXStart, nYStart, StringU.Buffer, cchString);
RtlFreeUnicodeString(&StringU);
return ret;
}
@@ -41,9 +41,9 @@ TextOutW(
int nXStart,
int nYStart,
LPCWSTR lpString,
int cbString)
int cchString)
{
return NtGdiExtTextOutW(hdc, nXStart, nYStart, 0, NULL, (LPWSTR)lpString, cbString, NULL, 0);
return NtGdiExtTextOutW(hdc, nXStart, nYStart, 0, NULL, (LPWSTR)lpString, cchString, NULL, 0);
}
@@ -143,7 +143,7 @@ APIENTRY
GetTextExtentPointA(
HDC hdc,
LPCSTR lpString,
int cbString,
int cchString,
LPSIZE lpSize
)
{
@@ -154,7 +154,7 @@ GetTextExtentPointA(
RtlInitAnsiString(&StringA, (LPSTR)lpString);
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
ret = GetTextExtentPointW(hdc, StringU.Buffer, cbString, lpSize);
ret = GetTextExtentPointW(hdc, StringU.Buffer, cchString, lpSize);
RtlFreeUnicodeString(&StringU);
@@ -170,11 +170,11 @@ APIENTRY
GetTextExtentPointW(
HDC hdc,
LPCWSTR lpString,
int cbString,
int cchString,
LPSIZE lpSize
)
{
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cbString, lpSize, 0);
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 0);
}
@@ -184,13 +184,13 @@ GetTextExtentPointW(
BOOL
APIENTRY
GetTextExtentExPointW(
HDC hdc,
LPCWSTR lpszStr,
int cchString,
int nMaxExtent,
LPINT lpnFit,
LPINT alpDx,
LPSIZE lpSize
HDC hdc,
LPCWSTR lpszStr,
int cchString,
int nMaxExtent,
LPINT lpnFit,
LPINT alpDx,
LPSIZE lpSize
)
{
return NtGdiGetTextExtentExW (
@@ -240,7 +240,7 @@ APIENTRY
GetTextExtentPoint32A(
HDC hdc,
LPCSTR lpString,
int cbString,
int cchString,
LPSIZE lpSize
)
{
@@ -251,7 +251,7 @@ GetTextExtentPoint32A(
RtlInitAnsiString(&StringA, (LPSTR)lpString);
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
ret = GetTextExtentPoint32W(hdc, StringU.Buffer, cbString, lpSize);
ret = GetTextExtentPoint32W(hdc, StringU.Buffer, cchString, lpSize);
RtlFreeUnicodeString(&StringU);
@@ -267,11 +267,11 @@ APIENTRY
GetTextExtentPoint32W(
HDC hdc,
LPCWSTR lpString,
int cbString,
int cchString,
LPSIZE lpSize
)
{
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cbString, lpSize, 0);
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 0);
}
/*
@@ -315,7 +315,7 @@ ExtTextOutA(
UINT fuOptions,
CONST RECT *lprc,
LPCSTR lpString,
UINT cbCount,
UINT cchString,
CONST INT *lpDx
)
{
@@ -326,7 +326,7 @@ ExtTextOutA(
RtlInitAnsiString(&StringA, (LPSTR)lpString);
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
ret = ExtTextOutW(hdc, X, Y, fuOptions, lprc, StringU.Buffer, cbCount, lpDx);
ret = ExtTextOutW(hdc, X, Y, fuOptions, lprc, StringU.Buffer, cchString, lpDx);
RtlFreeUnicodeString(&StringU);
@@ -346,11 +346,11 @@ ExtTextOutW(
UINT fuOptions,
CONST RECT *lprc,
LPCWSTR lpString,
UINT cbCount,
UINT cchString,
CONST INT *lpDx
)
{
return NtGdiExtTextOutW(hdc, X, Y, fuOptions, (LPRECT)lprc, (LPWSTR)lpString, cbCount, (LPINT)lpDx, 0);
return NtGdiExtTextOutW(hdc, X, Y, fuOptions, (LPRECT)lprc, (LPWSTR)lpString, cchString, (LPINT)lpDx, 0);
}
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="gdiplus" type="win32dll" baseaddress="${BASEADDRESS_GDIPLUS}" installbase="system32" installname="gdiplus.dll" allowwarnings="true">
<module name="gdiplus" type="win32dll" baseaddress="${BASEADDRESS_GDIPLUS}" installbase="system32" installname="gdiplus.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="gdiplus.spec" />
<include base="gdiplus">.</include>
<include base="ReactOS">include/reactos/wine</include>
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="glu32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_GLU32}" installbase="system32" installname="glu32.dll" allowwarnings="true">
<module name="glu32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_GLU32}" installbase="system32" installname="glu32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="glu32.spec" />
<include base="glu32">include</include>
<include base="glu32">libnurbs/internals</include>
+6 -6
View File
@@ -231,7 +231,7 @@ DWORD WINAPI IcmpSendEcho(
/* check the request size against SO_MAX_MSG_SIZE using getsockopt */
/* Prepare the request */
id=_getpid() & 0xFFFF;
id=GetCurrentProcessId() & 0xFFFF;
seq=InterlockedIncrement(&icmp_sequence) & 0xFFFF;
reqsize=ICMP_MINLEN+RequestSize;
@@ -319,18 +319,18 @@ DWORD WINAPI IcmpSendEcho(
res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, sizeof(addr));
HeapFree(GetProcessHeap (), 0, reqbuf);
if (res<0) {
if (errno==EMSGSIZE)
if (WSAGetLastError()==WSAEMSGSIZE)
SetLastError(IP_PACKET_TOO_BIG);
else {
switch (errno) {
case ENETUNREACH:
switch (WSAGetLastError()) {
case WSAENETUNREACH:
SetLastError(IP_DEST_NET_UNREACHABLE);
break;
case EHOSTUNREACH:
case WSAEHOSTUNREACH:
SetLastError(IP_DEST_HOST_UNREACHABLE);
break;
default:
TRACE("unknown error: errno=%d\n",errno);
TRACE("unknown error: errno=%d\n",WSAGetLastError());
SetLastError(IP_GENERAL_FAILURE);
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="iphlpapi" type="win32dll" baseaddress="${BASEADDRESS_IPHLPAPI}" installbase="system32" installname="iphlpapi.dll" allowwarnings="true" unicode="yes">
<module name="iphlpapi" type="win32dll" baseaddress="${BASEADDRESS_IPHLPAPI}" installbase="system32" installname="iphlpapi.dll" allowwarnings="true" unicode="yes" crt="msvcrt">
<importlibrary definition="iphlpapi.spec" />
<include base="iphlpapi">include</include>
<include base="ReactOS">include/reactos/wine</include>
+1 -1
View File
@@ -1,5 +1,5 @@
<group>
<module name="jscript" type="win32dll" baseaddress="${BASEADDRESS_JSCRIPT}" installbase="system32" installname="jscript.dll" allowwarnings="true">
<module name="jscript" type="win32dll" baseaddress="${BASEADDRESS_JSCRIPT}" installbase="system32" installname="jscript.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="jscript.spec" />
<include base="jscript">.</include>
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="kernel32_base" type="objectlibrary" allowwarnings="true">
<module name="kernel32_base" type="objectlibrary" crt="dll" allowwarnings="true">
<include base="kernel32_base">.</include>
<include base="kernel32_base">include</include>
<include base="ReactOS">include/reactos/subsys</include>
@@ -141,7 +141,7 @@
</directory>
<library>normalize</library>
</module>
<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}" installbase="system32" installname="kernel32.dll">
<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}" installbase="system32" installname="kernel32.dll" crt="dll">
<importlibrary definition="kernel32.spec" />
<include base="kernel32">.</include>
<include base="kernel32" root="intermediate">.</include>
+2 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="msi" type="win32dll" baseaddress="${BASEADDRESS_MSI}" installbase="system32" installname="msi.dll" allowwarnings="true">
<module name="msi" type="win32dll" baseaddress="${BASEADDRESS_MSI}" installbase="system32" installname="msi.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="msi.spec" />
<include base="msi">.</include>
@@ -69,6 +69,7 @@
<library>kernel32</library>
<library>odbccp32</library>
<library>ntdll</library>
<library>pseh</library>
<dependency>msiserver</dependency>
<dependency>msiheader</dependency>
</module>
+1
View File
@@ -20,6 +20,7 @@
<library>wine</library>
<library>kernel32</library>
<library>ntdll</library>
<library>pseh</library>
<pch>precomp.h</pch>
<file>dllmain.c</file>
<file>msvcrt.rc</file>
+1 -1
View File
@@ -1,5 +1,5 @@
<group>
<module name="msxml3" type="win32dll" baseaddress="${BASEADDRESS_MSXML3}" installbase="system32" installname="msxml3.dll" allowwarnings="true">
<module name="msxml3" type="win32dll" baseaddress="${BASEADDRESS_MSXML3}" installbase="system32" installname="msxml3.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="msxml3.spec" />
<include base="msxml3">.</include>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="odbc32" type="win32dll" baseaddress="${BASEADDRESS_ODBC32}" installbase="system32" installname="odbc32.dll" allowwarnings="true" >
<module name="odbc32" type="win32dll" baseaddress="${BASEADDRESS_ODBC32}" installbase="system32" installname="odbc32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="odbc32.spec" />
<include base="odbc32">.</include>
<include base="ReactOS">include/reactos/wine</include>
+2
View File
@@ -61,6 +61,8 @@
<file>dcom.idl</file>
<file>irot.idl</file>
<include base="ole32" root="intermediate">.</include>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>
<module name="ole32_irot_server" type="rpcserver">
<file>irot.idl</file>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true">
<module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="oleaut32.spec" />
<include base="oleaut32">.</include>
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="opengl32" type="win32dll" baseaddress="${BASEADDRESS_OPENGL32}" installbase="system32" installname="opengl32.dll" unicode="yes">
<module name="opengl32" type="win32dll" baseaddress="${BASEADDRESS_OPENGL32}" installbase="system32" installname="opengl32.dll" unicode="yes" crt="msvcrt">
<importlibrary definition="opengl32.spec" />
<define name="_DISABLE_TIDENTS" />
<library>ntdll</library>
+3 -1
View File
@@ -1,4 +1,4 @@
<module name="rpcrt4" type="win32dll" baseaddress="${BASEADDRESS_RPCRT4}" installbase="system32" installname="rpcrt4.dll" allowwarnings="true">
<module name="rpcrt4" type="win32dll" baseaddress="${BASEADDRESS_RPCRT4}" installbase="system32" installname="rpcrt4.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="rpcrt4.spec" />
<include base="rpcrt4">.</include>
@@ -39,6 +39,8 @@
<file>rpcrt4.rc</file>
<file>epm.idl</file>
<include base="rpcrt4" root="intermediate">.</include>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>
<module name="rpcrt4_epm_client" type="rpcclient">
<file>epm.idl</file>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="rsaenh" type="win32dll" baseaddress="${BASEADDRESS_RSAENH}" installbase="system32" installname="rsaenh.dll" allowwarnings="true">
<module name="rsaenh" type="win32dll" baseaddress="${BASEADDRESS_RSAENH}" installbase="system32" installname="rsaenh.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="rsaenh.spec" />
<include base="rsaenh">.</include>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="setupapi" type="win32dll" baseaddress="${BASEADDRESS_SETUPAPI}" installbase="system32" installname="setupapi.dll" allowwarnings="true" unicode="yes">
<module name="setupapi" type="win32dll" baseaddress="${BASEADDRESS_SETUPAPI}" installbase="system32" installname="setupapi.dll" allowwarnings="true" unicode="yes" crt="msvcrt">
<importlibrary definition="setupapi.spec" />
<include base="setupapi">.</include>
<include base="ReactOS">include/reactos/wine</include>
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="shell32" type="win32dll" baseaddress="${BASEADDRESS_SHELL32}" installbase="system32" installname="shell32.dll">
<module name="shell32" type="win32dll" baseaddress="${BASEADDRESS_SHELL32}" installbase="system32" installname="shell32.dll" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="Both" />
<importlibrary definition="shell32.spec" />
<include base="shell32">.</include>
+2 -4
View File
@@ -1202,11 +1202,9 @@ DoCreateLink(
if (StrRetToBufW(&strFile, This->dcm.apidl[0], szPath, MAX_PATH) != S_OK)
return E_FAIL;
pszExt = wcsrchr(szPath, L'.');
pszExt[0] = 0;
if (!wcsicmp(pszExt + 1, szLnk))
if (pszExt && !wcsicmp(pszExt + 1, szLnk))
{
if (!GetUniqueFileName(szPath, pszExt + 1, szTarget, TRUE))
return E_FAIL;
@@ -1231,7 +1229,7 @@ DoCreateLink(
{
return E_FAIL;
}
pszExt[0] = '.';
if (SUCCEEDED(IShellLinkW_SetPath(nLink, szPath)))
{
if (SUCCEEDED(IShellLinkW_QueryInterface(nLink, &IID_IPersistFile, (LPVOID*)&ipf)))
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="syssetup" type="win32dll" baseaddress="${BASEADDRESS_SYSSETUP}" installbase="system32" installname="syssetup.dll" unicode="yes" allowwarnings="true">
<module name="syssetup" type="win32dll" baseaddress="${BASEADDRESS_SYSSETUP}" installbase="system32" installname="syssetup.dll" unicode="yes" allowwarnings="true" crt="msvcrt">
<importlibrary definition="syssetup.def" />
<include base="syssetup">.</include>
<library>pseh</library>
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="twain_32" type="win32dll" baseaddress="${BASEADDRESS_TWAIN_32}" installbase="system32" installname="twain_32.dll" allowwarnings="true">
<module name="twain_32" type="win32dll" baseaddress="${BASEADDRESS_TWAIN_32}" installbase="system32" installname="twain_32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="twain_32.def" />
<include base="twain_32">.</include>
<define name="_DISABLE_TIDENTS" />
+38 -16
View File
@@ -132,16 +132,27 @@ LoadAppInitDlls()
{
WCHAR buffer[KEY_LENGTH];
LPWSTR ptr;
LPWSTR seps = L" ,";
size_t i;
RtlCopyMemory(buffer, szAppInit, KEY_LENGTH);;
RtlCopyMemory(buffer, szAppInit, KEY_LENGTH);
ptr = wcstok(buffer, seps);
while (ptr)
{
LoadLibraryW(ptr);
ptr = wcstok(NULL, seps);
}
for (i = 0; i < KEY_LENGTH; ++ i)
{
if(buffer[i] == L' ' || buffer[i] == L',')
buffer[i] = 0;
}
for (i = 0; i < KEY_LENGTH; )
{
if(buffer[i] == 0)
++ i;
else
{
ptr = buffer + i;
i += wcslen(ptr);
LoadLibraryW(ptr);
}
}
}
}
@@ -153,17 +164,28 @@ UnloadAppInitDlls()
WCHAR buffer[KEY_LENGTH];
HMODULE hModule;
LPWSTR ptr;
LPWSTR seps = L" ,";
size_t i;
RtlCopyMemory(buffer, szAppInit, KEY_LENGTH);
ptr = wcstok(buffer, seps);
while (ptr)
{
hModule = GetModuleHandleW(ptr);
FreeLibrary(hModule);
ptr = wcstok(NULL, seps);
}
for (i = 0; i < KEY_LENGTH; ++ i)
{
if(buffer[i] == L' ' || buffer[i] == L',')
buffer[i] = 0;
}
for (i = 0; i < KEY_LENGTH; )
{
if(buffer[i] == 0)
++ i;
else
{
ptr = buffer + i;
i += wcslen(ptr);
hModule = GetModuleHandleW(ptr);
FreeLibrary(hModule);
}
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
<module name="user32" type="win32dll" baseaddress="${BASEADDRESS_USER32}" installbase="system32" installname="user32.dll" unicode="yes" allowwarnings="true">
<module name="user32" type="win32dll" baseaddress="${BASEADDRESS_USER32}" installbase="system32" installname="user32.dll" unicode="yes" crt="dll" allowwarnings="true">
<importlibrary definition="user32.pspec" />
<include base="user32">.</include>
<include base="user32">include</include>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="winhttp" type="win32dll" baseaddress="${BASEADDRESS_WINHTTP}" installbase="system32" installname="winhttp.dll" allowwarnings="true">
<module name="winhttp" type="win32dll" baseaddress="${BASEADDRESS_WINHTTP}" installbase="system32" installname="winhttp.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="winhttp.spec" />
<include base="winhttp">.</include>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" allowwarnings="true">
<module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllInstall" />
<importlibrary definition="wininet.spec" />
<include base="wininet">.</include>
+1 -1
View File
@@ -7,7 +7,7 @@
<directory name="wavemap">
<xi:include href="wavemap/wavemap.rbuild" />
</directory>
<module name="winmm" type="win32dll" baseaddress="${BASEADDRESS_WINMM}" installbase="system32" installname="winmm.dll" allowwarnings="true">
<module name="winmm" type="win32dll" baseaddress="${BASEADDRESS_WINMM}" installbase="system32" installname="winmm.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="winmm.spec" />
<include base="winmm">.</include>
<include base="ReactOS">include/reactos/wine</include>
@@ -11,10 +11,13 @@
<library>kernel32</library>
<library>imagehlp</library>
<library>ntdll</library>
<library>pseh</library>
<file>crypt.c</file>
<file>register.c</file>
<file>wintrust_main.c</file>
<file>asn.c</file>
<file>softpub.c</file>
<file>version.rc</file>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>
+1 -1
View File
@@ -62,7 +62,7 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
UserRequest,
KernelMode,
FALSE,
NULL); /* FIXME: handle timeout */
&Fcb->TimeOut);
if ((NT_SUCCESS(Status)) && (Fcb->MessageCount > 0))
{
/* copy current message into buffer */
+6 -80
View File
@@ -10,9 +10,6 @@
#include "precomp.h"
/* Define this to bugcheck on double complete */
/* #define BREAK_ON_DOUBLE_COMPLETE */
UINT TransferDataCalled = 0;
UINT TransferDataCompleteCalled = 0;
UINT LanReceiveWorkerCalled = 0;
@@ -51,54 +48,6 @@ BOOLEAN ProtocolRegistered = FALSE;
LIST_ENTRY AdapterListHead;
KSPIN_LOCK AdapterListLock;
/* Double complete protection */
KSPIN_LOCK LanSendCompleteLock;
LIST_ENTRY LanSendCompleteList;
VOID LanChainCompletion( PLAN_ADAPTER Adapter, PNDIS_PACKET NdisPacket ) {
PLAN_WQ_ITEM PendingCompletion =
ExAllocatePool( NonPagedPool, sizeof(LAN_WQ_ITEM) );
if( !PendingCompletion ) return;
PendingCompletion->Packet = NdisPacket;
PendingCompletion->Adapter = Adapter;
ExInterlockedInsertTailList( &LanSendCompleteList,
&PendingCompletion->ListEntry,
&LanSendCompleteLock );
}
BOOLEAN LanShouldComplete( PLAN_ADAPTER Adapter, PNDIS_PACKET NdisPacket ) {
PLIST_ENTRY ListEntry;
PLAN_WQ_ITEM CompleteEntry;
KIRQL OldIrql;
KeAcquireSpinLock( &LanSendCompleteLock, &OldIrql );
for( ListEntry = LanSendCompleteList.Flink;
ListEntry != &LanSendCompleteList;
ListEntry = ListEntry->Flink ) {
CompleteEntry = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
if( CompleteEntry->Adapter == Adapter &&
CompleteEntry->Packet == NdisPacket ) {
RemoveEntryList( ListEntry );
KeReleaseSpinLock( &LanSendCompleteLock, OldIrql );
ExFreePool( CompleteEntry );
return TRUE;
}
}
KeReleaseSpinLock( &LanSendCompleteLock, OldIrql );
DbgPrint("NDIS completed the same send packet twice "
"(Adapter %x Packet %x)!!\n", Adapter, NdisPacket);
#ifdef BREAK_ON_DOUBLE_COMPLETE
KeBugCheck(0);
#endif
return FALSE;
}
NDIS_STATUS NDISCall(
PLAN_ADAPTER Adapter,
NDIS_REQUEST_TYPE Type,
@@ -283,13 +232,11 @@ VOID NTAPI ProtocolSendComplete(
*/
{
TI_DbgPrint(DEBUG_DATALINK, ("Calling completion routine\n"));
if( LanShouldComplete( (PLAN_ADAPTER)BindingContext, Packet ) ) {
ASSERT_KM_POINTER(Packet);
ASSERT_KM_POINTER(PC(Packet));
ASSERT_KM_POINTER(PC(Packet)->DLComplete);
(*PC(Packet)->DLComplete)( PC(Packet)->Context, Packet, Status);
TI_DbgPrint(DEBUG_DATALINK, ("Finished\n"));
}
ASSERT_KM_POINTER(Packet);
ASSERT_KM_POINTER(PC(Packet));
ASSERT_KM_POINTER(PC(Packet)->DLComplete);
(*PC(Packet)->DLComplete)( PC(Packet)->Context, Packet, Status);
TI_DbgPrint(DEBUG_DATALINK, ("Finished\n"));
}
VOID LanReceiveWorker( PVOID Context ) {
@@ -646,8 +593,6 @@ VOID LANTransmit(
* not needed immediately */
GetDataPtr( NdisPacket, 0, &Data, &Size );
LanChainCompletion( Adapter, NdisPacket );
switch (Adapter->Media) {
case NdisMedium802_3:
EHeader = (PETH_HEADER)Data;
@@ -1046,6 +991,7 @@ BOOLEAN BindAdapter(
if (NdisStatus != NDIS_STATUS_SUCCESS) {
TI_DbgPrint(DEBUG_DATALINK, ("Could not set packet filter (0x%X).\n", NdisStatus));
IPUnregisterInterface(IF);
IPDestroyInterface(IF);
return FALSE;
}
@@ -1380,24 +1326,4 @@ VOID LANUnregisterProtocol(
}
}
VOID LANStartup() {
InitializeListHead( &LanSendCompleteList );
KeInitializeSpinLock( &LanSendCompleteLock );
}
VOID LANShutdown() {
KIRQL OldIrql;
PLAN_WQ_ITEM WorkItem;
PLIST_ENTRY ListEntry;
KeAcquireSpinLock( &LanSendCompleteLock, &OldIrql );
while( !IsListEmpty( &LanSendCompleteList ) ) {
ListEntry = RemoveHeadList( &LanSendCompleteList );
WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
FreeNdisPacket( WorkItem->Packet );
ExFreePool( WorkItem );
}
KeReleaseSpinLock( &LanSendCompleteLock, OldIrql );
}
/* EOF */
@@ -585,9 +585,6 @@ VOID NTAPI TiUnload(
/* Shutdown network level protocol subsystem */
IPShutdown();
/* Shutdown the lan worker */
LANShutdown();
/* Free NDIS buffer descriptors */
if (GlobalBufferPool)
NdisFreeBufferPool(GlobalBufferPool);
@@ -827,9 +824,6 @@ DriverEntry(
return Status;
}
/* Initialize the lan worker */
LANStartup();
/* Register protocol with NDIS */
/* This used to be IP_DEVICE_NAME but the DDK says it has to match your entry in the SCM */
Status = LANRegisterProtocol(&strNdisDeviceName);
@@ -843,7 +837,6 @@ DriverEntry(
NULL,
0,
NULL);
LANShutdown();
TCPShutdown();
UDPShutdown();
RawIPShutdown();
@@ -863,7 +856,6 @@ DriverEntry(
Status = LoopRegisterAdapter(NULL, NULL);
if (!NT_SUCCESS(Status)) {
TI_DbgPrint(MIN_TRACE, ("Failed to create loopback adapter. Status (0x%X).\n", Status));
LANShutdown();
TCPShutdown();
UDPShutdown();
RawIPShutdown();
+843
View File
@@ -0,0 +1,843 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _DVEC_H_INCLUDED
#define _DVEC_H_INCLUDED
#ifndef RC_INVOKED
#if !defined __cplusplus
#error This file is only supported in C++ compilations!
#endif
#include <emmintrin.h>
#include <assert.h>
#include <fvec.h>
#include <_mingw.h>
#pragma pack(push,_CRT_PACKING)
#if defined(_ENABLE_VEC_DEBUG)
#include <iostream>
#endif
#pragma pack(push,16)
#define EXPLICIT explicit
class I8vec16;
class Is8vec16;
class Iu8vec16;
class I16vec8;
class Is16vec8;
class Iu16vec8;
class I32vec4;
class Is32vec4;
class Iu32vec4;
class I64vec2;
class I128vec1;
#define _MM_16UB(element,vector) (*((unsigned char*)&##vector + ##element))
#define _MM_16B(element,vector) (*((signed char*)&##vector + ##element))
#define _MM_8UW(element,vector) (*((unsigned short*)&##vector + ##element))
#define _MM_8W(element,vector) (*((short*)&##vector + ##element))
#define _MM_4UDW(element,vector) (*((unsigned int*)&##vector + ##element))
#define _MM_4DW(element,vector) (*((int*)&##vector + ##element))
#define _MM_2QW(element,vector) (*((__int64*)&##vector + ##element))
inline const __m128i get_mask128()
{
static const __m128i mask128 = _mm_set1_epi64(M64(0xffffffffffffffffi64));
return mask128;
}
class M128
{
protected:
__m128i vec;
public:
M128() { }
M128(__m128i mm) { vec = mm; }
operator __m128i() const { return vec; }
M128& operator&=(const M128 &a) { return *this = (M128) _mm_and_si128(vec,a); }
M128& operator|=(const M128 &a) { return *this = (M128) _mm_or_si128(vec,a); }
M128& operator^=(const M128 &a) { return *this = (M128) _mm_xor_si128(vec,a); }
};
inline M128 operator&(const M128 &a,const M128 &b) { return _mm_and_si128(a,b); }
inline M128 operator|(const M128 &a,const M128 &b) { return _mm_or_si128(a,b); }
inline M128 operator^(const M128 &a,const M128 &b) { return _mm_xor_si128(a,b); }
inline M128 andnot(const M128 &a,const M128 &b) { return _mm_andnot_si128(a,b); }
class I128vec1 : public M128
{
public:
I128vec1() { }
I128vec1(__m128i mm) : M128(mm) { }
I128vec1& operator= (const M128 &a) { return *this = (I128vec1) a; }
I128vec1& operator&=(const M128 &a) { return *this = (I128vec1) _mm_and_si128(vec,a); }
I128vec1& operator|=(const M128 &a) { return *this = (I128vec1) _mm_or_si128(vec,a); }
I128vec1& operator^=(const M128 &a) { return *this = (I128vec1) _mm_xor_si128(vec,a); }
};
class I64vec2 : public M128
{
public:
I64vec2() { }
I64vec2(__m128i mm) : M128(mm) { }
I64vec2(__m64 q1,__m64 q0)
{
_MM_2QW(0,vec) = *(__int64*)&q0;
_MM_2QW(1,vec) = *(__int64*)&q1;
}
I64vec2& operator= (const M128 &a) { return *this = (I64vec2) a; }
I64vec2& operator&=(const M128 &a) { return *this = (I64vec2) _mm_and_si128(vec,a); }
I64vec2& operator|=(const M128 &a) { return *this = (I64vec2) _mm_or_si128(vec,a); }
I64vec2& operator^=(const M128 &a) { return *this = (I64vec2) _mm_xor_si128(vec,a); }
I64vec2& operator +=(const I64vec2 &a) { return *this = (I64vec2) _mm_add_epi64(vec,a); }
I64vec2& operator -=(const I64vec2 &a) { return *this = (I64vec2) _mm_sub_epi64(vec,a); }
I64vec2 operator<<(const I64vec2 &a) { return _mm_sll_epi64(vec,a); }
I64vec2 operator<<(int count) { return _mm_slli_epi64(vec,count); }
I64vec2& operator<<=(const I64vec2 &a) { return *this = (I64vec2) _mm_sll_epi64(vec,a); }
I64vec2& operator<<=(int count) { return *this = (I64vec2) _mm_slli_epi64(vec,count); }
I64vec2 operator>>(const I64vec2 &a) { return _mm_srl_epi64(vec,a); }
I64vec2 operator>>(int count) { return _mm_srli_epi64(vec,count); }
I64vec2& operator>>=(const I64vec2 &a) { return *this = (I64vec2) _mm_srl_epi64(vec,a); }
I64vec2& operator>>=(int count) { return *this = (I64vec2) _mm_srli_epi64(vec,count); }
const __int64& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 2);
return _MM_2QW(i,vec);
}
__int64& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 2);
return _MM_2QW(i,vec);
}
};
inline I64vec2 unpack_low(const I64vec2 &a,const I64vec2 &b) {return _mm_unpacklo_epi64(a,b); }
inline I64vec2 unpack_high(const I64vec2 &a,const I64vec2 &b) {return _mm_unpackhi_epi64(a,b); }
class I32vec4 : public M128
{
public:
I32vec4() { }
I32vec4(__m128i mm) : M128(mm) { }
I32vec4& operator= (const M128 &a) { return *this = (I32vec4) a; }
I32vec4& operator&=(const M128 &a) { return *this = (I32vec4) _mm_and_si128(vec,a); }
I32vec4& operator|=(const M128 &a) { return *this = (I32vec4) _mm_or_si128(vec,a); }
I32vec4& operator^=(const M128 &a) { return *this = (I32vec4) _mm_xor_si128(vec,a); }
I32vec4& operator +=(const I32vec4 &a) { return *this = (I32vec4)_mm_add_epi32(vec,a); }
I32vec4& operator -=(const I32vec4 &a) { return *this = (I32vec4)_mm_sub_epi32(vec,a); }
I32vec4 operator<<(const I32vec4 &a) { return _mm_sll_epi32(vec,a); }
I32vec4 operator<<(int count) { return _mm_slli_epi32(vec,count); }
I32vec4& operator<<=(const I32vec4 &a) { return *this = (I32vec4)_mm_sll_epi32(vec,a); }
I32vec4& operator<<=(int count) { return *this = (I32vec4)_mm_slli_epi32(vec,count); }
};
inline I32vec4 cmpeq(const I32vec4 &a,const I32vec4 &b) { return _mm_cmpeq_epi32(a,b); }
inline I32vec4 cmpneq(const I32vec4 &a,const I32vec4 &b) { return _mm_andnot_si128(_mm_cmpeq_epi32(a,b),get_mask128()); }
inline I32vec4 unpack_low(const I32vec4 &a,const I32vec4 &b) { return _mm_unpacklo_epi32(a,b); }
inline I32vec4 unpack_high(const I32vec4 &a,const I32vec4 &b) { return _mm_unpackhi_epi32(a,b); }
class Is32vec4 : public I32vec4
{
public:
Is32vec4() { }
Is32vec4(__m128i mm) : I32vec4(mm) { }
Is32vec4(int i3,int i2,int i1,int i0)
{
_MM_4DW(0,vec) = i0;
_MM_4DW(1,vec) = i1;
_MM_4DW(2,vec) = i2;
_MM_4DW(3,vec) = i3;
}
Is32vec4& operator= (const M128 &a) { return *this = (Is32vec4) a; }
Is32vec4& operator&=(const M128 &a) { return *this = (Is32vec4) _mm_and_si128(vec,a); }
Is32vec4& operator|=(const M128 &a) { return *this = (Is32vec4) _mm_or_si128(vec,a); }
Is32vec4& operator^=(const M128 &a) { return *this = (Is32vec4) _mm_xor_si128(vec,a); }
Is32vec4& operator +=(const I32vec4 &a) { return *this = (Is32vec4)_mm_add_epi32(vec,a); }
Is32vec4& operator -=(const I32vec4 &a) { return *this = (Is32vec4)_mm_sub_epi32(vec,a); }
Is32vec4 operator<<(const M128 &a) { return _mm_sll_epi32(vec,a); }
Is32vec4 operator<<(int count) { return _mm_slli_epi32(vec,count); }
Is32vec4& operator<<=(const M128 &a) { return *this = (Is32vec4)_mm_sll_epi32(vec,a); }
Is32vec4& operator<<=(int count) { return *this = (Is32vec4)_mm_slli_epi32(vec,count); }
Is32vec4 operator>>(const M128 &a) { return _mm_sra_epi32(vec,a); }
Is32vec4 operator>>(int count) { return _mm_srai_epi32(vec,count); }
Is32vec4& operator>>=(const M128 &a) { return *this = (Is32vec4) _mm_sra_epi32(vec,a); }
Is32vec4& operator>>=(int count) { return *this = (Is32vec4) _mm_srai_epi32(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream& operator<< (std::ostream &os,const Is32vec4 &a)
{
os << "[3]:" << _MM_4DW(3,a)
<< " [2]:" << _MM_4DW(2,a)
<< " [1]:" << _MM_4DW(1,a)
<< " [0]:" << _MM_4DW(0,a);
return os;
}
#endif
const int& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 4);
return _MM_4DW(i,vec);
}
int& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 4);
return _MM_4DW(i,vec);
}
};
inline Is32vec4 cmpeq(const Is32vec4 &a,const Is32vec4 &b) { return _mm_cmpeq_epi32(a,b); }
inline Is32vec4 cmpneq(const Is32vec4 &a,const Is32vec4 &b) { return _mm_andnot_si128(_mm_cmpeq_epi32(a,b),get_mask128()); }
inline Is32vec4 cmpgt(const Is32vec4 &a,const Is32vec4 &b) { return _mm_cmpgt_epi32(a,b); }
inline Is32vec4 cmplt(const Is32vec4 &a,const Is32vec4 &b) { return _mm_cmpgt_epi32(b,a); }
inline Is32vec4 unpack_low(const Is32vec4 &a,const Is32vec4 &b) { return _mm_unpacklo_epi32(a,b); }
inline Is32vec4 unpack_high(const Is32vec4 &a,const Is32vec4 &b) { return _mm_unpackhi_epi32(a,b); }
class Iu32vec4 : public I32vec4
{
public:
Iu32vec4() { }
Iu32vec4(__m128i mm) : I32vec4(mm) { }
Iu32vec4(unsigned int ui3,unsigned int ui2,unsigned int ui1,unsigned int ui0)
{
_MM_4UDW(0,vec) = ui0;
_MM_4UDW(1,vec) = ui1;
_MM_4UDW(2,vec) = ui2;
_MM_4UDW(3,vec) = ui3;
}
Iu32vec4& operator= (const M128 &a) { return *this = (Iu32vec4) a; }
Iu32vec4& operator&=(const M128 &a) { return *this = (Iu32vec4) _mm_and_si128(vec,a); }
Iu32vec4& operator|=(const M128 &a) { return *this = (Iu32vec4) _mm_or_si128(vec,a); }
Iu32vec4& operator^=(const M128 &a) { return *this = (Iu32vec4) _mm_xor_si128(vec,a); }
Iu32vec4& operator +=(const I32vec4 &a) { return *this = (Iu32vec4)_mm_add_epi32(vec,a); }
Iu32vec4& operator -=(const I32vec4 &a) { return *this = (Iu32vec4)_mm_sub_epi32(vec,a); }
Iu32vec4 operator<<(const M128 &a) { return _mm_sll_epi32(vec,a); }
Iu32vec4 operator<<(int count) { return _mm_slli_epi32(vec,count); }
Iu32vec4& operator<<=(const M128 &a) { return *this = (Iu32vec4)_mm_sll_epi32(vec,a); }
Iu32vec4& operator<<=(int count) { return *this = (Iu32vec4)_mm_slli_epi32(vec,count); }
Iu32vec4 operator>>(const M128 &a) { return _mm_srl_epi32(vec,a); }
Iu32vec4 operator>>(int count) { return _mm_srli_epi32(vec,count); }
Iu32vec4& operator>>=(const M128 &a) { return *this = (Iu32vec4) _mm_srl_epi32(vec,a); }
Iu32vec4& operator>>=(int count) { return *this = (Iu32vec4) _mm_srli_epi32(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream& operator<< (std::ostream &os,const Iu32vec4 &a)
{
os << "[3]:" << _MM_4UDW(3,a)
<< " [2]:" << _MM_4UDW(2,a)
<< " [1]:" << _MM_4UDW(1,a)
<< " [0]:" << _MM_4UDW(0,a);
return os;
}
#endif
const unsigned int& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 4);
return _MM_4UDW(i,vec);
}
unsigned int& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 4);
return _MM_4UDW(i,vec);
}
};
inline I64vec2 operator*(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_mul_epu32(a,b); }
inline Iu32vec4 cmpeq(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_cmpeq_epi32(a,b); }
inline Iu32vec4 cmpneq(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_andnot_si128(_mm_cmpeq_epi32(a,b),get_mask128()); }
inline Iu32vec4 unpack_low(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_unpacklo_epi32(a,b); }
inline Iu32vec4 unpack_high(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_unpackhi_epi32(a,b); }
class I16vec8 : public M128
{
public:
I16vec8() { }
I16vec8(__m128i mm) : M128(mm) { }
I16vec8& operator= (const M128 &a) { return *this = (I16vec8) a; }
I16vec8& operator&=(const M128 &a) { return *this = (I16vec8) _mm_and_si128(vec,a); }
I16vec8& operator|=(const M128 &a) { return *this = (I16vec8) _mm_or_si128(vec,a); }
I16vec8& operator^=(const M128 &a) { return *this = (I16vec8) _mm_xor_si128(vec,a); }
I16vec8& operator +=(const I16vec8 &a) { return *this = (I16vec8) _mm_add_epi16(vec,a); }
I16vec8& operator -=(const I16vec8 &a) { return *this = (I16vec8) _mm_sub_epi16(vec,a); }
I16vec8& operator *=(const I16vec8 &a) { return *this = (I16vec8) _mm_mullo_epi16(vec,a); }
I16vec8 operator<<(const M128 &a) { return _mm_sll_epi16(vec,a); }
I16vec8 operator<<(int count) { return _mm_slli_epi16(vec,count); }
I16vec8& operator<<=(const M128 &a) { return *this = (I16vec8)_mm_sll_epi16(vec,a); }
I16vec8& operator<<=(int count) { return *this = (I16vec8)_mm_slli_epi16(vec,count); }
};
inline I16vec8 operator*(const I16vec8 &a,const I16vec8 &b) { return _mm_mullo_epi16(a,b); }
inline I16vec8 cmpeq(const I16vec8 &a,const I16vec8 &b) { return _mm_cmpeq_epi16(a,b); }
inline I16vec8 cmpneq(const I16vec8 &a,const I16vec8 &b) { return _mm_andnot_si128(_mm_cmpeq_epi16(a,b),get_mask128()); }
inline I16vec8 unpack_low(const I16vec8 &a,const I16vec8 &b) { return _mm_unpacklo_epi16(a,b); }
inline I16vec8 unpack_high(const I16vec8 &a,const I16vec8 &b) { return _mm_unpackhi_epi16(a,b); }
class Is16vec8 : public I16vec8
{
public:
Is16vec8() { }
Is16vec8(__m128i mm) : I16vec8(mm) { }
Is16vec8(signed short s7,signed short s6,signed short s5,signed short s4,signed short s3,signed short s2,signed short s1,signed short s0)
{
_MM_8W(0,vec) = s0;
_MM_8W(1,vec) = s1;
_MM_8W(2,vec) = s2;
_MM_8W(3,vec) = s3;
_MM_8W(4,vec) = s4;
_MM_8W(5,vec) = s5;
_MM_8W(6,vec) = s6;
_MM_8W(7,vec) = s7;
}
Is16vec8& operator= (const M128 &a) { return *this = (Is16vec8) a; }
Is16vec8& operator&=(const M128 &a) { return *this = (Is16vec8) _mm_and_si128(vec,a); }
Is16vec8& operator|=(const M128 &a) { return *this = (Is16vec8) _mm_or_si128(vec,a); }
Is16vec8& operator^=(const M128 &a) { return *this = (Is16vec8) _mm_xor_si128(vec,a); }
Is16vec8& operator +=(const I16vec8 &a) { return *this = (Is16vec8) _mm_add_epi16(vec,a); }
Is16vec8& operator -=(const I16vec8 &a) { return *this = (Is16vec8) _mm_sub_epi16(vec,a); }
Is16vec8& operator *=(const I16vec8 &a) { return *this = (Is16vec8) _mm_mullo_epi16(vec,a); }
Is16vec8 operator<<(const M128 &a) { return _mm_sll_epi16(vec,a); }
Is16vec8 operator<<(int count) { return _mm_slli_epi16(vec,count); }
Is16vec8& operator<<=(const M128 &a) { return *this = (Is16vec8)_mm_sll_epi16(vec,a); }
Is16vec8& operator<<=(int count) { return *this = (Is16vec8)_mm_slli_epi16(vec,count); }
Is16vec8 operator>>(const M128 &a) { return _mm_sra_epi16(vec,a); }
Is16vec8 operator>>(int count) { return _mm_srai_epi16(vec,count); }
Is16vec8& operator>>=(const M128 &a) { return *this = (Is16vec8)_mm_sra_epi16(vec,a); }
Is16vec8& operator>>=(int count) { return *this = (Is16vec8)_mm_srai_epi16(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream& operator<< (std::ostream &os,const Is16vec8 &a)
{
os << "[7]:" << _MM_8W(7,a)
<< " [6]:" << _MM_8W(6,a)
<< " [5]:" << _MM_8W(5,a)
<< " [4]:" << _MM_8W(4,a)
<< " [3]:" << _MM_8W(3,a)
<< " [2]:" << _MM_8W(2,a)
<< " [1]:" << _MM_8W(1,a)
<< " [0]:" << _MM_8W(0,a);
return os;
}
#endif
const signed short& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 8);
return _MM_8W(i,vec);
}
signed short& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 8);
return _MM_8W(i,vec);
}
};
inline Is16vec8 operator*(const Is16vec8 &a,const Is16vec8 &b) { return _mm_mullo_epi16(a,b); }
inline Is16vec8 cmpeq(const Is16vec8 &a,const Is16vec8 &b) { return _mm_cmpeq_epi16(a,b); }
inline Is16vec8 cmpneq(const Is16vec8 &a,const Is16vec8 &b) { return _mm_andnot_si128(_mm_cmpeq_epi16(a,b),get_mask128()); }
inline Is16vec8 cmpgt(const Is16vec8 &a,const Is16vec8 &b) { return _mm_cmpgt_epi16(a,b); }
inline Is16vec8 cmplt(const Is16vec8 &a,const Is16vec8 &b) { return _mm_cmpgt_epi16(b,a); }
inline Is16vec8 unpack_low(const Is16vec8 &a,const Is16vec8 &b) { return _mm_unpacklo_epi16(a,b); }
inline Is16vec8 unpack_high(const Is16vec8 &a,const Is16vec8 &b) { return _mm_unpackhi_epi16(a,b); }
inline Is16vec8 mul_high(const Is16vec8 &a,const Is16vec8 &b) { return _mm_mulhi_epi16(a,b); }
inline Is32vec4 mul_add(const Is16vec8 &a,const Is16vec8 &b) { return _mm_madd_epi16(a,b);}
inline Is16vec8 sat_add(const Is16vec8 &a,const Is16vec8 &b) { return _mm_adds_epi16(a,b); }
inline Is16vec8 sat_sub(const Is16vec8 &a,const Is16vec8 &b) { return _mm_subs_epi16(a,b); }
inline Is16vec8 simd_max(const Is16vec8 &a,const Is16vec8 &b) { return _mm_max_epi16(a,b); }
inline Is16vec8 simd_min(const Is16vec8 &a,const Is16vec8 &b) { return _mm_min_epi16(a,b); }
class Iu16vec8 : public I16vec8
{
public:
Iu16vec8() { }
Iu16vec8(__m128i mm) : I16vec8(mm) { }
Iu16vec8(unsigned short s7,unsigned short s6,unsigned short s5,unsigned short s4,unsigned short s3,unsigned short s2,unsigned short s1,unsigned short s0)
{
_MM_8UW(0,vec) = s0;
_MM_8UW(1,vec) = s1;
_MM_8UW(2,vec) = s2;
_MM_8UW(3,vec) = s3;
_MM_8UW(4,vec) = s4;
_MM_8UW(5,vec) = s5;
_MM_8UW(6,vec) = s6;
_MM_8UW(7,vec) = s7;
}
Iu16vec8& operator= (const M128 &a) { return *this = (Iu16vec8) a; }
Iu16vec8& operator&=(const M128 &a) { return *this = (Iu16vec8) _mm_and_si128(vec,a); }
Iu16vec8& operator|=(const M128 &a) { return *this = (Iu16vec8) _mm_or_si128(vec,a); }
Iu16vec8& operator^=(const M128 &a) { return *this = (Iu16vec8) _mm_xor_si128(vec,a); }
Iu16vec8& operator +=(const I16vec8 &a) { return *this = (Iu16vec8) _mm_add_epi16(vec,a); }
Iu16vec8& operator -=(const I16vec8 &a) { return *this = (Iu16vec8) _mm_sub_epi16(vec,a); }
Iu16vec8& operator *=(const I16vec8 &a) { return *this = (Iu16vec8) _mm_mullo_epi16(vec,a); }
Iu16vec8 operator<<(const M128 &a) { return _mm_sll_epi16(vec,a); }
Iu16vec8 operator<<(int count) { return _mm_slli_epi16(vec,count); }
Iu16vec8& operator<<=(const M128 &a) { return *this = (Iu16vec8)_mm_sll_epi16(vec,a); }
Iu16vec8& operator<<=(int count) { return *this = (Iu16vec8)_mm_slli_epi16(vec,count); }
Iu16vec8 operator>>(const M128 &a) { return _mm_srl_epi16(vec,a); }
Iu16vec8 operator>>(int count) { return _mm_srli_epi16(vec,count); }
Iu16vec8& operator>>=(const M128 &a) { return *this = (Iu16vec8) _mm_srl_epi16(vec,a); }
Iu16vec8& operator>>=(int count) { return *this = (Iu16vec8) _mm_srli_epi16(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream& operator << (std::ostream &os,const Iu16vec8 &a)
{
os << "[7]:" << unsigned short(_MM_8UW(7,a))
<< " [6]:" << unsigned short(_MM_8UW(6,a))
<< " [5]:" << unsigned short(_MM_8UW(5,a))
<< " [4]:" << unsigned short(_MM_8UW(4,a))
<< " [3]:" << unsigned short(_MM_8UW(3,a))
<< " [2]:" << unsigned short(_MM_8UW(2,a))
<< " [1]:" << unsigned short(_MM_8UW(1,a))
<< " [0]:" << unsigned short(_MM_8UW(0,a));
return os;
}
#endif
const unsigned short& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 8);
return _MM_8UW(i,vec);
}
unsigned short& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 8);
return _MM_8UW(i,vec);
}
};
inline Iu16vec8 operator*(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_mullo_epi16(a,b); }
inline Iu16vec8 cmpeq(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_cmpeq_epi16(a,b); }
inline Iu16vec8 cmpneq(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_andnot_si128(_mm_cmpeq_epi16(a,b),get_mask128()); }
inline Iu16vec8 unpack_low(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_unpacklo_epi16(a,b); }
inline Iu16vec8 unpack_high(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_unpackhi_epi16(a,b); }
inline Iu16vec8 sat_add(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_adds_epu16(a,b); }
inline Iu16vec8 sat_sub(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_subs_epu16(a,b); }
inline Iu16vec8 simd_avg(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_avg_epu16(a,b); }
inline I16vec8 mul_high(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_mulhi_epu16(a,b); }
class I8vec16 : public M128
{
public:
I8vec16() { }
I8vec16(__m128i mm) : M128(mm) { }
I8vec16& operator= (const M128 &a) { return *this = (I8vec16) a; }
I8vec16& operator&=(const M128 &a) { return *this = (I8vec16) _mm_and_si128(vec,a); }
I8vec16& operator|=(const M128 &a) { return *this = (I8vec16) _mm_or_si128(vec,a); }
I8vec16& operator^=(const M128 &a) { return *this = (I8vec16) _mm_xor_si128(vec,a); }
I8vec16& operator +=(const I8vec16 &a) { return *this = (I8vec16) _mm_add_epi8(vec,a); }
I8vec16& operator -=(const I8vec16 &a) { return *this = (I8vec16) _mm_sub_epi8(vec,a); }
};
inline I8vec16 cmpeq(const I8vec16 &a,const I8vec16 &b) { return _mm_cmpeq_epi8(a,b); }
inline I8vec16 cmpneq(const I8vec16 &a,const I8vec16 &b) { return _mm_andnot_si128(_mm_cmpeq_epi8(a,b),get_mask128()); }
inline I8vec16 unpack_low(const I8vec16 &a,const I8vec16 &b) { return _mm_unpacklo_epi8(a,b); }
inline I8vec16 unpack_high(const I8vec16 &a,const I8vec16 &b) { return _mm_unpackhi_epi8(a,b); }
class Is8vec16 : public I8vec16
{
public:
Is8vec16() { }
Is8vec16(__m128i mm) : I8vec16(mm) { }
Is8vec16& operator= (const M128 &a) { return *this = (Is8vec16) a; }
Is8vec16& operator&=(const M128 &a) { return *this = (Is8vec16) _mm_and_si128(vec,a); }
Is8vec16& operator|=(const M128 &a) { return *this = (Is8vec16) _mm_or_si128(vec,a); }
Is8vec16& operator^=(const M128 &a) { return *this = (Is8vec16) _mm_xor_si128(vec,a); }
Is8vec16& operator +=(const I8vec16 &a) { return *this = (Is8vec16) _mm_add_epi8(vec,a); }
Is8vec16& operator -=(const I8vec16 &a) { return *this = (Is8vec16) _mm_sub_epi8(vec,a); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream& operator << (std::ostream &os,const Is8vec16 &a)
{
os << "[15]:" << short(_MM_16B(15,a))
<< " [14]:" << short(_MM_16B(14,a))
<< " [13]:" << short(_MM_16B(13,a))
<< " [12]:" << short(_MM_16B(12,a))
<< " [11]:" << short(_MM_16B(11,a))
<< " [10]:" << short(_MM_16B(10,a))
<< " [9]:" << short(_MM_16B(9,a))
<< " [8]:" << short(_MM_16B(8,a))
<< " [7]:" << short(_MM_16B(7,a))
<< " [6]:" << short(_MM_16B(6,a))
<< " [5]:" << short(_MM_16B(5,a))
<< " [4]:" << short(_MM_16B(4,a))
<< " [3]:" << short(_MM_16B(3,a))
<< " [2]:" << short(_MM_16B(2,a))
<< " [1]:" << short(_MM_16B(1,a))
<< " [0]:" << short(_MM_16B(0,a));
return os;
}
#endif
const signed char& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 16);
return _MM_16B(i,vec);
}
signed char& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 16);
return _MM_16B(i,vec);
}
};
inline Is8vec16 cmpeq(const Is8vec16 &a,const Is8vec16 &b) { return _mm_cmpeq_epi8(a,b); }
inline Is8vec16 cmpneq(const Is8vec16 &a,const Is8vec16 &b) { return _mm_andnot_si128(_mm_cmpeq_epi8(a,b),get_mask128()); }
inline Is8vec16 cmpgt(const Is8vec16 &a,const Is8vec16 &b) { return _mm_cmpgt_epi8(a,b); }
inline Is8vec16 cmplt(const Is8vec16 &a,const Is8vec16 &b) { return _mm_cmplt_epi8(a,b); }
inline Is8vec16 unpack_low(const Is8vec16 &a,const Is8vec16 &b) { return _mm_unpacklo_epi8(a,b); }
inline Is8vec16 unpack_high(const Is8vec16 &a,const Is8vec16 &b) { return _mm_unpackhi_epi8(a,b); }
inline Is8vec16 sat_add(const Is8vec16 &a,const Is8vec16 &b) { return _mm_adds_epi8(a,b); }
inline Is8vec16 sat_sub(const Is8vec16 &a,const Is8vec16 &b) { return _mm_subs_epi8(a,b); }
class Iu8vec16 : public I8vec16
{
public:
Iu8vec16() { }
Iu8vec16(__m128i mm) : I8vec16(mm) { }
Iu8vec16& operator= (const M128 &a) { return *this = (Iu8vec16) a; }
Iu8vec16& operator&=(const M128 &a) { return *this = (Iu8vec16) _mm_and_si128(vec,a); }
Iu8vec16& operator|=(const M128 &a) { return *this = (Iu8vec16) _mm_or_si128(vec,a); }
Iu8vec16& operator^=(const M128 &a) { return *this = (Iu8vec16) _mm_xor_si128(vec,a); }
Iu8vec16& operator +=(const I8vec16 &a) { return *this = (Iu8vec16) _mm_add_epi8(vec,a); }
Iu8vec16& operator -=(const I8vec16 &a) { return *this = (Iu8vec16) _mm_sub_epi8(vec,a); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream& operator << (std::ostream &os,const Iu8vec16 &a)
{
os << "[15]:" << unsigned short(_MM_16UB(15,a))
<< " [14]:" << unsigned short(_MM_16UB(14,a))
<< " [13]:" << unsigned short(_MM_16UB(13,a))
<< " [12]:" << unsigned short(_MM_16UB(12,a))
<< " [11]:" << unsigned short(_MM_16UB(11,a))
<< " [10]:" << unsigned short(_MM_16UB(10,a))
<< " [9]:" << unsigned short(_MM_16UB(9,a))
<< " [8]:" << unsigned short(_MM_16UB(8,a))
<< " [7]:" << unsigned short(_MM_16UB(7,a))
<< " [6]:" << unsigned short(_MM_16UB(6,a))
<< " [5]:" << unsigned short(_MM_16UB(5,a))
<< " [4]:" << unsigned short(_MM_16UB(4,a))
<< " [3]:" << unsigned short(_MM_16UB(3,a))
<< " [2]:" << unsigned short(_MM_16UB(2,a))
<< " [1]:" << unsigned short(_MM_16UB(1,a))
<< " [0]:" << unsigned short(_MM_16UB(0,a));
return os;
}
#endif
const unsigned char& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 16);
return _MM_16UB(i,vec);
}
unsigned char& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 16);
return _MM_16UB(i,vec);
}
};
inline Iu8vec16 cmpeq(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_cmpeq_epi8(a,b); }
inline Iu8vec16 cmpneq(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_andnot_si128(_mm_cmpeq_epi8(a,b),get_mask128()); }
inline Iu8vec16 unpack_low(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_unpacklo_epi8(a,b); }
inline Iu8vec16 unpack_high(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_unpackhi_epi8(a,b); }
inline Iu8vec16 sat_add(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_adds_epu8(a,b); }
inline Iu8vec16 sat_sub(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_subs_epu8(a,b); }
inline I64vec2 sum_abs(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_sad_epu8(a,b); }
inline Iu8vec16 simd_avg(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_avg_epu8(a,b); }
inline Iu8vec16 simd_max(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_max_epu8(a,b); }
inline Iu8vec16 simd_min(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_min_epu8(a,b); }
inline Is16vec8 pack_sat(const Is32vec4 &a,const Is32vec4 &b) { return _mm_packs_epi32(a,b); }
inline Is8vec16 pack_sat(const Is16vec8 &a,const Is16vec8 &b) { return _mm_packs_epi16(a,b); }
inline Iu8vec16 packu_sat(const Is16vec8 &a,const Is16vec8 &b) { return _mm_packus_epi16(a,b);}
#define IVEC128_LOGICALS(vect,element) inline I##vect##vec##element operator& (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_and_si128(a,b); } inline I##vect##vec##element operator| (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_or_si128(a,b); } inline I##vect##vec##element operator^ (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_xor_si128(a,b); } inline I##vect##vec##element andnot (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_andnot_si128(a,b); }
IVEC128_LOGICALS(8,16)
IVEC128_LOGICALS(u8,16)
IVEC128_LOGICALS(s8,16)
IVEC128_LOGICALS(16,8)
IVEC128_LOGICALS(u16,8)
IVEC128_LOGICALS(s16,8)
IVEC128_LOGICALS(32,4)
IVEC128_LOGICALS(u32,4)
IVEC128_LOGICALS(s32,4)
IVEC128_LOGICALS(64,2)
IVEC128_LOGICALS(128,1)
#undef IVEC128_LOGICALS
#define IVEC128_ADD_SUB(vect,element,opsize) inline I##vect##vec##element operator+ (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_add_##opsize(a,b); } inline I##vect##vec##element operator- (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_sub_##opsize(a,b); }
IVEC128_ADD_SUB(8,16,epi8)
IVEC128_ADD_SUB(u8,16,epi8)
IVEC128_ADD_SUB(s8,16,epi8)
IVEC128_ADD_SUB(16,8,epi16)
IVEC128_ADD_SUB(u16,8,epi16)
IVEC128_ADD_SUB(s16,8,epi16)
IVEC128_ADD_SUB(32,4,epi32)
IVEC128_ADD_SUB(u32,4,epi32)
IVEC128_ADD_SUB(s32,4,epi32)
IVEC128_ADD_SUB(64,2,epi64)
#undef IVEC128_ADD_SUB
#define IVEC128_SELECT(vect12,vect34,element,selop,arg1,arg2) inline I##vect34##vec##element select_##selop (const I##vect12##vec##element &a,const I##vect12##vec##element &b,const I##vect34##vec##element &c,const I##vect34##vec##element &d) { I##vect12##vec##element mask = cmp##selop(a,b); return(I##vect34##vec##element ((mask & arg1) | I##vect12##vec##element ((_mm_andnot_si128(mask,arg2))))); }
IVEC128_SELECT(8,s8,16,eq,c,d)
IVEC128_SELECT(8,u8,16,eq,c,d)
IVEC128_SELECT(8,8,16,eq,c,d)
IVEC128_SELECT(8,s8,16,neq,c,d)
IVEC128_SELECT(8,u8,16,neq,c,d)
IVEC128_SELECT(8,8,16,neq,c,d)
IVEC128_SELECT(16,s16,8,eq,c,d)
IVEC128_SELECT(16,u16,8,eq,c,d)
IVEC128_SELECT(16,16,8,eq,c,d)
IVEC128_SELECT(16,s16,8,neq,c,d)
IVEC128_SELECT(16,u16,8,neq,c,d)
IVEC128_SELECT(16,16,8,neq,c,d)
IVEC128_SELECT(32,s32,4,eq,c,d)
IVEC128_SELECT(32,u32,4,eq,c,d)
IVEC128_SELECT(32,32,4,eq,c,d)
IVEC128_SELECT(32,s32,4,neq,c,d)
IVEC128_SELECT(32,u32,4,neq,c,d)
IVEC128_SELECT(32,32,4,neq,c,d)
IVEC128_SELECT(s8,s8,16,gt,c,d)
IVEC128_SELECT(s8,u8,16,gt,c,d)
IVEC128_SELECT(s8,8,16,gt,c,d)
IVEC128_SELECT(s8,s8,16,lt,c,d)
IVEC128_SELECT(s8,u8,16,lt,c,d)
IVEC128_SELECT(s8,8,16,lt,c,d)
IVEC128_SELECT(s16,s16,8,gt,c,d)
IVEC128_SELECT(s16,u16,8,gt,c,d)
IVEC128_SELECT(s16,16,8,gt,c,d)
IVEC128_SELECT(s16,s16,8,lt,c,d)
IVEC128_SELECT(s16,u16,8,lt,c,d)
IVEC128_SELECT(s16,16,8,lt,c,d)
#undef IVEC128_SELECT
class F64vec2
{
protected:
__m128d vec;
public:
F64vec2() {}
F64vec2(__m128d m) { vec = m;}
F64vec2(double d1,double d0) { vec= _mm_set_pd(d1,d0); }
EXPLICIT F64vec2(double d) { vec = _mm_set1_pd(d); }
operator __m128d() const { return vec; }
friend F64vec2 operator &(const F64vec2 &a,const F64vec2 &b) { return _mm_and_pd(a,b); }
friend F64vec2 operator |(const F64vec2 &a,const F64vec2 &b) { return _mm_or_pd(a,b); }
friend F64vec2 operator ^(const F64vec2 &a,const F64vec2 &b) { return _mm_xor_pd(a,b); }
friend F64vec2 operator +(const F64vec2 &a,const F64vec2 &b) { return _mm_add_pd(a,b); }
friend F64vec2 operator -(const F64vec2 &a,const F64vec2 &b) { return _mm_sub_pd(a,b); }
friend F64vec2 operator *(const F64vec2 &a,const F64vec2 &b) { return _mm_mul_pd(a,b); }
friend F64vec2 operator /(const F64vec2 &a,const F64vec2 &b) { return _mm_div_pd(a,b); }
F64vec2& operator +=(F64vec2 &a) { return *this = _mm_add_pd(vec,a); }
F64vec2& operator -=(F64vec2 &a) { return *this = _mm_sub_pd(vec,a); }
F64vec2& operator *=(F64vec2 &a) { return *this = _mm_mul_pd(vec,a); }
F64vec2& operator /=(F64vec2 &a) { return *this = _mm_div_pd(vec,a); }
F64vec2& operator &=(F64vec2 &a) { return *this = _mm_and_pd(vec,a); }
F64vec2& operator |=(F64vec2 &a) { return *this = _mm_or_pd(vec,a); }
F64vec2& operator ^=(F64vec2 &a) { return *this = _mm_xor_pd(vec,a); }
friend double add_horizontal(F64vec2 &a)
{
F64vec2 ftemp = _mm_add_sd(a,_mm_shuffle_pd(a,a,1));
return ftemp[0];
}
friend F64vec2 andnot(const F64vec2 &a,const F64vec2 &b) { return _mm_andnot_pd(a,b); }
friend F64vec2 sqrt(const F64vec2 &a) { return _mm_sqrt_pd(a); }
#define F64vec2_COMP(op) friend F64vec2 cmp##op (const F64vec2 &a,const F64vec2 &b) { return _mm_cmp##op##_pd(a,b); }
F64vec2_COMP(eq)
F64vec2_COMP(lt)
F64vec2_COMP(le)
F64vec2_COMP(gt)
F64vec2_COMP(ge)
F64vec2_COMP(ngt)
F64vec2_COMP(nge)
F64vec2_COMP(neq)
F64vec2_COMP(nlt)
F64vec2_COMP(nle)
#undef F64vec2_COMP
friend F64vec2 simd_min(const F64vec2 &a,const F64vec2 &b) { return _mm_min_pd(a,b); }
friend F64vec2 simd_max(const F64vec2 &a,const F64vec2 &b) { return _mm_max_pd(a,b); }
#define F64vec2_COMI(op) friend int comi##op (const F64vec2 &a,const F64vec2 &b) { return _mm_comi##op##_sd(a,b); }
F64vec2_COMI(eq)
F64vec2_COMI(lt)
F64vec2_COMI(le)
F64vec2_COMI(gt)
F64vec2_COMI(ge)
F64vec2_COMI(neq)
#undef F64vec2_COMI
#define F64vec2_UCOMI(op) friend int ucomi##op (const F64vec2 &a,const F64vec2 &b) { return _mm_ucomi##op##_sd(a,b); }
F64vec2_UCOMI(eq)
F64vec2_UCOMI(lt)
F64vec2_UCOMI(le)
F64vec2_UCOMI(gt)
F64vec2_UCOMI(ge)
F64vec2_UCOMI(neq)
#undef F64vec2_UCOMI
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream & operator<<(std::ostream & os,const F64vec2 &a) {
double *dp = (double*)&a;
os << " [1]:" << *(dp+1)
<< " [0]:" << *dp;
return os;
}
#endif
const double &operator[](int i) const {
assert((0 <= i) && (i <= 1));
double *dp = (double*)&vec;
return *(dp+i);
}
double &operator[](int i) {
assert((0 <= i) && (i <= 1));
double *dp = (double*)&vec;
return *(dp+i);
}
};
inline F64vec2 unpack_low(const F64vec2 &a,const F64vec2 &b) { return _mm_unpacklo_pd(a,b); }
inline F64vec2 unpack_high(const F64vec2 &a,const F64vec2 &b) { return _mm_unpackhi_pd(a,b); }
inline int move_mask(const F64vec2 &a) { return _mm_movemask_pd(a); }
inline void loadu(F64vec2 &a,double *p) { a = _mm_loadu_pd(p); }
inline void storeu(double *p,const F64vec2 &a) { _mm_storeu_pd(p,a); }
inline void store_nta(double *p,F64vec2 &a) { _mm_stream_pd(p,a); }
#define F64vec2_SELECT(op) inline F64vec2 select_##op (const F64vec2 &a,const F64vec2 &b,const F64vec2 &c,const F64vec2 &d) { F64vec2 mask = _mm_cmp##op##_pd(a,b); return((mask & c) | F64vec2((_mm_andnot_pd(mask,d)))); }
F64vec2_SELECT(eq)
F64vec2_SELECT(lt)
F64vec2_SELECT(le)
F64vec2_SELECT(gt)
F64vec2_SELECT(ge)
F64vec2_SELECT(neq)
F64vec2_SELECT(nlt)
F64vec2_SELECT(nle)
#undef F64vec2_SELECT
inline int F64vec2ToInt(const F64vec2 &a) { return _mm_cvttsd_si32(a); }
inline F64vec2 F32vec4ToF64vec2(const F32vec4 &a) { return _mm_cvtps_pd(a); }
inline F32vec4 F64vec2ToF32vec4(const F64vec2 &a) { return _mm_cvtpd_ps(a); }
inline F64vec2 IntToF64vec2(const F64vec2 &a,int b) { return _mm_cvtsi32_sd(a,b); }
#pragma pack(pop)
#pragma pack(pop)
#endif
#endif
+40
View File
@@ -0,0 +1,40 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#include <_mingw.h>
#ifndef _EH_H_
#define _EH_H_
#ifndef RC_INVOKED
#pragma pack(push,_CRT_PACKING)
#ifndef __cplusplus
#error eh.h is only for C++!
#endif
typedef void (__cdecl *terminate_function)();
typedef void (__cdecl *terminate_handler)();
typedef void (__cdecl *unexpected_function)();
typedef void (__cdecl *unexpected_handler)();
struct _EXCEPTION_POINTERS;
typedef void (__cdecl *_se_translator_function)(unsigned int,struct _EXCEPTION_POINTERS *);
_CRTIMP __declspec(noreturn) void __cdecl terminate(void);
_CRTIMP void __cdecl unexpected(void);
_CRTIMP int __cdecl _is_exception_typeof(const type_info &_Type,struct _EXCEPTION_POINTERS *_ExceptionPtr);
_CRTIMP terminate_function __cdecl set_terminate(terminate_function _NewPtFunc);
extern "C" _CRTIMP terminate_function __cdecl _get_terminate(void);
_CRTIMP unexpected_function __cdecl set_unexpected(unexpected_function _NewPtFunc);
extern "C" _CRTIMP unexpected_function __cdecl _get_unexpected(void);
_CRTIMP _se_translator_function __cdecl _set_se_translator(_se_translator_function _NewPtFunc);
_CRTIMP bool __cdecl __uncaught_exception();
#pragma pack(pop)
#endif
#endif /* End _EH_H_ */
+140
View File
@@ -0,0 +1,140 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _INC_FPIEEE
#define _INC_FPIEEE
#include <_mingw.h>
#pragma pack(push,_CRT_PACKING)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
_FpCompareEqual,_FpCompareGreater,_FpCompareLess,_FpCompareUnordered
} _FPIEEE_COMPARE_RESULT;
typedef enum {
_FpFormatFp32,_FpFormatFp64,_FpFormatFp80,_FpFormatFp128,_FpFormatI16,_FpFormatI32,_FpFormatI64,_FpFormatU16,_FpFormatU32,_FpFormatU64,_FpFormatBcd80,_FpFormatCompare,_FpFormatString,
#if defined(__ia64__)
_FpFormatFp82
#endif
} _FPIEEE_FORMAT;
typedef enum {
_FpCodeUnspecified,_FpCodeAdd,_FpCodeSubtract,_FpCodeMultiply,_FpCodeDivide,_FpCodeSquareRoot,_FpCodeRemainder,_FpCodeCompare,_FpCodeConvert,_FpCodeRound,_FpCodeTruncate,_FpCodeFloor,_FpCodeCeil,_FpCodeAcos,_FpCodeAsin,_FpCodeAtan,_FpCodeAtan2,_FpCodeCabs,_FpCodeCos,_FpCodeCosh,_FpCodeExp,_FpCodeFabs,_FpCodeFmod,_FpCodeFrexp,_FpCodeHypot,_FpCodeLdexp,_FpCodeLog,_FpCodeLog10,_FpCodeModf,_FpCodePow,_FpCodeSin,_FpCodeSinh,_FpCodeTan,_FpCodeTanh,_FpCodeY0,_FpCodeY1,_FpCodeYn,_FpCodeLogb,_FpCodeNextafter,_FpCodeNegate,_FpCodeFmin,_FpCodeFmax,_FpCodeConvertTrunc,_XMMIAddps,_XMMIAddss,_XMMISubps,_XMMISubss,_XMMIMulps,_XMMIMulss,_XMMIDivps,_XMMIDivss,_XMMISqrtps,_XMMISqrtss,_XMMIMaxps,_XMMIMaxss,_XMMIMinps,_XMMIMinss,_XMMICmpps,_XMMICmpss,_XMMIComiss,_XMMIUComiss,_XMMICvtpi2ps,_XMMICvtsi2ss,_XMMICvtps2pi,_XMMICvtss2si,_XMMICvttps2pi,_XMMICvttss2si,_XMMIAddsubps,_XMMIHaddps,_XMMIHsubps,_XMMI2Addpd,_XMMI2Addsd,_XMMI2Subpd,_XMMI2Subsd,_XMMI2Mulpd,_XMMI2Mulsd,_XMMI2Divpd,_XMMI2Divsd,_XMMI2Sqrtpd,_XMMI2Sqrtsd,_XMMI2Maxpd,_XMMI2Maxsd,_XMMI2Minpd,_XMMI2Minsd,_XMMI2Cmppd,_XMMI2Cmpsd,_XMMI2Comisd,_XMMI2UComisd,_XMMI2Cvtpd2pi,_XMMI2Cvtsd2si,_XMMI2Cvttpd2pi,_XMMI2Cvttsd2si,_XMMI2Cvtps2pd,_XMMI2Cvtss2sd,_XMMI2Cvtpd2ps,_XMMI2Cvtsd2ss,_XMMI2Cvtdq2ps,_XMMI2Cvttps2dq,_XMMI2Cvtps2dq,_XMMI2Cvttpd2dq,_XMMI2Cvtpd2dq,_XMMI2Addsubpd,_XMMI2Haddpd,_XMMI2Hsubpd,
#if defined(__ia64__)
_FpCodeFma,_FpCodeFmaSingle,_FpCodeFmaDouble,_FpCodeFms,_FpCodeFmsSingle,_FpCodeFmsDouble,_FpCodeFnma,_FpCodeFnmaSingle,_FpCodeFnmaDouble,_FpCodeFamin,_FpCodeFamax
#endif
} _FP_OPERATION_CODE;
typedef enum {
_FpRoundNearest,_FpRoundMinusInfinity,_FpRoundPlusInfinity,_FpRoundChopped
} _FPIEEE_ROUNDING_MODE;
typedef enum {
_FpPrecisionFull,_FpPrecision53,_FpPrecision24,
#if defined(__ia64__)
_FpPrecision64,_FpPrecision113
#endif
} _FPIEEE_PRECISION;
typedef float _FP32;
typedef double _FP64;
typedef short _I16;
typedef int _I32;
typedef unsigned short _U16;
typedef unsigned int _U32;
typedef __int64 _Q64;
typedef struct
#if defined(__ia64__)
_CRT_ALIGN(16)
#endif
{
unsigned short W[5];
} _FP80;
typedef struct _CRT_ALIGN(16) {
unsigned long W[4];
} _FP128;
typedef struct _CRT_ALIGN(8) {
unsigned long W[2];
} _I64;
typedef struct _CRT_ALIGN(8) {
unsigned long W[2];
} _U64;
typedef struct
#if defined(__ia64__)
_CRT_ALIGN(16)
#endif
{
unsigned short W[5];
} _BCD80;
typedef struct _CRT_ALIGN(16) {
_Q64 W[2];
} _FPQ64;
typedef struct {
union {
_FP32 Fp32Value;
_FP64 Fp64Value;
_FP80 Fp80Value;
_FP128 Fp128Value;
_I16 I16Value;
_I32 I32Value;
_I64 I64Value;
_U16 U16Value;
_U32 U32Value;
_U64 U64Value;
_BCD80 Bcd80Value;
char *StringValue;
int CompareValue;
_Q64 Q64Value;
_FPQ64 Fpq64Value;
} Value;
unsigned int OperandValid : 1;
unsigned int Format : 4;
} _FPIEEE_VALUE;
typedef struct {
unsigned int Inexact : 1;
unsigned int Underflow : 1;
unsigned int Overflow : 1;
unsigned int ZeroDivide : 1;
unsigned int InvalidOperation : 1;
} _FPIEEE_EXCEPTION_FLAGS;
typedef struct {
unsigned int RoundingMode : 2;
unsigned int Precision : 3;
unsigned int Operation :12;
_FPIEEE_EXCEPTION_FLAGS Cause;
_FPIEEE_EXCEPTION_FLAGS Enable;
_FPIEEE_EXCEPTION_FLAGS Status;
_FPIEEE_VALUE Operand1;
_FPIEEE_VALUE Operand2;
_FPIEEE_VALUE Result;
#if defined(__ia64__)
_FPIEEE_VALUE Operand3;
#endif
} _FPIEEE_RECORD,*_PFPIEEE_RECORD;
struct _EXCEPTION_POINTERS;
_CRTIMP int __cdecl _fpieee_flt(unsigned long _ExceptionCode,struct _EXCEPTION_POINTERS *_PtExceptionPtr,int (__cdecl *_Handler)(_FPIEEE_RECORD *));
#ifdef __cplusplus
}
#endif
#pragma pack(pop)
#endif
+244
View File
@@ -0,0 +1,244 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _FVEC_H_INCLUDED
#define _FVEC_H_INCLUDED
#ifndef RC_INVOKED
#ifndef __cplusplus
#error ERROR: This file is only supported in C++ compilations!
#endif
#include <xmmintrin.h>
#include <assert.h>
#include <ivec.h>
#include <_mingw.h>
#if defined(_ENABLE_VEC_DEBUG)
#include <iostream>
#endif
#pragma pack(push,_CRT_PACKING)
#pragma pack(push,16)
#define EXPLICIT explicit
class F32vec4 {
protected:
__m128 vec;
public:
F32vec4() {}
F32vec4(__m128 m) { vec = m;}
F32vec4(float f3,float f2,float f1,float f0) { vec= _mm_set_ps(f3,f2,f1,f0); }
EXPLICIT F32vec4(float f) { vec = _mm_set_ps1(f); }
EXPLICIT F32vec4(double d) { vec = _mm_set_ps1((float) d); }
F32vec4& operator =(float f) { vec = _mm_set_ps1(f); return *this; }
F32vec4& operator =(double d) { vec = _mm_set_ps1((float) d); return *this; }
operator __m128() const { return vec; }
friend F32vec4 operator &(const F32vec4 &a,const F32vec4 &b) { return _mm_and_ps(a,b); }
friend F32vec4 operator |(const F32vec4 &a,const F32vec4 &b) { return _mm_or_ps(a,b); }
friend F32vec4 operator ^(const F32vec4 &a,const F32vec4 &b) { return _mm_xor_ps(a,b); }
friend F32vec4 operator +(const F32vec4 &a,const F32vec4 &b) { return _mm_add_ps(a,b); }
friend F32vec4 operator -(const F32vec4 &a,const F32vec4 &b) { return _mm_sub_ps(a,b); }
friend F32vec4 operator *(const F32vec4 &a,const F32vec4 &b) { return _mm_mul_ps(a,b); }
friend F32vec4 operator /(const F32vec4 &a,const F32vec4 &b) { return _mm_div_ps(a,b); }
F32vec4& operator =(const F32vec4 &a) { vec = a.vec; return *this; }
F32vec4& operator =(const __m128 &avec) { vec = avec; return *this; }
F32vec4& operator +=(F32vec4 &a) { return *this = _mm_add_ps(vec,a); }
F32vec4& operator -=(F32vec4 &a) { return *this = _mm_sub_ps(vec,a); }
F32vec4& operator *=(F32vec4 &a) { return *this = _mm_mul_ps(vec,a); }
F32vec4& operator /=(F32vec4 &a) { return *this = _mm_div_ps(vec,a); }
F32vec4& operator &=(F32vec4 &a) { return *this = _mm_and_ps(vec,a); }
F32vec4& operator |=(F32vec4 &a) { return *this = _mm_or_ps(vec,a); }
F32vec4& operator ^=(F32vec4 &a) { return *this = _mm_xor_ps(vec,a); }
friend float add_horizontal(F32vec4 &a) {
F32vec4 ftemp = _mm_add_ss(a,_mm_add_ss(_mm_shuffle_ps(a,a,1),_mm_add_ss(_mm_shuffle_ps(a,a,2),_mm_shuffle_ps(a,a,3))));
return ftemp[0];
}
friend F32vec4 sqrt(const F32vec4 &a) { return _mm_sqrt_ps(a); }
friend F32vec4 rcp(const F32vec4 &a) { return _mm_rcp_ps(a); }
friend F32vec4 rsqrt(const F32vec4 &a) { return _mm_rsqrt_ps(a); }
friend F32vec4 rcp_nr(const F32vec4 &a) {
F32vec4 Ra0 = _mm_rcp_ps(a);
return _mm_sub_ps(_mm_add_ps(Ra0,Ra0),_mm_mul_ps(_mm_mul_ps(Ra0,a),Ra0));
}
friend F32vec4 rsqrt_nr(const F32vec4 &a) {
static const F32vec4 fvecf0pt5(0.5f);
static const F32vec4 fvecf3pt0(3.0f);
F32vec4 Ra0 = _mm_rsqrt_ps(a);
return (fvecf0pt5 *Ra0) *(fvecf3pt0 - (a *Ra0) *Ra0);
}
#define Fvec32s4_COMP(op) friend F32vec4 cmp##op (const F32vec4 &a,const F32vec4 &b) { return _mm_cmp##op##_ps(a,b); }
Fvec32s4_COMP(eq)
Fvec32s4_COMP(lt)
Fvec32s4_COMP(le)
Fvec32s4_COMP(gt)
Fvec32s4_COMP(ge)
Fvec32s4_COMP(neq)
Fvec32s4_COMP(nlt)
Fvec32s4_COMP(nle)
Fvec32s4_COMP(ngt)
Fvec32s4_COMP(nge)
#undef Fvec32s4_COMP
friend F32vec4 simd_min(const F32vec4 &a,const F32vec4 &b) { return _mm_min_ps(a,b); }
friend F32vec4 simd_max(const F32vec4 &a,const F32vec4 &b) { return _mm_max_ps(a,b); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream & operator<<(std::ostream & os,const F32vec4 &a) {
float *fp = (float*)&a;
os << "[3]:" << *(fp+3)
<< " [2]:" << *(fp+2)
<< " [1]:" << *(fp+1)
<< " [0]:" << *fp;
return os;
}
#endif
const float& operator[](int i) const {
assert((0 <= i) && (i <= 3));
float *fp = (float*)&vec;
return *(fp+i);
}
float& operator[](int i) {
assert((0 <= i) && (i <= 3));
float *fp = (float*)&vec;
return *(fp+i);
}
};
inline F32vec4 unpack_low(const F32vec4 &a,const F32vec4 &b) { return _mm_unpacklo_ps(a,b); }
inline F32vec4 unpack_high(const F32vec4 &a,const F32vec4 &b) { return _mm_unpackhi_ps(a,b); }
inline int move_mask(const F32vec4 &a) { return _mm_movemask_ps(a); }
inline void loadu(F32vec4 &a,float *p) { a = _mm_loadu_ps(p); }
inline void storeu(float *p,const F32vec4 &a) { _mm_storeu_ps(p,a); }
inline void store_nta(float *p,F32vec4 &a) { _mm_stream_ps(p,a); }
#define Fvec32s4_SELECT(op) inline F32vec4 select_##op (const F32vec4 &a,const F32vec4 &b,const F32vec4 &c,const F32vec4 &d) { F32vec4 mask = _mm_cmp##op##_ps(a,b); return((mask & c) | F32vec4((_mm_andnot_ps(mask,d)))); }
Fvec32s4_SELECT(eq)
Fvec32s4_SELECT(lt)
Fvec32s4_SELECT(le)
Fvec32s4_SELECT(gt)
Fvec32s4_SELECT(ge)
Fvec32s4_SELECT(neq)
Fvec32s4_SELECT(nlt)
Fvec32s4_SELECT(nle)
Fvec32s4_SELECT(ngt)
Fvec32s4_SELECT(nge)
#undef Fvec32s4_SELECT
inline Is16vec4 simd_max(const Is16vec4 &a,const Is16vec4 &b) { return _m_pmaxsw(a,b); }
inline Is16vec4 simd_min(const Is16vec4 &a,const Is16vec4 &b) { return _m_pminsw(a,b); }
inline Iu8vec8 simd_max(const Iu8vec8 &a,const Iu8vec8 &b) { return _m_pmaxub(a,b); }
inline Iu8vec8 simd_min(const Iu8vec8 &a,const Iu8vec8 &b) { return _m_pminub(a,b); }
inline Iu16vec4 simd_avg(const Iu16vec4 &a,const Iu16vec4 &b) { return _m_pavgw(a,b); }
inline Iu8vec8 simd_avg(const Iu8vec8 &a,const Iu8vec8 &b) { return _m_pavgb(a,b); }
inline int move_mask(const I8vec8 &a) { return _m_pmovmskb(a); }
inline Iu16vec4 mul_high(const Iu16vec4 &a,const Iu16vec4 &b) { return _m_pmulhuw(a,b); }
inline void mask_move(const I8vec8 &a,const I8vec8 &b,char *addr) { _m_maskmovq(a,b,addr); }
inline void store_nta(__m64 *p,M64 &a) { _mm_stream_pi(p,a); }
inline int F32vec4ToInt(const F32vec4 &a) { return _mm_cvtt_ss2si(a); }
inline Is32vec2 F32vec4ToIs32vec2 (const F32vec4 &a) {
__m64 result;
result = _mm_cvtt_ps2pi(a);
return Is32vec2(result);
}
inline F32vec4 IntToF32vec4(const F32vec4 &a,int i) {
__m128 result;
result = _mm_cvt_si2ss(a,i);
return F32vec4(result);
}
inline F32vec4 Is32vec2ToF32vec4(const F32vec4 &a,const Is32vec2 &b) {
__m128 result;
result = _mm_cvt_pi2ps(a,b);
return F32vec4(result);
}
class F32vec1 {
protected:
__m128 vec;
public:
F32vec1() {}
F32vec1(int i) { vec = _mm_cvt_si2ss(vec,i);};
EXPLICIT F32vec1(float f) { vec = _mm_set_ss(f); }
EXPLICIT F32vec1(double d) { vec = _mm_set_ss((float) d); }
F32vec1(__m128 m) { vec = m; }
operator __m128() const { return vec; }
friend F32vec1 operator &(const F32vec1 &a,const F32vec1 &b) { return _mm_and_ps(a,b); }
friend F32vec1 operator |(const F32vec1 &a,const F32vec1 &b) { return _mm_or_ps(a,b); }
friend F32vec1 operator ^(const F32vec1 &a,const F32vec1 &b) { return _mm_xor_ps(a,b); }
friend F32vec1 operator +(const F32vec1 &a,const F32vec1 &b) { return _mm_add_ss(a,b); }
friend F32vec1 operator -(const F32vec1 &a,const F32vec1 &b) { return _mm_sub_ss(a,b); }
friend F32vec1 operator *(const F32vec1 &a,const F32vec1 &b) { return _mm_mul_ss(a,b); }
friend F32vec1 operator /(const F32vec1 &a,const F32vec1 &b) { return _mm_div_ss(a,b); }
F32vec1& operator +=(F32vec1 &a) { return *this = _mm_add_ss(vec,a); }
F32vec1& operator -=(F32vec1 &a) { return *this = _mm_sub_ss(vec,a); }
F32vec1& operator *=(F32vec1 &a) { return *this = _mm_mul_ss(vec,a); }
F32vec1& operator /=(F32vec1 &a) { return *this = _mm_div_ss(vec,a); }
F32vec1& operator &=(F32vec1 &a) { return *this = _mm_and_ps(vec,a); }
F32vec1& operator |=(F32vec1 &a) { return *this = _mm_or_ps(vec,a); }
F32vec1& operator ^=(F32vec1 &a) { return *this = _mm_xor_ps(vec,a); }
friend F32vec1 sqrt(const F32vec1 &a) { return _mm_sqrt_ss(a); }
friend F32vec1 rcp(const F32vec1 &a) { return _mm_rcp_ss(a); }
friend F32vec1 rsqrt(const F32vec1 &a) { return _mm_rsqrt_ss(a); }
friend F32vec1 rcp_nr(const F32vec1 &a) {
F32vec1 Ra0 = _mm_rcp_ss(a);
return _mm_sub_ss(_mm_add_ss(Ra0,Ra0),_mm_mul_ss(_mm_mul_ss(Ra0,a),Ra0));
}
friend F32vec1 rsqrt_nr(const F32vec1 &a) {
static const F32vec1 fvecf0pt5(0.5f);
static const F32vec1 fvecf3pt0(3.0f);
F32vec1 Ra0 = _mm_rsqrt_ss(a);
return (fvecf0pt5 *Ra0) *(fvecf3pt0 - (a *Ra0) *Ra0);
}
#define Fvec32s1_COMP(op) friend F32vec1 cmp##op (const F32vec1 &a,const F32vec1 &b) { return _mm_cmp##op##_ss(a,b); }
Fvec32s1_COMP(eq)
Fvec32s1_COMP(lt)
Fvec32s1_COMP(le)
Fvec32s1_COMP(gt)
Fvec32s1_COMP(ge)
Fvec32s1_COMP(neq)
Fvec32s1_COMP(nlt)
Fvec32s1_COMP(nle)
Fvec32s1_COMP(ngt)
Fvec32s1_COMP(nge)
#undef Fvec32s1_COMP
friend F32vec1 simd_min(const F32vec1 &a,const F32vec1 &b) { return _mm_min_ss(a,b); }
friend F32vec1 simd_max(const F32vec1 &a,const F32vec1 &b) { return _mm_max_ss(a,b); }
#if defined(_ENABLE_VEC_DEBUG)
friend std::ostream & operator<<(std::ostream & os,const F32vec1 &a) {
float *fp = (float*)&a;
os << "float:" << *fp;
return os;
}
#endif
};
#define Fvec32s1_SELECT(op) inline F32vec1 select_##op (const F32vec1 &a,const F32vec1 &b,const F32vec1 &c,const F32vec1 &d) { F32vec1 mask = _mm_cmp##op##_ss(a,b); return((mask & c) | F32vec1((_mm_andnot_ps(mask,d)))); }
Fvec32s1_SELECT(eq)
Fvec32s1_SELECT(lt)
Fvec32s1_SELECT(le)
Fvec32s1_SELECT(gt)
Fvec32s1_SELECT(ge)
Fvec32s1_SELECT(neq)
Fvec32s1_SELECT(nlt)
Fvec32s1_SELECT(nle)
Fvec32s1_SELECT(ngt)
Fvec32s1_SELECT(nge)
#undef Fvec32s1_SELECT
inline int F32vec1ToInt(const F32vec1 &a)
{
return _mm_cvtt_ss2si(a);
}
#pragma pack(pop)
#pragma pack(pop)
#endif
#endif
+14 -6
View File
@@ -65,6 +65,10 @@
would use in the same case
*/
#ifdef __cplusplus
extern "C" {
#endif
/*** Stack frame juggling ***/
#define _ReturnAddress() (__builtin_return_address(0))
#define _AddressOfReturnAddress() (&(((void **)(__builtin_frame_address(0)))[1]))
@@ -823,14 +827,14 @@ static __inline__ __attribute__((always_inline)) unsigned char _bittestandset(lo
return retval;
}
static __inline__ __attribute__((always_inline)) unsigned char _rotl8(const unsigned char value, const unsigned char shift)
static __inline__ __attribute__((always_inline)) unsigned char _rotl8(unsigned char value, unsigned char shift)
{
unsigned char retval;
__asm__("rolb %b[shift], %b[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
return retval;
}
static __inline__ __attribute__((always_inline)) unsigned short _rotl16(const unsigned short value, const unsigned char shift)
static __inline__ __attribute__((always_inline)) unsigned short _rotl16(unsigned short value, unsigned char shift)
{
unsigned short retval;
__asm__("rolw %b[shift], %w[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
@@ -838,14 +842,14 @@ static __inline__ __attribute__((always_inline)) unsigned short _rotl16(const un
}
#ifndef __MSVCRT__
static __inline__ __attribute__((always_inline)) unsigned int _rotl(const unsigned int value, const int shift)
static __inline__ __attribute__((always_inline)) unsigned int _rotl(unsigned int value, int shift)
{
unsigned long retval;
__asm__("roll %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
return retval;
}
static __inline__ __attribute__((always_inline)) unsigned long _rotr(const unsigned int value, const unsigned char shift)
static __inline__ __attribute__((always_inline)) unsigned int _rotr(unsigned int value, int shift)
{
unsigned long retval;
__asm__("rorl %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
@@ -853,14 +857,14 @@ static __inline__ __attribute__((always_inline)) unsigned long _rotr(const unsig
}
#endif
static __inline__ __attribute__((always_inline)) unsigned char _rotr8(const unsigned char value, const unsigned char shift)
static __inline__ __attribute__((always_inline)) unsigned char _rotr8(unsigned char value, unsigned char shift)
{
unsigned char retval;
__asm__("rorb %b[shift], %b[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
return retval;
}
static __inline__ __attribute__((always_inline)) unsigned short _rotr16(const unsigned short value, const unsigned char shift)
static __inline__ __attribute__((always_inline)) unsigned short _rotr16(unsigned short value, unsigned char shift)
{
unsigned short retval;
__asm__("rorw %b[shift], %w[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
@@ -1296,6 +1300,10 @@ static __inline__ __attribute__((always_inline)) void __sidt(void *Destination)
__asm__ __volatile__("sidt %0" : : "m"(*(short*)Destination) : "memory");
}
#ifdef __cplusplus
}
#endif
#endif /* KJK_INTRIN_X86_H_ */
/* EOF */
+21
View File
@@ -0,0 +1,21 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _INC_MINMAX
#define _INC_MINMAX
#ifndef __cplusplus
#ifndef NOMINMAX
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif
#endif
#endif
+45
View File
@@ -0,0 +1,45 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _INC_NEW
#define _INC_NEW
#ifdef __cplusplus
#include <new>
#include <_mingw.h>
#pragma push_macro("new")
#undef new
#ifndef __NOTHROW_T_DEFINED
#define __NOTHROW_T_DEFINED
#endif
#ifndef __PLACEMENT_NEW_INLINE
#define __PLACEMENT_NEW_INLINE
#endif
_CRTIMP int __cdecl _query_new_mode(void);
_CRTIMP int __cdecl _set_new_mode(int _NewMode);
#ifndef _PNH_DEFINED
typedef int (__cdecl *_PNH)(size_t);
#define _PNH_DEFINED
#endif
_CRTIMP _PNH __cdecl _query_new_handler(void);
_CRTIMP _PNH __cdecl _set_new_handler(_PNH _NewHandler);
#ifndef _NO_ANSI_NH_DEFINED
#define _NO_ANSI_NEW_HANDLER ((new_handler)-1)
#define _NO_ANSI_NEW_HANDLER_M ((_new_handler_m)-1)
#define _NO_ANSI_NH_DEFINED
#endif
#pragma pop_macro("new")
#endif
#endif
+30
View File
@@ -0,0 +1,30 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifdef _WCHAR_T_DEFINED
typedef void (__cdecl *POGOAUTOSWEEPPROCW)(const wchar_t *);
#else
typedef void (__cdecl *POGOAUTOSWEEPPROCW)(const unsigned short *);
#endif
typedef void (__cdecl *POGOAUTOSWEEPPROCA)(const char *);
#ifdef __cplusplus
extern "C"
#else
extern
#endif
POGOAUTOSWEEPPROCW PogoAutoSweepW;
#ifdef __cplusplus
extern "C"
#else
extern
#endif
POGOAUTOSWEEPPROCA PogoAutoSweepA;
#ifdef UNICODE
#define PgoAutoSweep PogoAutoSweepW
#else
#define PgoAutoSweep PogoAutoSweepA
#endif
+93
View File
@@ -0,0 +1,93 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _INC_RTCAPI
#define _INC_RTCAPI
#include <_mingw.h>
#pragma pack(push,_CRT_PACKING)
#define _RTCINTERNAL_DEPRECATED
#ifdef __cplusplus
extern "C" {
#endif
typedef enum _RTC_ErrorNumber {
_RTC_CHKSTK = 0,_RTC_CVRT_LOSS_INFO,_RTC_CORRUPT_STACK,_RTC_UNINIT_LOCAL_USE,_RTC_CORRUPTED_ALLOCA,_RTC_ILLEGAL
} _RTC_ErrorNumber;
#define _RTC_ERRTYPE_IGNORE -1
#define _RTC_ERRTYPE_ASK -2
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#endif
typedef int (__cdecl *_RTC_error_fn)(int,const char *,int,const char *,const char *,...);
typedef int (__cdecl *_RTC_error_fnW)(int,const wchar_t *,int,const wchar_t *,const wchar_t *,...);
int __cdecl _RTC_NumErrors(void);
const char *__cdecl _RTC_GetErrDesc(_RTC_ErrorNumber _Errnum);
int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber _Errnum,int _ErrType);
_RTC_error_fn __cdecl _RTC_SetErrorFunc(_RTC_error_fn);
_RTC_error_fnW __cdecl _RTC_SetErrorFuncW(_RTC_error_fnW);
void __cdecl _RTC_Initialize(void);
void __cdecl _RTC_Terminate(void);
_RTC_error_fn __cdecl _CRT_RTC_INIT(void *_Res0,void **_Res1,int _Res2,int _Res3,int _Res4);
_RTC_error_fnW __cdecl _CRT_RTC_INITW(void *_Res0,void **_Res1,int _Res2,int _Res3,int _Res4);
typedef struct _RTC_vardesc {
int addr;
int size;
char *name;
} _RTC_vardesc;
typedef struct _RTC_framedesc {
int varCount;
_RTC_vardesc *variables;
} _RTC_framedesc;
#pragma pack(push,1)
typedef struct _RTC_ALLOCA_NODE {
__int32 guard1;
struct _RTC_ALLOCA_NODE *next;
#if (defined(_X86_) && !defined(__x86_64))
__int32 dummypad;
#endif
size_t allocaSize;
#if (defined(_X86_) && !defined(__x86_64))
__int32 dummypad2;
#endif
__int32 guard2[3];
} _RTC_ALLOCA_NODE;
#pragma pack(pop)
char __fastcall _RTC_Check_2_to_1(short _Src);
char __fastcall _RTC_Check_4_to_1(int _Src);
char __fastcall _RTC_Check_8_to_1(__int64 _Src);
short __fastcall _RTC_Check_4_to_2(int _Src);
short __fastcall _RTC_Check_8_to_2(__int64 _Src);
int __fastcall _RTC_Check_8_to_4(__int64 _Src);
#if (defined(_X86_) && !defined(__x86_64))
void __cdecl _RTC_CheckEsp();
#endif
void __fastcall _RTC_CheckStackVars(void *_Esp,_RTC_framedesc *_Fd);
void __fastcall _RTC_CheckStackVars2(void *_Esp,_RTC_framedesc *_Fd,_RTC_ALLOCA_NODE *_AllocaList);
void __fastcall _RTC_AllocaHelper(_RTC_ALLOCA_NODE *_PAllocaBase,size_t _CbSize,_RTC_ALLOCA_NODE **_PAllocaInfoList);
void __cdecl _RTC_UninitUse(const char *_Varname);
void __cdecl _RTC_Shutdown(void);
void __cdecl _RTC_InitBase(void);
#ifdef __cplusplus
void *_ReturnAddress();
}
#endif
#pragma pack(pop)
#endif
+24
View File
@@ -0,0 +1,24 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _INC_SETJMPEX
#define _INC_SETJMPEX
#ifndef _WIN32
#error Only Win32 target is supported!
#endif
#if (defined(_X86_) && !defined(__x86_64))
#define setjmp _setjmp
#define longjmp _longjmpex
#else
#ifdef setjmp
#undef setjmp
#endif
#define setjmp _setjmpex
#endif
#include <setjmp.h>
#endif
+15
View File
@@ -0,0 +1,15 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#include <_mingw.h>
#ifndef _INC_STDEXCPT
#define _INC_STDEXCPT
#ifdef __cplusplus
#include <exception>
#endif
#endif
+4
View File
@@ -241,6 +241,7 @@ extern "C" {
#define _tcscat wcscat
#define _tcschr wcschr
#define _tcscpy wcscpy
#define _tcscpy_s wcscpy_s
#define _tcscspn wcscspn
#define _tcslen wcslen
#define _tcsnlen wcsnlen
@@ -342,6 +343,7 @@ extern "C" {
#define _tputenv _wputenv
#define _tsearchenv _wsearchenv
#define _tsplitpath _wsplitpath
#define _tsplitpath_s _wsplitpath_s
#define _tfdopen _wfdopen
#define _tfsopen _wfsopen
@@ -619,6 +621,7 @@ extern "C" {
#define _tcscat strcat
#define _tcscpy strcpy
#define _tcscpy_s strcpy_s
#define _tcsdup _strdup
#define _tcslen strlen
#if 0
@@ -683,6 +686,7 @@ extern "C" {
#define _tputenv _putenv
#define _tsearchenv _searchenv
#define _tsplitpath _splitpath
#define _tsplitpath_s _splitpath_s
#ifdef _POSIX_
#define _tfdopen fdopen
+1 -14
View File
@@ -145,9 +145,8 @@ extern "C" {
_CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm);
#if defined (_POSIX_) || defined(__GNUC__)
void __cdecl tzset(void);
#else
_CRTIMP void __cdecl _tzset(void);
#endif
_CRTIMP void __cdecl _tzset(void);
#if _INTEGRAL_MAX_BITS >= 64
double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2);
@@ -236,18 +235,6 @@ struct timeval {
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif /* _TIMEVAL_DEFINED */
#ifndef __STRICT_ANSI__
#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
#define _TIMEZONE_DEFINED
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z);
#endif
#endif /* __STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
+32
View File
@@ -0,0 +1,32 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#include <_mingw.h>
#ifndef _INC_TYPEINFO
#define _INC_TYPEINFO
#pragma pack(push,_CRT_PACKING)
#ifndef RC_INVOKED
#ifndef __cplusplus
#error This header requires a C++ compiler ...
#endif
#include <typeinfo>
#ifdef __RTTI_OLDNAMES
using std::bad_cast;
using std::bad_typeid;
typedef type_info Type_info;
typedef bad_cast Bad_cast;
typedef bad_typeid Bad_typeid;
#endif
#endif
#pragma pack(pop)
#endif
+12
View File
@@ -0,0 +1,12 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _VARARGS_H
#define _VARARGS_H
#error "GCC no longer implements <varargs.h>."
#error "Revise your code to use <stdarg.h>."
#endif
+99
View File
@@ -0,0 +1,99 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _XLOCINFO
#define _XLOCINFO
#include <ctype.h>
#include <locale.h>
#include <wchar.h>
#include <yvals.h>
#pragma pack(push,_CRT_PACKING)
_C_STD_BEGIN
_C_LIB_DECL
#define _XA 0x100
#define _XS 0x000
#define _BB _CONTROL
#define _CN _SPACE
#define _DI _DIGIT
#define _LO _LOWER
#define _PU _PUNCT
#define _SP _BLANK
#define _UP _UPPER
#define _XD _HEX
#define _X_ALL LC_ALL
#define _X_COLLATE LC_COLLATE
#define _X_CTYPE LC_CTYPE
#define _X_MONETARY LC_MONETARY
#define _X_NUMERIC LC_NUMERIC
#define _X_TIME LC_TIME
#define _X_MAX LC_MAX
#define _X_MESSAGES 6
#define _NCAT 7
#define _CATMASK(n) ((1 << (n)) >> 1)
#define _M_COLLATE _CATMASK(_X_COLLATE)
#define _M_CTYPE _CATMASK(_X_CTYPE)
#define _M_MONETARY _CATMASK(_X_MONETARY)
#define _M_NUMERIC _CATMASK(_X_NUMERIC)
#define _M_TIME _CATMASK(_X_TIME)
#define _M_MESSAGES _CATMASK(_X_MESSAGES)
#define _M_ALL (_CATMASK(_NCAT) - 1)
typedef struct _Collvec {
unsigned long _Hand;
unsigned int _Page;
} _Collvec;
typedef struct _Ctypevec {
unsigned long _Hand;
unsigned int _Page;
const short *_Table;
int _Delfl;
} _Ctypevec;
typedef struct _Cvtvec {
unsigned long _Hand;
unsigned int _Page;
} _Cvtvec;
_CRTIMP _Collvec __cdecl _Getcoll();
_CRTIMP _Ctypevec __cdecl _Getctype();
_CRTIMP _Cvtvec __cdecl _Getcvt();
_CRTIMP int __cdecl _Getdateorder();
_CRTIMP int __cdecl _Mbrtowc(wchar_t *,const char *,size_t,mbstate_t *,const _Cvtvec *);
_CRTIMP float __cdecl _Stof(const char *,char **,long);
_CRTIMP double __cdecl _Stod(const char *,char **,long);
_CRTIMP long double __cdecl _Stold(const char *,char **,long);
_CRTIMP int __cdecl _Strcoll(const char *,const char *,const char *,const char *,const _Collvec *);
_CRTIMP size_t __cdecl _Strxfrm(char *_String1,char *_End1,const char *,const char *,const _Collvec *);
_CRTIMP int __cdecl _Tolower(int,const _Ctypevec *);
_CRTIMP int __cdecl _Toupper(int,const _Ctypevec *);
_CRTIMP int __cdecl _Wcrtomb(char *,wchar_t,mbstate_t *,const _Cvtvec *);
_CRTIMP int __cdecl _Wcscoll(const wchar_t *,const wchar_t *,const wchar_t *,const wchar_t *,const _Collvec *);
_CRTIMP size_t __cdecl _Wcsxfrm(wchar_t *_String1,wchar_t *_End1,const wchar_t *,const wchar_t *,const _Collvec *);
_CRTIMP short __cdecl _Getwctype(wchar_t,const _Ctypevec *);
_CRTIMP const wchar_t *__cdecl _Getwctypes(const wchar_t *,const wchar_t *,short*,const _Ctypevec*);
_CRTIMP wchar_t __cdecl _Towlower(wchar_t,const _Ctypevec *);
_CRTIMP wchar_t __cdecl _Towupper(wchar_t,const _Ctypevec *);
_END_C_LIB_DECL
_C_STD_END
_C_LIB_DECL
_CRTIMP void *__cdecl _Gettnames();
_CRTIMP char *__cdecl _Getdays();
_CRTIMP char *__cdecl _Getmonths();
_CRTIMP size_t __cdecl _Strftime(char *,size_t _Maxsize,const char *,const struct tm *,void *);
_END_C_LIB_DECL
_C_LIB_DECL
_locale_t __cdecl _GetLocaleForCP(unsigned int);
_END_C_LIB_DECL
#pragma pack(pop)
#endif
+108
View File
@@ -0,0 +1,108 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _XMATH
#define _XMATH
#include <errno.h>
#include <math.h>
#include <stddef.h>
#include <ymath.h>
_C_STD_BEGIN
#define _DBIAS 0x3fe
#define _DOFF 4
#define _FBIAS 0x7e
#define _FOFF 7
#define _FRND 1
#define _D0 3
#define _D1 2
#define _D2 1
#define _D3 0
#define _DLONG 0
#define _LBIAS 0x3fe
#define _LOFF 4
#define _DFRAC ((unsigned short)((1 << _DOFF) - 1))
#define _DMASK ((unsigned short)(0x7fff & ~_DFRAC))
#define _DMAX ((unsigned short)((1 << (15 - _DOFF)) - 1))
#define _DSIGN ((unsigned short)0x8000)
#define DSIGN(x) (((unsigned short *)&(x))[_D0] & _DSIGN)
#define HUGE_EXP (int)(_DMAX *900L / 1000)
#define HUGE_RAD 2.73e9
#define SAFE_EXP ((unsigned short)(_DMAX >> 1))
#define _FFRAC ((unsigned short)((1 << _FOFF) - 1))
#define _FMASK ((unsigned short)(0x7fff & ~_FFRAC))
#define _FMAX ((unsigned short)((1 << (15 - _FOFF)) - 1))
#define _FSIGN ((unsigned short)0x8000)
#define FSIGN(x) (((unsigned short *)&(x))[_F0] & _FSIGN)
#define FHUGE_EXP (int)(_FMAX *900L / 1000)
#define FHUGE_RAD 31.8
#define FSAFE_EXP ((unsigned short)(_FMAX >> 1))
#define _F0 1
#define _F1 0
#define _LFRAC ((unsigned short)(-1))
#define _LMASK ((unsigned short)0x7fff)
#define _LMAX ((unsigned short)0x7fff)
#define _LSIGN ((unsigned short)0x8000)
#define LSIGN(x) (((unsigned short *)&(x))[_L0] & _LSIGN)
#define LHUGE_EXP (int)(_LMAX *900L / 1000)
#define LHUGE_RAD 2.73e9
#define LSAFE_EXP ((unsigned short)(_LMAX >> 1))
#define _L0 3
#define _L1 2
#define _L2 1
#define _L3 0
#define _L4 xxx
#define FINITE _FINITE
#define INF _INFCODE
#define NAN _NANCODE
#define FL_ERR 0
#define FL_DEC 1
#define FL_HEX 2
#define FL_INF 3
#define FL_NAN 4
#define FL_NEG 8
_C_LIB_DECL
_CRTIMP int __cdecl _Stopfx(const char **,char **);
_CRTIMP int __cdecl _Stoflt(const char *,const char *,char **,long[],int);
_CRTIMP int __cdecl _Stoxflt(const char *,const char *,char **,long[],int);
_CRTIMP int __cdecl _WStopfx(const wchar_t **,wchar_t **);
_CRTIMP int __cdecl _WStoflt(const wchar_t *,const wchar_t *,wchar_t **,long[],int);
_CRTIMP int __cdecl _WStoxflt(const wchar_t *,const wchar_t *,wchar_t **,long[],int);
_CRTIMP short __cdecl _Dnorm(unsigned short *);
_CRTIMP short __cdecl _Dscale(double *,long);
_CRTIMP short __cdecl _Dunscale(short *,double *);
_CRTIMP double __cdecl _Poly(double,const double *,int);
extern _CRTIMP _Dconst _Eps,_Rteps;
extern _CRTIMP double _Xbig;
_CRTIMP short __cdecl _FDnorm(unsigned short *);
_CRTIMP short __cdecl _FDscale(float *,long);
_CRTIMP short __cdecl _FDunscale(short *,float *);
extern _CRTIMP _Dconst _FEps,_FRteps;
extern _CRTIMP float _FXbig;
_CRTIMP short __cdecl _LDnorm(unsigned short *);
_CRTIMP short __cdecl _LDscale(long double *,long);
_CRTIMP short __cdecl _LDunscale(short *,long double *);
_CRTIMP long double __cdecl _LPoly(long double,const long double *,int);
extern _CRTIMP _Dconst _LEps,_LRteps;
extern _CRTIMP long double _LXbig;
_END_C_LIB_DECL
_C_STD_END
#endif
+52
View File
@@ -0,0 +1,52 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _YMATH
#define _YMATH
#include <yvals.h>
_C_STD_BEGIN
_C_LIB_DECL
#pragma pack(push,_CRT_PACKING)
#define _DENORM (-2)
#define _FINITE (-1)
#define _INFCODE 1
#define _NANCODE 2
#define _FE_DIVBYZERO 0x04
#define _FE_INEXACT 0x20
#define _FE_INVALID 0x01
#define _FE_OVERFLOW 0x08
#define _FE_UNDERFLOW 0x10
typedef union {
unsigned short _Word[8];
float _Float;
double _Double;
long double _Long_double;
} _Dconst;
void __cdecl _Feraise(int);
_CRTIMP double __cdecl _Cosh(double,double);
_CRTIMP short __cdecl _Dtest(double *);
_CRTIMP short __cdecl _Exp(double *,double,short);
_CRTIMP double __cdecl _Sinh(double,double);
extern _CRTIMP _Dconst _Denorm,_Hugeval,_Inf,_Nan,_Snan;
_CRTIMP float __cdecl _FCosh(float,float);
_CRTIMP short __cdecl _FDtest(float *);
_CRTIMP short __cdecl _FExp(float *,float,short);
_CRTIMP float __cdecl _FSinh(float,float);
extern _CRTIMP _Dconst _FDenorm,_FInf,_FNan,_FSnan;
_CRTIMP long double __cdecl _LCosh(long double,long double);
_CRTIMP short __cdecl _LDtest(long double *);
_CRTIMP short __cdecl _LExp(long double *,long double,short);
_CRTIMP long double __cdecl _LSinh(long double,long double);
extern _CRTIMP _Dconst _LDenorm,_LInf,_LNan,_LSnan;
_END_C_LIB_DECL
_C_STD_END
#pragma pack(pop)
#endif
+271
View File
@@ -0,0 +1,271 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _YVALS
#define _YVALS
#include <_mingw.h>
#pragma pack(push,_CRT_PACKING)
#define _CPPLIB_VER 405
#define __PURE_APPDOMAIN_GLOBAL
#ifndef __CRTDECL
#define __CRTDECL __cdecl
#endif
#define _WIN32_C_LIB 1
#define _MULTI_THREAD 1
#define _IOSTREAM_OP_LOCKS 1
#define _GLOBAL_LOCALE 0
#define _COMPILER_TLS 1
#define _TLS_QUAL __declspec(thread)
#ifndef _HAS_EXCEPTIONS
#define _HAS_EXCEPTIONS 1
#endif
#ifndef _HAS_NAMESPACE
#define _HAS_NAMESPACE 1
#endif
#ifndef _HAS_IMMUTABLE_SETS
#define _HAS_IMMUTABLE_SETS 0
#endif
#ifndef _HAS_STRICT_CONFORMANCE
#define _HAS_STRICT_CONFORMANCE 0
#endif
#define _GLOBAL_USING 1
#define _HAS_ITERATOR_DEBUGGING 0
#define __STR2WSTR(str) L##str
#define _STR2WSTR(str) __STR2WSTR(str)
#define __FILEW__ _STR2WSTR(__FILE__)
#define __FUNCTIONW__ _STR2WSTR(__FUNCTION__)
#define _SCL_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter_noinfo()
#define _SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT _SCL_SECURE_INVALID_PARAMETER("invalid argument")
#define _SCL_SECURE_OUT_OF_RANGE_NO_ASSERT _SCL_SECURE_INVALID_PARAMETER("out of range")
#define _SCL_SECURE_ALWAYS_VALIDATE(cond) { if (!(cond)) { _ASSERTE((#cond,0)); _SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT; } }
#define _SCL_SECURE_ALWAYS_VALIDATE_RANGE(cond) { if (!(cond)) { _ASSERTE((#cond,0)); _SCL_SECURE_OUT_OF_RANGE_NO_ASSERT; } }
#define _SCL_SECURE_CRT_VALIDATE(cond,retvalue) { if (!(cond)) { _ASSERTE((#cond,0)); _SCL_SECURE_INVALID_PARAMETER(cond); return (retvalue); } }
#define _SCL_SECURE_VALIDATE(cond)
#define _SCL_SECURE_VALIDATE_RANGE(cond)
#define _SCL_SECURE_INVALID_ARGUMENT
#define _SCL_SECURE_OUT_OF_RANGE
#define _SCL_SECURE_MOVE(func,dst,size,src,count) func((dst),(src),(count))
#define _SCL_SECURE_COPY(func,dst,size,src,count) func((dst),(src),(count))
#define _SECURE_VALIDATION _Secure_validation
#define _SECURE_VALIDATION_DEFAULT false
#define _SCL_SECURE_TRAITS_VALIDATE(cond)
#define _SCL_SECURE_TRAITS_VALIDATE_RANGE(cond)
#define _SCL_SECURE_TRAITS_INVALID_ARGUMENT
#define _SCL_SECURE_TRAITS_OUT_OF_RANGE
#define _CRT_SECURE_MEMCPY(dest,destsize,source,count) ::memcpy((dest),(source),(count))
#define _CRT_SECURE_MEMMOVE(dest,destsize,source,count) ::memmove((dest),(source),(count))
#define _CRT_SECURE_WMEMCPY(dest,destsize,source,count) ::wmemcpy((dest),(source),(count))
#define _CRT_SECURE_WMEMMOVE(dest,destsize,source,count) ::wmemmove((dest),(source),(count))
#ifndef _VC6SP2
#define _VC6SP2 0
#endif
#ifndef _CRTIMP2_NCEEPURE
#define _CRTIMP2_NCEEPURE _CRTIMP
#endif
#ifndef _MRTIMP2_NPURE
#define _MRTIMP2_NPURE
#endif
#ifndef _MRTIMP2_NCEE
#define _MRTIMP2_NCEE _CRTIMP
#endif
#ifndef _MRTIMP2_NCEEPURE
#define _MRTIMP2_NCEEPURE _CRTIMP
#endif
#ifndef _MRTIMP2_NPURE_NCEEPURE
#define _MRTIMP2_NPURE_NCEEPURE
#endif
#define _DLL_CPPLIB
#ifndef _CRTIMP2_PURE
#define _CRTIMP2_PURE _CRTIMP
#endif
#ifndef _CRTDATA2
#define _CRTDATA2 _CRTIMP
#endif
#define _DEPRECATED
#ifdef __cplusplus
#define _STD_BEGIN namespace std {
#define _STD_END }
#define _STD ::std::
#define _STDEXT_BEGIN namespace stdext {
#define _STDEXT_END }
#define _STDEXT ::stdext::
#ifdef _STD_USING
#define _C_STD_BEGIN namespace std {
#define _C_STD_END }
#define _CSTD ::std::
#else
#define _C_STD_BEGIN
#define _C_STD_END
#define _CSTD ::
#endif
#define _C_LIB_DECL extern "C" {
#define _END_C_LIB_DECL }
#define _EXTERN_C extern "C" {
#define _END_EXTERN_C }
#else
#define _STD_BEGIN
#define _STD_END
#define _STD
#define _C_STD_BEGIN
#define _C_STD_END
#define _CSTD
#define _C_LIB_DECL
#define _END_C_LIB_DECL
#define _EXTERN_C
#define _END_EXTERN_C
#endif
#define _Restrict restrict
#ifdef __cplusplus
_STD_BEGIN
typedef bool _Bool;
_STD_END
#endif
#define _LONGLONG __int64
#define _ULONGLONG unsigned __int64
#define _LLONG_MAX 0x7fffffffffffffff
#define _ULLONG_MAX 0xffffffffffffffff
#define _C2 1
#define _MAX_EXP_DIG 8
#define _MAX_INT_DIG 32
#define _MAX_SIG_DIG 36
typedef _LONGLONG _Longlong;
typedef _ULONGLONG _ULonglong;
#define _Filet _iobuf
#ifndef _FPOS_T_DEFINED
#define _FPOSOFF(fp) ((long)(fp))
#endif
#define _IOBASE _base
#define _IOPTR _ptr
#define _IOCNT _cnt
#define _LOCK_LOCALE 0
#define _LOCK_MALLOC 1
#define _LOCK_STREAM 2
#define _LOCK_DEBUG 3
#define _MAX_LOCK 4
#ifdef __cplusplus
_STD_BEGIN
class _CRTIMP _Lockit {
public:
explicit __thiscall _Lockit();
explicit __thiscall _Lockit(int);
__thiscall ~_Lockit();
static void __cdecl _Lockit_ctor(int);
static void __cdecl _Lockit_dtor(int);
private:
static void __cdecl _Lockit_ctor(_Lockit *);
static void __cdecl _Lockit_ctor(_Lockit *,int);
static void __cdecl _Lockit_dtor(_Lockit *);
_Lockit(const _Lockit&);
_Lockit& operator=(const _Lockit&);
int _Locktype;
};
#define _BEGIN_LOCK(_Kind) { _STD _Lockit _Lock(_Kind);
#define _END_LOCK() }
#define _BEGIN_LOCINFO(_VarName) { _Locinfo _VarName;
#define _END_LOCINFO() }
#define _RELIABILITY_CONTRACT
class _CRTIMP _Mutex {
public:
__thiscall _Mutex();
__thiscall ~_Mutex();
void __thiscall _Lock();
void __thiscall _Unlock();
private:
static void __cdecl _Mutex_ctor(_Mutex *);
static void __cdecl _Mutex_dtor(_Mutex *);
static void __cdecl _Mutex_Lock(_Mutex *);
static void __cdecl _Mutex_Unlock(_Mutex *);
_Mutex(const _Mutex&);
_Mutex& operator=(const _Mutex&);
void *_Mtx;
};
class _CRTIMP _Init_locks {
public:
__thiscall _Init_locks();
__thiscall ~_Init_locks();
private:
static void __cdecl _Init_locks_ctor(_Init_locks *);
static void __cdecl _Init_locks_dtor(_Init_locks *);
};
_STD_END
#endif
#ifndef _RELIABILITY_CONTRACT
#define _RELIABILITY_CONTRACT
#endif
_C_STD_BEGIN
_CRTIMP void __cdecl _Atexit(void (__cdecl *)(void));
typedef int _Mbstatet;
#define _ATEXIT_T void
#define _Mbstinit(x) mbstate_t x = {0}
_C_STD_END
#define _EXTERN_TEMPLATE template
#define _THROW_BAD_ALLOC _THROW1(...)
#pragma pack(pop)
#endif
+5
View File
@@ -1050,6 +1050,11 @@ typedef struct tagACTCTX_SECTION_KEYED_DATA {
HANDLE ulAssemblyRosterIndex;
} ACTCTX_SECTION_KEYED_DATA,*PACTCTX_SECTION_KEYED_DATA;
typedef const ACTCTX_SECTION_KEYED_DATA *PCACTCTX_SECTION_KEYED_DATA;
typedef struct _ACTIVATION_CONTEXT_BASIC_INFORMATION {
HANDLE hActCtx;
DWORD dwFlags;
} ACTIVATION_CONTEXT_BASIC_INFORMATION, *PACTIVATION_CONTEXT_BASIC_INFORMATION;
typedef const struct _ACTIVATION_CONTEXT_BASIC_INFORMATION *PCACTIVATION_CONTEXT_BASIC_INFORMATION;
typedef enum {
LowMemoryResourceNotification ,
HighMemoryResourceNotification
+18 -7
View File
@@ -576,10 +576,21 @@ extern "C" {
#define DCBA_FACEDOWNRIGHT 259
#define FLOODFILLBORDER 0
#define FLOODFILLSURFACE 1
#define ETO_CLIPPED 4
#define ETO_GLYPH_INDEX 16
#define ETO_OPAQUE 2
#define ETO_RTLREADING 128
#define ETO_OPAQUE 0x00002
#define ETO_CLIPPED 0x00004
#if (WINVER >= 0x0400)
#define ETO_GLYPH_INDEX 0x00010
#define ETO_RTLREADING 0x00080
#define ETO_NUMERICSLOCAL 0x00400
#define ETO_NUMERICSLATIN 0x00800
#define ETO_IGNORELANGUAGE 0x01000
#endif
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
#define ETO_PDY 0x02000
#endif
#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
#define ETO_REVERSE_INDEX_MAP 0x10000
#endif
#define GDICOMMENT_WINDOWS_METAFILE (-2147483647)
#define GDICOMMENT_BEGINGROUP 2
#define GDICOMMENT_ENDGROUP 3
@@ -866,7 +877,7 @@ extern "C" {
#define TCI_SRCCODEPAGE 2
#define TCI_SRCFONTSIG 3
#if (_WIN32_WINNT >= 0x0500)
#define SHADEBLENDCAPS 120
#define SHADEBLENDCAPS 120
#define COLORMGMTCAPS 121
/* SHADEBLENDCAPS */
#define SB_NONE 0x00000000
@@ -1654,7 +1665,7 @@ typedef struct tagEMRCREATECOLORSPACEW {
typedef struct tagEMRCREATECOLORSPACE {
EMR emr;
DWORD ihCS;
LOGCOLORSPACEW lcs;
LOGCOLORSPACEA lcs;
} EMRCREATECOLORSPACE,*PEMRCREATECOLORSPACE;
typedef struct tagEMRCREATEDIBPATTERNBRUSHPT {
EMR emr;
@@ -1972,7 +1983,7 @@ typedef struct tagEMRPOLYLINE16 {
EMR emr;
RECTL rclBounds;
DWORD cpts;
POINTL apts[1];
POINTS apts[1];
} EMRPOLYLINE16,*PEMRPOLYLINE16,EMRPOLYBEZIER16,*PEMRPOLYBEZIER16,EMRPOLYGON16,*PEMRPOLYGON16,EMRPOLYBEZIERTO16,*PEMRPOLYBEZIERTO16,EMRPOLYLINETO16,*PEMRPOLYLINETO16;
typedef struct tagEMRPOLYPOLYLINE {
EMR emr;
+4 -1
View File
@@ -181,7 +181,9 @@ typedef PDWORD PLCID;
typedef WORD LANGID;
#ifdef __GNUC__
#define _HAVE_INT64
#define _INTEGRAL_MAX_BITS 64
#ifndef _INTEGRAL_MAX_BITS
# define _INTEGRAL_MAX_BITS 64
#endif
#undef __int64
#define __int64 long long
#elif defined(__WATCOMC__) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
@@ -1236,6 +1238,7 @@ typedef enum
#define SECTION_QUERY 1
#define SECTION_MAP_EXECUTE 8
#define SECTION_ALL_ACCESS 0xf001f
#define WRITE_WATCH_FLAG_RESET 0x01
#ifndef __NTDDK_H
#define MESSAGE_RESOURCE_UNICODE 1
#endif
+1 -13
View File
@@ -69,7 +69,7 @@ extern "C"
{
#endif
extern void __cdecl _SEH2EnterFrame(_SEH2Frame_t *);
extern __attribute__((returns_twice)) void __cdecl _SEH2EnterFrame(_SEH2Frame_t *);
extern void __cdecl _SEH2LeaveFrame(void);
extern void __cdecl _SEH2Return(void);
@@ -134,23 +134,12 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
/* GCC doesn't know that this equals zero */
#define __SEH_VOLATILE_ZERO ({ int zero = 0; __asm__ __volatile__("#" : "+g" (zero)); zero; })
/* GCC believes this is setjmp */
#define __SEH_PRETEND_SETJMP() (_SEH2PretendSetjmp(), 0)
#define __SEH_VOLATILE_FALSE __builtin_expect(__SEH_VOLATILE_ZERO, 0)
#define __SEH_VOLATILE_TRUE __builtin_expect(!__SEH_VOLATILE_ZERO, 1)
#define ___SEH_STRINGIFY(X_) # X_
#define __SEH_STRINGIFY(X_) ___SEH_STRINGIFY(X_)
static
__inline__
__attribute__((returns_twice))
__attribute__((always_inline))
void _SEH2PretendSetjmp(void)
{
}
#define __SEH_FORCE_NEST \
__asm__ __volatile__("#%0" : : "r" (&_SEHFrame))
@@ -166,7 +155,6 @@ void _SEH2PretendSetjmp(void)
#define __SEH_RETURN_FINALLY() return
#define __SEH_BEGIN_TRY \
if(!__SEH_PRETEND_SETJMP()) \
{ \
__label__ _SEHEndTry; \
\
+36 -312
View File
@@ -1,342 +1,66 @@
/*
* Wine exception handling
*
* Copyright (c) 1999 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WINE_EXCEPTION_H
#define __WINE_WINE_EXCEPTION_H
#include <setjmp.h>
#include <windef.h>
#include <excpt.h>
#include <intrin.h>
#include <pseh/pseh2.h>
#include <pseh/excpt.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The following definitions allow using exceptions in Wine and Winelib code
*
* They should be used like this:
*
* __TRY
* {
* do some stuff that can raise an exception
* }
* __EXCEPT(filter_func,param)
* {
* handle the exception here
* }
* __ENDTRY
*
* or
*
* __TRY
* {
* do some stuff that can raise an exception
* }
* __FINALLY(finally_func,param)
*
* The filter_func must be defined with the WINE_EXCEPTION_FILTER
* macro, and return one of the EXCEPTION_* code; it can use
* GetExceptionInformation and GetExceptionCode to retrieve the
* exception info.
*
* The finally_func must be defined with the WINE_FINALLY_FUNC macro.
*
* Warning: inside a __TRY or __EXCEPT block, 'break' or 'continue' statements
* break out of the current block. You cannot use 'return', 'goto'
* or 'longjmp' to leave a __TRY block, as this will surely crash.
* You can use them to leave a __EXCEPT block though.
*
* -- AJ
*/
struct _EXCEPTION_REGISTRATION_RECORD;
typedef struct _EXCEPTION_REGISTRATION_RECORD EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
typedef struct _EXCEPTION_REGISTRATION_RECORD
struct _EXCEPTION_REGISTRATION_RECORD
{
struct _EXCEPTION_REGISTRATION_RECORD *Prev;
struct _EXCEPTION_REGISTRATION_RECORD * Prev;
PEXCEPTION_HANDLER Handler;
} EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
};
/* Define this if you want to use your compiler built-in __try/__except support.
* This is only useful when compiling to a native Windows binary, as the built-in
* compiler exceptions will most certainly not work under Winelib.
*/
#ifdef USE_COMPILER_EXCEPTIONS
#define __TRY _SEH2_TRY
#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION)
#define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
#define __ENDTRY _SEH2_END
#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
#define __TRY __try
#define __EXCEPT(func) __except((func)(GetExceptionInformation()))
#define __FINALLY(func) __finally { (func)(!AbnormalTermination()); }
#define __ENDTRY /*nothing*/
#define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
#define __EXCEPT_ALL __except(EXCEPTION_EXECUTE_HANDLER)
#else /* USE_COMPILER_EXCEPTIONS */
#ifndef __GNUC__
#define __attribute__(x) /* nothing */
#ifndef GetExceptionCode
#define GetExceptionCode() _SEH2_GetExceptionCode()
#endif
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__REACTOS__)
#define sigjmp_buf jmp_buf
#define sigsetjmp(buf,sigs) setjmp(buf)
#define siglongjmp(buf,val) longjmp(buf,val)
#ifndef GetExceptionInformation
#define GetExceptionInformation() _SEH2_GetExceptionInformation()
#endif
#define __TRY \
do { __WINE_FRAME __f; \
int __first = 1; \
for (;;) if (!__first) \
{ \
do {
#define __EXCEPT(func) \
} while(0); \
__wine_pop_frame( &__f.frame ); \
break; \
} else { \
__f.frame.Handler = __wine_exception_handler; \
__f.u.filter = (func); \
if (sigsetjmp( __f.jmp, 0 )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
/* convenience handler for page fault exceptions */
#define __EXCEPT_PAGE_FAULT \
} while(0); \
__wine_pop_frame( &__f.frame ); \
break; \
} else { \
__f.frame.Handler = __wine_exception_handler_page_fault; \
if (sigsetjmp( __f.jmp, 0 )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
/* convenience handler for all exception */
#define __EXCEPT_ALL \
} while(0); \
__wine_pop_frame( &__f.frame ); \
break; \
} else { \
__f.frame.Handler = __wine_exception_handler_all; \
if (sigsetjmp( __f.jmp, 0 )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
#define __ENDTRY \
} while (0); \
break; \
} \
__wine_push_frame( &__f.frame ); \
__first = 0; \
} \
} while (0);
#define __FINALLY(func) \
} while(0); \
__wine_pop_frame( &__f.frame ); \
(func)(1); \
break; \
} else { \
__f.frame.Handler = __wine_finally_handler; \
__f.u.finally_func = (func); \
__wine_push_frame( &__f.frame ); \
__first = 0; \
} \
} while (0);
typedef LONG (CALLBACK *__WINE_FILTER)(PEXCEPTION_POINTERS);
typedef void (CALLBACK *__WINE_FINALLY)(BOOL);
#define GetExceptionInformation() (__eptr)
#define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode)
#undef AbnormalTermination
#define AbnormalTermination() (!__normal)
typedef struct __tagWINE_FRAME
{
EXCEPTION_REGISTRATION_RECORD frame;
union
{
/* exception data */
__WINE_FILTER filter;
/* finally data */
__WINE_FINALLY finally_func;
} u;
sigjmp_buf jmp;
/* hack to make GetExceptionCode() work in handler */
DWORD ExceptionCode;
const struct __tagWINE_FRAME *ExceptionRecord;
} __WINE_FRAME;
#endif /* USE_COMPILER_EXCEPTIONS */
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
#if defined(__GNUC__) && defined(__i386__)
EXCEPTION_REGISTRATION_RECORD *prev;
__asm__ __volatile__(".byte 0x64\n\tmovl (0),%0"
"\n\tmovl %0,(%1)"
"\n\t.byte 0x64\n\tmovl %1,(0)"
: "=&r" (prev) : "r" (frame) : "memory" );
return prev;
#else
NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
frame->Prev = teb->ExceptionList;
teb->ExceptionList = frame;
return frame->Prev;
#ifndef AbnormalTermination
#define AbnormalTermination() _SEH2_AbnormalTermination()
#endif
}
static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
#if defined(__GNUC__) && defined(__i386__)
__asm__ __volatile__(".byte 0x64\n\tmovl %0,(0)"
: : "r" (frame->Prev) : "memory" );
return frame->Prev;
#define EXCEPTION_WINE_STUB 0x80000100
#define EXCEPTION_WINE_ASSERTION 0x80000101
#else
NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
teb->ExceptionList = frame->Prev;
return frame->Prev;
#endif
}
/* Exception handling flags - from OS/2 2.0 exception handling */
/* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD */
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
/* Wine-specific exceptions codes */
#define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */
#define EXCEPTION_WINE_ASSERTION 0x80000101 /* assertion failed */
/* unhandled return status from vm86 mode */
#define EXCEPTION_VM86_INTx 0x80000110
#define EXCEPTION_VM86_STI 0x80000111
#define EXCEPTION_VM86_PICRETURN 0x80000112
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
frame->Prev = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
__writefsdword(0, (unsigned long)frame);
return frame->Prev;
}
static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
__writefsdword(0, (unsigned long)frame->Prev);
return frame->Prev;
}
extern void __wine_enter_vm86( CONTEXT *context );
#ifndef USE_COMPILER_EXCEPTIONS
/* wrapper for RtlUnwind since it clobbers registers on Windows */
static inline void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record )
{
#if defined(__GNUC__) && defined(__i386__)
int dummy1, dummy2, dummy3;
__asm__ __volatile__("pushl %%ebp\n\t"
"pushl %%ebx\n\t"
"pushl $0\n\t"
"pushl %2\n\t"
"pushl $0\n\t"
"pushl %1\n\t"
"call *%0\n\t"
"popl %%ebx\n\t"
"popl %%ebp"
: "=a" (dummy1), "=S" (dummy2), "=D" (dummy3)
: "0" (RtlUnwind), "1" (frame), "2" (record)
: "ecx", "edx", "memory" );
#else
RtlUnwind( frame, 0, record, 0 );
#endif
}
static inline void DECLSPEC_NORETURN __wine_unwind_frame( EXCEPTION_RECORD *record,
EXCEPTION_REGISTRATION_RECORD *frame )
{
__WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
/* hack to make GetExceptionCode() work in handler */
wine_frame->ExceptionCode = record->ExceptionCode;
wine_frame->ExceptionRecord = wine_frame;
__wine_rtl_unwind( frame, record );
__wine_pop_frame( frame );
siglongjmp( wine_frame->jmp, 1 );
}
static inline EXCEPTION_DISPOSITION
__wine_exception_handler( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
__WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
EXCEPTION_POINTERS ptrs;
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
ptrs.ExceptionRecord = record;
ptrs.ContextRecord = context;
switch(wine_frame->u.filter( &ptrs ))
{
case EXCEPTION_CONTINUE_SEARCH:
return ExceptionContinueSearch;
case EXCEPTION_CONTINUE_EXECUTION:
return ExceptionContinueExecution;
case EXCEPTION_EXECUTE_HANDLER:
break;
}
__wine_unwind_frame( record, frame );
}
static inline EXCEPTION_DISPOSITION
__wine_exception_handler_page_fault( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
if (record->ExceptionCode != STATUS_ACCESS_VIOLATION)
return ExceptionContinueSearch;
__wine_unwind_frame( record, frame );
}
static inline EXCEPTION_DISPOSITION
__wine_exception_handler_all( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
__wine_unwind_frame( record, frame );
}
static inline EXCEPTION_DISPOSITION
__wine_finally_handler( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
{
__WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
wine_frame->u.finally_func( FALSE );
}
return ExceptionContinueSearch;
}
#endif /* USE_COMPILER_EXCEPTIONS */
#ifdef __cplusplus
}
#endif
#endif /* __WINE_WINE_EXCEPTION_H */
#endif
+2
View File
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="wine" type="staticlibrary">
<include base="ReactOS">include/reactos/wine</include>
<define name="_DISABLE_TIDENTS" />
<define name="__WINESRC__" />
<file>config.c</file>
<file>debug_ros.c</file>
<file>string.c</file>
+1 -1
View File
@@ -227,7 +227,7 @@
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
//#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
+2
View File
@@ -163,6 +163,8 @@ extern char **_imp___wcmdln;
PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva);
BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget);
extern int __globallocalestatus;
#ifdef __cplusplus
}
#endif
+47 -28
View File
@@ -22,6 +22,7 @@ typedef struct _LAN_WQ_ITEM {
KSPIN_LOCK LoopWorkLock;
LIST_ENTRY LoopWorkList;
WORK_QUEUE_ITEM LoopWorkItem;
BOOLEAN LoopReceiveWorkerBusy = FALSE;
VOID NTAPI LoopReceiveWorker( PVOID Context ) {
PLIST_ENTRY ListEntry;
@@ -34,43 +35,46 @@ VOID NTAPI LoopReceiveWorker( PVOID Context ) {
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
ListEntry = ExInterlockedRemoveHeadList( &LoopWorkList, &LoopWorkLock );
WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
while( (ListEntry =
ExInterlockedRemoveHeadList( &LoopWorkList, &LoopWorkLock )) ) {
WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
TI_DbgPrint(DEBUG_DATALINK, ("WorkItem: %x\n", WorkItem));
TI_DbgPrint(DEBUG_DATALINK, ("WorkItem: %x\n", WorkItem));
Packet = WorkItem->Packet;
Adapter = WorkItem->Adapter;
BytesTransferred = WorkItem->BytesTransferred;
Packet = WorkItem->Packet;
Adapter = WorkItem->Adapter;
BytesTransferred = WorkItem->BytesTransferred;
ExFreePool( WorkItem );
ExFreePool( WorkItem );
IPPacket.NdisPacket = Packet;
IPPacket.NdisPacket = Packet;
TI_DbgPrint(DEBUG_DATALINK, ("Packet %x Adapter %x Trans %x\n",
Packet, Adapter, BytesTransferred));
TI_DbgPrint(DEBUG_DATALINK, ("Packet %x Adapter %x Trans %x\n",
Packet, Adapter, BytesTransferred));
NdisGetFirstBufferFromPacket(Packet,
&NdisBuffer,
&IPPacket.Header,
&IPPacket.ContigSize,
&IPPacket.TotalSize);
NdisGetFirstBufferFromPacket(Packet,
&NdisBuffer,
&IPPacket.Header,
&IPPacket.ContigSize,
&IPPacket.TotalSize);
IPPacket.ContigSize = IPPacket.TotalSize = BytesTransferred;
/* Determine which upper layer protocol that should receive
this packet and pass it to the correct receive handler */
IPPacket.ContigSize = IPPacket.TotalSize = BytesTransferred;
/* Determine which upper layer protocol that should receive
this packet and pass it to the correct receive handler */
TI_DbgPrint(MID_TRACE,
("ContigSize: %d, TotalSize: %d, BytesTransferred: %d\n",
IPPacket.ContigSize, IPPacket.TotalSize,
BytesTransferred));
TI_DbgPrint(MID_TRACE,
("ContigSize: %d, TotalSize: %d, BytesTransferred: %d\n",
IPPacket.ContigSize, IPPacket.TotalSize,
BytesTransferred));
IPPacket.Position = 0;
IPPacket.Position = 0;
IPReceive(Loopback, &IPPacket);
IPReceive(Loopback, &IPPacket);
FreeNdisPacket( Packet );
FreeNdisPacket( Packet );
}
TI_DbgPrint(DEBUG_DATALINK, ("Leaving\n"));
LoopReceiveWorkerBusy = FALSE;
}
VOID LoopSubmitReceiveWork(
@@ -80,19 +84,34 @@ VOID LoopSubmitReceiveWork(
UINT BytesTransferred) {
PLAN_WQ_ITEM WQItem;
PLAN_ADAPTER Adapter = (PLAN_ADAPTER)BindingContext;
KIRQL OldIrql;
TcpipAcquireSpinLock( &LoopWorkLock, &OldIrql );
WQItem = ExAllocatePool( NonPagedPool, sizeof(LAN_WQ_ITEM) );
if( !WQItem ) return;
if( !WQItem ) {
TcpipReleaseSpinLock( &LoopWorkLock, OldIrql );
return;
}
WQItem->Packet = Packet;
WQItem->Adapter = Adapter;
WQItem->BytesTransferred = BytesTransferred;
ExInterlockedInsertTailList( &LoopWorkList, &WQItem->ListEntry, &LoopWorkLock );
InsertTailList( &LoopWorkList, &WQItem->ListEntry );
TI_DbgPrint(DEBUG_DATALINK, ("Packet %x Adapter %x BytesTrans %x\n",
Packet, Adapter, BytesTransferred));
ExQueueWorkItem( &LoopWorkItem, CriticalWorkQueue );
if( !LoopReceiveWorkerBusy ) {
LoopReceiveWorkerBusy = TRUE;
ExQueueWorkItem( &LoopWorkItem, CriticalWorkQueue );
TI_DbgPrint(DEBUG_DATALINK,
("Work item inserted %x %x\n", &LoopWorkItem, WQItem));
} else {
TI_DbgPrint(DEBUG_DATALINK,
("LOOP WORKER BUSY %x %x\n", &LoopWorkItem, WQItem));
}
TcpipReleaseSpinLock( &LoopWorkLock, OldIrql );
}
VOID LoopTransmit(
+7 -1
View File
@@ -216,7 +216,13 @@ NTSTATUS SendFragments(
return NDIS_STATUS_FAILURE;
}
return IPSendFragment(IFC->NdisPacket, NCE, IFC);
if (!NT_SUCCESS((NdisStatus = IPSendFragment(IFC->NdisPacket, NCE, IFC))))
{
FreeNdisPacket(IFC->NdisPacket);
ExFreePool(IFC);
}
return NdisStatus;
}
NTSTATUS IPSendDatagram(PIP_PACKET IPPacket, PNEIGHBOR_CACHE_ENTRY NCE,
@@ -230,7 +230,11 @@ NTSTATUS RawIPSendDatagram(
TI_DbgPrint(MID_TRACE,("About to send datagram\n"));
IPSendDatagram( &Packet, NCE, RawIpSendPacketComplete, NULL );
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, RawIpSendPacketComplete, NULL )))
{
FreeNdisPacket(Packet.NdisPacket);
return Status;
}
TI_DbgPrint(MID_TRACE,("Leaving\n"));
+5 -1
View File
@@ -102,7 +102,11 @@ int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len ) {
Packet.SrcAddr = LocalAddress;
Packet.DstAddr = RemoteAddress;
IPSendDatagram( &Packet, NCE, TCPPacketSendComplete, NULL );
if (!NT_SUCCESS(IPSendDatagram( &Packet, NCE, TCPPacketSendComplete, NULL )))
{
FreeNdisPacket(Packet.NdisPacket);
return OSK_EINVAL;
}
return 0;
}
+5 -5
View File
@@ -47,8 +47,6 @@ NTSTATUS AddUDPHeaderIPv4(
if (!NT_SUCCESS(Status))
return Status;
/* Build UDP header */
UDPHeader = (PUDP_HEADER)((ULONG_PTR)IPPacket->Data - sizeof(UDP_HEADER));
/* Port values are already big-endian values */
UDPHeader->SourcePort = LocalPort;
UDPHeader->DestPort = RemotePort;
@@ -57,8 +55,6 @@ NTSTATUS AddUDPHeaderIPv4(
/* Length of UDP header and data */
UDPHeader->Length = WH2N(DataLength + sizeof(UDP_HEADER));
IPPacket->Data = ((PCHAR)UDPHeader) + sizeof(UDP_HEADER);
TI_DbgPrint(MID_TRACE, ("Packet: %d ip %d udp %d payload\n",
(PCHAR)UDPHeader - (PCHAR)IPPacket->Header,
(PCHAR)IPPacket->Data - (PCHAR)UDPHeader,
@@ -204,7 +200,11 @@ NTSTATUS UDPSendDatagram(
return STATUS_UNSUCCESSFUL;
}
IPSendDatagram( &Packet, NCE, UDPSendPacketComplete, NULL );
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, UDPSendPacketComplete, NULL )))
{
FreeNdisPacket(Packet.NdisPacket);
return Status;
}
return STATUS_SUCCESS;
}
+18 -1
View File
@@ -38,7 +38,6 @@
#endif
extern _SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void);
extern void _SEH2GlobalUnwind(void *);
extern int __SEH2Except(void *, void *);
extern void __SEH2Finally(void *, void *);
@@ -50,6 +49,24 @@ extern void __cdecl __SEH2LeaveFrame(void);
extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
extern int __cdecl __SEH2NestedHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
FORCEINLINE
void _SEH2GlobalUnwind(void * target)
{
__asm__ __volatile__
(
"push %%ebp\n"
"push $0\n"
"push $0\n"
"push $Return%=\n"
"push %[target]\n"
"call %c[RtlUnwind]\n"
"Return%=: pop %%ebp\n" :
:
[target] "g" (target), [RtlUnwind] "g" (&RtlUnwind) :
"eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"
);
}
FORCEINLINE
int _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
{
+24 -24
View File
@@ -21,11 +21,14 @@
.text
.intel_syntax noprefix
.func _SEH2CurrentRegistration
.globl __SEH2CurrentRegistration
__SEH2CurrentRegistration:
mov eax, [fs:0]
ret
.endfunc
.func __SEH2EnterFrame
.globl ___SEH2EnterFrame
___SEH2EnterFrame:
mov eax, [esp+4]
@@ -33,24 +36,39 @@ ___SEH2EnterFrame:
mov [eax], ecx
mov [fs:0], eax
ret
.endfunc
.func __SEH2LeaveFrame
.globl ___SEH2LeaveFrame
___SEH2LeaveFrame:
mov eax, [fs:0]
mov eax, [eax]
mov [fs:0], eax
ret
.endfunc
.func __SEH2Handle
.globl ___SEH2Handle
___SEH2Handle:
mov eax, [esp+4]
mov ebp, [esp+8]
mov esp, [esp+12]
jmp eax
.endfunc
.func __SEH2Except
.globl ___SEH2Except
.globl ___SEH2Finally
___SEH2Except:
mov eax, [esp+4]
mov ecx, [esp+8]
call eax
ret
.endfunc
.func __SEH2Finally
.globl ___SEH2Finally
___SEH2Finally:
mov eax, [esp+4]
mov ecx, [esp+8]
@@ -58,30 +76,9 @@ ___SEH2Finally:
call eax
ret
.endfunc
.globl __SEH2GlobalUnwind
__SEH2GlobalUnwind:
.extern _RtlUnwind@16
push ebx
mov ebx, [esp+8]
push esi
push edi
push 0 // ReturnValue
push 0 // ExceptionRecord
push .RestoreRegisters // TargetIp
push ebx // TargetFrame
call _RtlUnwind@16
.RestoreRegisters:
pop edi
pop esi
pop ebx
ret
.func __SEH2FrameHandler
.globl ___SEH2FrameHandler
___SEH2FrameHandler:
@@ -89,7 +86,9 @@ ___SEH2FrameHandler:
cld
jmp __SEH2FrameHandler
.endfunc
.func __SEH2NestedHandler
.globl ___SEH2NestedHandler
___SEH2NestedHandler:
@@ -97,5 +96,6 @@ ___SEH2NestedHandler:
cld
jmp __SEH2NestedHandler
.endfunc
// EOF
+1 -1
View File
@@ -8,7 +8,7 @@
/*
* @implemented
*/
void _assert(const char *msg, const char *file, int line)
void _assert(const char *msg, const char *file, unsigned line)
{
/* Assertion failed at foo.c line 45: x<y */
fprintf(stderr, "Assertion failed at %s line %d: %s\n", file, line, msg);
+1
View File
@@ -18,6 +18,7 @@
#include <malloc.h>
#include <math.h>
#include <limits.h>
#include <io.h>
#include <sys/stat.h>
#include <sys/locking.h>
+5
View File
@@ -77,14 +77,19 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
StartupInfo.cb = sizeof(STARTUPINFO);
if (*md == 'r' ) {
StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
StartupInfo.hStdOutput = hWritePipe;
StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
}
else if ( *md == 'w' ) {
StartupInfo.hStdInput = hReadPipe;
StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
}
if (StartupInfo.dwFlags & STARTF_USESTDHANDLES)
StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
result = CreateProcess(szComSpec,
szCmdLine,
NULL,
+4 -4
View File
@@ -111,13 +111,13 @@ int CDECL _fstat64(int fd, struct __stat64* buf)
if (type == FILE_TYPE_PIPE)
{
buf->st_dev = buf->st_rdev = fd;
buf->st_mode = S_IFIFO;
buf->st_mode = _S_IFIFO;
buf->st_nlink = 1;
}
else if (type == FILE_TYPE_CHAR)
{
buf->st_dev = buf->st_rdev = fd;
buf->st_mode = S_IFCHR;
buf->st_mode = _S_IFCHR;
buf->st_nlink = 1;
}
else /* FILE_TYPE_DISK etc. */
@@ -128,9 +128,9 @@ int CDECL _fstat64(int fd, struct __stat64* buf)
__set_errno(ERROR_INVALID_PARAMETER);
return -1;
}
buf->st_mode = S_IFREG | S_IREAD;
buf->st_mode = _S_IFREG | _S_IREAD;
if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
buf->st_mode |= S_IWRITE;
buf->st_mode |= _S_IWRITE;
buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow;
RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw);
buf->st_atime = dw;
+3
View File
@@ -137,6 +137,9 @@ ExDereferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack,
{
/* Release rundown protection */
ExReleaseRundownProtection(&CallbackRoutineBlock->RundownProtect);
/* We're all done */
break;
}
}
}
+2 -2
View File
@@ -73,8 +73,8 @@ PspRunCreateProcessNotifyRoutines(IN PEPROCESS CurrentProcess,
/* Do the callback */
ExDoCallBack(&PspProcessNotifyRoutine[i],
CurrentProcess->InheritedFromUniqueProcessId,
(PVOID)(ULONG_PTR)Create,
NULL);
CurrentProcess->UniqueProcessId,
(PVOID)(ULONG_PTR)Create);
}
}
}
+6 -6
View File
@@ -428,7 +428,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Cleanup after exception */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
IopCleanupAfterException(FileObject, Irp, EventObject, NULL);
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
@@ -485,7 +485,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Cleanup after exception */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
IopCleanupAfterException(FileObject, Irp, EventObject, NULL);
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
@@ -2107,7 +2107,7 @@ NtReadFile(IN HANDLE FileHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Allocating failed, clean up */
IopCleanupAfterException(FileObject, Irp, NULL, Event);
IopCleanupAfterException(FileObject, Irp, EventObject, NULL);
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
@@ -2139,7 +2139,7 @@ NtReadFile(IN HANDLE FileHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Allocating failed, clean up */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
IopCleanupAfterException(FileObject, Irp, EventObject, NULL);
Status = _SEH2_GetExceptionCode();
_SEH2_YIELD(return Status);
}
@@ -2971,7 +2971,7 @@ NtWriteFile(IN HANDLE FileHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Allocating failed, clean up */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
IopCleanupAfterException(FileObject, Irp, EventObject, NULL);
Status = _SEH2_GetExceptionCode();
_SEH2_YIELD(return Status);
}
@@ -3000,7 +3000,7 @@ NtWriteFile(IN HANDLE FileHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Allocating failed, clean up */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
IopCleanupAfterException(FileObject, Irp, EventObject, NULL);
Status = _SEH2_GetExceptionCode();
_SEH2_YIELD(return Status);
}
+1 -1
View File
@@ -1185,7 +1185,7 @@ Module::GetDefaultModuleCRT () const
return "static";
case Win32DLL:
case Win32OCX:
return "msvcrt";
return "ntdll";
case NativeDLL:
case NativeCUI:
return "ntdll";
+7 -1
View File
@@ -823,7 +823,13 @@ size_t type_memsize(const type_t *t, unsigned int *align)
}
else if (is_ptr(t) || is_conformant_array(t))
{
size = sizeof(void *);
#if defined(TARGET_i386)
size = 4;
#elif defined(TARGET_amd64)
size = 8;
#else
#error Unsupported CPU
#endif
if (size > *align) *align = size;
}
else switch (t->type)