Lines 1-29
Link Here
|
1 |
--- src/3rdparty/chromium/third_party/zlib/arm_features.c.orig 2018-11-13 18:25:11 UTC |
1 |
--- src/3rdparty/chromium/third_party/zlib/arm_features.c.orig 2019-01-16 11:59:47 UTC |
2 |
+++ src/3rdparty/chromium/third_party/zlib/arm_features.c |
2 |
+++ src/3rdparty/chromium/third_party/zlib/arm_features.c |
3 |
@@ -16,12 +16,13 @@ |
3 |
@@ -10,20 +10,33 @@ |
|
|
4 |
#include <pthread.h> |
5 |
#include <stdint.h> |
6 |
|
7 |
-#if defined(ARMV8_OS_ANDROID) |
8 |
+int ZLIB_INTERNAL arm_cpu_enable_crc32 = 0; |
9 |
+int ZLIB_INTERNAL arm_cpu_enable_pmull = 0; |
10 |
+ |
11 |
+static pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; |
12 |
+ |
13 |
+#if defined (__FreeBSD__) |
14 |
+#include <machine/armreg.h> |
15 |
+#include <sys/types.h> |
16 |
+static void init_arm_features(void) |
17 |
+{ |
18 |
+#if defined (__aarch64__) |
19 |
+ uint64_t id_aa64isar0; |
20 |
+ |
21 |
+ id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); |
22 |
+ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) |
23 |
+ arm_cpu_enable_pmull = 1; |
24 |
+ if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) |
25 |
+ arm_cpu_enable_crc32 = 1; |
26 |
+#endif |
27 |
+} |
28 |
+#elif defined(ARMV8_OS_ANDROID) |
29 |
#include <cpu-features.h> |
30 |
#elif defined(ARMV8_OS_LINUX) |
4 |
#include <asm/hwcap.h> |
31 |
#include <asm/hwcap.h> |
5 |
#include <sys/auxv.h> |
32 |
#include <sys/auxv.h> |
6 |
#else |
33 |
-#else |
7 |
-#error ### No ARM CPU features detection in your platform/OS |
34 |
-#error ### No ARM CPU features detection in your platform/OS |
8 |
+/* #error ### No ARM CPU features detection in your platform/OS */ |
35 |
-#endif |
9 |
#endif |
|
|
10 |
|
11 |
int ZLIB_INTERNAL arm_cpu_enable_crc32 = 0; |
12 |
int ZLIB_INTERNAL arm_cpu_enable_pmull = 0; |
13 |
|
36 |
|
14 |
+#ifdef ARMV8_OS_LINUX |
37 |
-int ZLIB_INTERNAL arm_cpu_enable_crc32 = 0; |
15 |
static pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; |
38 |
-int ZLIB_INTERNAL arm_cpu_enable_pmull = 0; |
16 |
|
39 |
|
|
|
40 |
-static pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT; |
41 |
- |
17 |
static void init_arm_features(void) |
42 |
static void init_arm_features(void) |
18 |
@@ -53,8 +54,11 @@ static void init_arm_features(void) |
43 |
{ |
|
|
44 |
uint64_t flag_crc32 = 0, flag_pmull = 0, capabilities = 0; |
45 |
@@ -53,6 +66,9 @@ static void init_arm_features(void) |
19 |
if (capabilities & flag_pmull) |
46 |
if (capabilities & flag_pmull) |
20 |
arm_cpu_enable_pmull = 1; |
47 |
arm_cpu_enable_pmull = 1; |
21 |
} |
48 |
} |
|
|
49 |
+#else |
50 |
+#error ### No ARM CPU features detection in your platform/OS |
22 |
+#endif |
51 |
+#endif |
23 |
|
52 |
|
24 |
void ZLIB_INTERNAL arm_check_features(void) |
53 |
void ZLIB_INTERNAL arm_check_features(void) |
25 |
{ |
54 |
{ |
26 |
+#ifdef ARMV8_OS_LINUX |
|
|
27 |
pthread_once(&cpu_check_inited_once, init_arm_features); |
28 |
+#endif |
29 |
} |