ntdll: Move RtlIsProcessorFeaturePresent implementation to the CPU backends.

This commit is contained in:
Alexandre Julliard 2024-06-21 11:16:57 +02:00
parent 7f53949a49
commit 0051e102cc
6 changed files with 68 additions and 35 deletions

View file

@ -34,7 +34,6 @@
#include "wine/exception.h"
#include "ntdll_misc.h"
#include "in6addr.h"
#include "ddk/ntddk.h"
#include "ddk/ntifs.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
@ -1421,40 +1420,6 @@ void WINAPI RtlGetCurrentProcessorNumberEx(PROCESSOR_NUMBER *processor)
processor->Reserved = 0;
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
#ifdef __aarch64__
static const ULONGLONG arm64_features =
(1ull << PF_COMPARE_EXCHANGE_DOUBLE) |
(1ull << PF_NX_ENABLED) |
(1ull << PF_ARM_VFP_32_REGISTERS_AVAILABLE) |
(1ull << PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_SECOND_LEVEL_ADDRESS_TRANSLATION) |
(1ull << PF_FASTFAIL_AVAILABLE) |
(1ull << PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE) |
(1ull << PF_ARM_64BIT_LOADSTORE_ATOMIC) |
(1ull << PF_ARM_EXTERNAL_CACHE_AVAILABLE) |
(1ull << PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE);
return (feature < PROCESSOR_FEATURE_MAX && (arm64_features & (1ull << feature)) &&
user_shared_data->ProcessorFeatures[feature]);
#elif defined _WIN64
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
#else
return NtWow64IsProcessorFeaturePresent( feature );
#endif
}
/***********************************************************************
* RtlInitializeGenericTableAvl (NTDLL.@)
*/

View file

@ -566,6 +566,15 @@ NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return NtWow64IsProcessorFeaturePresent( feature );
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View file

@ -31,6 +31,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h"
#include "ntdll_misc.h"
#include "wine/debug.h"
@ -600,6 +601,35 @@ NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
static const ULONGLONG arm64_features =
(1ull << PF_COMPARE_EXCHANGE_DOUBLE) |
(1ull << PF_NX_ENABLED) |
(1ull << PF_ARM_VFP_32_REGISTERS_AVAILABLE) |
(1ull << PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_SECOND_LEVEL_ADDRESS_TRANSLATION) |
(1ull << PF_FASTFAIL_AVAILABLE) |
(1ull << PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE) |
(1ull << PF_ARM_64BIT_LOADSTORE_ATOMIC) |
(1ull << PF_ARM_EXTERNAL_CACHE_AVAILABLE) |
(1ull << PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) |
(1ull << PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE);
return (feature < PROCESSOR_FEATURE_MAX && (arm64_features & (1ull << feature)) &&
user_shared_data->ProcessorFeatures[feature]);
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View file

@ -28,6 +28,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h"
#include "wine/list.h"
#include "ntdll_misc.h"
@ -1204,6 +1205,15 @@ NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View file

@ -461,6 +461,15 @@ NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return NtWow64IsProcessorFeaturePresent( feature );
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/

View file

@ -32,6 +32,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h"
#include "wine/list.h"
#include "ntdll_misc.h"
@ -802,6 +803,15 @@ NTSTATUS WINAPI RtlGetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class,
}
/***********************************************************************
* RtlIsProcessorFeaturePresent [NTDLL.@]
*/
BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature )
{
return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature];
}
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/