View | Details | Raw Unified | Return to bug 236855 | Differences between
and this patch

Collapse All | Expand All

(-)src/3rdparty/chromium/third_party/zlib/arm_features.c (-8 / +24 lines)
Lines 10-29 Link Here
10
#include <pthread.h>
10
#include <pthread.h>
11
#include <stdint.h>
11
#include <stdint.h>
12
12
13
#if defined(ARMV8_OS_ANDROID)
13
int ZLIB_INTERNAL arm_cpu_enable_crc32 = 0;
14
int ZLIB_INTERNAL arm_cpu_enable_pmull = 0;
15
16
static pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT;
17
18
#if defined (__FreeBSD__)
19
#include <machine/armreg.h>
20
#include <sys/types.h>
21
static void init_arm_features(void)
22
{
23
#if defined (__aarch64__)
24
    uint64_t id_aa64isar0;
25
26
    id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
27
    if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL)
28
        arm_cpu_enable_pmull = 1;
29
    if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE)
30
        arm_cpu_enable_crc32 = 1;
31
#endif
32
}
33
#elif defined(ARMV8_OS_ANDROID)
14
#include <cpu-features.h>
34
#include <cpu-features.h>
15
#elif defined(ARMV8_OS_LINUX)
35
#elif defined(ARMV8_OS_LINUX)
16
#include <asm/hwcap.h>
36
#include <asm/hwcap.h>
17
#include <sys/auxv.h>
37
#include <sys/auxv.h>
18
#else
19
#error ### No ARM CPU features detection in your platform/OS
20
#endif
21
38
22
int ZLIB_INTERNAL arm_cpu_enable_crc32 = 0;
23
int ZLIB_INTERNAL arm_cpu_enable_pmull = 0;
24
39
25
static pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT;
26
27
static void init_arm_features(void)
40
static void init_arm_features(void)
28
{
41
{
29
    uint64_t flag_crc32 = 0, flag_pmull = 0, capabilities = 0;
42
    uint64_t flag_crc32 = 0, flag_pmull = 0, capabilities = 0;
Lines 53-58 static void init_arm_features(void) Link Here
53
    if (capabilities & flag_pmull)
66
    if (capabilities & flag_pmull)
54
        arm_cpu_enable_pmull = 1;
67
        arm_cpu_enable_pmull = 1;
55
}
68
}
69
#else
70
#error ### No ARM CPU features detection in your platform/OS
71
#endif
56
72
57
void ZLIB_INTERNAL arm_check_features(void)
73
void ZLIB_INTERNAL arm_check_features(void)
58
{
74
{

Return to bug 236855