1 |
commit: a9a34f14be36d79fe974d3481470458e0caa128f |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 26 09:27:39 2020 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 26 10:27:39 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=a9a34f14 |
7 |
|
8 |
dev-qt/qtwebengine: bump to 5.13.2 |
9 |
|
10 |
patches from the void |
11 |
with arm64 and ppc64 support |
12 |
|
13 |
Package-Manager: Portage-2.3.89, Repoman-2.3.20 |
14 |
RepoMan-Options: --force |
15 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
16 |
|
17 |
dev-qt/qtwebengine/Manifest | 2 +- |
18 |
...fpstate-instead-of-_libc_fpstate-on-linux.patch | 42 + |
19 |
...-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch | 26 + |
20 |
...musl.patch => 0004-musl-dispatch-to-musl.patch} | 2 +- |
21 |
...-mallinfo.patch => 0008-musl-no-mallinfo.patch} | 11 +- |
22 |
.../{qt-musl-off_t.patch => 0009-musl-off_t.patch} | 0 |
23 |
...d-pwrite.patch => 0010-musl-pread-pwrite.patch} | 8 +- |
24 |
...alloc.patch => 0011-musl-replace-pvalloc.patch} | 0 |
25 |
.../qtwebengine/files/musl/0012-musl-resolve.patch | 26 + |
26 |
...l-siginfo_t.patch => 0015-musl-siginfo_t.patch} | 0 |
27 |
...stackstart.patch => 0017-musl-stackstart.patch} | 10 +- |
28 |
.../qtwebengine/files/musl/0020-musl-sandbox.patch | 71 + |
29 |
.../0025-musl-chromium-default-stacksize.patch | 15 + |
30 |
.../qtwebengine/files/musl/0026-data_pack-be.patch | 15 + |
31 |
.../files/musl/0027-remove-glibc-check.patch | 13 + |
32 |
.../musl/0032-musl-cross-no-asm_ptrace_h.patch | 30 + |
33 |
dev-qt/qtwebengine/files/musl/0040-yasm-nls.patch | 13 + |
34 |
.../files/musl/0042-arm-void-is-not-android.patch | 21 + |
35 |
...-execinfo.patch => 0044-qt-musl-execinfo.patch} | 67 +- |
36 |
...e.patch => 0045-qt-musl-thread-stacksize.patch} | 8 +- |
37 |
.../files/musl/0046-sandbox-membarrier.patch | 60 + |
38 |
.../files/musl/0047-gn-cross-sysroot.patch | 24 + |
39 |
.../files/musl/0089-webengine-ppc64.patch | 20 + |
40 |
.../files/musl/0090-chromium-ppc64le.patch | 4267 ++++++++++++++++++++ |
41 |
.../files/musl/0091-chromium-ppc64-musl.patch | 141 + |
42 |
.../files/musl/0092-chromium-ppc64-be.patch | 2955 ++++++++++++++ |
43 |
.../files/musl/0093-chromium-v8-elfv2.patch | 43 + |
44 |
.../files/musl/0094-big-endian-skia-portable.patch | 17 + |
45 |
.../files/musl/0100-sandbox-sched_getparam.patch | 24 + |
46 |
dev-qt/qtwebengine/files/musl/musl-crashpad.patch | 23 + |
47 |
dev-qt/qtwebengine/files/musl/musl-sandbox.patch | 153 - |
48 |
dev-qt/qtwebengine/files/musl/musl-sync.patch | 30 + |
49 |
.../qtwebengine/files/musl/qt-musl-fpstate.patch | 48 - |
50 |
.../qtwebengine/files/musl/qt-musl-resolve.patch | 61 - |
51 |
.../qtwebengine/files/musl/qt-musl-serialio.patch | 12 - |
52 |
.../files/musl/qt-musl-sysreg-for__WORDSIZE.patch | 14 - |
53 |
dev-qt/qtwebengine/files/musl/resolv_compat.h | 29 + |
54 |
.../qtwebengine-5.11.2-paxmark-mksnapshot.patch | 41 - |
55 |
.../qtwebengine-5.12.0-nouveau-disable-gpu.patch | 98 - |
56 |
.../files/qtwebengine-5.12.5-icu-65.patch | 33 + |
57 |
.../files/qtwebengine-5.12.5-pulseaudio-13.patch | 88 - |
58 |
dev-qt/qtwebengine/metadata.xml | 1 - |
59 |
...ine-5.12.5.ebuild => qtwebengine-5.13.2.ebuild} | 29 +- |
60 |
43 files changed, 8008 insertions(+), 583 deletions(-) |
61 |
|
62 |
diff --git a/dev-qt/qtwebengine/Manifest b/dev-qt/qtwebengine/Manifest |
63 |
index 9aaf2c3..d0d6e0f 100644 |
64 |
--- a/dev-qt/qtwebengine/Manifest |
65 |
+++ b/dev-qt/qtwebengine/Manifest |
66 |
@@ -1 +1 @@ |
67 |
-DIST qtwebengine-everywhere-src-5.12.5.tar.xz 249295448 BLAKE2B 3bbb9ea44ed58127a251b0dc5bd2681b9efbe4709b0c493940c85cedcbf668fe58ae2440c4afbb1e579cd69e504aa7efedd44519823ffed40444d8b3382362e8 SHA512 b485d37dca14f1cf4adf01bd8b1ae52c1d4916d7acf6ed210bc9feaece8efc2aa6cee8a3ef9174b50b767e373379c6a18d14db4426ac53a8c27d2d7b222826df |
68 |
+DIST qtwebengine-everywhere-src-5.13.2.tar.xz 255593964 BLAKE2B 458f718183aa53376e1aeeb6306b0b3960bd001aebf61e9650d30afd408af003183b7748a87aa0c6a1aa0b3a4be548b417609146b71dc6afa46db49c4b48919f SHA512 10ae5cca36230069ef117cae15b84e29124c43e4864dbfa7a1f99879764b871355281edcb1942e86ec3a4cac12bbfd2749577745c8c7e736eb6a9909876554d0 |
69 |
|
70 |
diff --git a/dev-qt/qtwebengine/files/musl/0002-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch b/dev-qt/qtwebengine/files/musl/0002-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch |
71 |
new file mode 100644 |
72 |
index 0000000..3e787d1 |
73 |
--- /dev/null |
74 |
+++ b/dev-qt/qtwebengine/files/musl/0002-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch |
75 |
@@ -0,0 +1,42 @@ |
76 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h 2018-06-15 09:47:20.000000000 +0200 |
77 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h 2018-09-07 22:21:28.521763716 +0200 |
78 |
+@@ -50,7 +50,7 @@ |
79 |
+ // info: the collection of register structures. |
80 |
+ #if defined(__i386__) || defined(__x86_64) |
81 |
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
82 |
+- const struct _libc_fpstate* fp); |
83 |
++ const struct _fpstate* fp); |
84 |
+ #elif defined(__aarch64__) |
85 |
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
86 |
+ const struct fpsimd_context* fpregs); |
87 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc 2018-06-15 09:47:20.000000000 +0200 |
88 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc 2018-09-07 22:21:45.766762688 +0200 |
89 |
+@@ -49,7 +49,7 @@ |
90 |
+ } |
91 |
+ |
92 |
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
93 |
+- const struct _libc_fpstate* fp) { |
94 |
++ const struct _fpstate* fp) { |
95 |
+ const greg_t* regs = uc->uc_mcontext.gregs; |
96 |
+ |
97 |
+ out->context_flags = MD_CONTEXT_X86_FULL | |
98 |
+@@ -97,7 +97,7 @@ |
99 |
+ } |
100 |
+ |
101 |
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
102 |
+- const struct _libc_fpstate* fpregs) { |
103 |
++ const struct _fpstate* fpregs) { |
104 |
+ const greg_t* regs = uc->uc_mcontext.gregs; |
105 |
+ |
106 |
+ out->context_flags = MD_CONTEXT_AMD64_FULL; |
107 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h 2018-06-15 09:47:20.000000000 +0200 |
108 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h 2018-09-07 23:36:32.049495285 +0200 |
109 |
+@@ -48,7 +48,7 @@ |
110 |
+ #if defined(__aarch64__) |
111 |
+ typedef struct fpsimd_context fpstate_t; |
112 |
+ #elif !defined(__ARM_EABI__) && !defined(__mips__) |
113 |
+-typedef struct _libc_fpstate fpstate_t; |
114 |
++typedef struct _fpstate fpstate_t; |
115 |
+ #endif |
116 |
+ |
117 |
+ // These entries store a list of memory regions that the client wants included |
118 |
|
119 |
diff --git a/dev-qt/qtwebengine/files/musl/0003-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch b/dev-qt/qtwebengine/files/musl/0003-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch |
120 |
new file mode 100644 |
121 |
index 0000000..da4160b |
122 |
--- /dev/null |
123 |
+++ b/dev-qt/qtwebengine/files/musl/0003-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch |
124 |
@@ -0,0 +1,26 @@ |
125 |
+From 9001c54d6b974449174a8cee8f3f5d78a9bd6c9e Mon Sep 17 00:00:00 2001 |
126 |
+From: Felix Janda <felix.janda@××××××.de> |
127 |
+Date: Sun, 1 Feb 2015 14:26:52 +0100 |
128 |
+Subject: [PATCH 3/6] include <sys/reg.h> to get __WORDSIZE on musl libc |
129 |
+ |
130 |
+--- |
131 |
+ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h | 1 + |
132 |
+ 1 file changed, 1 insertion(+) |
133 |
+ |
134 |
+diff --git a/src/common/linux/elf_core_dump.h b/src/common/linux/elf_core_dump.h |
135 |
+index d03c7a8..02eb391 100644 |
136 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h |
137 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h |
138 |
+@@ -36,6 +36,9 @@ |
139 |
+ #include <elf.h> |
140 |
+ #include <link.h> |
141 |
+ #include <stddef.h> |
142 |
++#ifndef __GLIBC__ |
143 |
++#include <sys/reg.h> |
144 |
++#endif |
145 |
+ |
146 |
+ #include "common/memory_range.h" |
147 |
+ |
148 |
+-- |
149 |
+2.0.5 |
150 |
+ |
151 |
|
152 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-dispatch_to_musl.patch b/dev-qt/qtwebengine/files/musl/0004-musl-dispatch-to-musl.patch |
153 |
similarity index 98% |
154 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-dispatch_to_musl.patch |
155 |
rename to dev-qt/qtwebengine/files/musl/0004-musl-dispatch-to-musl.patch |
156 |
index 1258d4f..de32a3d 100644 |
157 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-dispatch_to_musl.patch |
158 |
+++ b/dev-qt/qtwebengine/files/musl/0004-musl-dispatch-to-musl.patch |
159 |
@@ -1,5 +1,5 @@ |
160 |
--- qtwebengine/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
161 |
-+++ qtwebengine/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
162 |
+--- qtwebengine/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
163 |
@@ -6,6 +6,7 @@ |
164 |
|
165 |
#include <malloc.h> |
166 |
|
167 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-mallinfo.patch b/dev-qt/qtwebengine/files/musl/0008-musl-no-mallinfo.patch |
168 |
similarity index 83% |
169 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-mallinfo.patch |
170 |
rename to dev-qt/qtwebengine/files/musl/0008-musl-no-mallinfo.patch |
171 |
index 7b30717..c332b92 100644 |
172 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-mallinfo.patch |
173 |
+++ b/dev-qt/qtwebengine/files/musl/0008-musl-no-mallinfo.patch |
174 |
@@ -20,7 +20,7 @@ |
175 |
MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc"); |
176 |
--- qtwebengine/src/3rdparty/chromium/base/process/process_metrics_posix.cc 2017-11-28 14:06:53.000000000 +0100 |
177 |
+++ qtwebengine/src/3rdparty/chromium/base/process/process_metrics_posix.cc 2018-01-27 20:48:11.571040348 +0100 |
178 |
-@@ -94,7 +94,7 @@ |
179 |
+@@ -100,14 +100,14 @@ |
180 |
malloc_statistics_t stats = {0}; |
181 |
malloc_zone_statistics(nullptr, &stats); |
182 |
return stats.size_in_use; |
183 |
@@ -29,3 +29,12 @@ |
184 |
struct mallinfo minfo = mallinfo(); |
185 |
#if defined(USE_TCMALLOC) |
186 |
return minfo.uordblks; |
187 |
+ #else |
188 |
+ return minfo.hblkhd + minfo.arena; |
189 |
+ #endif |
190 |
+-#elif defined(OS_FUCHSIA) |
191 |
++#else //if defined(OS_FUCHSIA) // also musl doesn't do this. |
192 |
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. |
193 |
+ return 0; |
194 |
+ #endif |
195 |
+ |
196 |
|
197 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-off_t.patch b/dev-qt/qtwebengine/files/musl/0009-musl-off_t.patch |
198 |
similarity index 100% |
199 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-off_t.patch |
200 |
rename to dev-qt/qtwebengine/files/musl/0009-musl-off_t.patch |
201 |
|
202 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-pread-pwrite.patch b/dev-qt/qtwebengine/files/musl/0010-musl-pread-pwrite.patch |
203 |
similarity index 57% |
204 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-pread-pwrite.patch |
205 |
rename to dev-qt/qtwebengine/files/musl/0010-musl-pread-pwrite.patch |
206 |
index c5dcfd8..00017bb 100644 |
207 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-pread-pwrite.patch |
208 |
+++ b/dev-qt/qtwebengine/files/musl/0010-musl-pread-pwrite.patch |
209 |
@@ -1,8 +1,6 @@ |
210 |
-diff --git a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h |
211 |
-index 5d9c2e8..e81e7b4 100644 |
212 |
---- a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h |
213 |
-+++ b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h |
214 |
-@@ -1794,6 +1794,15 @@ struct kernel_statfs { |
215 |
+--- qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h 2018-09-07 21:25:26.639964100 +0200 |
216 |
++++ qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h 2018-09-07 21:25:11.611964995 +0200 |
217 |
+@@ -1794,6 +1794,15 @@ |
218 |
/* End of s390/s390x definitions */ |
219 |
#endif |
220 |
|
221 |
|
222 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-pvalloc.patch b/dev-qt/qtwebengine/files/musl/0011-musl-replace-pvalloc.patch |
223 |
similarity index 100% |
224 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-pvalloc.patch |
225 |
rename to dev-qt/qtwebengine/files/musl/0011-musl-replace-pvalloc.patch |
226 |
|
227 |
diff --git a/dev-qt/qtwebengine/files/musl/0012-musl-resolve.patch b/dev-qt/qtwebengine/files/musl/0012-musl-resolve.patch |
228 |
new file mode 100644 |
229 |
index 0000000..edfceb7 |
230 |
--- /dev/null |
231 |
+++ b/dev-qt/qtwebengine/files/musl/0012-musl-resolve.patch |
232 |
@@ -0,0 +1,26 @@ |
233 |
+--- qtwebengine/src/3rdparty/chromium/net/dns/dns_reloader.cc 2016-11-07 15:46:18.000000000 +0100 |
234 |
++++ qtwebengine/src/3rdparty/chromium/net/dns/dns_reloader.cc 2016-12-20 03:33:11.749059656 +0100 |
235 |
+@@ -9,6 +9,10 @@ |
236 |
+ |
237 |
+ #include <resolv.h> |
238 |
+ |
239 |
++#if !defined(__GLIBC__) |
240 |
++#include "resolv_compat.h" |
241 |
++#endif |
242 |
++ |
243 |
+ #include "base/lazy_instance.h" |
244 |
+ #include "base/logging.h" |
245 |
+ #include "base/macros.h" |
246 |
+--- qtwebengine/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc 2016-11-07 15:46:18.000000000 +0100 |
247 |
++++ qtwebengine/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc 2016-12-20 03:40:07.671953098 +0100 |
248 |
+@@ -6,6 +6,10 @@ |
249 |
+ |
250 |
+ #include <string> |
251 |
+ |
252 |
++#if !defined(__GLIBC__) |
253 |
++#include "resolv_compat.h" |
254 |
++#endif |
255 |
++ |
256 |
+ #include "base/bind.h" |
257 |
+ #include "base/files/file.h" |
258 |
+ #include "base/files/file_path.h" |
259 |
|
260 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-siginfo_t.patch b/dev-qt/qtwebengine/files/musl/0015-musl-siginfo_t.patch |
261 |
similarity index 100% |
262 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-siginfo_t.patch |
263 |
rename to dev-qt/qtwebengine/files/musl/0015-musl-siginfo_t.patch |
264 |
|
265 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-stackstart.patch b/dev-qt/qtwebengine/files/musl/0017-musl-stackstart.patch |
266 |
similarity index 58% |
267 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-stackstart.patch |
268 |
rename to dev-qt/qtwebengine/files/musl/0017-musl-stackstart.patch |
269 |
index 1286c74..57136bc 100644 |
270 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-stackstart.patch |
271 |
+++ b/dev-qt/qtwebengine/files/musl/0017-musl-stackstart.patch |
272 |
@@ -1,8 +1,6 @@ |
273 |
-diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc |
274 |
-index 10f1c0d..8e86a2e 100644 |
275 |
---- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc |
276 |
-+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc |
277 |
-@@ -28,7 +28,7 @@ size_t GetUnderestimatedStackSize() { |
278 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc 2018-01-27 23:08:43.586475349 +0100 |
279 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc 2018-01-27 23:18:22.274505203 +0100 |
280 |
+@@ -28,7 +28,7 @@ |
281 |
// FIXME: On Mac OSX and Linux, this method cannot estimate stack size |
282 |
// correctly for the main thread. |
283 |
|
284 |
@@ -11,7 +9,7 @@ index 10f1c0d..8e86a2e 100644 |
285 |
defined(OS_FUCHSIA) |
286 |
// pthread_getattr_np() can fail if the thread is not invoked by |
287 |
// pthread_create() (e.g., the main thread of webkit_unit_tests). |
288 |
-@@ -96,7 +96,7 @@ size_t GetUnderestimatedStackSize() { |
289 |
+@@ -96,7 +96,7 @@ |
290 |
} |
291 |
|
292 |
void* GetStackStart() { |
293 |
|
294 |
diff --git a/dev-qt/qtwebengine/files/musl/0020-musl-sandbox.patch b/dev-qt/qtwebengine/files/musl/0020-musl-sandbox.patch |
295 |
new file mode 100644 |
296 |
index 0000000..d3de1e4 |
297 |
--- /dev/null |
298 |
+++ b/dev-qt/qtwebengine/files/musl/0020-musl-sandbox.patch |
299 |
@@ -0,0 +1,71 @@ |
300 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2018-06-15 09:47:20.000000000 +0200 |
301 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2018-09-13 19:53:53.453780253 +0200 |
302 |
+@@ -129,7 +129,7 @@ |
303 |
+ // CLONE_VM, nor CLONE_THREAD, which includes all fork() implementations. |
304 |
+ ResultExpr RestrictCloneToThreadsAndEPERMFork() { |
305 |
+ const Arg<unsigned long> flags(0); |
306 |
+- |
307 |
++#if defined(__GLIBC__) |
308 |
+ // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. |
309 |
+ const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | |
310 |
+ CLONE_SIGHAND | CLONE_THREAD | |
311 |
+@@ -148,6 +148,17 @@ |
312 |
+ return If(IsAndroid() ? android_test : glibc_test, Allow()) |
313 |
+ .ElseIf((flags & (CLONE_VM | CLONE_THREAD)) == 0, Error(EPERM)) |
314 |
+ .Else(CrashSIGSYSClone()); |
315 |
++#else |
316 |
++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | |
317 |
++ CLONE_THREAD | CLONE_SYSVSEM; |
318 |
++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | |
319 |
++ CLONE_DETACHED; |
320 |
++ const BoolExpr thread_clone_ok = (flags&~safe)==required; |
321 |
++ |
322 |
++ return If(thread_clone_ok, Allow()) |
323 |
++ .ElseIf((flags & (CLONE_VM | CLONE_THREAD)) == 0, Error(EPERM)) |
324 |
++ .Else(CrashSIGSYSClone()); |
325 |
++#endif |
326 |
+ } |
327 |
+ |
328 |
+ ResultExpr RestrictPrctl() { |
329 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc 2018-06-15 09:47:20.000000000 +0200 |
330 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc 2018-09-13 19:56:31.779773940 +0200 |
331 |
+@@ -375,6 +375,9 @@ |
332 |
+ #if defined(__i386__) |
333 |
+ case __NR_waitpid: |
334 |
+ #endif |
335 |
++#if !defined(__GLIBC__) |
336 |
++ case __NR_set_tid_address: |
337 |
++#endif |
338 |
+ return true; |
339 |
+ case __NR_clone: // Should be parameter-restricted. |
340 |
+ case __NR_setns: // Privileged. |
341 |
+@@ -387,7 +390,9 @@ |
342 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
343 |
+ case __NR_set_thread_area: |
344 |
+ #endif |
345 |
++#if defined(__GLIBC__) |
346 |
+ case __NR_set_tid_address: |
347 |
++#endif |
348 |
+ case __NR_unshare: |
349 |
+ #if !defined(__mips__) && !defined(__aarch64__) |
350 |
+ case __NR_vfork: |
351 |
+@@ -496,6 +501,9 @@ |
352 |
+ case __NR_mlock: |
353 |
+ case __NR_munlock: |
354 |
+ case __NR_munmap: |
355 |
++#if !defined(__GLIBC__) |
356 |
++ case __NR_mremap: |
357 |
++#endif |
358 |
+ return true; |
359 |
+ case __NR_madvise: |
360 |
+ case __NR_mincore: |
361 |
+@@ -511,7 +519,9 @@ |
362 |
+ case __NR_modify_ldt: |
363 |
+ #endif |
364 |
+ case __NR_mprotect: |
365 |
++#if defined(__GLIBC__) |
366 |
+ case __NR_mremap: |
367 |
++#endif |
368 |
+ case __NR_msync: |
369 |
+ case __NR_munlockall: |
370 |
+ case __NR_readahead: |
371 |
|
372 |
diff --git a/dev-qt/qtwebengine/files/musl/0025-musl-chromium-default-stacksize.patch b/dev-qt/qtwebengine/files/musl/0025-musl-chromium-default-stacksize.patch |
373 |
new file mode 100644 |
374 |
index 0000000..7bf5a22 |
375 |
--- /dev/null |
376 |
+++ b/dev-qt/qtwebengine/files/musl/0025-musl-chromium-default-stacksize.patch |
377 |
@@ -0,0 +1,15 @@ |
378 |
+--- qtwebengine/src/3rdparty/chromium/base/threading/platform_thread_linux.cc.orig 2018-09-19 18:05:15.523923703 +0200 |
379 |
++++ qtwebengine/src/3rdparty/chromium/base/threading/platform_thread_linux.cc 2018-09-19 18:08:05.150932454 +0200 |
380 |
+@@ -173,7 +173,12 @@ |
381 |
+ |
382 |
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { |
383 |
+ #if !defined(THREAD_SANITIZER) |
384 |
++#if defined(__GLIBC__) |
385 |
+ return 0; |
386 |
++#else // defined(__GLIBC__) |
387 |
++ // For Musl libc try with a default stack size of 2 MiB |
388 |
++ return 2 * 1024 * 1024; |
389 |
++#endif // !defined(__GLIBC__) |
390 |
+ #else |
391 |
+ // ThreadSanitizer bloats the stack heavily. Evidence has been that the |
392 |
+ // default stack size isn't enough for some browser tests. |
393 |
|
394 |
diff --git a/dev-qt/qtwebengine/files/musl/0026-data_pack-be.patch b/dev-qt/qtwebengine/files/musl/0026-data_pack-be.patch |
395 |
new file mode 100644 |
396 |
index 0000000..c113ddb |
397 |
--- /dev/null |
398 |
+++ b/dev-qt/qtwebengine/files/musl/0026-data_pack-be.patch |
399 |
@@ -0,0 +1,15 @@ |
400 |
+--- qtwebengine/src/3rdparty/chromium/ui/base/resource/data_pack.cc.orig 2018-09-11 14:16:53.104897379 +0200 |
401 |
++++ qtwebengine/src/3rdparty/chromium/ui/base/resource/data_pack.cc 2018-09-11 14:17:12.009896253 +0200 |
402 |
+@@ -383,12 +383,6 @@ |
403 |
+ |
404 |
+ bool DataPack::GetStringPiece(uint16_t resource_id, |
405 |
+ base::StringPiece* data) const { |
406 |
+- // It won't be hard to make this endian-agnostic, but it's not worth |
407 |
+- // bothering to do right now. |
408 |
+-#if !defined(ARCH_CPU_LITTLE_ENDIAN) |
409 |
+-#error "datapack assumes little endian" |
410 |
+-#endif |
411 |
+- |
412 |
+ const Entry* target = LookupEntryById(resource_id); |
413 |
+ if (!target) |
414 |
+ return false; |
415 |
|
416 |
diff --git a/dev-qt/qtwebengine/files/musl/0027-remove-glibc-check.patch b/dev-qt/qtwebengine/files/musl/0027-remove-glibc-check.patch |
417 |
new file mode 100644 |
418 |
index 0000000..fd0ab84 |
419 |
--- /dev/null |
420 |
+++ b/dev-qt/qtwebengine/files/musl/0027-remove-glibc-check.patch |
421 |
@@ -0,0 +1,13 @@ |
422 |
+--- qtwebengine/config.tests/glibc/glibc.cpp |
423 |
++++ qtwebengine/config.tests/glibc/glibc.cpp |
424 |
+@@ -28,10 +28,6 @@ |
425 |
+ |
426 |
+ #include <features.h> |
427 |
+ |
428 |
+-#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 17 |
429 |
+-#error glibc versions below 2.17 are not supported |
430 |
+-#endif |
431 |
+- |
432 |
+ int main(int , char **) { |
433 |
+ return 0; |
434 |
+ } |
435 |
|
436 |
diff --git a/dev-qt/qtwebengine/files/musl/0032-musl-cross-no-asm_ptrace_h.patch b/dev-qt/qtwebengine/files/musl/0032-musl-cross-no-asm_ptrace_h.patch |
437 |
new file mode 100644 |
438 |
index 0000000..140742f |
439 |
--- /dev/null |
440 |
+++ b/dev-qt/qtwebengine/files/musl/0032-musl-cross-no-asm_ptrace_h.patch |
441 |
@@ -0,0 +1,30 @@ |
442 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc 2018-08-27 10:21:31.000000000 +0200 |
443 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc 2018-11-22 00:41:58.522477559 +0100 |
444 |
+@@ -38,7 +38,12 @@ |
445 |
+ |
446 |
+ #include "client/linux/minidump_writer/linux_ptrace_dumper.h" |
447 |
+ |
448 |
++#if defined(__GLIBC__) |
449 |
+ #include <asm/ptrace.h> |
450 |
++#else |
451 |
++/* For arm*-musl this definition is missing */ |
452 |
++#define ARM_sp uregs[13] |
453 |
++#endif |
454 |
+ #include <assert.h> |
455 |
+ #include <errno.h> |
456 |
+ #include <fcntl.h> |
457 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc 2018-08-27 10:21:31.000000000 +0200 |
458 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc 2018-11-22 00:49:39.533492245 +0100 |
459 |
+@@ -32,7 +32,12 @@ |
460 |
+ |
461 |
+ #include "client/linux/minidump_writer/linux_core_dumper.h" |
462 |
+ |
463 |
++#if defined(__GLIBC__) |
464 |
+ #include <asm/ptrace.h> |
465 |
++#else |
466 |
++/* For arm*-musl this definition is missing */ |
467 |
++#define ARM_sp uregs[13] |
468 |
++#endif |
469 |
+ #include <assert.h> |
470 |
+ #include <elf.h> |
471 |
+ #include <stdio.h> |
472 |
|
473 |
diff --git a/dev-qt/qtwebengine/files/musl/0040-yasm-nls.patch b/dev-qt/qtwebengine/files/musl/0040-yasm-nls.patch |
474 |
new file mode 100644 |
475 |
index 0000000..22ac042 |
476 |
--- /dev/null |
477 |
+++ b/dev-qt/qtwebengine/files/musl/0040-yasm-nls.patch |
478 |
@@ -0,0 +1,13 @@ |
479 |
+diff --git src/3rdparty/chromium/third_party/yasm/source/config/linux/config.h src/3rdparty/chromium/third_party/yasm/source/config/linux/config.h |
480 |
+index 9e36539..f588083 100644 |
481 |
+--- qtwebengine/src/3rdparty/chromium//third_party/yasm/source/config/linux/config.h |
482 |
+--- qtwebengine/src/3rdparty/chromium//third_party/yasm/source/config/linux/config.h |
483 |
+@@ -5,7 +5,7 @@ |
484 |
+ #define CPP_PROG "gcc -E" |
485 |
+ |
486 |
+ /* */ |
487 |
+-#define ENABLE_NLS 1 |
488 |
++/* #undef ENABLE_NLS 1 */ |
489 |
+ |
490 |
+ /* Define to 1 if you have the `abort' function. */ |
491 |
+ #define HAVE_ABORT 1 |
492 |
|
493 |
diff --git a/dev-qt/qtwebengine/files/musl/0042-arm-void-is-not-android.patch b/dev-qt/qtwebengine/files/musl/0042-arm-void-is-not-android.patch |
494 |
new file mode 100644 |
495 |
index 0000000..b13290d |
496 |
--- /dev/null |
497 |
+++ b/dev-qt/qtwebengine/files/musl/0042-arm-void-is-not-android.patch |
498 |
@@ -0,0 +1,21 @@ |
499 |
+--- qtwebengine/src/3rdparty/chromium//third_party/openmax_dl/dl/BUILD.gn 2019-04-09 09:31:16.000000000 +0200 |
500 |
++++ - 2019-05-06 23:08:09.537346546 +0200 |
501 |
+@@ -206,18 +206,6 @@ |
502 |
+ "sp/src/arm/armv7/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S", |
503 |
+ "sp/src/arm/armv7/omxSP_FFTInv_CCSToR_F32_Sfs_s.S", |
504 |
+ ] |
505 |
+- if (arm_optionally_use_neon) { |
506 |
+- # Run-time NEON detection. |
507 |
+- deps = [ |
508 |
+- "//third_party/android_tools:cpu_features", |
509 |
+- ] |
510 |
+- |
511 |
+- # To get the __android_log_print routine |
512 |
+- libs = [ "log" ] |
513 |
+- |
514 |
+- # Detection routine |
515 |
+- sources += [ "sp/src/arm/detect.c" ] |
516 |
+- } |
517 |
+ } |
518 |
+ |
519 |
+ # NEON implementation of FFT. This library is NOT |
520 |
|
521 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-execinfo.patch b/dev-qt/qtwebengine/files/musl/0044-qt-musl-execinfo.patch |
522 |
similarity index 66% |
523 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-execinfo.patch |
524 |
rename to dev-qt/qtwebengine/files/musl/0044-qt-musl-execinfo.patch |
525 |
index c5e0850..98f3a38 100644 |
526 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-execinfo.patch |
527 |
+++ b/dev-qt/qtwebengine/files/musl/0044-qt-musl-execinfo.patch |
528 |
@@ -1,6 +1,6 @@ |
529 |
---- qtwebengine/src/3rdparty/chromium/base/debug/stack_trace_posix.cc 2017-11-28 14:06:53.000000000 +0100 |
530 |
-+++ qtwebengine/src/3rdparty/chromium/base/debug/stack_trace_posix.cc 2018-01-27 21:50:04.693231905 +0100 |
531 |
-@@ -26,7 +26,7 @@ |
532 |
+--- qtwebengine/src/3rdparty/chromium//base/debug/stack_trace_posix.cc.orig 2019-04-09 09:31:16.000000000 +0200 |
533 |
++++ qtwebengine/src/3rdparty/chromium//base/debug/stack_trace_posix.cc 2019-05-06 23:16:13.245502467 +0200 |
534 |
+@@ -27,7 +27,7 @@ |
535 |
#if !defined(USE_SYMBOLIZE) |
536 |
#include <cxxabi.h> |
537 |
#endif |
538 |
@@ -9,7 +9,7 @@ |
539 |
#include <execinfo.h> |
540 |
#endif |
541 |
|
542 |
-@@ -82,7 +82,7 @@ |
543 |
+@@ -86,7 +86,7 @@ |
544 |
// Note: code in this function is NOT async-signal safe (std::string uses |
545 |
// malloc internally). |
546 |
|
547 |
@@ -18,7 +18,7 @@ |
548 |
std::string::size_type search_from = 0; |
549 |
while (search_from < text->size()) { |
550 |
// Look for the start of a mangled symbol, from search_from. |
551 |
-@@ -117,7 +117,7 @@ |
552 |
+@@ -121,7 +121,7 @@ |
553 |
search_from = mangled_start + 2; |
554 |
} |
555 |
} |
556 |
@@ -27,8 +27,8 @@ |
557 |
} |
558 |
#endif // !defined(USE_SYMBOLIZE) |
559 |
|
560 |
-@@ -129,7 +129,7 @@ |
561 |
- virtual ~BacktraceOutputHandler() {} |
562 |
+@@ -133,7 +133,7 @@ |
563 |
+ virtual ~BacktraceOutputHandler() = default; |
564 |
}; |
565 |
|
566 |
-#if !defined(__UCLIBC__) && !defined(_AIX) |
567 |
@@ -36,7 +36,7 @@ |
568 |
void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { |
569 |
// This should be more than enough to store a 64-bit number in hex: |
570 |
// 16 hex digits + 1 for null-terminator. |
571 |
-@@ -206,7 +206,7 @@ |
572 |
+@@ -216,7 +216,7 @@ |
573 |
} |
574 |
#endif // defined(USE_SYMBOLIZE) |
575 |
} |
576 |
@@ -45,44 +45,44 @@ |
577 |
|
578 |
void PrintToStderr(const char* output) { |
579 |
// NOTE: This code MUST be async-signal safe (it's used by in-process |
580 |
-@@ -749,7 +749,7 @@ |
581 |
- // NOTE: This code MUST be async-signal safe (it's used by in-process |
582 |
- // stack dumping signal handler). NO malloc or stdio is allowed here. |
583 |
+@@ -812,7 +812,7 @@ |
584 |
+ // NOTE: This code MUST be async-signal safe (it's used by in-process |
585 |
+ // stack dumping signal handler). NO malloc or stdio is allowed here. |
586 |
|
587 |
-#if !defined(__UCLIBC__) && !defined(_AIX) |
588 |
+#if defined(__GLIBC__) && !defined(_AIX) |
589 |
- count = std::min(arraysize(trace_), count); |
590 |
- |
591 |
// Though the backtrace API man page does not list any possible negative |
592 |
-@@ -764,13 +764,13 @@ |
593 |
- // NOTE: This code MUST be async-signal safe (it's used by in-process |
594 |
- // stack dumping signal handler). NO malloc or stdio is allowed here. |
595 |
+ // return values, we take no chance. |
596 |
+ return base::saturated_cast<size_t>(backtrace(trace, count)); |
597 |
+@@ -825,13 +825,13 @@ |
598 |
+ // NOTE: This code MUST be async-signal safe (it's used by in-process |
599 |
+ // stack dumping signal handler). NO malloc or stdio is allowed here. |
600 |
|
601 |
-#if !defined(__UCLIBC__) && !defined(_AIX) |
602 |
+#if defined(__GLIBC__) && !defined(_AIX) |
603 |
PrintBacktraceOutputHandler handler; |
604 |
- ProcessBacktrace(trace_, count_, &handler); |
605 |
+ ProcessBacktrace(trace_, count_, prefix_string, &handler); |
606 |
#endif |
607 |
} |
608 |
|
609 |
-#if !defined(__UCLIBC__) && !defined(_AIX) |
610 |
+#if defined(__GLIBC__) && !defined(_AIX) |
611 |
- void StackTrace::OutputToStream(std::ostream* os) const { |
612 |
+ void StackTrace::OutputToStreamWithPrefix(std::ostream* os, |
613 |
+ const char* prefix_string) const { |
614 |
StreamBacktraceOutputHandler handler(os); |
615 |
- ProcessBacktrace(trace_, count_, &handler); |
616 |
---- qtwebengine/src/3rdparty/chromium/base/debug/stack_trace.cc 2017-11-28 14:06:53.000000000 +0100 |
617 |
-+++ qtwebengine/src/3rdparty/chromium/base/debug/stack_trace.cc 2018-01-27 22:31:08.296359000 +0100 |
618 |
-@@ -214,7 +214,7 @@ |
619 |
- |
620 |
- std::string StackTrace::ToString() const { |
621 |
+--- qtwebengine/src/3rdparty/chromium/base/debug/stack_trace.cc 2019-04-09 09:31:16.000000000 +0200 |
622 |
++++ - 2019-05-06 23:18:14.923566992 +0200 |
623 |
+@@ -233,7 +233,7 @@ |
624 |
+ } |
625 |
+ std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { |
626 |
std::stringstream stream; |
627 |
-#if !defined(__UCLIBC__) && !defined(_AIX) |
628 |
+#if defined(__GLIBC__) && !defined(_AIX) |
629 |
- OutputToStream(&stream); |
630 |
+ OutputToStreamWithPrefix(&stream, prefix_string); |
631 |
#endif |
632 |
return stream.str(); |
633 |
---- qtwebengine/src/3rdparty/chromium/base/logging.cc 2017-11-28 14:06:53.000000000 +0100 |
634 |
-+++ qtwebengine/src/3rdparty/chromium/base/logging.cc 2018-01-27 22:46:34.970406807 +0100 |
635 |
+--- qtwebengine/src/3rdparty/chromium//base/logging.cc 2017-11-28 14:06:53.000000000 +0100 |
636 |
+--- qtwebengine/src/3rdparty/chromium//base/logging.cc 2018-01-27 22:46:34.970406807 +0100 |
637 |
@@ -546,7 +546,7 @@ |
638 |
|
639 |
LogMessage::~LogMessage() { |
640 |
@@ -92,15 +92,16 @@ |
641 |
!defined(OS_AIX) |
642 |
if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) { |
643 |
// Include a stack trace on a fatal, unless a debugger is attached. |
644 |
-diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/assertions.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/assertions.cc |
645 |
-index c7ecc7f..96ba0e4 100644 |
646 |
---- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/assertions.cc |
647 |
-+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/assertions.cc |
648 |
-@@ -51,7 +51,6 @@ |
649 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/assertions.cc 2019-04-09 09:31:16.000000000 +0200 |
650 |
++++ - 2019-05-06 23:12:07.040977258 +0200 |
651 |
+@@ -51,8 +51,10 @@ |
652 |
#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(__UCLIBC__)) |
653 |
#include <cxxabi.h> |
654 |
#include <dlfcn.h> |
655 |
--#include <execinfo.h> |
656 |
++#if defined(__GLIBC__) |
657 |
+ #include <execinfo.h> |
658 |
#endif |
659 |
++#endif |
660 |
|
661 |
#if defined(OS_ANDROID) |
662 |
+ #include <android/log.h> |
663 |
|
664 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-thread-stacksize.patch b/dev-qt/qtwebengine/files/musl/0045-qt-musl-thread-stacksize.patch |
665 |
similarity index 75% |
666 |
rename from dev-qt/qtwebengine/files/musl/qt-musl-thread-stacksize.patch |
667 |
rename to dev-qt/qtwebengine/files/musl/0045-qt-musl-thread-stacksize.patch |
668 |
index a5c59fe..496753b 100644 |
669 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-thread-stacksize.patch |
670 |
+++ b/dev-qt/qtwebengine/files/musl/0045-qt-musl-thread-stacksize.patch |
671 |
@@ -1,7 +1,7 @@ |
672 |
diff --git a/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc b/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc |
673 |
index 02bf49b..05ee182 100644 |
674 |
---- a/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc |
675 |
-+++ b/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc |
676 |
+--- qtwebengine/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc |
677 |
++++ qtwebengine/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc |
678 |
@@ -13,7 +13,7 @@ namespace pp { |
679 |
namespace { |
680 |
|
681 |
@@ -13,8 +13,8 @@ index 02bf49b..05ee182 100644 |
682 |
const size_t kDefaultStackSize = 0; |
683 |
diff --git a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc |
684 |
index cf7f3ec..e06a5ce 100644 |
685 |
---- a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc |
686 |
-+++ b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc |
687 |
+--- qtwebengine/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc |
688 |
++++ qtwebengine/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc |
689 |
@@ -761,7 +761,7 @@ void Thread::Start() { |
690 |
#if V8_OS_MACOSX |
691 |
// Default on Mac OS X is 512kB -- bump up to 1MB |
692 |
|
693 |
diff --git a/dev-qt/qtwebengine/files/musl/0046-sandbox-membarrier.patch b/dev-qt/qtwebengine/files/musl/0046-sandbox-membarrier.patch |
694 |
new file mode 100644 |
695 |
index 0000000..b73971f |
696 |
--- /dev/null |
697 |
+++ b/dev-qt/qtwebengine/files/musl/0046-sandbox-membarrier.patch |
698 |
@@ -0,0 +1,60 @@ |
699 |
+--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm64_linux_syscalls.h |
700 |
++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm64_linux_syscalls.h |
701 |
+@@ -1063,4 +1063,8 @@ |
702 |
+ #define __NR_memfd_create 279 |
703 |
+ #endif |
704 |
+ |
705 |
++#if !defined(__NR_membarrier) |
706 |
++#define __NR_membarrier 283 |
707 |
++#endif |
708 |
++ |
709 |
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_ |
710 |
+ |
711 |
+--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm_linux_syscalls.h |
712 |
++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm_linux_syscalls.h |
713 |
+@@ -1385,6 +1385,10 @@ |
714 |
+ #define __NR_memfd_create (__NR_SYSCALL_BASE+385) |
715 |
+ #endif |
716 |
+ |
717 |
++#if !defined(__NR_membarrier) |
718 |
++#define __NR_membarrier (__NR_SYSCALL_BASE+389) |
719 |
++#endif |
720 |
++ |
721 |
+ // ARM private syscalls. |
722 |
+ #if !defined(__ARM_NR_BASE) |
723 |
+ #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) |
724 |
+ |
725 |
+--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_32_linux_syscalls.h |
726 |
++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_32_linux_syscalls.h |
727 |
+@@ -1422,5 +1422,9 @@ |
728 |
+ #define __NR_memfd_create 356 |
729 |
+ #endif |
730 |
+ |
731 |
++#if !defined(__NR_membarrier) |
732 |
++#define __NR_membarrier 375 |
733 |
++#endif |
734 |
++ |
735 |
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_ |
736 |
+ |
737 |
+--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_64_linux_syscalls.h |
738 |
++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_64_linux_syscalls.h |
739 |
+@@ -1290,5 +1290,9 @@ |
740 |
+ #define __NR_memfd_create 319 |
741 |
+ #endif |
742 |
+ |
743 |
++#if !defined(__NR_membarrier) |
744 |
++#define __NR_membarrier 324 |
745 |
++#endif |
746 |
++ |
747 |
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ |
748 |
+ |
749 |
+--- qtwebengine/src/3rdparty/chromium//sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
750 |
++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
751 |
+@@ -370,6 +370,7 @@ |
752 |
+ switch (sysno) { |
753 |
+ case __NR_exit: |
754 |
+ case __NR_exit_group: |
755 |
++ case __NR_membarrier: |
756 |
+ case __NR_wait4: |
757 |
+ case __NR_waitid: |
758 |
+ #if defined(__i386__) |
759 |
|
760 |
diff --git a/dev-qt/qtwebengine/files/musl/0047-gn-cross-sysroot.patch b/dev-qt/qtwebengine/files/musl/0047-gn-cross-sysroot.patch |
761 |
new file mode 100644 |
762 |
index 0000000..ee6689a |
763 |
--- /dev/null |
764 |
+++ b/dev-qt/qtwebengine/files/musl/0047-gn-cross-sysroot.patch |
765 |
@@ -0,0 +1,24 @@ |
766 |
+There is no reason to run this script and running it fails on architectures |
767 |
+chromium does not officially support (such as ppc64). |
768 |
+ |
769 |
+--- qtwebengine/src/3rdparty/chromium/build/config/posix/BUILD.gn |
770 |
++++ qtwebengine/src/3rdparty/chromium/build/config/posix/BUILD.gn |
771 |
+@@ -102,12 +102,12 @@ config("runtime_library") { |
772 |
+ # when turning the sysroot on or off. (defines are passed via the command |
773 |
+ # line, and build system rebuilds things when their commandline |
774 |
+ # changes). Nothing should ever read this define. |
775 |
+- sysroot_hash = |
776 |
+- exec_script("//build/linux/sysroot_scripts/install-sysroot.py", |
777 |
+- [ "--print-hash=$current_cpu" ], |
778 |
+- "trim string", |
779 |
+- [ "//build/linux/sysroot_scripts/sysroots.json" ]) |
780 |
+- defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ] |
781 |
++ #sysroot_hash = |
782 |
++ # exec_script("//build/linux/sysroot_scripts/install-sysroot.py", |
783 |
++ # [ "--print-hash=$current_cpu" ], |
784 |
++ # "trim string", |
785 |
++ # [ "//build/linux/sysroot_scripts/sysroots.json" ]) |
786 |
++ #defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ] |
787 |
+ } |
788 |
+ asmflags += sysroot_flags |
789 |
+ |
790 |
|
791 |
diff --git a/dev-qt/qtwebengine/files/musl/0089-webengine-ppc64.patch b/dev-qt/qtwebengine/files/musl/0089-webengine-ppc64.patch |
792 |
new file mode 100644 |
793 |
index 0000000..402d7e2 |
794 |
--- /dev/null |
795 |
+++ b/dev-qt/qtwebengine/files/musl/0089-webengine-ppc64.patch |
796 |
@@ -0,0 +1,20 @@ |
797 |
+--- qtwebengine/mkspecs/features/functions.prf |
798 |
++++ qtwebengine/mkspecs/features/functions.prf |
799 |
+@@ -95,6 +95,7 @@ |
800 |
+ contains(qtArch, "arm64"): return(arm64) |
801 |
+ contains(qtArch, "mips"): return(mipsel) |
802 |
+ contains(qtArch, "mips64"): return(mips64el) |
803 |
++ contains(qtArch, "power64"): return(ppc64) |
804 |
+ return(unknown) |
805 |
+ } |
806 |
+ |
807 |
+--- qtwebengine/mkspecs/features/platform.prf |
808 |
++++ qtwebengine/mkspecs/features/platform.prf |
809 |
+@@ -82,6 +82,7 @@ |
810 |
+ contains(QT_ARCH, "arm")|contains(QT_ARCH, "arm64"): return(true) |
811 |
+ contains(QT_ARCH, "mips"): return(true) |
812 |
+ # contains(QT_ARCH, "mips64"): return(true) |
813 |
++ contains(QT_ARCH, "power64"): return(true) |
814 |
+ |
815 |
+ skipBuild("QtWebEngine can only be built for x86, x86-64, ARM, Aarch64, and MIPSel architectures.") |
816 |
+ return(false) |
817 |
|
818 |
diff --git a/dev-qt/qtwebengine/files/musl/0090-chromium-ppc64le.patch b/dev-qt/qtwebengine/files/musl/0090-chromium-ppc64le.patch |
819 |
new file mode 100644 |
820 |
index 0000000..04d8d3e |
821 |
--- /dev/null |
822 |
+++ b/dev-qt/qtwebengine/files/musl/0090-chromium-ppc64le.patch |
823 |
@@ -0,0 +1,4267 @@ |
824 |
+This is a base patch that adds support for ppc64le glibc. Big endian and musl |
825 |
+support is added in extra patches afterwards. |
826 |
+ |
827 |
+Ping q66 if you're updating qt5 and the patch does not apply anymore. |
828 |
+ |
829 |
+Source: https://wiki.raptorcs.com/w/index.php?title=Porting/Chromium |
830 |
+Upstream: Currently being submitted |
831 |
+ |
832 |
+--- qtwebengine/src/3rdparty/chromium/base/allocator/partition_allocator/page_allocator_constants.h |
833 |
++++ qtwebengine/src/3rdparty/chromium/base/allocator/partition_allocator/page_allocator_constants.h |
834 |
+@@ -10,7 +10,7 @@ |
835 |
+ #include "build/build_config.h" |
836 |
+ |
837 |
+ namespace base { |
838 |
+-#if defined(OS_WIN) |
839 |
++#if defined(OS_WIN) || defined(ARCH_CPU_PPC64) |
840 |
+ static constexpr size_t kPageAllocationGranularityShift = 16; // 64KB |
841 |
+ #elif defined(_MIPS_ARCH_LOONGSON) |
842 |
+ static constexpr size_t kPageAllocationGranularityShift = 14; // 16KB |
843 |
+@@ -26,6 +26,10 @@ static constexpr size_t kPageAllocationGranularityBaseMask = |
844 |
+ |
845 |
+ #if defined(_MIPS_ARCH_LOONGSON) |
846 |
+ static constexpr size_t kSystemPageSize = 16384; |
847 |
++#elif defined(ARCH_CPU_PPC64) |
848 |
++// TODO: modern ppc64 can do 4k and 64k page sizes |
849 |
++// for now, 64k is assumed |
850 |
++static constexpr size_t kSystemPageSize = 65536; |
851 |
+ #else |
852 |
+ static constexpr size_t kSystemPageSize = 4096; |
853 |
+ #endif |
854 |
+--- qtwebengine/src/3rdparty/chromium/base/allocator/partition_allocator/partition_alloc_constants.h |
855 |
++++ qtwebengine/src/3rdparty/chromium/base/allocator/partition_allocator/partition_alloc_constants.h |
856 |
+@@ -35,6 +35,8 @@ static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2; |
857 |
+ |
858 |
+ #if defined(_MIPS_ARCH_LOONGSON) |
859 |
+ static const size_t kPartitionPageShift = 16; // 64 KiB |
860 |
++#elif defined(ARCH_CPU_PPC64) |
861 |
++static const size_t kPartitionPageShift = 18; // 256 KiB |
862 |
+ #else |
863 |
+ static const size_t kPartitionPageShift = 14; // 16 KiB |
864 |
+ #endif |
865 |
+--- qtwebengine/src/3rdparty/chromium/build/download_nacl_toolchains.py |
866 |
++++ qtwebengine/src/3rdparty/chromium/build/download_nacl_toolchains.py |
867 |
+@@ -11,6 +11,10 @@ import sys |
868 |
+ |
869 |
+ |
870 |
+ def Main(args): |
871 |
++ # If `disable_nacl=1` is in GYP_DEFINES, exit |
872 |
++ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): |
873 |
++ return 0 |
874 |
++ |
875 |
+ script_dir = os.path.dirname(os.path.abspath(__file__)) |
876 |
+ src_dir = os.path.dirname(script_dir) |
877 |
+ nacl_dir = os.path.join(src_dir, 'native_client') |
878 |
+--- qtwebengine/src/3rdparty/chromium/build/toolchain/linux/BUILD.gn |
879 |
++++ qtwebengine/src/3rdparty/chromium/build/toolchain/linux/BUILD.gn |
880 |
+@@ -5,6 +5,14 @@ |
881 |
+ import("//build/config/sysroot.gni") |
882 |
+ import("//build/toolchain/gcc_toolchain.gni") |
883 |
+ |
884 |
++clang_toolchain("clang_ppc64") { |
885 |
++ enable_linker_map = true |
886 |
++ toolchain_args = { |
887 |
++ current_cpu = "ppc64" |
888 |
++ current_os = "linux" |
889 |
++ } |
890 |
++} |
891 |
++ |
892 |
+ clang_toolchain("clang_arm") { |
893 |
+ toolprefix = "arm-linux-gnueabihf-" |
894 |
+ toolchain_args = { |
895 |
+--- qtwebengine/src/3rdparty/chromium/components/update_client/update_query_params.cc |
896 |
++++ qtwebengine/src/3rdparty/chromium/components/update_client/update_query_params.cc |
897 |
+@@ -55,6 +55,8 @@ const char kArch[] = |
898 |
+ "mips64el"; |
899 |
+ #elif defined(__mips__) |
900 |
+ "mipsel"; |
901 |
++#elif defined(__powerpc64__) |
902 |
++ "ppc64"; |
903 |
+ #else |
904 |
+ #error "unknown arch" |
905 |
+ #endif |
906 |
+@@ -127,6 +129,8 @@ const char* UpdateQueryParams::GetNaclArch() { |
907 |
+ return "mips32"; |
908 |
+ #elif defined(ARCH_CPU_MIPS64EL) |
909 |
+ return "mips64"; |
910 |
++#elif defined(ARCH_CPU_PPC64) |
911 |
++ return "ppc64"; |
912 |
+ #else |
913 |
+ // NOTE: when adding new values here, please remember to update the |
914 |
+ // comment in the .h file about possible return values from this function. |
915 |
+--- qtwebengine/src/3rdparty/chromium/components/update_client/update_query_params.h |
916 |
++++ qtwebengine/src/3rdparty/chromium/components/update_client/update_query_params.h |
917 |
+@@ -45,7 +45,7 @@ class UpdateQueryParams { |
918 |
+ // Returns the value we use for the "nacl_arch" parameter. Note that this may |
919 |
+ // be different from the "arch" parameter above (e.g. one may be 32-bit and |
920 |
+ // the other 64-bit). Possible return values include: "x86-32", "x86-64", |
921 |
+- // "arm", and "mips32". |
922 |
++ // "arm", "mips32", and "ppc64". |
923 |
+ static const char* GetNaclArch(); |
924 |
+ |
925 |
+ // Returns the current version of Chrome/Chromium. |
926 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/features.gni |
927 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/features.gni |
928 |
+@@ -12,6 +12,6 @@ use_seccomp_bpf = |
929 |
+ (is_linux || is_android) && |
930 |
+ (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || |
931 |
+ current_cpu == "arm64" || current_cpu == "mipsel" || |
932 |
+- current_cpu == "mips64el") |
933 |
++ current_cpu == "mips64el" || current_cpu == "ppc64") |
934 |
+ |
935 |
+ use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi |
936 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/BUILD.gn |
937 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/BUILD.gn |
938 |
+@@ -416,6 +416,8 @@ component("sandbox_services") { |
939 |
+ |
940 |
+ source_set("sandbox_services_headers") { |
941 |
+ sources = [ |
942 |
++ "system_headers/ppc64_linux_syscalls.h", |
943 |
++ "system_headers/ppc64_linux_ucontext.h", |
944 |
+ "system_headers/arm64_linux_syscalls.h", |
945 |
+ "system_headers/arm_linux_syscalls.h", |
946 |
+ "system_headers/arm_linux_ucontext.h", |
947 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h |
948 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h |
949 |
+@@ -55,6 +55,13 @@ |
950 |
+ #define MAX_PUBLIC_SYSCALL 279u |
951 |
+ #define MAX_SYSCALL MAX_PUBLIC_SYSCALL |
952 |
+ |
953 |
++#elif defined(__powerpc64__) |
954 |
++ |
955 |
++#include <asm/unistd.h> |
956 |
++#define MIN_SYSCALL 0u |
957 |
++#define MAX_PUBLIC_SYSCALL 386u |
958 |
++#define MAX_SYSCALL MAX_PUBLIC_SYSCALL |
959 |
++ |
960 |
+ #else |
961 |
+ #error "Unsupported architecture" |
962 |
+ #endif |
963 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h |
964 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h |
965 |
+@@ -16,6 +16,9 @@ |
966 |
+ #if defined(__mips__) |
967 |
+ // sys/user.h in eglibc misses size_t definition |
968 |
+ #include <stddef.h> |
969 |
++#elif defined(__powerpc64__) |
970 |
++// Manually define greg_t on ppc64 |
971 |
++typedef unsigned long long greg_t; |
972 |
+ #endif |
973 |
+ #endif |
974 |
+ |
975 |
+@@ -346,6 +349,51 @@ struct regs_struct { |
976 |
+ #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3] |
977 |
+ #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4] |
978 |
+ #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5] |
979 |
++ |
980 |
++#elif defined(__powerpc64__) |
981 |
++#include <asm/ptrace.h> |
982 |
++ |
983 |
++typedef struct pt_regs regs_struct; |
984 |
++ |
985 |
++#ifdef ARCH_CPU_LITTLE_ENDIAN |
986 |
++#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE |
987 |
++#else |
988 |
++#define SECCOMP_ARCH AUDIT_ARCH_PPC64 |
989 |
++#endif |
990 |
++ |
991 |
++#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg]) |
992 |
++ |
993 |
++#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3) |
994 |
++#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0) |
995 |
++#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip |
996 |
++#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3) |
997 |
++#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4) |
998 |
++#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5) |
999 |
++#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6) |
1000 |
++#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7) |
1001 |
++#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8) |
1002 |
++ |
1003 |
++#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr)) |
1004 |
++#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch)) |
1005 |
++#define SECCOMP_IP_MSB_IDX \ |
1006 |
++ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4) |
1007 |
++#define SECCOMP_IP_LSB_IDX \ |
1008 |
++ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0) |
1009 |
++#define SECCOMP_ARG_MSB_IDX(nr) \ |
1010 |
++ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4) |
1011 |
++#define SECCOMP_ARG_LSB_IDX(nr) \ |
1012 |
++ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0) |
1013 |
++ |
1014 |
++#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3] |
1015 |
++#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0] |
1016 |
++#define SECCOMP_PT_IP(_regs) (_regs).nip |
1017 |
++#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3] |
1018 |
++#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4] |
1019 |
++#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5] |
1020 |
++#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6] |
1021 |
++#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7] |
1022 |
++#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8] |
1023 |
++ |
1024 |
+ #else |
1025 |
+ #error Unsupported target platform |
1026 |
+ |
1027 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc |
1028 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc |
1029 |
+@@ -87,7 +87,8 @@ bool IsBaselinePolicyWatched(int sysno) { |
1030 |
+ SyscallSets::IsPrctl(sysno) || |
1031 |
+ SyscallSets::IsProcessGroupOrSession(sysno) || |
1032 |
+ #if defined(__i386__) || \ |
1033 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1034 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1035 |
++ defined(__powerpc64__) |
1036 |
+ SyscallSets::IsSocketCall(sysno) || |
1037 |
+ #endif |
1038 |
+ #if defined(__arm__) |
1039 |
+@@ -190,7 +191,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno, |
1040 |
+ } |
1041 |
+ |
1042 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1043 |
+- defined(__aarch64__) |
1044 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1045 |
+ if (sysno == __NR_mmap) |
1046 |
+ return RestrictMmapFlags(); |
1047 |
+ #endif |
1048 |
+@@ -208,7 +209,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno, |
1049 |
+ return RestrictPrctl(); |
1050 |
+ |
1051 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1052 |
+- defined(__aarch64__) |
1053 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1054 |
+ if (sysno == __NR_socketpair) { |
1055 |
+ // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen. |
1056 |
+ static_assert(AF_UNIX == PF_UNIX, |
1057 |
+@@ -248,7 +249,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno, |
1058 |
+ } |
1059 |
+ |
1060 |
+ #if defined(__i386__) || \ |
1061 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1062 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1063 |
++ defined(__powerpc64__) |
1064 |
+ if (SyscallSets::IsSocketCall(sysno)) |
1065 |
+ return RestrictSocketcallCommand(); |
1066 |
+ #endif |
1067 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc |
1068 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc |
1069 |
+@@ -257,7 +257,7 @@ TEST_BASELINE_SIGSYS(__NR_sysinfo); |
1070 |
+ TEST_BASELINE_SIGSYS(__NR_syslog); |
1071 |
+ TEST_BASELINE_SIGSYS(__NR_timer_create); |
1072 |
+ |
1073 |
+-#if !defined(__aarch64__) |
1074 |
++#if !defined(__aarch64__) && !defined(__powerpc64__) |
1075 |
+ TEST_BASELINE_SIGSYS(__NR_eventfd); |
1076 |
+ TEST_BASELINE_SIGSYS(__NR_inotify_init); |
1077 |
+ TEST_BASELINE_SIGSYS(__NR_vserver); |
1078 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc |
1079 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc |
1080 |
+@@ -35,7 +35,8 @@ |
1081 |
+ #include <sys/ioctl.h> |
1082 |
+ #include <sys/ptrace.h> |
1083 |
+ #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(__arm__) && \ |
1084 |
+- !defined(__aarch64__) && !defined(PTRACE_GET_THREAD_AREA) |
1085 |
++ !defined(__aarch64__) && !defined(__powerpc64__) && \ |
1086 |
++ !defined(PTRACE_GET_THREAD_AREA) |
1087 |
+ // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance |
1088 |
+ // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA. |
1089 |
+ // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't |
1090 |
+@@ -44,6 +44,11 @@ |
1091 |
+ #endif |
1092 |
+ #endif // !OS_NACL_NONSFI |
1093 |
+ |
1094 |
++// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h |
1095 |
++#ifdef __powerpc64__ |
1096 |
++#include <termios.h> |
1097 |
++#endif |
1098 |
++ |
1099 |
+ #if defined(OS_ANDROID) |
1100 |
+ |
1101 |
+ #if !defined(F_DUPFD_CLOEXEC) |
1102 |
+@@ -106,6 +111,15 @@ inline bool IsArchitectureMips() { |
1103 |
+ #endif |
1104 |
+ } |
1105 |
+ |
1106 |
++inline bool IsArchitecturePPC64() { |
1107 |
++#if defined(__powerpc64__) |
1108 |
++ return true; |
1109 |
++#else |
1110 |
++ return false; |
1111 |
++#endif |
1112 |
++} |
1113 |
++ |
1114 |
++ |
1115 |
+ // Ubuntu's version of glibc has a race condition in sem_post that can cause |
1116 |
+ // it to call futex(2) with bogus op arguments. To workaround this, we need |
1117 |
+ // to allow those futex(2) calls to fail with EINVAL, instead of crashing the |
1118 |
+@@ -247,7 +261,8 @@ ResultExpr RestrictFcntlCommands() { |
1119 |
+ // operator. |
1120 |
+ // Glibc overrides the kernel's O_LARGEFILE value. Account for this. |
1121 |
+ uint64_t kOLargeFileFlag = O_LARGEFILE; |
1122 |
+- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips()) |
1123 |
++ if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips() \ |
1124 |
++ || IsArchitecturePPC64()) |
1125 |
+ kOLargeFileFlag = 0100000; |
1126 |
+ |
1127 |
+ const Arg<int> cmd(1); |
1128 |
+@@ -270,7 +285,7 @@ ResultExpr RestrictFcntlCommands() { |
1129 |
+ .Default(CrashSIGSYS()); |
1130 |
+ } |
1131 |
+ |
1132 |
+-#if defined(__i386__) || defined(__mips__) |
1133 |
++#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__) |
1134 |
+ ResultExpr RestrictSocketcallCommand() { |
1135 |
+ // Unfortunately, we are unable to restrict the first parameter to |
1136 |
+ // socketpair(2). Whilst initially sounding bad, it's noteworthy that very |
1137 |
+@@ -421,7 +422,7 @@ ResultExpr RestrictPrlimit(pid_t target_pid) { |
1138 |
+ ResultExpr RestrictPtrace() { |
1139 |
+ const Arg<int> request(0); |
1140 |
+ return Switch(request).CASES(( |
1141 |
+-#if !defined(__aarch64__) |
1142 |
++#if !defined(__aarch64__) && !defined(__powerpc64__) |
1143 |
+ PTRACE_GETREGS, |
1144 |
+ PTRACE_GETFPREGS, |
1145 |
+ PTRACE_GET_THREAD_AREA, |
1146 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h |
1147 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h |
1148 |
+@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags(); |
1149 |
+ // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME. |
1150 |
+ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands(); |
1151 |
+ |
1152 |
+-#if defined(__i386__) || defined(__mips__) |
1153 |
++#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__) |
1154 |
+ // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2), |
1155 |
+ // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2). |
1156 |
+ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand(); |
1157 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
1158 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
1159 |
+@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) { |
1160 |
+ switch (sysno) { |
1161 |
+ case __NR_gettimeofday: |
1162 |
+ #if defined(__i386__) || defined(__x86_64__) || \ |
1163 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1164 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1165 |
++ defined(__powerpc64__) |
1166 |
+ case __NR_time: |
1167 |
+ #endif |
1168 |
+ return true; |
1169 |
+@@ -45,7 +46,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) { |
1170 |
+ #endif |
1171 |
+ case __NR_settimeofday: // Privileged. |
1172 |
+ #if defined(__i386__) || \ |
1173 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1174 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1175 |
++ defined(__powerpc64__) |
1176 |
+ case __NR_stime: |
1177 |
+ #endif |
1178 |
+ default: |
1179 |
+@@ -111,7 +113,7 @@ bool SyscallSets::IsFileSystem(int sysno) { |
1180 |
+ case __NR_faccessat: // EPERM not a valid errno. |
1181 |
+ case __NR_fchmodat: |
1182 |
+ case __NR_fchownat: // Should be called chownat ? |
1183 |
+-#if defined(__x86_64__) || defined(__aarch64__) |
1184 |
++#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) |
1185 |
+ case __NR_newfstatat: // fstatat(). EPERM not a valid errno. |
1186 |
+ #elif defined(__i386__) || defined(__arm__) || \ |
1187 |
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1188 |
+@@ -130,7 +132,7 @@ bool SyscallSets::IsFileSystem(int sysno) { |
1189 |
+ case __NR_memfd_create: |
1190 |
+ case __NR_mkdirat: |
1191 |
+ case __NR_mknodat: |
1192 |
+-#if defined(__i386__) |
1193 |
++#if defined(__i386__) || defined(__powerpc64__) |
1194 |
+ case __NR_oldlstat: |
1195 |
+ case __NR_oldstat: |
1196 |
+ #endif |
1197 |
+@@ -154,7 +156,8 @@ bool SyscallSets::IsFileSystem(int sysno) { |
1198 |
+ case __NR_truncate64: |
1199 |
+ #endif |
1200 |
+ case __NR_unlinkat: |
1201 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1202 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1203 |
++ defined(__powerpc64__) |
1204 |
+ case __NR_utime: |
1205 |
+ #endif |
1206 |
+ case __NR_utimensat: // New. |
1207 |
+@@ -173,7 +176,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) { |
1208 |
+ #endif |
1209 |
+ return true; |
1210 |
+ // TODO(jln): these should be denied gracefully as well (moved below). |
1211 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1212 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1213 |
++ defined(__powerpc64__) |
1214 |
+ case __NR_fadvise64: // EPERM not a valid errno. |
1215 |
+ #endif |
1216 |
+ #if defined(__i386__) |
1217 |
+@@ -186,7 +190,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) { |
1218 |
+ case __NR_flock: // EPERM not a valid errno. |
1219 |
+ case __NR_fstatfs: // Give information about the whole filesystem. |
1220 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1221 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1222 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1223 |
++ defined(__powerpc64__) |
1224 |
+ case __NR_fstatfs64: |
1225 |
+ #endif |
1226 |
+ case __NR_fsync: // EPERM not a valid errno. |
1227 |
+@@ -198,6 +203,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) { |
1228 |
+ case __NR_sync_file_range: // EPERM not a valid errno. |
1229 |
+ #elif defined(__arm__) |
1230 |
+ case __NR_arm_sync_file_range: // EPERM not a valid errno. |
1231 |
++#elif defined(__powerpc64__) |
1232 |
++ case __NR_sync_file_range2: // EPERM not a valid errno. |
1233 |
+ #endif |
1234 |
+ default: |
1235 |
+ return false; |
1236 |
+@@ -223,7 +230,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) { |
1237 |
+ #endif |
1238 |
+ case __NR_getdents64: // EPERM not a valid errno. |
1239 |
+ #if defined(__i386__) || \ |
1240 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1241 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1242 |
++ defined(__powerpc64__) |
1243 |
+ case __NR_readdir: |
1244 |
+ #endif |
1245 |
+ return true; |
1246 |
+@@ -264,7 +272,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) { |
1247 |
+ bool SyscallSets::IsProcessPrivilegeChange(int sysno) { |
1248 |
+ switch (sysno) { |
1249 |
+ case __NR_capset: |
1250 |
+-#if defined(__i386__) || defined(__x86_64__) |
1251 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__) |
1252 |
+ case __NR_ioperm: // Intel privilege. |
1253 |
+ case __NR_iopl: // Intel privilege. |
1254 |
+ #endif |
1255 |
+@@ -314,7 +322,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) { |
1256 |
+ case __NR_rt_sigprocmask: |
1257 |
+ case __NR_rt_sigreturn: |
1258 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1259 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1260 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1261 |
++ defined(__powerpc64__) |
1262 |
+ case __NR_sigaction: |
1263 |
+ case __NR_sigprocmask: |
1264 |
+ case __NR_sigreturn: |
1265 |
+@@ -331,7 +340,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) { |
1266 |
+ #endif |
1267 |
+ case __NR_signalfd4: |
1268 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1269 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1270 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1271 |
++ defined(__powerpc64__) |
1272 |
+ case __NR_sigpending: |
1273 |
+ case __NR_sigsuspend: |
1274 |
+ #endif |
1275 |
+@@ -355,7 +365,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) { |
1276 |
+ #endif |
1277 |
+ case __NR_dup3: |
1278 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1279 |
+- defined(__aarch64__) |
1280 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1281 |
+ case __NR_shutdown: |
1282 |
+ #endif |
1283 |
+ return true; |
1284 |
+@@ -389,7 +399,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { |
1285 |
+ case __NR_membarrier: |
1286 |
+ case __NR_wait4: |
1287 |
+ case __NR_waitid: |
1288 |
+-#if defined(__i386__) |
1289 |
++#if defined(__i386__) || defined(__powerpc64__) |
1290 |
+ case __NR_waitpid: |
1291 |
+ #endif |
1292 |
+ #if !defined(__GLIBC__) |
1293 |
+@@ -411,7 +421,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { |
1294 |
+ case __NR_set_tid_address: |
1295 |
+ #endif |
1296 |
+ case __NR_unshare: |
1297 |
+-#if !defined(__mips__) && !defined(__aarch64__) |
1298 |
++#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__) |
1299 |
+ case __NR_vfork: |
1300 |
+ #endif |
1301 |
+ default: |
1302 |
+@@ -460,7 +470,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) { |
1303 |
+ return true; |
1304 |
+ default: |
1305 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1306 |
+- defined(__aarch64__) |
1307 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1308 |
+ case __NR_socketpair: // We will want to inspect its argument. |
1309 |
+ #endif |
1310 |
+ return false; |
1311 |
+@@ -470,7 +480,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) { |
1312 |
+ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) { |
1313 |
+ switch (sysno) { |
1314 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1315 |
+- defined(__aarch64__) |
1316 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1317 |
+ case __NR_accept: |
1318 |
+ case __NR_accept4: |
1319 |
+ case __NR_bind: |
1320 |
+@@ -485,7 +495,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) { |
1321 |
+ } |
1322 |
+ |
1323 |
+ #if defined(__i386__) || \ |
1324 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1325 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1326 |
++ defined(__powerpc64__) |
1327 |
+ // Big multiplexing system call for sockets. |
1328 |
+ bool SyscallSets::IsSocketCall(int sysno) { |
1329 |
+ switch (sysno) { |
1330 |
+@@ -499,7 +510,8 @@ bool SyscallSets::IsSocketCall(int sysno) { |
1331 |
+ } |
1332 |
+ #endif |
1333 |
+ |
1334 |
+-#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) |
1335 |
++#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1336 |
++ defined(__powerpc64__) |
1337 |
+ bool SyscallSets::IsNetworkSocketInformation(int sysno) { |
1338 |
+ switch (sysno) { |
1339 |
+ case __NR_getpeername: |
1340 |
+@@ -527,7 +539,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { |
1341 |
+ case __NR_mincore: |
1342 |
+ case __NR_mlockall: |
1343 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1344 |
+- defined(__aarch64__) |
1345 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1346 |
+ case __NR_mmap: |
1347 |
+ #endif |
1348 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1349 |
+@@ -559,7 +571,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) { |
1350 |
+ switch (sysno) { |
1351 |
+ case __NR_lseek: |
1352 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1353 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1354 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1355 |
++ defined(__powerpc64__) |
1356 |
+ case __NR__llseek: |
1357 |
+ #endif |
1358 |
+ #if !defined(__aarch64__) |
1359 |
+@@ -571,26 +584,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) { |
1360 |
+ case __NR_readv: |
1361 |
+ case __NR_pread64: |
1362 |
+ #if defined(__arm__) || \ |
1363 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1364 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1365 |
++ defined(__powerpc64__) |
1366 |
+ case __NR_recv: |
1367 |
+ #endif |
1368 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1369 |
+- defined(__aarch64__) |
1370 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1371 |
+ case __NR_recvfrom: // Could specify source. |
1372 |
+ case __NR_recvmsg: // Could specify source. |
1373 |
+ #endif |
1374 |
+-#if defined(__i386__) || defined(__x86_64__) |
1375 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__) |
1376 |
+ case __NR_select: |
1377 |
+ #endif |
1378 |
+-#if defined(__i386__) || defined(__arm__) || defined(__mips__) |
1379 |
++#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__) |
1380 |
+ case __NR__newselect: |
1381 |
+ #endif |
1382 |
+ #if defined(__arm__) || \ |
1383 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1384 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1385 |
++ defined(__powerpc64__) |
1386 |
+ case __NR_send: |
1387 |
+ #endif |
1388 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1389 |
+- defined(__aarch64__) |
1390 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1391 |
+ case __NR_sendmsg: // Could specify destination. |
1392 |
+ case __NR_sendto: // Could specify destination. |
1393 |
+ #endif |
1394 |
+@@ -647,7 +662,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) { |
1395 |
+ return true; |
1396 |
+ case __NR_getpriority: |
1397 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1398 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1399 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1400 |
++ defined(__powerpc64__) |
1401 |
+ case __NR_nice: |
1402 |
+ #endif |
1403 |
+ case __NR_setpriority: |
1404 |
+@@ -659,7 +675,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) { |
1405 |
+ bool SyscallSets::IsAdminOperation(int sysno) { |
1406 |
+ switch (sysno) { |
1407 |
+ #if defined(__i386__) || defined(__arm__) || \ |
1408 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1409 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1410 |
++ defined(__powerpc64__) |
1411 |
+ case __NR_bdflush: |
1412 |
+ #endif |
1413 |
+ case __NR_kexec_load: |
1414 |
+@@ -675,7 +692,8 @@ bool SyscallSets::IsAdminOperation(int sysno) { |
1415 |
+ |
1416 |
+ bool SyscallSets::IsKernelModule(int sysno) { |
1417 |
+ switch (sysno) { |
1418 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1419 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1420 |
++ defined(__powerpc64__) |
1421 |
+ case __NR_create_module: |
1422 |
+ case __NR_get_kernel_syms: // Should ENOSYS. |
1423 |
+ case __NR_query_module: |
1424 |
+@@ -708,7 +726,8 @@ bool SyscallSets::IsFsControl(int sysno) { |
1425 |
+ case __NR_swapoff: |
1426 |
+ case __NR_swapon: |
1427 |
+ #if defined(__i386__) || \ |
1428 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1429 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1430 |
++ defined(__powerpc64__) |
1431 |
+ case __NR_umount: |
1432 |
+ #endif |
1433 |
+ case __NR_umount2: |
1434 |
+@@ -724,7 +743,7 @@ bool SyscallSets::IsNuma(int sysno) { |
1435 |
+ case __NR_getcpu: |
1436 |
+ case __NR_mbind: |
1437 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1438 |
+- defined(__aarch64__) |
1439 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1440 |
+ case __NR_migrate_pages: |
1441 |
+ #endif |
1442 |
+ case __NR_move_pages: |
1443 |
+@@ -753,14 +772,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) { |
1444 |
+ switch (sysno) { |
1445 |
+ case __NR_acct: // Privileged. |
1446 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1447 |
+- defined(__aarch64__) |
1448 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1449 |
+ case __NR_getrlimit: |
1450 |
+ #endif |
1451 |
+-#if defined(__i386__) || defined(__arm__) |
1452 |
++#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__) |
1453 |
+ case __NR_ugetrlimit: |
1454 |
+ #endif |
1455 |
+ #if defined(__i386__) || \ |
1456 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1457 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1458 |
++ defined(__powerpc64__) |
1459 |
+ case __NR_ulimit: |
1460 |
+ #endif |
1461 |
+ case __NR_getrusage: |
1462 |
+@@ -794,7 +814,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) { |
1463 |
+ #endif |
1464 |
+ case __NR_sysinfo: |
1465 |
+ case __NR_uname: |
1466 |
+-#if defined(__i386__) |
1467 |
++#if defined(__i386__) || defined(__powerpc64__) |
1468 |
+ case __NR_olduname: |
1469 |
+ case __NR_oldolduname: |
1470 |
+ #endif |
1471 |
+@@ -888,7 +908,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) { |
1472 |
+ #endif |
1473 |
+ |
1474 |
+ #if defined(__i386__) || \ |
1475 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1476 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1477 |
++ defined(__powerpc64__) |
1478 |
+ // Big system V multiplexing system call. |
1479 |
+ bool SyscallSets::IsSystemVIpc(int sysno) { |
1480 |
+ switch (sysno) { |
1481 |
+@@ -908,7 +929,8 @@ bool SyscallSets::IsAnySystemV(int sysno) { |
1482 |
+ return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) || |
1483 |
+ IsSystemVSharedMemory(sysno); |
1484 |
+ #elif defined(__i386__) || \ |
1485 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1486 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1487 |
++ defined(__powerpc64__) |
1488 |
+ return IsSystemVIpc(sysno); |
1489 |
+ #endif |
1490 |
+ } |
1491 |
+@@ -961,7 +983,8 @@ bool SyscallSets::IsFaNotify(int sysno) { |
1492 |
+ bool SyscallSets::IsTimer(int sysno) { |
1493 |
+ switch (sysno) { |
1494 |
+ case __NR_getitimer: |
1495 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1496 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1497 |
++ defined(__powerpc64__) |
1498 |
+ case __NR_alarm: |
1499 |
+ #endif |
1500 |
+ case __NR_setitimer: |
1501 |
+@@ -1020,18 +1043,22 @@ bool SyscallSets::IsMisc(int sysno) { |
1502 |
+ case __NR_syncfs: |
1503 |
+ case __NR_vhangup: |
1504 |
+ // The system calls below are not implemented. |
1505 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1506 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1507 |
++ defined(__powerpc64__) |
1508 |
+ case __NR_afs_syscall: |
1509 |
+ #endif |
1510 |
+ #if defined(__i386__) || \ |
1511 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1512 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1513 |
++ defined(__powerpc64__) |
1514 |
+ case __NR_break: |
1515 |
+ #endif |
1516 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1517 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1518 |
++ defined(__powerpc64__) |
1519 |
+ case __NR_getpmsg: |
1520 |
+ #endif |
1521 |
+ #if defined(__i386__) || \ |
1522 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1523 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1524 |
++ defined(__powerpc64__) |
1525 |
+ case __NR_gtty: |
1526 |
+ case __NR_idle: |
1527 |
+ case __NR_lock: |
1528 |
+@@ -1039,20 +1066,22 @@ bool SyscallSets::IsMisc(int sysno) { |
1529 |
+ case __NR_prof: |
1530 |
+ case __NR_profil: |
1531 |
+ #endif |
1532 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
1533 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ |
1534 |
++ defined(__powerpc64__) |
1535 |
+ case __NR_putpmsg: |
1536 |
+ #endif |
1537 |
+ #if defined(__x86_64__) |
1538 |
+ case __NR_security: |
1539 |
+ #endif |
1540 |
+ #if defined(__i386__) || \ |
1541 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1542 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1543 |
++ defined(__powerpc64__) |
1544 |
+ case __NR_stty: |
1545 |
+ #endif |
1546 |
+-#if defined(__x86_64__) |
1547 |
++#if defined(__x86_64__) || defined(__powerpc64__) |
1548 |
+ case __NR_tuxcall: |
1549 |
+ #endif |
1550 |
+-#if !defined(__aarch64__) |
1551 |
++#if !defined(__aarch64__) && !defined(__powerpc64__) |
1552 |
+ case __NR_vserver: |
1553 |
+ #endif |
1554 |
+ return true; |
1555 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h |
1556 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h |
1557 |
+@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets { |
1558 |
+ static bool IsDeniedGetOrModifySocket(int sysno); |
1559 |
+ |
1560 |
+ #if defined(__i386__) || \ |
1561 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1562 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1563 |
++ defined(__powerpc64__) |
1564 |
+ // Big multiplexing system call for sockets. |
1565 |
+ static bool IsSocketCall(int sysno); |
1566 |
+ #endif |
1567 |
+ |
1568 |
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ |
1569 |
+- defined(__aarch64__) |
1570 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1571 |
+ static bool IsNetworkSocketInformation(int sysno); |
1572 |
+ #endif |
1573 |
+ |
1574 |
+@@ -87,7 +88,8 @@ class SANDBOX_EXPORT SyscallSets { |
1575 |
+ #endif |
1576 |
+ |
1577 |
+ #if defined(__i386__) || \ |
1578 |
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) |
1579 |
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \ |
1580 |
++ defined(__powerpc64__) |
1581 |
+ // Big system V multiplexing system call. |
1582 |
+ static bool IsSystemVIpc(int sysno); |
1583 |
+ #endif |
1584 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/syscall.cc |
1585 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/syscall.cc |
1586 |
+@@ -16,7 +16,7 @@ namespace sandbox { |
1587 |
+ namespace { |
1588 |
+ |
1589 |
+ #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \ |
1590 |
+- defined(ARCH_CPU_MIPS_FAMILY) |
1591 |
++ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY) |
1592 |
+ // Number that's not currently used by any Linux kernel ABIs. |
1593 |
+ const int kInvalidSyscallNumber = 0x351d3; |
1594 |
+ #else |
1595 |
+@@ -308,12 +308,56 @@ asm(// We need to be able to tell the kernel exactly where we made a |
1596 |
+ // Enter the kernel |
1597 |
+ "svc 0\n" |
1598 |
+ "2:ret\n" |
1599 |
++ ".cfi_endproc\n" |
1600 |
++ ".size SyscallAsm, .-SyscallAsm\n" |
1601 |
++#elif defined(__powerpc64__) |
1602 |
++ ".text\n" |
1603 |
++ ".align 4\n" |
1604 |
++ ".type SyscallAsm @function\n" |
1605 |
++ "SyscallAsm:\n" |
1606 |
++ ".cfi_startproc\n" |
1607 |
++ |
1608 |
++ // Check if r3 is negative |
1609 |
++ "cmpdi 3, 0\n" |
1610 |
++ "bgt 2f\n" |
1611 |
++ |
1612 |
++ // Load address of 3f into r3 and return |
1613 |
++ "mflr 10\n" |
1614 |
++ "bl 1f\n" |
1615 |
++ "1: mflr 3\n" |
1616 |
++ "mtlr 10\n" |
1617 |
++ "addi 3, 3, 4*13\n" |
1618 |
++ "blr\n" |
1619 |
++ |
1620 |
++ // Load arguments from array into r3-8 |
1621 |
++ // save param 3 in r10 |
1622 |
++ "2:\n" |
1623 |
++ "mr 0, 3\n" |
1624 |
++ "ld 3, 0(4)\n" |
1625 |
++ "ld 5, 16(4)\n" |
1626 |
++ "ld 6, 24(4)\n" |
1627 |
++ "ld 7, 32(4)\n" |
1628 |
++ "ld 8, 40(4)\n" |
1629 |
++ "ld 4, 8(4)\n" |
1630 |
++ "li 9, 0\n" |
1631 |
++ |
1632 |
++ // Enter kernel |
1633 |
++ "sc\n" |
1634 |
++ |
1635 |
++ // Magic return address |
1636 |
++ "3:\n" |
1637 |
++ // Like MIPS, ppc64 return values are always positive. |
1638 |
++ // Check for error in cr0.SO and negate upon error |
1639 |
++ "bc 4, 3, 4f\n" |
1640 |
++ "neg 3, 3\n" |
1641 |
++ "4: blr\n" |
1642 |
++ |
1643 |
+ ".cfi_endproc\n" |
1644 |
+ ".size SyscallAsm, .-SyscallAsm\n" |
1645 |
+ #endif |
1646 |
+ ); // asm |
1647 |
+ |
1648 |
+-#if defined(__x86_64__) |
1649 |
++#if defined(__x86_64__) || defined(__powerpc64__) |
1650 |
+ extern "C" { |
1651 |
+ intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]); |
1652 |
+ } |
1653 |
+@@ -427,6 +471,8 @@ intptr_t Syscall::Call(int nr, |
1654 |
+ ret = inout; |
1655 |
+ } |
1656 |
+ |
1657 |
++#elif defined(__powerpc64__) |
1658 |
++ intptr_t ret = SyscallAsm(nr, args); |
1659 |
+ #else |
1660 |
+ #error "Unimplemented architecture" |
1661 |
+ #endif |
1662 |
+@@ -443,8 +489,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) { |
1663 |
+ // needs to be changed back. |
1664 |
+ ret_val = -ret_val; |
1665 |
+ SECCOMP_PARM4(ctx) = 1; |
1666 |
+- } else |
1667 |
++ } else { |
1668 |
+ SECCOMP_PARM4(ctx) = 0; |
1669 |
++ } |
1670 |
++#endif |
1671 |
++#if defined(__powerpc64__) |
1672 |
++ // Same as MIPS, need to invert ret and set error register (cr0.SO) |
1673 |
++ if (ret_val <= -1 && ret_val >= -4095) { |
1674 |
++ ret_val = -ret_val; |
1675 |
++ ctx->uc_mcontext.regs->ccr |= (1 << 28); |
1676 |
++ } else { |
1677 |
++ ctx->uc_mcontext.regs->ccr &= ~(1 << 28); |
1678 |
++ } |
1679 |
+ #endif |
1680 |
+ SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val); |
1681 |
+ } |
1682 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc |
1683 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc |
1684 |
+@@ -230,6 +230,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) { |
1685 |
+ SetIsInSigHandler(); |
1686 |
+ } |
1687 |
+ |
1688 |
++#if defined(__powerpc64__) |
1689 |
++ // On ppc64+glibc, some syscalls seem to accidentally negate the first |
1690 |
++ // parameter which causes checks against it to fail. For now, manually |
1691 |
++ // negate them back. |
1692 |
++ // TODO(shawn@×××××××.io): investigate this issue further |
1693 |
++ auto nr = SECCOMP_SYSCALL(ctx); |
1694 |
++ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat || |
1695 |
++ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) { |
1696 |
++ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) { |
1697 |
++ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx); |
1698 |
++ } |
1699 |
++ } |
1700 |
++#endif |
1701 |
++ |
1702 |
+ // Copy the seccomp-specific data into a arch_seccomp_data structure. This |
1703 |
+ // is what we are showing to TrapFnc callbacks that the system call |
1704 |
+ // evaluator registered with the sandbox. |
1705 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/services/credentials.cc |
1706 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/services/credentials.cc |
1707 |
+@@ -79,7 +79,7 @@ bool ChrootToSafeEmptyDir() { |
1708 |
+ pid_t pid = -1; |
1709 |
+ alignas(16) char stack_buf[PTHREAD_STACK_MIN]; |
1710 |
+ #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \ |
1711 |
+- defined(ARCH_CPU_MIPS_FAMILY) |
1712 |
++ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY) |
1713 |
+ // The stack grows downward. |
1714 |
+ void* stack = stack_buf + sizeof(stack_buf); |
1715 |
+ #else |
1716 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/syscall_broker/broker_process.cc |
1717 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/syscall_broker/broker_process.cc |
1718 |
+@@ -151,7 +151,7 @@ bool BrokerProcess::IsSyscallAllowed(int sysno) const { |
1719 |
+ #if defined(__NR_fstatat) |
1720 |
+ case __NR_fstatat: |
1721 |
+ #endif |
1722 |
+-#if defined(__x86_64__) || defined(__aarch64__) |
1723 |
++#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) |
1724 |
+ case __NR_newfstatat: |
1725 |
+ #endif |
1726 |
+ return !fast_check_in_client_ || allowed_command_set_.test(COMMAND_STAT); |
1727 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_seccomp.h |
1728 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_seccomp.h |
1729 |
+@@ -29,6 +29,9 @@ |
1730 |
+ #ifndef EM_AARCH64 |
1731 |
+ #define EM_AARCH64 183 |
1732 |
+ #endif |
1733 |
++#ifndef EM_PPC64 |
1734 |
++#define EM_PPC64 21 |
1735 |
++#endif |
1736 |
+ |
1737 |
+ #ifndef __AUDIT_ARCH_64BIT |
1738 |
+ #define __AUDIT_ARCH_64BIT 0x80000000 |
1739 |
+@@ -54,6 +57,12 @@ |
1740 |
+ #ifndef AUDIT_ARCH_AARCH64 |
1741 |
+ #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE) |
1742 |
+ #endif |
1743 |
++#ifndef AUDIT_ARCH_PPC64 |
1744 |
++#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT) |
1745 |
++#endif |
1746 |
++#ifndef AUDIT_ARCH_PPC64LE |
1747 |
++#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE) |
1748 |
++#endif |
1749 |
+ |
1750 |
+ // For prctl.h |
1751 |
+ #ifndef PR_SET_SECCOMP |
1752 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_signal.h |
1753 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_signal.h |
1754 |
+@@ -13,7 +13,7 @@ |
1755 |
+ // (not undefined, but defined different values and in different memory |
1756 |
+ // layouts). So, fill the gap here. |
1757 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \ |
1758 |
+- defined(__aarch64__) |
1759 |
++ defined(__aarch64__) || defined(__powerpc64__) |
1760 |
+ |
1761 |
+ #define LINUX_SIGHUP 1 |
1762 |
+ #define LINUX_SIGINT 2 |
1763 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_syscalls.h |
1764 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_syscalls.h |
1765 |
+@@ -35,5 +35,9 @@ |
1766 |
+ #include "sandbox/linux/system_headers/arm64_linux_syscalls.h" |
1767 |
+ #endif |
1768 |
+ |
1769 |
++#if defined(__powerpc64__) |
1770 |
++#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h" |
1771 |
++#endif |
1772 |
++ |
1773 |
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_ |
1774 |
+ |
1775 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_ucontext.h |
1776 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_ucontext.h |
1777 |
+@@ -11,6 +11,8 @@ |
1778 |
+ #include "sandbox/linux/system_headers/arm_linux_ucontext.h" |
1779 |
+ #elif defined(__i386__) |
1780 |
+ #include "sandbox/linux/system_headers/i386_linux_ucontext.h" |
1781 |
++#elif defined(__powerpc64__) |
1782 |
++#include "sandbox/linux/system_headers/ppc64_linux_ucontext.h" |
1783 |
+ #else |
1784 |
+ #error "No support for your architecture in PNaCl header" |
1785 |
+ #endif |
1786 |
+new file mode 100644 |
1787 |
+--- /dev/null |
1788 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/ppc64_linux_syscalls.h |
1789 |
+@@ -0,0 +1,12 @@ |
1790 |
++// Copyright 2014 The Chromium Authors. All rights reserved. |
1791 |
++// Use of this source code is governed by a BSD-style license that can be |
1792 |
++// found in the LICENSE file. |
1793 |
++ |
1794 |
++#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_ |
1795 |
++#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_ |
1796 |
++ |
1797 |
++#include <asm/unistd.h> |
1798 |
++ |
1799 |
++//TODO: is it necessary to redefine syscall numbers for PPC64? |
1800 |
++ |
1801 |
++#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_ |
1802 |
+new file mode 100644 |
1803 |
+--- /dev/null |
1804 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/ppc64_linux_ucontext.h |
1805 |
+@@ -0,0 +1,12 @@ |
1806 |
++// Copyright 2014 The Chromium Authors. All rights reserved. |
1807 |
++// Use of this source code is governed by a BSD-style license that can be |
1808 |
++// found in the LICENSE file. |
1809 |
++ |
1810 |
++#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_ |
1811 |
++#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_ |
1812 |
++ |
1813 |
++#include <sys/ucontext.h> |
1814 |
++ |
1815 |
++//TODO: is it necessary to redefine ucontext on PPC64? |
1816 |
++ |
1817 |
++#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_ |
1818 |
+--- qtwebengine/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc |
1819 |
++++ qtwebengine/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc |
1820 |
+@@ -15,6 +15,11 @@ |
1821 |
+ #include "sandbox/linux/system_headers/linux_syscalls.h" |
1822 |
+ #include "services/service_manager/sandbox/linux/sandbox_linux.h" |
1823 |
+ |
1824 |
++// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h |
1825 |
++#ifdef __powerpc64__ |
1826 |
++#include <termios.h> |
1827 |
++#endif |
1828 |
++ |
1829 |
+ // TODO(vignatti): replace the local definitions below with #include |
1830 |
+ // <linux/dma-buf.h> once kernel version 4.6 becomes widely used. |
1831 |
+ #include <linux/types.h> |
1832 |
+--- qtwebengine/src/3rdparty/chromium/third_party/angle/src/libANGLE/Constants.h |
1833 |
++++ qtwebengine/src/3rdparty/chromium/third_party/angle/src/libANGLE/Constants.h |
1834 |
+@@ -9,6 +9,7 @@ |
1835 |
+ #ifndef LIBANGLE_CONSTANTS_H_ |
1836 |
+ #define LIBANGLE_CONSTANTS_H_ |
1837 |
+ |
1838 |
++#include <cstddef> |
1839 |
+ #include "common/platform.h" |
1840 |
+ |
1841 |
+ namespace gl |
1842 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/heap/asm/BUILD.gn |
1843 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/heap/asm/BUILD.gn |
1844 |
+@@ -46,6 +46,10 @@ if (current_cpu == "x86" || current_cpu == "x64") { |
1845 |
+ sources = [ |
1846 |
+ "SaveRegisters_mips64.S", |
1847 |
+ ] |
1848 |
++ } else if (current_cpu == "ppc64") { |
1849 |
++ sources = [ |
1850 |
++ "SaveRegisters_ppc64.S", |
1851 |
++ ] |
1852 |
+ } |
1853 |
+ |
1854 |
+ if (current_cpu == "arm") { |
1855 |
+new file mode 100644 |
1856 |
+--- /dev/null |
1857 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/heap/asm/SaveRegisters_ppc64.S |
1858 |
+@@ -0,0 +1,60 @@ |
1859 |
++/* |
1860 |
++ * typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*); |
1861 |
++ * extern "C" void PushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback) |
1862 |
++ */ |
1863 |
++ |
1864 |
++.type PushAllRegisters, %function |
1865 |
++.global PushAllRegisters |
1866 |
++.hidden PushAllRegisters |
1867 |
++PushAllRegisters: |
1868 |
++ // Push all callee-saves registers to get them |
1869 |
++ // on the stack for conservative stack scanning. |
1870 |
++ // Reserve space for callee-saved registers and minimal stack frame. |
1871 |
++ mflr 0 # r0 = LR |
1872 |
++ std 0,16(1) # store LR at addr sp+16 |
1873 |
++ stdu 1,-176(1) # grow stack by 176 bytes and store new stack top ptr to r1 |
1874 |
++ # 3218*8 = min stack non-volatile registers |
1875 |
++ |
1876 |
++ // Save the callee-saved registers |
1877 |
++ std 31,168(1) # store r31 to addr sp+168 |
1878 |
++ std 30,160(1) # etc... |
1879 |
++ std 29,152(1) |
1880 |
++ std 28,144(1) |
1881 |
++ std 27,136(1) |
1882 |
++ std 26,128(1) |
1883 |
++ std 25,120(1) |
1884 |
++ std 24,112(1) |
1885 |
++ std 23,104(1) |
1886 |
++ std 22,96(1) |
1887 |
++ std 21,88(1) |
1888 |
++ std 20,80(1) |
1889 |
++ std 19,72(1) |
1890 |
++ std 18,64(1) |
1891 |
++ std 17,56(1) |
1892 |
++ std 16,48(1) |
1893 |
++ std 15,40(1) |
1894 |
++ std 14,32(1) |
1895 |
++ |
1896 |
++ // Note: the callee-saved floating point registers do not need to be |
1897 |
++ // copied to the stack, because fp registers never hold heap pointers |
1898 |
++ // and so do not need to be kept visible to the garbage collector. |
1899 |
++ |
1900 |
++ // Pass the two first arguments untouched in r3 and r4 and the |
1901 |
++ // stack pointer to the callback. |
1902 |
++ |
1903 |
++ std 2, 24(1) # save r2 to sp+24 addr |
1904 |
++ mtctr 5 # copy 3rd function arg (callback fn pointer) to CTR |
1905 |
++ mr 12, 5 # r12 must hold address of callback we are going to call |
1906 |
++ # for position-idependent functions inside the callback to work |
1907 |
++ mr 5, 1 # set current sp (stack top) as 3rd argument for the callback |
1908 |
++ bctrl # set LR to PC+4 and call the callback |
1909 |
++ ld 2, 24(1) # restore r2 from sp+24 addr |
1910 |
++ |
1911 |
++ // Adjust stack, restore return address and return. |
1912 |
++ // Note: the copied registers do not need to be reloaded here, |
1913 |
++ // because they were preserved by the called routine. |
1914 |
++ addi 1,1,176 # restore original SP by doing sp += 176 |
1915 |
++ ld 0,16(1) # restore original LR from addr sp+16 |
1916 |
++ mtlr 0 # ... copy it to the actual LR |
1917 |
++ blr # return to LR addr |
1918 |
++ |
1919 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/heap/heap_page.h |
1920 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/heap/heap_page.h |
1921 |
+@@ -67,11 +67,12 @@ constexpr size_t kBlinkPageBaseMask = ~kBlinkPageOffsetMask; |
1922 |
+ constexpr size_t kBlinkPagesPerRegion = 10; |
1923 |
+ |
1924 |
+ // TODO(nya): Replace this with something like #if ENABLE_NACL. |
1925 |
+-#if 0 |
1926 |
++#if defined(ARCH_CPU_PPC64) |
1927 |
+ // NaCl's system page size is 64 KiB. This causes a problem in Oilpan's heap |
1928 |
+ // layout because Oilpan allocates two guard pages for each Blink page (whose |
1929 |
+ // size is kBlinkPageSize = 2^17 = 128 KiB). So we don't use guard pages in |
1930 |
+ // NaCl. |
1931 |
++// The same issue holds for ppc64 systems, which use a 64k page size. |
1932 |
+ constexpr size_t kBlinkGuardPageSize = 0; |
1933 |
+ #else |
1934 |
+ constexpr size_t kBlinkGuardPageSize = base::kSystemPageSize; |
1935 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/dtoa/utils.h |
1936 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/dtoa/utils.h |
1937 |
+@@ -45,7 +45,7 @@ |
1938 |
+ // disabled.) |
1939 |
+ // On Linux,x86 89255e-22 != Div_double(89255.0/1e22) |
1940 |
+ #if defined(_M_X64) || defined(__x86_64__) || defined(__ARMEL__) || \ |
1941 |
+- defined(__aarch64__) || defined(__MIPSEL__) |
1942 |
++ defined(__aarch64__) || defined(__MIPSEL__) || defined(__powerpc64__) |
1943 |
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 |
1944 |
+ #elif defined(_M_IX86) || defined(__i386__) |
1945 |
+ #if defined(_WIN32) |
1946 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/BUILD.gn |
1947 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/BUILD.gn |
1948 |
+@@ -100,6 +100,13 @@ if (is_win && !is_msan && current_cpu != "arm64") { |
1949 |
+ } else { |
1950 |
+ public_configs = [ ":no_asm_config" ] |
1951 |
+ } |
1952 |
++ } else if (current_cpu == "ppc64") { |
1953 |
++ if (is_linux) { |
1954 |
++ # TODO: ppc64 (be) check |
1955 |
++ sources += crypto_sources_linux_ppc64le |
1956 |
++ } else { |
1957 |
++ public_configs = [ ":no_asm_config" ] |
1958 |
++ } |
1959 |
+ } else { |
1960 |
+ public_configs = [ ":no_asm_config" ] |
1961 |
+ } |
1962 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h |
1963 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h |
1964 |
+@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU; |
1965 |
+ typedef MDRawContextARM64_Old RawContextCPU; |
1966 |
+ #elif defined(__mips__) |
1967 |
+ typedef MDRawContextMIPS RawContextCPU; |
1968 |
++#elif defined(__powerpc64__) |
1969 |
++typedef MDRawContextPPC64 RawContextCPU; |
1970 |
+ #else |
1971 |
+ #error "This code has not been ported to your platform yet." |
1972 |
+ #endif |
1973 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc |
1974 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc |
1975 |
+@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const { |
1976 |
+ out->float_save.fir = mcontext.fpc_eir; |
1977 |
+ #endif |
1978 |
+ } |
1979 |
+-#endif // __mips__ |
1980 |
++ |
1981 |
++#elif defined(__powerpc64__) |
1982 |
++ |
1983 |
++uintptr_t ThreadInfo::GetInstructionPointer() const { |
1984 |
++ return mcontext.gp_regs[PT_NIP]; |
1985 |
++} |
1986 |
++ |
1987 |
++void ThreadInfo::FillCPUContext(RawContextCPU* out) const { |
1988 |
++ out->context_flags = MD_CONTEXT_PPC64_FULL; |
1989 |
++ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++) |
1990 |
++ out->gpr[i] = mcontext.gp_regs[i]; |
1991 |
++ |
1992 |
++ out->lr = mcontext.gp_regs[PT_LNK]; |
1993 |
++ out->srr0 = mcontext.gp_regs[PT_NIP]; |
1994 |
++ out->srr1 = mcontext.gp_regs[PT_MSR]; |
1995 |
++ out->cr = mcontext.gp_regs[PT_CCR]; |
1996 |
++ out->xer = mcontext.gp_regs[PT_XER]; |
1997 |
++ out->ctr = mcontext.gp_regs[PT_CTR]; |
1998 |
++ |
1999 |
++ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++) |
2000 |
++ out->float_save.fpregs[i] = mcontext.fp_regs[i]; |
2001 |
++ |
2002 |
++ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1]; |
2003 |
++ |
2004 |
++ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) |
2005 |
++ out->vector_save.save_vr[i] = \ |
2006 |
++ {(((uint64_t)vregs.vrregs[i][0]) << 32) |
2007 |
++ | vregs.vrregs[i][1], |
2008 |
++ (((uint64_t)vregs.vrregs[i][2]) << 32) |
2009 |
++ | vregs.vrregs[i][3]}; |
2010 |
++ |
2011 |
++ out->vrsave = vregs.vrsave; |
2012 |
++ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word}; |
2013 |
++ out->vector_save.save_vrvalid = 0xFFFFFFFF; |
2014 |
++} |
2015 |
++#endif // __powerpc64__ |
2016 |
+ |
2017 |
+ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) { |
2018 |
+ assert(gp_regs || size); |
2019 |
+@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) { |
2020 |
+ *gp_regs = mcontext.gregs; |
2021 |
+ if (size) |
2022 |
+ *size = sizeof(mcontext.gregs); |
2023 |
++#elif defined(__powerpc64__) |
2024 |
++ if (gp_regs) |
2025 |
++ *gp_regs = mcontext.gp_regs; |
2026 |
++ if (size) |
2027 |
++ *size = sizeof(mcontext.gp_regs); |
2028 |
+ #else |
2029 |
+ if (gp_regs) |
2030 |
+ *gp_regs = ®s; |
2031 |
+@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) { |
2032 |
+ *fp_regs = &mcontext.fpregs; |
2033 |
+ if (size) |
2034 |
+ *size = sizeof(mcontext.fpregs); |
2035 |
++#elif defined(__powerpc64__) |
2036 |
++ if (fp_regs) |
2037 |
++ *fp_regs = &mcontext.fp_regs; |
2038 |
++ if (size) |
2039 |
++ *size = sizeof(mcontext.fp_regs); |
2040 |
+ #else |
2041 |
+ if (fp_regs) |
2042 |
+ *fp_regs = &fpregs; |
2043 |
+@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) { |
2044 |
+ #endif |
2045 |
+ } |
2046 |
+ |
2047 |
++#if defined(__powerpc64__) |
2048 |
++void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) { |
2049 |
++ if (v_regs) |
2050 |
++ *v_regs = &vregs; |
2051 |
++ if (size) |
2052 |
++ *size = sizeof(vregs); |
2053 |
++} |
2054 |
++#endif |
2055 |
++ |
2056 |
+ } // namespace google_breakpad |
2057 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h |
2058 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h |
2059 |
+@@ -68,6 +68,10 @@ struct ThreadInfo { |
2060 |
+ // Use the structures defined in <sys/user.h> |
2061 |
+ struct user_regs_struct regs; |
2062 |
+ struct user_fpsimd_struct fpregs; |
2063 |
++#elif defined(__powerpc64__) |
2064 |
++ // Use the structures defined in <sys/ucontext.h>. |
2065 |
++ mcontext_t mcontext; |
2066 |
++ vrregset_t vregs; |
2067 |
+ #elif defined(__mips__) |
2068 |
+ // Use the structure defined in <sys/ucontext.h>. |
2069 |
+ mcontext_t mcontext; |
2070 |
+@@ -84,6 +88,11 @@ struct ThreadInfo { |
2071 |
+ |
2072 |
+ // Returns the pointer and size of float point register area. |
2073 |
+ void GetFloatingPointRegisters(void** fp_regs, size_t* size); |
2074 |
++ |
2075 |
++#if defined(__powerpc64__) |
2076 |
++ // Returns the pointer and size of the vector register area. (PPC64 only) |
2077 |
++ void GetVectorRegisters(void** v_regs, size_t* size); |
2078 |
++#endif |
2079 |
+ }; |
2080 |
+ |
2081 |
+ } // namespace google_breakpad |
2082 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
2083 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
2084 |
+@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) { |
2085 |
+ out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused. |
2086 |
+ #endif |
2087 |
+ } |
2088 |
++ |
2089 |
++#elif defined(__powerpc64__) |
2090 |
++ |
2091 |
++uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { |
2092 |
++ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]; |
2093 |
++} |
2094 |
++ |
2095 |
++uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { |
2096 |
++ return uc->uc_mcontext.gp_regs[PT_NIP]; |
2097 |
++} |
2098 |
++ |
2099 |
++void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc, |
2100 |
++ const vrregset_t* vregs) { |
2101 |
++ out->context_flags = MD_CONTEXT_PPC64_FULL; |
2102 |
++ |
2103 |
++ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++) |
2104 |
++ out->gpr[i] = uc->uc_mcontext.gp_regs[i]; |
2105 |
++ |
2106 |
++ out->lr = uc->uc_mcontext.gp_regs[PT_LNK]; |
2107 |
++ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP]; |
2108 |
++ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR]; |
2109 |
++ out->cr = uc->uc_mcontext.gp_regs[PT_CCR]; |
2110 |
++ out->xer = uc->uc_mcontext.gp_regs[PT_XER]; |
2111 |
++ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR]; |
2112 |
++ |
2113 |
++ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++) |
2114 |
++ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i]; |
2115 |
++ |
2116 |
++ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1]; |
2117 |
++ |
2118 |
++ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) |
2119 |
++ out->vector_save.save_vr[i] = |
2120 |
++ {(((uint64_t)vregs->vrregs[i][0]) << 32) |
2121 |
++ | vregs->vrregs[i][1], |
2122 |
++ (((uint64_t)vregs->vrregs[i][2]) << 32) |
2123 |
++ | vregs->vrregs[i][3]}; |
2124 |
++ |
2125 |
++ out->vrsave = vregs->vrsave; |
2126 |
++ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word}; |
2127 |
++ out->vector_save.save_vrvalid = 0xFFFFFFFF; |
2128 |
++} |
2129 |
++ |
2130 |
+ #endif |
2131 |
+ |
2132 |
+ } // namespace google_breakpad |
2133 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h |
2134 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h |
2135 |
+@@ -54,6 +54,9 @@ struct UContextReader { |
2136 |
+ #elif defined(__aarch64__) |
2137 |
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
2138 |
+ const struct fpsimd_context* fpregs); |
2139 |
++#elif defined(__powerpc64__) |
2140 |
++ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
2141 |
++ const vrregset_t* vregs); |
2142 |
+ #else |
2143 |
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc); |
2144 |
+ #endif |
2145 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc |
2146 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc |
2147 |
+@@ -467,9 +467,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) { |
2148 |
+ memcpy(&g_crash_context_.float_state, fp_ptr, |
2149 |
+ sizeof(g_crash_context_.float_state)); |
2150 |
+ } |
2151 |
++#elif defined(__powerpc64__) |
2152 |
++ // On PPC64, we must copy VR state |
2153 |
++ ucontext_t* uc_ptr = (ucontext_t*)uc; |
2154 |
++ if (uc_ptr->uc_mcontext.v_regs) { |
2155 |
++ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs, |
2156 |
++ sizeof(g_crash_context_.vector_state)); |
2157 |
++ } |
2158 |
+ #elif !defined(__ARM_EABI__) && !defined(__mips__) |
2159 |
+ // FP state is not part of user ABI on ARM Linux. |
2160 |
+- // In case of MIPS Linux FP state is already part of ucontext_t |
2161 |
++ // In case of MIPS, Linux FP state is already part of ucontext_t |
2162 |
+ // and 'float_state' is not a member of CrashContext. |
2163 |
+ ucontext_t* uc_ptr = (ucontext_t*)uc; |
2164 |
+ if (uc_ptr->uc_mcontext.fpregs) { |
2165 |
+@@ -707,11 +714,19 @@ bool ExceptionHandler::WriteMinidump() { |
2166 |
+ } |
2167 |
+ #endif |
2168 |
+ |
2169 |
+-#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) |
2170 |
++#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \ |
2171 |
++ && !defined(__powerpc64__) |
2172 |
+ // FPU state is not part of ARM EABI ucontext_t. |
2173 |
+ memcpy(&context.float_state, context.context.uc_mcontext.fpregs, |
2174 |
+ sizeof(context.float_state)); |
2175 |
+ #endif |
2176 |
++ |
2177 |
++#if defined(__powerpc64__) |
2178 |
++ // Vector registers must be copied on PPC64 |
2179 |
++ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs, |
2180 |
++ sizeof(context.vector_state)); |
2181 |
++#endif |
2182 |
++ |
2183 |
+ context.tid = sys_gettid(); |
2184 |
+ |
2185 |
+ // Add an exception stream to the minidump for better reporting. |
2186 |
+@@ -732,6 +747,9 @@ bool ExceptionHandler::WriteMinidump() { |
2187 |
+ #elif defined(__mips__) |
2188 |
+ context.siginfo.si_addr = |
2189 |
+ reinterpret_cast<void*>(context.context.uc_mcontext.pc); |
2190 |
++#elif defined(__powerpc64__) |
2191 |
++ context.siginfo.si_addr = |
2192 |
++ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]); |
2193 |
+ #else |
2194 |
+ #error "This code has not been ported to your platform yet." |
2195 |
+ #endif |
2196 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h |
2197 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h |
2198 |
+@@ -192,7 +192,11 @@ class ExceptionHandler { |
2199 |
+ siginfo_t siginfo; |
2200 |
+ pid_t tid; // the crashing thread. |
2201 |
+ ucontext_t context; |
2202 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2203 |
++#if defined(__powerpc64__) |
2204 |
++ // PPC64's FP state is a part of ucontext_t like MIPS but the vector |
2205 |
++ // state is not, so a struct is needed. |
2206 |
++ vstate_t vector_state; |
2207 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2208 |
+ // #ifdef this out because FP state is not part of user ABI for Linux ARM. |
2209 |
+ // In case of MIPS Linux FP state is already part of ucontext_t so |
2210 |
+ // 'float_state' is not required. |
2211 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc |
2212 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc |
2213 |
+@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) { |
2214 |
+ } |
2215 |
+ |
2216 |
+ // Wait a while until the child should have crashed. |
2217 |
+- usleep(1000000); |
2218 |
++ usleep(2000000); |
2219 |
+ // Kill the child if it is still running. |
2220 |
+ kill(child, SIGKILL); |
2221 |
+ |
2222 |
+@@ -576,6 +576,8 @@ const unsigned char kIllegalInstruction[] = { |
2223 |
+ #if defined(__mips__) |
2224 |
+ // mfc2 zero,Impl - usually illegal in userspace. |
2225 |
+ 0x48, 0x00, 0x00, 0x48 |
2226 |
++#elif defined(__powerpc64__) |
2227 |
++ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu |
2228 |
+ #else |
2229 |
+ // This crashes with SIGILL on x86/x86-64/arm. |
2230 |
+ 0xff, 0xff, 0xff, 0xff |
2231 |
+@@ -771,10 +773,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) { |
2232 |
+ |
2233 |
+ // These are defined here so the parent can use them to check the |
2234 |
+ // data from the minidump afterwards. |
2235 |
+- // Use 4k here because the OS will hand out a single page even |
2236 |
++ // Use the page size here because the OS will hand out a single page even |
2237 |
+ // if a smaller size is requested, and this test wants to |
2238 |
+ // test the upper bound of the memory range. |
2239 |
+- const uint32_t kMemorySize = 4096; // bytes |
2240 |
++ const uint32_t kMemorySize = getpagesize(); // bytes |
2241 |
+ const int kOffset = kMemorySize - sizeof(kIllegalInstruction); |
2242 |
+ |
2243 |
+ const pid_t child = fork(); |
2244 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc |
2245 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc |
2246 |
+@@ -138,7 +138,9 @@ class MicrodumpWriter { |
2247 |
+ const MicrodumpExtraInfo& microdump_extra_info, |
2248 |
+ LinuxDumper* dumper) |
2249 |
+ : ucontext_(context ? &context->context : NULL), |
2250 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2251 |
++#if defined(__powerpc64__) |
2252 |
++ vector_state_(context ? &context->vector_state : NULL), |
2253 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2254 |
+ float_state_(context ? &context->float_state : NULL), |
2255 |
+ #endif |
2256 |
+ dumper_(dumper), |
2257 |
+@@ -337,6 +339,8 @@ class MicrodumpWriter { |
2258 |
+ # else |
2259 |
+ # error "This mips ABI is currently not supported (n32)" |
2260 |
+ #endif |
2261 |
++#elif defined(__powerpc64__) |
2262 |
++ const char kArch[] = "ppc64"; |
2263 |
+ #else |
2264 |
+ #error "This code has not been ported to your platform yet" |
2265 |
+ #endif |
2266 |
+@@ -409,7 +413,9 @@ class MicrodumpWriter { |
2267 |
+ void DumpCPUState() { |
2268 |
+ RawContextCPU cpu; |
2269 |
+ my_memset(&cpu, 0, sizeof(RawContextCPU)); |
2270 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2271 |
++#if defined(__powerpc64__) |
2272 |
++ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_); |
2273 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2274 |
+ UContextReader::FillCPUContext(&cpu, ucontext_, float_state_); |
2275 |
+ #else |
2276 |
+ UContextReader::FillCPUContext(&cpu, ucontext_); |
2277 |
+@@ -605,7 +611,9 @@ class MicrodumpWriter { |
2278 |
+ void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); } |
2279 |
+ |
2280 |
+ const ucontext_t* const ucontext_; |
2281 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2282 |
++#if defined(__powerpc64__) |
2283 |
++ const google_breakpad::vstate_t* const vector_state_; |
2284 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2285 |
+ const google_breakpad::fpstate_t* const float_state_; |
2286 |
+ #endif |
2287 |
+ LinuxDumper* dumper_; |
2288 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc |
2289 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc |
2290 |
+@@ -278,10 +278,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) { |
2291 |
+ CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf); |
2292 |
+ ASSERT_TRUE(ContainsMicrodump(buf)); |
2293 |
+ |
2294 |
++ int page_size = getpagesize(); |
2295 |
+ #ifdef __LP64__ |
2296 |
+- ASSERT_NE(std::string::npos, |
2297 |
+- buf.find("M 0000000000001000 000000000000002A 0000000000001000 " |
2298 |
+- "33221100554477668899AABBCCDDEEFF0 libfoo.so")); |
2299 |
++ // This test is only available for the following page sizes |
2300 |
++ ASSERT_TRUE((page_size == 4096) || (page_size == 65536)); |
2301 |
++ if (page_size == 4096) { |
2302 |
++ ASSERT_NE(std::string::npos, |
2303 |
++ buf.find("M 0000000000001000 000000000000002A 0000000000001000 " |
2304 |
++ "33221100554477668899AABBCCDDEEFF0 libfoo.so")); |
2305 |
++ } else { |
2306 |
++ ASSERT_NE(std::string::npos, |
2307 |
++ buf.find("M 0000000000010000 000000000000002A 0000000000010000 " |
2308 |
++ "33221100554477668899AABBCCDDEEFF0 libfoo.so")); |
2309 |
++ } |
2310 |
+ #else |
2311 |
+ ASSERT_NE(std::string::npos, |
2312 |
+ buf.find("M 00001000 0000002A 00001000 " |
2313 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc |
2314 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc |
2315 |
+@@ -116,6 +116,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { |
2316 |
+ #elif defined(__mips__) |
2317 |
+ stack_pointer = |
2318 |
+ reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); |
2319 |
++#elif defined(__powerpc64__) |
2320 |
++ stack_pointer = |
2321 |
++ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]); |
2322 |
+ #else |
2323 |
+ #error "This code hasn't been ported to your platform yet." |
2324 |
+ #endif |
2325 |
+@@ -200,7 +203,10 @@ bool LinuxCoreDumper::EnumerateThreads() { |
2326 |
+ memset(&info, 0, sizeof(ThreadInfo)); |
2327 |
+ info.tgid = status->pr_pgrp; |
2328 |
+ info.ppid = status->pr_ppid; |
2329 |
+-#if defined(__mips__) |
2330 |
++#if defined(__powerpc64__) |
2331 |
++ for (int i = 0; i < 31; i++) |
2332 |
++ info.mcontext.gp_regs[i] = status->pr_reg[i]; |
2333 |
++#elif defined(__mips__) |
2334 |
+ #if defined(__ANDROID__) |
2335 |
+ for (int i = EF_R0; i <= EF_R31; i++) |
2336 |
+ info.mcontext.gregs[i - EF_R0] = status->pr_reg[i]; |
2337 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc |
2338 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc |
2339 |
+@@ -798,7 +798,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len, |
2340 |
+ reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1)); |
2341 |
+ |
2342 |
+ // The number of bytes of stack which we try to capture. |
2343 |
+- static const ptrdiff_t kStackToCapture = 32 * 1024; |
2344 |
++ // This now depends on page_size to avoid missing data |
2345 |
++ // on systems with larger page sizes. |
2346 |
++ static const ptrdiff_t kStackToCapture = 8 * page_size; |
2347 |
+ |
2348 |
+ const MappingInfo* mapping = FindMapping(stack_pointer); |
2349 |
+ if (!mapping) |
2350 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h |
2351 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h |
2352 |
+@@ -60,7 +60,8 @@ namespace google_breakpad { |
2353 |
+ (defined(__mips__) && _MIPS_SIM == _ABIO32) |
2354 |
+ typedef Elf32_auxv_t elf_aux_entry; |
2355 |
+ #elif defined(__x86_64) || defined(__aarch64__) || \ |
2356 |
+- (defined(__mips__) && _MIPS_SIM != _ABIO32) |
2357 |
++ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \ |
2358 |
++ defined(__powerpc64__) |
2359 |
+ typedef Elf64_auxv_t elf_aux_entry; |
2360 |
+ #endif |
2361 |
+ |
2362 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc |
2363 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc |
2364 |
+@@ -51,6 +51,8 @@ |
2365 |
+ #define TID_PTR_REGISTER "rcx" |
2366 |
+ #elif defined(__mips__) |
2367 |
+ #define TID_PTR_REGISTER "$1" |
2368 |
++#elif defined(__powerpc64__) |
2369 |
++#define TID_PTR_REGISTER "r8" |
2370 |
+ #else |
2371 |
+ #error This test has not been ported to this platform. |
2372 |
+ #endif |
2373 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc |
2374 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc |
2375 |
+@@ -154,19 +154,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child, |
2376 |
+ return true; |
2377 |
+ } |
2378 |
+ |
2379 |
+-bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) |
2380 |
+-{ |
2381 |
++bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) { |
2382 |
+ #ifdef PTRACE_GETREGSET |
2383 |
+ struct iovec io; |
2384 |
+ info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len); |
2385 |
+- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) { |
2386 |
++ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) { |
2387 |
+ return false; |
2388 |
+ } |
2389 |
+ |
2390 |
+ info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len); |
2391 |
+- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) { |
2392 |
++ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) { |
2393 |
+ return false; |
2394 |
+ } |
2395 |
++ |
2396 |
++#if defined(__powerpc64__) |
2397 |
++ // Grab the vector registers on PPC64 too |
2398 |
++ info->GetVectorRegisters(&io.iov_base, &io.iov_len); |
2399 |
++ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) { |
2400 |
++ return false; |
2401 |
++ } |
2402 |
++#endif // defined(__powerpc64__) |
2403 |
++ |
2404 |
+ return true; |
2405 |
+ #else |
2406 |
+ return false; |
2407 |
+@@ -303,6 +311,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { |
2408 |
+ #elif defined(__mips__) |
2409 |
+ stack_pointer = |
2410 |
+ reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); |
2411 |
++#elif defined(__powerpc64__) |
2412 |
++ stack_pointer = |
2413 |
++ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]); |
2414 |
+ #else |
2415 |
+ #error "This code hasn't been ported to your platform yet." |
2416 |
+ #endif |
2417 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc |
2418 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc |
2419 |
+@@ -457,6 +457,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) { |
2420 |
+ #elif defined(__mips__) |
2421 |
+ pid_t* process_tid_location = |
2422 |
+ reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]); |
2423 |
++#elif defined(__powerpc64__) |
2424 |
++ pid_t* process_tid_location = |
2425 |
++ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]); |
2426 |
+ #else |
2427 |
+ #error This test has not been ported to this platform. |
2428 |
+ #endif |
2429 |
+@@ -553,6 +556,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) { |
2430 |
+ uintptr_t heap_addr = thread_info.regs.rcx; |
2431 |
+ #elif defined(__mips__) |
2432 |
+ uintptr_t heap_addr = thread_info.mcontext.gregs[1]; |
2433 |
++#elif defined(__powerpc64__) |
2434 |
++ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8]; |
2435 |
+ #else |
2436 |
+ #error This test has not been ported to this platform. |
2437 |
+ #endif |
2438 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc |
2439 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc |
2440 |
+@@ -136,7 +136,9 @@ class MinidumpWriter { |
2441 |
+ : fd_(minidump_fd), |
2442 |
+ path_(minidump_path), |
2443 |
+ ucontext_(context ? &context->context : NULL), |
2444 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2445 |
++#if defined(__powerpc64__) |
2446 |
++ vector_state_(context ? &context->vector_state : NULL), |
2447 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2448 |
+ float_state_(context ? &context->float_state : NULL), |
2449 |
+ #endif |
2450 |
+ dumper_(dumper), |
2451 |
+@@ -468,7 +470,9 @@ class MinidumpWriter { |
2452 |
+ if (!cpu.Allocate()) |
2453 |
+ return false; |
2454 |
+ my_memset(cpu.get(), 0, sizeof(RawContextCPU)); |
2455 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2456 |
++#if defined(__powerpc64__) |
2457 |
++ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_); |
2458 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2459 |
+ UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_); |
2460 |
+ #else |
2461 |
+ UContextReader::FillCPUContext(cpu.get(), ucontext_); |
2462 |
+@@ -891,7 +895,7 @@ class MinidumpWriter { |
2463 |
+ dirent->location.rva = 0; |
2464 |
+ } |
2465 |
+ |
2466 |
+-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
2467 |
++#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__) |
2468 |
+ bool WriteCPUInformation(MDRawSystemInfo* sys_info) { |
2469 |
+ char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0}; |
2470 |
+ static const char vendor_id_name[] = "vendor_id"; |
2471 |
+@@ -911,7 +915,9 @@ class MinidumpWriter { |
2472 |
+ |
2473 |
+ // processor_architecture should always be set, do this first |
2474 |
+ sys_info->processor_architecture = |
2475 |
+-#if defined(__mips__) |
2476 |
++#if defined(__powerpc64__) |
2477 |
++ MD_CPU_ARCHITECTURE_PPC64; |
2478 |
++#elif defined(__mips__) |
2479 |
+ # if _MIPS_SIM == _ABIO32 |
2480 |
+ MD_CPU_ARCHITECTURE_MIPS; |
2481 |
+ # elif _MIPS_SIM == _ABI64 |
2482 |
+@@ -1327,7 +1333,9 @@ class MinidumpWriter { |
2483 |
+ const char* path_; // Path to the file where the minidum should be written. |
2484 |
+ |
2485 |
+ const ucontext_t* const ucontext_; // also from the signal handler |
2486 |
+-#if !defined(__ARM_EABI__) && !defined(__mips__) |
2487 |
++#if defined(__powerpc64__) |
2488 |
++ const google_breakpad::vstate_t* const vector_state_; |
2489 |
++#elif !defined(__ARM_EABI__) && !defined(__mips__) |
2490 |
+ const google_breakpad::fpstate_t* const float_state_; // ditto |
2491 |
+ #endif |
2492 |
+ LinuxDumper* dumper_; |
2493 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h |
2494 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h |
2495 |
+@@ -47,6 +47,8 @@ class ExceptionHandler; |
2496 |
+ |
2497 |
+ #if defined(__aarch64__) |
2498 |
+ typedef struct fpsimd_context fpstate_t; |
2499 |
++#elif defined(__powerpc64__) |
2500 |
++typedef vrregset_t vstate_t; |
2501 |
+ #elif !defined(__ARM_EABI__) && !defined(__mips__) |
2502 |
+ typedef struct _fpstate fpstate_t; |
2503 |
+ #endif |
2504 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc |
2505 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc |
2506 |
+@@ -710,6 +710,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) { |
2507 |
+ #elif defined(__mips__) |
2508 |
+ context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] = |
2509 |
+ invalid_stack_pointer; |
2510 |
++#elif defined(__powerpc64__) |
2511 |
++ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] = |
2512 |
++ invalid_stack_pointer; |
2513 |
+ #else |
2514 |
+ # error "This code has not been ported to your platform yet." |
2515 |
+ #endif |
2516 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc |
2517 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc |
2518 |
+@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) { |
2519 |
+ } |
2520 |
+ |
2521 |
+ #if defined(__x86_64__) || defined(__aarch64__) || \ |
2522 |
+- (defined(__mips__) && _MIPS_SIM == _ABI64) |
2523 |
+- |
2524 |
++ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__) |
2525 |
+ struct kernel_stat st; |
2526 |
+ if (sys_fstat(fd, &st) == -1 || st.st_size < 0) { |
2527 |
+ #else |
2528 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc |
2529 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc |
2530 |
+@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) { |
2531 |
+ TEST_F(MemoryMappedFileTest, MapWithOffset) { |
2532 |
+ // Put more data in the test file this time. Offsets can only be |
2533 |
+ // done on page boundaries, so we need a two page file to test this. |
2534 |
+- const int page_size = 4096; |
2535 |
+- char data1[2 * page_size]; |
2536 |
+- size_t data1_size = sizeof(data1); |
2537 |
++ const int page_size = getpagesize(); |
2538 |
++ char *data1 = static_cast<char*>(malloc(2 * page_size)); |
2539 |
++ EXPECT_TRUE(data1 != NULL); |
2540 |
++ size_t data1_size = (2 * page_size); |
2541 |
+ for (size_t i = 0; i < data1_size; ++i) { |
2542 |
+ data1[i] = i & 0x7f; |
2543 |
+ } |
2544 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc |
2545 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc |
2546 |
+@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) { |
2547 |
+ |
2548 |
+ EXPECT_EQ(0U, allocator.pages_allocated()); |
2549 |
+ uint8_t *p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000)); |
2550 |
++ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize()); |
2551 |
+ ASSERT_FALSE(p == NULL); |
2552 |
+- EXPECT_EQ(3U, allocator.pages_allocated()); |
2553 |
++ EXPECT_EQ(expected_pages, allocator.pages_allocated()); |
2554 |
+ for (unsigned i = 1; i < 10; ++i) { |
2555 |
+ uint8_t *p = reinterpret_cast<uint8_t*>(allocator.Alloc(i)); |
2556 |
+ ASSERT_FALSE(p == NULL); |
2557 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc |
2558 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc |
2559 |
+@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { |
2560 |
+ // Check architecture and set architecture variable to corresponding flag |
2561 |
+ // in objdump. |
2562 |
+ switch (context->GetContextCPU()) { |
2563 |
++#if defined(__i386) || defined(__x86_64) |
2564 |
+ case MD_CONTEXT_X86: |
2565 |
+ architecture = "i386"; |
2566 |
+ break; |
2567 |
+ case MD_CONTEXT_AMD64: |
2568 |
+ architecture = "i386:x86-64"; |
2569 |
+ break; |
2570 |
++#endif |
2571 |
+ default: |
2572 |
+ // Unsupported architecture. Note that ARM architectures are not |
2573 |
+ // supported because objdump does not support ARM. |
2574 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc |
2575 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc |
2576 |
+@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) { |
2577 |
+ } |
2578 |
+ |
2579 |
+ TEST(ExploitabilityTest, TestWindowsEngine) { |
2580 |
++// The following tests are only executable on an x86-class linux machine. |
2581 |
++#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64)) |
2582 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH, |
2583 |
+ ExploitabilityFor("ascii_read_av.dmp")); |
2584 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH, |
2585 |
+@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) { |
2586 |
+ ExploitabilityFor("read_av_clobber_write.dmp")); |
2587 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW, |
2588 |
+ ExploitabilityFor("read_av_conditional.dmp")); |
2589 |
++#endif |
2590 |
+ } |
2591 |
+ |
2592 |
+ TEST(ExploitabilityTest, TestLinuxEngine) { |
2593 |
++// The following tests are only executable on an x86-class linux machine. |
2594 |
++#if defined(__i386) || defined(__x86_64) |
2595 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING, |
2596 |
+ ExploitabilityFor("linux_null_read_av.dmp")); |
2597 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH, |
2598 |
+@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) { |
2599 |
+ ExploitabilityFor("linux_executable_heap.dmp")); |
2600 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH, |
2601 |
+ ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp")); |
2602 |
+-#ifndef _WIN32 |
2603 |
++#endif |
2604 |
++#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64)) |
2605 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH, |
2606 |
+ ExploitabilityFor("linux_write_to_nonwritable_module.dmp")); |
2607 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH, |
2608 |
+@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) { |
2609 |
+ ExploitabilityFor("linux_write_to_outside_module_via_math.dmp")); |
2610 |
+ ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING, |
2611 |
+ ExploitabilityFor("linux_write_to_under_4k.dmp")); |
2612 |
+-#endif // _WIN32 |
2613 |
++#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64)) |
2614 |
+ } |
2615 |
+ |
2616 |
+-#ifndef _WIN32 |
2617 |
++#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64)) |
2618 |
+ TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) { |
2619 |
+ ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL)); |
2620 |
+ uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0}; |
2621 |
+@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) { |
2622 |
+ context, |
2623 |
+ &write_address)); |
2624 |
+ } |
2625 |
+-#endif // _WIN32 |
2626 |
++#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64)) |
2627 |
++ |
2628 |
+ |
2629 |
+ } // namespace |
2630 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc |
2631 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc |
2632 |
+@@ -76,6 +76,8 @@ |
2633 |
+ #define ELF_ARCH EM_MIPS |
2634 |
+ #elif defined(__aarch64__) |
2635 |
+ #define ELF_ARCH EM_AARCH64 |
2636 |
++#elif defined(__powerpc64__) |
2637 |
++ #define ELF_ARCH EM_PPC64 |
2638 |
+ #endif |
2639 |
+ |
2640 |
+ #if defined(__arm__) |
2641 |
+@@ -86,6 +88,8 @@ typedef user_regs user_regs_struct; |
2642 |
+ #elif defined (__mips__) |
2643 |
+ // This file-local typedef simplifies the source code. |
2644 |
+ typedef gregset_t user_regs_struct; |
2645 |
++#elif defined(__powerpc64__) |
2646 |
++typedef struct pt_regs user_regs_struct; |
2647 |
+ #endif |
2648 |
+ |
2649 |
+ using google_breakpad::MDTypeHelper; |
2650 |
+@@ -320,6 +324,9 @@ struct CrashedProcess { |
2651 |
+ #endif |
2652 |
+ #if defined(__aarch64__) |
2653 |
+ user_fpsimd_struct fpregs; |
2654 |
++#endif |
2655 |
++#if defined(__powerpc64__) |
2656 |
++ mcontext_t mcontext; |
2657 |
+ #endif |
2658 |
+ uintptr_t stack_addr; |
2659 |
+ const uint8_t* stack; |
2660 |
+@@ -534,6 +541,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread, |
2661 |
+ thread->mcontext.fpc_eir = rawregs->float_save.fir; |
2662 |
+ #endif |
2663 |
+ } |
2664 |
++#elif defined(__powerpc64__) |
2665 |
++static void |
2666 |
++ParseThreadRegisters(CrashedProcess::Thread* thread, |
2667 |
++ const MinidumpMemoryRange& range) { |
2668 |
++ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0); |
2669 |
++ |
2670 |
++ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++) |
2671 |
++ thread->mcontext.gp_regs[i] = rawregs->gpr[i]; |
2672 |
++ |
2673 |
++ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr; |
2674 |
++ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0; |
2675 |
++ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1; |
2676 |
++ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr; |
2677 |
++ thread->mcontext.gp_regs[PT_XER] = rawregs->xer; |
2678 |
++ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr; |
2679 |
++ thread->mcontext.v_regs->vrsave = rawregs->vrsave; |
2680 |
++ |
2681 |
++ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++) |
2682 |
++ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i]; |
2683 |
++ |
2684 |
++ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr; |
2685 |
++ |
2686 |
++ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) { |
2687 |
++ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32; |
2688 |
++ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high; |
2689 |
++ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32; |
2690 |
++ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low; |
2691 |
++ } |
2692 |
++ |
2693 |
++ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF; |
2694 |
++} |
2695 |
++ |
2696 |
+ #else |
2697 |
+ #error "This code has not been ported to your platform yet" |
2698 |
+ #endif |
2699 |
+@@ -622,6 +661,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo, |
2700 |
+ # else |
2701 |
+ # error "This mips ABI is currently not supported (n32)" |
2702 |
+ # endif |
2703 |
++#elif defined(__powerpc64__) |
2704 |
++ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) { |
2705 |
++ fprintf(stderr, |
2706 |
++ "This version of minidump-2-core only supports PPC64.\n"); |
2707 |
++ exit(1); |
2708 |
++ } |
2709 |
+ #else |
2710 |
+ #error "This code has not been ported to your platform yet" |
2711 |
+ #endif |
2712 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/CONTRIBUTORS |
2713 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/CONTRIBUTORS |
2714 |
+@@ -13,3 +13,4 @@ Mark Mentovai <mark@××××××××.org> |
2715 |
+ Robert Sesek <rsesek@××××××××.org> |
2716 |
+ Scott Graham <scottmg@××××××××.org> |
2717 |
+ Joshua Peraza <jperaza@××××××××.org> |
2718 |
++Shawn Anastasio <shawn@×××××××.io> |
2719 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux/sys/user.h |
2720 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux/sys/user.h |
2721 |
+@@ -15,6 +15,7 @@ |
2722 |
+ #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_ |
2723 |
+ #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_ |
2724 |
+ |
2725 |
++#include <cstddef> |
2726 |
+ #include_next <sys/user.h> |
2727 |
+ |
2728 |
+ #include <features.h> |
2729 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context.h |
2730 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context.h |
2731 |
+@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 { |
2732 |
+ uint64_t fir; |
2733 |
+ }; |
2734 |
+ |
2735 |
++//! \brief ppc64-specific flags for MinidumpPPC64::context_flags |
2736 |
++//! Based on minidump_cpu_ppc64.h from breakpad |
2737 |
++enum MinidumpContextPPC64Flags : uint32_t { |
2738 |
++ //! \brief Identifies the context as PPC64. |
2739 |
++ kMinidumpContextPPC64 = 0x01000000, |
2740 |
++ |
2741 |
++ //! \brief Indicates the validity of general purpose registers. |
2742 |
++ //! |
2743 |
++ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid. |
2744 |
++ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001, |
2745 |
++ |
2746 |
++ //! \brief Indicates the validity of floating point registers. |
2747 |
++ //! |
2748 |
++ //! Registers `fp0`-`fp31`, `fpscr` are valid. |
2749 |
++ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008, |
2750 |
++ |
2751 |
++ //! \brief Indicates the validity of Altivec/VMX registers. |
2752 |
++ //! |
2753 |
++ //! Registers `v0`-`v31`, `vscr`, `vrsave`. |
2754 |
++ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020, |
2755 |
++ |
2756 |
++ //! \brief Indicates the validity of all registers |
2757 |
++ kMinidumpContextPPC64All = kMinidumpContextPPC64Base | |
2758 |
++ kMinidumpContextPPC64Floating | |
2759 |
++ kMinidumpContextPPC64Vector |
2760 |
++}; |
2761 |
++ |
2762 |
++//! \brief A PPC64 CPU context carried in a minidump file. |
2763 |
++//! Based on minidump_cpu_ppc64.h from breakpad. |
2764 |
++struct MinidumpContextPPC64 { |
2765 |
++ uint64_t context_flags; |
2766 |
++ |
2767 |
++ //! \brief General purpose registers. |
2768 |
++ uint64_t nip; |
2769 |
++ uint64_t msr; |
2770 |
++ uint64_t regs[32]; |
2771 |
++ uint64_t ccr; |
2772 |
++ uint64_t xer; |
2773 |
++ uint64_t lnk; |
2774 |
++ uint64_t ctr; |
2775 |
++ |
2776 |
++ //! \brief Floating point registers. |
2777 |
++ double fpregs[32]; |
2778 |
++ |
2779 |
++ //! \brief FPU status register. |
2780 |
++ double fpscr; |
2781 |
++ |
2782 |
++ //! \brief Altivec/VMX vector registers. |
2783 |
++ struct { |
2784 |
++ //! \brief Vector registers are 128bits. |
2785 |
++ uint128_struct save_vr[32]; |
2786 |
++ uint128_struct save_vscr; |
2787 |
++ |
2788 |
++ //! \brief Padding included for breakpad compatibiltiy. |
2789 |
++ uint32_t save_pad5[4]; |
2790 |
++ |
2791 |
++ //! \brief VRSAVE register. |
2792 |
++ uint32_t save_vrsave; |
2793 |
++ |
2794 |
++ //! \brief Padding included for breakpad compatibiltiy. |
2795 |
++ uint32_t save_pad6[7]; |
2796 |
++ } vregs; |
2797 |
++}; |
2798 |
++ |
2799 |
+ } // namespace crashpad |
2800 |
+ |
2801 |
+ #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
2802 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc |
2803 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc |
2804 |
+@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) { |
2805 |
+ break; |
2806 |
+ } |
2807 |
+ |
2808 |
++ case kCPUArchitecturePPC64: { |
2809 |
++ context = std::make_unique<MinidumpContextPPC64Writer>(); |
2810 |
++ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get()) |
2811 |
++ ->InitalizeFromSnapshot(context_snapshot->ppc64); |
2812 |
++ break; |
2813 |
++ } |
2814 |
++ |
2815 |
+ default: { |
2816 |
+ LOG(ERROR) << "unknown context architecture " |
2817 |
+ << context_snapshot->architecture; |
2818 |
+@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const { |
2819 |
+ return sizeof(context_); |
2820 |
+ } |
2821 |
+ |
2822 |
++MinidumpContextPPC64Writer::MinidumpContextPPC64Writer() |
2823 |
++ : MinidumpContextWriter(), context_() { |
2824 |
++ context_.context_flags = kMinidumpContextPPC64; |
2825 |
++} |
2826 |
++ |
2827 |
++MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default; |
2828 |
++ |
2829 |
++void MinidumpContextPPC64Writer::InitalizeFromSnapshot( |
2830 |
++ const CPUContextPPC64* context_snapshot) { |
2831 |
++ DCHECK_EQ(state(), kStateMutable); |
2832 |
++ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64); |
2833 |
++ |
2834 |
++ context_.context_flags = kMinidumpContextPPC64All; |
2835 |
++ |
2836 |
++ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs)); |
2837 |
++ context_.nip = context_snapshot->nip; |
2838 |
++ context_.msr = context_snapshot->msr; |
2839 |
++ context_.ccr = context_snapshot->ccr; |
2840 |
++ context_.xer = context_snapshot->xer; |
2841 |
++ context_.lnk = context_snapshot->lnk; |
2842 |
++ context_.ctr = context_snapshot->ctr; |
2843 |
++ |
2844 |
++ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs)); |
2845 |
++ context_.fpscr = context_snapshot->fpscr; |
2846 |
++ |
2847 |
++ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr, |
2848 |
++ sizeof(context_.vregs.save_vr)); |
2849 |
++ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr, |
2850 |
++ sizeof(context_.vregs.save_vscr)); |
2851 |
++ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave; |
2852 |
++} |
2853 |
++ |
2854 |
++bool MinidumpContextPPC64Writer::WriteObject( |
2855 |
++ FileWriterInterface* file_writer) { |
2856 |
++ DCHECK_EQ(state(), kStateWritable); |
2857 |
++ return file_writer->Write(&context_, sizeof(context_)); |
2858 |
++} |
2859 |
++ |
2860 |
++size_t MinidumpContextPPC64Writer::ContextSize() const { |
2861 |
++ DCHECK_GE(state(), kStateFrozen); |
2862 |
++ return sizeof(context_); |
2863 |
++} |
2864 |
++ |
2865 |
+ } // namespace crashpad |
2866 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h |
2867 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h |
2868 |
+@@ -315,6 +315,45 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter { |
2869 |
+ DISALLOW_COPY_AND_ASSIGN(MinidumpContextMIPS64Writer); |
2870 |
+ }; |
2871 |
+ |
2872 |
++class MinidumpContextPPC64Writer final : public MinidumpContextWriter { |
2873 |
++ public: |
2874 |
++ MinidumpContextPPC64Writer(); |
2875 |
++ ~MinidumpContextPPC64Writer() override; |
2876 |
++ |
2877 |
++ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot. |
2878 |
++ //! |
2879 |
++ //! \param[in] context_snapshot The context snapshot to use as source data. |
2880 |
++ //! |
2881 |
++ //! \note Valid in #kStateMutable. No mutation of context() may be done before |
2882 |
++ //! calling this method, and it is not normally necessary to alter |
2883 |
++ //! context() after calling this method. |
2884 |
++ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot); |
2885 |
++ |
2886 |
++ //! \brief Returns a pointer to the context structure that this object will |
2887 |
++ //! write. |
2888 |
++ //! |
2889 |
++ //! \attention This returns a non-`const` pointer to this object’s private |
2890 |
++ //! data so that a caller can populate the context structure directly. |
2891 |
++ //! This is done because providing setter interfaces to each field in the |
2892 |
++ //! context structure would be unwieldy and cumbersome. Care must be taken |
2893 |
++ //! to populate the context structure correctly. The context structure |
2894 |
++ //! must only be modified while this object is in the #kStateMutable |
2895 |
++ //! state. |
2896 |
++ MinidumpContextPPC64* context() { return &context_; } |
2897 |
++ |
2898 |
++ protected: |
2899 |
++ // MinidumpWritable: |
2900 |
++ bool WriteObject(FileWriterInterface* file_writer) override; |
2901 |
++ |
2902 |
++ // MinidumpContextWriter: |
2903 |
++ size_t ContextSize() const override; |
2904 |
++ |
2905 |
++ private: |
2906 |
++ MinidumpContextPPC64 context_; |
2907 |
++ |
2908 |
++ DISALLOW_COPY_AND_ASSIGN(MinidumpContextPPC64Writer); |
2909 |
++}; |
2910 |
++ |
2911 |
+ } // namespace crashpad |
2912 |
+ |
2913 |
+ #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_ |
2914 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc |
2915 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc |
2916 |
+@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) { |
2917 |
+ context, ExpectMinidumpContextMIPS64, kSeed); |
2918 |
+ } |
2919 |
+ |
2920 |
++TEST(MinidumpContextWriter, PPC64_Zeros) { |
2921 |
++ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>( |
2922 |
++ ExpectMinidumpContextPPC64); |
2923 |
++} |
2924 |
++ |
2925 |
++TEST(MinidumpContextWriter, PPC64_FromSnapshot) { |
2926 |
++ constexpr uint32_t kSeed = 64; |
2927 |
++ CPUContextPPC64 context_ppc64; |
2928 |
++ CPUContext context; |
2929 |
++ context.ppc64 = &context_ppc64; |
2930 |
++ InitializeCPUContextPPC64(&context, kSeed); |
2931 |
++ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>( |
2932 |
++ context, ExpectMinidumpContextPPC64, kSeed); |
2933 |
++} |
2934 |
++ |
2935 |
+ } // namespace |
2936 |
+ } // namespace test |
2937 |
+ } // namespace crashpad |
2938 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc |
2939 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc |
2940 |
+@@ -126,6 +126,8 @@ std::string MinidumpMiscInfoDebugBuildString() { |
2941 |
+ static constexpr char kCPU[] = "mips"; |
2942 |
+ #elif defined(ARCH_CPU_MIPS64EL) |
2943 |
+ static constexpr char kCPU[] = "mips64"; |
2944 |
++#elif defined(ARCH_CPU_PPC64) |
2945 |
++ static constexpr char kCPU[] = "ppc64"; |
2946 |
+ #else |
2947 |
+ #error define kCPU for this CPU |
2948 |
+ #endif |
2949 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc |
2950 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc |
2951 |
+@@ -111,6 +111,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context, |
2952 |
+ for (size_t i = 0; i < base::size(context.mipsel->regs); ++i) { |
2953 |
+ MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]); |
2954 |
+ } |
2955 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
2956 |
++ MaybeCaptureMemoryAround(delegate, context.ppc64->nip); |
2957 |
++ for (size_t i = 0; i < base::size(context.ppc64->regs); ++i) { |
2958 |
++ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]); |
2959 |
++ } |
2960 |
+ #else |
2961 |
+ #error Port. |
2962 |
+ #endif |
2963 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_architecture.h |
2964 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_architecture.h |
2965 |
+@@ -43,7 +43,10 @@ enum CPUArchitecture { |
2966 |
+ kCPUArchitectureMIPSEL, |
2967 |
+ |
2968 |
+ //! \brief 64-bit MIPSEL. |
2969 |
+- kCPUArchitectureMIPS64EL |
2970 |
++ kCPUArchitectureMIPS64EL, |
2971 |
++ |
2972 |
++ //! \brief 64-bit PPC64. |
2973 |
++ kCPUArchitecturePPC64 |
2974 |
+ }; |
2975 |
+ |
2976 |
+ } // namespace crashpad |
2977 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_context.cc |
2978 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_context.cc |
2979 |
+@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const { |
2980 |
+ return arm->pc; |
2981 |
+ case kCPUArchitectureARM64: |
2982 |
+ return arm64->pc; |
2983 |
++ case kCPUArchitecturePPC64: |
2984 |
++ return ppc64->nip; |
2985 |
+ default: |
2986 |
+ NOTREACHED(); |
2987 |
+ return ~0ull; |
2988 |
+@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const { |
2989 |
+ return arm->sp; |
2990 |
+ case kCPUArchitectureARM64: |
2991 |
+ return arm64->sp; |
2992 |
++ case kCPUArchitecturePPC64: |
2993 |
++ return ppc64->regs[1]; |
2994 |
+ default: |
2995 |
+ NOTREACHED(); |
2996 |
+ return ~0ull; |
2997 |
+@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const { |
2998 |
+ case kCPUArchitectureX86_64: |
2999 |
+ case kCPUArchitectureARM64: |
3000 |
+ case kCPUArchitectureMIPS64EL: |
3001 |
++ case kCPUArchitecturePPC64: |
3002 |
+ return true; |
3003 |
+ case kCPUArchitectureX86: |
3004 |
+ case kCPUArchitectureARM: |
3005 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_context.h |
3006 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_context.h |
3007 |
+@@ -352,6 +352,24 @@ struct CPUContextMIPS64 { |
3008 |
+ uint64_t fir; |
3009 |
+ }; |
3010 |
+ |
3011 |
++//! \brief A context structure carrying PPC64 CPU state. |
3012 |
++struct CPUContextPPC64 { |
3013 |
++ uint64_t nip; |
3014 |
++ uint64_t msr; |
3015 |
++ uint64_t regs[32]; |
3016 |
++ uint64_t ccr; |
3017 |
++ uint64_t xer; |
3018 |
++ uint64_t lnk; |
3019 |
++ uint64_t ctr; |
3020 |
++ double fpregs[32]; |
3021 |
++ double fpscr; |
3022 |
++ struct { |
3023 |
++ uint128_struct save_vr[32]; |
3024 |
++ uint128_struct save_vscr; |
3025 |
++ uint32_t save_vrsave; |
3026 |
++ } vregs; |
3027 |
++}; |
3028 |
++ |
3029 |
+ //! \brief A context structure capable of carrying the context of any supported |
3030 |
+ //! CPU architecture. |
3031 |
+ struct CPUContext { |
3032 |
+@@ -382,6 +400,7 @@ struct CPUContext { |
3033 |
+ CPUContextARM64* arm64; |
3034 |
+ CPUContextMIPS* mipsel; |
3035 |
+ CPUContextMIPS64* mips64; |
3036 |
++ CPUContextPPC64* ppc64; |
3037 |
+ }; |
3038 |
+ }; |
3039 |
+ |
3040 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h |
3041 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h |
3042 |
+@@ -15,6 +15,7 @@ |
3043 |
+ #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_ |
3044 |
+ #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_ |
3045 |
+ |
3046 |
++#include <cstring> |
3047 |
+ #include "build/build_config.h" |
3048 |
+ #include "snapshot/cpu_context.h" |
3049 |
+ #include "snapshot/linux/signal_context.h" |
3050 |
+@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS( |
3051 |
+ |
3052 |
+ #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN |
3053 |
+ |
3054 |
++#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN |
3055 |
++ |
3056 |
++//! \brief Initalizes a CPUContextPPC64 structure from native context |
3057 |
++//! structures on Linux. |
3058 |
++//! |
3059 |
++//! \param[in] thread_context The native thread context. |
3060 |
++//! \param[in] float_context The native float context. |
3061 |
++//! \param[in] vector_context The native vector context. |
3062 |
++//! \param[out] context The CPUContextPPC64 structure to initalize. |
3063 |
++template <typename Traits> |
3064 |
++void InitializeCPUContextPPC64( |
3065 |
++ const ThreadContext::t64_t& thread_context, |
3066 |
++ const FloatContext::f64_t& float_context, |
3067 |
++ const VectorContext::v64_t& vector_context, |
3068 |
++ typename Traits::CPUContext* context) { |
3069 |
++ |
3070 |
++ memcpy(context->regs, thread_context.gpr, sizeof(context->regs)); |
3071 |
++ context->nip = thread_context.nip; |
3072 |
++ context->msr = thread_context.msr; |
3073 |
++ context->ccr = thread_context.ccr; |
3074 |
++ context->xer = thread_context.xer; |
3075 |
++ context->lnk = thread_context.lnk; |
3076 |
++ context->ctr = thread_context.ctr; |
3077 |
++ |
3078 |
++ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs)); |
3079 |
++ context->fpscr = float_context.fpscr; |
3080 |
++ |
3081 |
++ for (uint8_t i = 0; i < 32; i++) { |
3082 |
++ context->vregs.save_vr[i] = { |
3083 |
++ (((uint64_t)vector_context.vrregs[i][0]) << 32) | |
3084 |
++ vector_context.vrregs[i][1], |
3085 |
++ (((uint64_t)vector_context.vrregs[i][2]) << 32) | |
3086 |
++ vector_context.vrregs[i][3] |
3087 |
++ }; |
3088 |
++ } |
3089 |
++ context->vregs.save_vrsave = vector_context.vrsave; |
3090 |
++ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word}; |
3091 |
++} |
3092 |
++ |
3093 |
++template <typename Traits> |
3094 |
++void InitializeCPUContextPPC64( |
3095 |
++ const SignalThreadContext64 &thread_context, |
3096 |
++ const SignalFloatContext64 &float_context, |
3097 |
++ const SignalVectorContext64 &vector_context, |
3098 |
++ typename Traits::CPUContext* context) { |
3099 |
++ |
3100 |
++ memcpy(context->regs, thread_context.regs, sizeof(context->regs)); |
3101 |
++ context->nip = thread_context.nip; |
3102 |
++ context->msr = thread_context.msr; |
3103 |
++ context->ccr = thread_context.ccr; |
3104 |
++ context->xer = thread_context.xer; |
3105 |
++ context->lnk = thread_context.lnk; |
3106 |
++ context->ctr = thread_context.ctr; |
3107 |
++ |
3108 |
++ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs)); |
3109 |
++ context->fpscr = float_context.fpscr; |
3110 |
++ |
3111 |
++ for (uint8_t i = 0; i < 32; i++) { |
3112 |
++ context->vregs.save_vr[i] = { |
3113 |
++ (((uint64_t)vector_context.vrregs[i][0]) << 32) | |
3114 |
++ vector_context.vrregs[i][1], |
3115 |
++ (((uint64_t)vector_context.vrregs[i][2]) << 32) | |
3116 |
++ vector_context.vrregs[i][3] |
3117 |
++ }; |
3118 |
++ } |
3119 |
++ context->vregs.save_vrsave = vector_context.vrsave; |
3120 |
++ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word}; |
3121 |
++} |
3122 |
++ |
3123 |
++ |
3124 |
++#endif |
3125 |
++ |
3126 |
+ } // namespace internal |
3127 |
+ } // namespace crashpad |
3128 |
+ |
3129 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc |
3130 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc |
3131 |
+@@ -159,9 +159,11 @@ void TestAgainstTarget(PtraceConnection* connection) { |
3132 |
+ const bool is_vdso_mapping = |
3133 |
+ device == 0 && inode == 0 && mapping_name == "[vdso]"; |
3134 |
+ static constexpr char kPrefix[] = "linux-vdso.so."; |
3135 |
++ static constexpr char kPrefix64[] = "linux-vdso64.so."; |
3136 |
+ return is_vdso_mapping == |
3137 |
+ (module_name.empty() || |
3138 |
+- module_name.compare(0, strlen(kPrefix), kPrefix) == 0); |
3139 |
++ module_name.compare(0, strlen(kPrefix), kPrefix) == 0 || |
3140 |
++ module_name.compare(0, strlen(kPrefix64), kPrefix64) == 0); |
3141 |
+ }, |
3142 |
+ module_mapping->name, |
3143 |
+ module_mapping->device, |
3144 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc |
3145 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc |
3146 |
+@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>( |
3147 |
+ reader, context_address, context_.mips64); |
3148 |
+ } |
3149 |
+ |
3150 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3151 |
++ |
3152 |
++template <typename Traits> |
3153 |
++static bool ReadContext(ProcessReaderLinux* reader, |
3154 |
++ LinuxVMAddress context_address, |
3155 |
++ typename Traits::CPUContext* dest_context) { |
3156 |
++ const ProcessMemory* memory = reader->Memory(); |
3157 |
++ |
3158 |
++ LinuxVMAddress gp_regs_address = context_address + |
3159 |
++ offsetof(UContext, mcontext) + |
3160 |
++ offsetof(typename Traits::MContext, gp_regs); |
3161 |
++ |
3162 |
++ typename Traits::SignalThreadContext thread_context; |
3163 |
++ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) { |
3164 |
++ LOG(ERROR) << "Couldn't read gp_regs!"; |
3165 |
++ return false; |
3166 |
++ } |
3167 |
++ |
3168 |
++ LinuxVMAddress fp_regs_address = context_address + |
3169 |
++ offsetof(UContext, mcontext) + |
3170 |
++ offsetof(typename Traits::MContext, fp_regs); |
3171 |
++ |
3172 |
++ typename Traits::SignalFloatContext fp_context; |
3173 |
++ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) { |
3174 |
++ LOG(ERROR) << "Couldn't read fp_regs!"; |
3175 |
++ return false; |
3176 |
++ } |
3177 |
++ |
3178 |
++ LinuxVMAddress v_regs_ptr_address = context_address + |
3179 |
++ offsetof(UContext, mcontext) + |
3180 |
++ offsetof(typename Traits::MContext, vmx_reserve) + 8; |
3181 |
++ |
3182 |
++ typename Traits::SignalVectorContext v_context; |
3183 |
++ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) { |
3184 |
++ LOG(ERROR) << "Couldn't read v_regs!"; |
3185 |
++ return false; |
3186 |
++ } |
3187 |
++ |
3188 |
++ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context, |
3189 |
++ v_context, dest_context); |
3190 |
++ |
3191 |
++ return true; |
3192 |
++} |
3193 |
++ |
3194 |
++template<> |
3195 |
++bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>( |
3196 |
++ ProcessReaderLinux* reader, |
3197 |
++ LinuxVMAddress context_address) { |
3198 |
++ context_.architecture = kCPUArchitecturePPC64; |
3199 |
++ context_.ppc64 = &context_union_.ppc64; |
3200 |
++ |
3201 |
++ return internal::ReadContext<ContextTraits64>( |
3202 |
++ reader, context_address, context_.ppc64); |
3203 |
++} |
3204 |
++ |
3205 |
++template<> |
3206 |
++bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>( |
3207 |
++ ProcessReaderLinux* reader, |
3208 |
++ LinuxVMAddress context_address) { |
3209 |
++ // PPC64 is 64-bit |
3210 |
++ return false; |
3211 |
++} |
3212 |
++ |
3213 |
+ #endif // ARCH_CPU_X86_FAMILY |
3214 |
+ |
3215 |
+ bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader, |
3216 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h |
3217 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h |
3218 |
+@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot { |
3219 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3220 |
+ CPUContextMIPS mipsel; |
3221 |
+ CPUContextMIPS64 mips64; |
3222 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3223 |
++ CPUContextPPC64 ppc64; |
3224 |
+ #endif |
3225 |
+ } context_union_; |
3226 |
+ CPUContext context_; |
3227 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc |
3228 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc |
3229 |
+@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) { |
3230 |
+ 0); |
3231 |
+ #undef CPU_ARCH_NAME |
3232 |
+ } |
3233 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3234 |
++using NativeCPUContext = ucontext_t; |
3235 |
++ |
3236 |
++void InitializeContext(NativeCPUContext* context) { |
3237 |
++ for (size_t reg = 0; reg < 32; ++reg) { |
3238 |
++ context->uc_mcontext.gp_regs[reg] = reg; |
3239 |
++ } |
3240 |
++ |
3241 |
++ memset(&context->uc_mcontext.fp_regs, 44, |
3242 |
++ sizeof(context->uc_mcontext.fp_regs)); |
3243 |
++} |
3244 |
+ |
3245 |
++void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) { |
3246 |
++ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64); |
3247 |
++ |
3248 |
++ for (size_t reg = 0; reg < 32; ++reg) { |
3249 |
++ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]); |
3250 |
++ } |
3251 |
++ |
3252 |
++ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs, |
3253 |
++ sizeof(actual.ppc64->fpregs)), 0); |
3254 |
++} |
3255 |
+ #else |
3256 |
+ #error Port. |
3257 |
+ #endif |
3258 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc |
3259 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc |
3260 |
+@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) { |
3261 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3262 |
+ stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29] |
3263 |
+ : thread_info.thread_context.t32.regs[29]; |
3264 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3265 |
++ stack_pointer = thread_info.thread_context.t64.gpr[1]; |
3266 |
+ #else |
3267 |
+ #error Port. |
3268 |
+ #endif |
3269 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux_test.cc |
3270 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux_test.cc |
3271 |
+@@ -591,6 +591,8 @@ bool WriteTestModule(const base::FilePath& module_path) { |
3272 |
+ module.ehdr.e_machine = EM_AARCH64; |
3273 |
+ #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL) |
3274 |
+ module.ehdr.e_machine = EM_MIPS; |
3275 |
++#elif defined(ARCH_CPU_PPC64) |
3276 |
++ module.ehdr.e_machine = EM_PPC64; |
3277 |
+ #endif |
3278 |
+ |
3279 |
+ module.ehdr.e_version = EV_CURRENT; |
3280 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h |
3281 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h |
3282 |
+@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) == |
3283 |
+ "context offset mismatch"); |
3284 |
+ #endif |
3285 |
+ |
3286 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3287 |
++ |
3288 |
++struct SignalThreadContext64 { |
3289 |
++ uint64_t regs[32]; |
3290 |
++ uint64_t nip; |
3291 |
++ uint64_t msr; |
3292 |
++ uint64_t orig_r3; |
3293 |
++ uint64_t ctr; |
3294 |
++ uint64_t lnk; |
3295 |
++ uint64_t xer; |
3296 |
++ uint64_t ccr; |
3297 |
++ uint64_t softe; |
3298 |
++ uint64_t trap; |
3299 |
++ uint64_t dar; |
3300 |
++ uint64_t dsisr; |
3301 |
++ uint64_t result; |
3302 |
++ uint64_t dscr; |
3303 |
++ uint64_t fpr0[3]; |
3304 |
++}; |
3305 |
++ |
3306 |
++struct SignalFloatContext64 { |
3307 |
++ double regs[32]; |
3308 |
++ double fpscr; |
3309 |
++}; |
3310 |
++ |
3311 |
++struct SignalVectorContext64 { |
3312 |
++ int32_t vrregs[32][4]; |
3313 |
++ struct { |
3314 |
++ int32_t __pad[3]; |
3315 |
++ int32_t vscr_word; |
3316 |
++ } vscr; |
3317 |
++ int32_t vrsave; |
3318 |
++ int32_t __pad[3]; |
3319 |
++} __attribute__((__aligned__(16))); |
3320 |
++ |
3321 |
++ |
3322 |
++#pragma pack(pop) |
3323 |
++struct MContext64 { |
3324 |
++ uint64_t reserved[4]; |
3325 |
++ int32_t signal; |
3326 |
++ int32_t __pad0; |
3327 |
++ uint64_t handler; |
3328 |
++ uint64_t oldmask; |
3329 |
++ uint64_t pt_regs_ptr; |
3330 |
++ SignalThreadContext64 gp_regs; |
3331 |
++ SignalFloatContext64 fp_regs; |
3332 |
++ SignalVectorContext64 *v_regs; |
3333 |
++ int64_t vmx_reserve[69]; |
3334 |
++}; |
3335 |
++ |
3336 |
++struct ContextTraits64 : public Traits64 { |
3337 |
++ using MContext = MContext64; |
3338 |
++ using SignalThreadContext = SignalThreadContext64; |
3339 |
++ using SignalFloatContext = SignalFloatContext64; |
3340 |
++ using SignalVectorContext = SignalVectorContext64; |
3341 |
++ using CPUContext = CPUContextPPC64; |
3342 |
++}; |
3343 |
++ |
3344 |
++struct ContextTraits32 : public Traits32 {}; |
3345 |
++ |
3346 |
++struct UContext { |
3347 |
++ uint64_t flags; |
3348 |
++ uint64_t link; |
3349 |
++ SignalStack<ContextTraits64> stack; |
3350 |
++ Sigset<ContextTraits64> sigmask; |
3351 |
++ MContext64 mcontext; |
3352 |
++}; |
3353 |
++#pragma pack(push, 1) |
3354 |
++ |
3355 |
++static_assert(sizeof(UContext) == sizeof(ucontext_t), |
3356 |
++ "ucontext_t size mismatch"); |
3357 |
++static_assert(sizeof(MContext64) == sizeof(mcontext_t), |
3358 |
++ "mcontext_t size mismatch"); |
3359 |
++static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t), |
3360 |
++ "gregset_t size mismatch"); |
3361 |
++static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t), |
3362 |
++ "fpregset_t size mismatch"); |
3363 |
++static_assert(sizeof(SignalVectorContext64) == sizeof(_libc_vrstate), |
3364 |
++ "vrstate size mismatch"); |
3365 |
++static_assert(offsetof(UContext, mcontext) == |
3366 |
++ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch"); |
3367 |
++static_assert(offsetof(MContext64, gp_regs) == |
3368 |
++ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch"); |
3369 |
+ #else |
3370 |
+ #error Port. |
3371 |
+ #endif // ARCH_CPU_X86_FAMILY |
3372 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc |
3373 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc |
3374 |
+@@ -203,6 +203,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const { |
3375 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3376 |
+ return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL |
3377 |
+ : kCPUArchitectureMIPSEL; |
3378 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3379 |
++ return kCPUArchitecturePPC64; |
3380 |
+ #else |
3381 |
+ #error port to your architecture |
3382 |
+ #endif |
3383 |
+@@ -218,6 +220,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const { |
3384 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3385 |
+ // Not implementable on MIPS |
3386 |
+ return 0; |
3387 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3388 |
++ // Not yet implemented on PPC64 |
3389 |
++ return 0; |
3390 |
+ #else |
3391 |
+ #error port to your architecture |
3392 |
+ #endif |
3393 |
+@@ -238,6 +243,9 @@ std::string SystemSnapshotLinux::CPUVendor() const { |
3394 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3395 |
+ // Not implementable on MIPS |
3396 |
+ return std::string(); |
3397 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3398 |
++ // Not yet implemented on PPC64 |
3399 |
++ return std::string(); |
3400 |
+ #else |
3401 |
+ #error port to your architecture |
3402 |
+ #endif |
3403 |
+@@ -371,6 +379,9 @@ bool SystemSnapshotLinux::NXEnabled() const { |
3404 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3405 |
+ // Not implementable on MIPS |
3406 |
+ return false; |
3407 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3408 |
++ // Not yet implemented on PPC64 |
3409 |
++ return false; |
3410 |
+ #else |
3411 |
+ #error Port. |
3412 |
+ #endif // ARCH_CPU_X86_FAMILY |
3413 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc |
3414 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc |
3415 |
+@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader, |
3416 |
+ thread.thread_info.float_context.f32, |
3417 |
+ context_.mipsel); |
3418 |
+ } |
3419 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3420 |
++ context_.architecture = kCPUArchitecturePPC64; |
3421 |
++ context_.ppc64 = &context_union_.ppc64; |
3422 |
++ InitializeCPUContextPPC64<ContextTraits64>( |
3423 |
++ thread.thread_info.thread_context.t64, |
3424 |
++ thread.thread_info.float_context.f64, |
3425 |
++ thread.thread_info.vector_context.v64, |
3426 |
++ context_.ppc64); |
3427 |
+ #else |
3428 |
+ #error Port. |
3429 |
+ #endif |
3430 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h |
3431 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h |
3432 |
+@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot { |
3433 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3434 |
+ CPUContextMIPS mipsel; |
3435 |
+ CPUContextMIPS64 mips64; |
3436 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3437 |
++ CPUContextPPC64 ppc64; |
3438 |
+ #else |
3439 |
+ #error Port. |
3440 |
+ #endif // ARCH_CPU_X86_FAMILY |
3441 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc |
3442 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc |
3443 |
+@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) { |
3444 |
+ if (type == AT_IGNORE) { |
3445 |
+ continue; |
3446 |
+ } |
3447 |
++#if defined(ARCH_CPU_PPC64_FAMILY) |
3448 |
++ if (type == AT_IGNOREPPC) { |
3449 |
++ continue; |
3450 |
++ } |
3451 |
++#endif |
3452 |
+ if (!MapInsertOrReplace(&values_, type, value, nullptr)) { |
3453 |
+ LOG(ERROR) << "duplicate auxv entry"; |
3454 |
+ return false; |
3455 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptrace_broker.cc |
3456 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptrace_broker.cc |
3457 |
+@@ -93,8 +93,8 @@ int PtraceBroker::Run() { |
3458 |
+ } |
3459 |
+ |
3460 |
+ bool PtraceBroker::AllocateAttachments() { |
3461 |
+- constexpr size_t page_size = 4096; |
3462 |
+- constexpr size_t alloc_size = |
3463 |
++ static size_t page_size = getpagesize(); |
3464 |
++ size_t alloc_size = |
3465 |
+ (sizeof(ScopedPtraceAttach) + page_size - 1) & ~(page_size - 1); |
3466 |
+ void* alloc = sbrk(alloc_size); |
3467 |
+ if (reinterpret_cast<intptr_t>(alloc) == -1) { |
3468 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc |
3469 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc |
3470 |
+@@ -394,6 +394,64 @@ bool GetThreadArea64(pid_t tid, |
3471 |
+ return true; |
3472 |
+ } |
3473 |
+ |
3474 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3475 |
++// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it). |
3476 |
++// That means we can simply use PTRACE_GETREGESET. |
3477 |
++ |
3478 |
++template <typename Destination> |
3479 |
++bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) { |
3480 |
++ iovec iov; |
3481 |
++ iov.iov_base = reinterpret_cast<void*>(dest); |
3482 |
++ iov.iov_len = sizeof(*dest); |
3483 |
++ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) { |
3484 |
++ PLOG_IF(ERROR, can_log) << "ptrace"; |
3485 |
++ return false; |
3486 |
++ } |
3487 |
++ if (iov.iov_len != sizeof(*dest)) { |
3488 |
++ LOG_IF(ERROR, can_log) << "Unexpected registers size"; |
3489 |
++ return false; |
3490 |
++ } |
3491 |
++ return true; |
3492 |
++} |
3493 |
++ |
3494 |
++bool GetVectorRegisters64(pid_t tid, |
3495 |
++ VectorContext* context, |
3496 |
++ bool can_log) { |
3497 |
++ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log); |
3498 |
++} |
3499 |
++ |
3500 |
++bool GetFloatingPointRegisters64(pid_t tid, |
3501 |
++ FloatContext* context, |
3502 |
++ bool can_log) { |
3503 |
++ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log); |
3504 |
++} |
3505 |
++ |
3506 |
++bool GetThreadArea64(pid_t tid, |
3507 |
++ const ThreadContext& context, |
3508 |
++ LinuxVMAddress* address, |
3509 |
++ bool can_log) { |
3510 |
++ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer |
3511 |
++ // is stored in GPR 13. |
3512 |
++ ThreadContext::t64_t tc; |
3513 |
++ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) { |
3514 |
++ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!"; |
3515 |
++ return false; |
3516 |
++ } |
3517 |
++ |
3518 |
++ *address = tc.gpr[13]; |
3519 |
++ |
3520 |
++ return true; |
3521 |
++} |
3522 |
++ |
3523 |
++// Stubs for 32-bit functions not applicable on PPC64 |
3524 |
++bool GetFloatingPointRegisters32(pid_t tid, |
3525 |
++ FloatContext* context, |
3526 |
++ bool can_log) { return false; } |
3527 |
++bool GetThreadArea32(pid_t tid, |
3528 |
++ const ThreadContext &context, |
3529 |
++ LinuxVMAddress *address, |
3530 |
++ bool can_log) { return false; } |
3531 |
++ |
3532 |
+ #else |
3533 |
+ #error Port. |
3534 |
+ #endif // ARCH_CPU_X86_FAMILY |
3535 |
+@@ -486,6 +544,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) { |
3536 |
+ if (is_64_bit_) { |
3537 |
+ return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) && |
3538 |
+ GetFloatingPointRegisters64(tid, &info->float_context, can_log_) && |
3539 |
++#if defined(ARCH_CPU_PPC64_FAMILY) |
3540 |
++ GetVectorRegisters64(tid, &info->vector_context, can_log_) && |
3541 |
++#endif |
3542 |
+ GetThreadArea64(tid, |
3543 |
+ info->thread_context, |
3544 |
+ &info->thread_specific_data_address, |
3545 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h |
3546 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h |
3547 |
+@@ -28,6 +28,10 @@ |
3548 |
+ #include <android/api-level.h> |
3549 |
+ #endif |
3550 |
+ |
3551 |
++#if defined(ARCH_CPU_PPC64_FAMILY) |
3552 |
++#include <sys/ucontext.h> |
3553 |
++#endif |
3554 |
++ |
3555 |
+ namespace crashpad { |
3556 |
+ |
3557 |
+ //! \brief The set of general purpose registers for an architecture family. |
3558 |
+@@ -79,6 +83,8 @@ union ThreadContext { |
3559 |
+ uint32_t cp0_status; |
3560 |
+ uint32_t cp0_cause; |
3561 |
+ uint32_t padding1_; |
3562 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3563 |
++ // PPC64 is 64-bit |
3564 |
+ #else |
3565 |
+ #error Port. |
3566 |
+ #endif // ARCH_CPU_X86_FAMILY |
3567 |
+@@ -132,6 +138,21 @@ union ThreadContext { |
3568 |
+ uint64_t cp0_badvaddr; |
3569 |
+ uint64_t cp0_status; |
3570 |
+ uint64_t cp0_cause; |
3571 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3572 |
++ // Reflects struct pt_regs in asm/ptrace.h. |
3573 |
++ uint64_t gpr[32]; |
3574 |
++ uint64_t nip; |
3575 |
++ uint64_t msr; |
3576 |
++ uint64_t orig_gpr3; |
3577 |
++ uint64_t ctr; |
3578 |
++ uint64_t lnk; |
3579 |
++ uint64_t xer; |
3580 |
++ uint64_t ccr; |
3581 |
++ uint64_t softe; |
3582 |
++ uint64_t trap; |
3583 |
++ uint64_t dar; |
3584 |
++ uint64_t dsisr; |
3585 |
++ uint64_t result; |
3586 |
+ #else |
3587 |
+ #error Port. |
3588 |
+ #endif // ARCH_CPU_X86_FAMILY |
3589 |
+@@ -143,6 +164,8 @@ union ThreadContext { |
3590 |
+ using NativeThreadContext = user_regs; |
3591 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3592 |
+ // No appropriate NativeThreadsContext type available for MIPS |
3593 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3594 |
++ using NativeThreadContext = struct pt_regs; |
3595 |
+ #else |
3596 |
+ #error Port. |
3597 |
+ #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64 |
3598 |
+@@ -218,6 +241,9 @@ union FloatContext { |
3599 |
+ } fpregs[32]; |
3600 |
+ uint32_t fpcsr; |
3601 |
+ uint32_t fpu_id; |
3602 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3603 |
++ // Crashpad's PPC support is 64-bit only, so this |
3604 |
++ // 32bit-only struct is declared as empty. |
3605 |
+ #else |
3606 |
+ #error Port. |
3607 |
+ #endif // ARCH_CPU_X86_FAMILY |
3608 |
+@@ -252,6 +278,10 @@ union FloatContext { |
3609 |
+ double fpregs[32]; |
3610 |
+ uint32_t fpcsr; |
3611 |
+ uint32_t fpu_id; |
3612 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3613 |
++ // Reflects fpregset_t in sys/ucontext.h |
3614 |
++ double fpregs[32]; |
3615 |
++ double fpscr; |
3616 |
+ #else |
3617 |
+ #error Port. |
3618 |
+ #endif // ARCH_CPU_X86_FAMILY |
3619 |
+@@ -280,6 +310,8 @@ union FloatContext { |
3620 |
+ static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch"); |
3621 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3622 |
+ // No appropriate floating point context native type for available MIPS. |
3623 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3624 |
++ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch"); |
3625 |
+ #else |
3626 |
+ #error Port. |
3627 |
+ #endif // ARCH_CPU_X86 |
3628 |
+@@ -287,6 +319,26 @@ union FloatContext { |
3629 |
+ static_assert(std::is_standard_layout<FloatContext>::value, |
3630 |
+ "Not standard layout"); |
3631 |
+ |
3632 |
++//! \brief The vector registers used for an architecture family |
3633 |
++union VectorContext { |
3634 |
++ struct v32_t {} v32; |
3635 |
++#if defined(ARCH_CPU_PPC64_FAMILY) |
3636 |
++ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned. |
3637 |
++#endif |
3638 |
++ struct v64_t { |
3639 |
++#if defined(ARCH_CPU_PPC64_FAMILY) |
3640 |
++ // Reflects vrregset_t in sys/ucontext.h |
3641 |
++ uint32_t vrregs[32][4]; |
3642 |
++ struct { |
3643 |
++ uint32_t __pad[3]; |
3644 |
++ uint32_t vscr_word; |
3645 |
++ } vscr; |
3646 |
++ uint32_t vrsave; |
3647 |
++ uint32_t __pad[3]; |
3648 |
++#endif |
3649 |
++ } v64; |
3650 |
++}; |
3651 |
++ |
3652 |
+ //! \brief A collection of `ptrace`-able information about a thread. |
3653 |
+ struct ThreadInfo { |
3654 |
+ ThreadInfo(); |
3655 |
+@@ -298,6 +350,9 @@ struct ThreadInfo { |
3656 |
+ //! \brief The floating point registers for the thread. |
3657 |
+ FloatContext float_context; |
3658 |
+ |
3659 |
++ //! \brief (Optional) The vector registers used for the thread. |
3660 |
++ VectorContext vector_context; |
3661 |
++ |
3662 |
+ //! \brief The thread-local storage address for the thread. |
3663 |
+ LinuxVMAddress thread_specific_data_address; |
3664 |
+ }; |
3665 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h |
3666 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h |
3667 |
+@@ -66,6 +66,7 @@ using NativeCPUContext = ucontext_t; |
3668 |
+ //! macOS/Linux/Fuchsia | x86_64 | `%%rdi` |
3669 |
+ //! Linux | ARM/ARM64 | `r0`/`x0` |
3670 |
+ //! Linux | MIPS/MIPS64 | `$a0` |
3671 |
++//! Linux | PPC64 | `r3` |
3672 |
+ //! |
3673 |
+ //! Additionally, the value `LR` on ARM/ARM64 will be the return address of |
3674 |
+ //! this function. |
3675 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_linux.S |
3676 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_linux.S |
3677 |
+@@ -28,7 +28,7 @@ |
3678 |
+ .globl CAPTURECONTEXT_SYMBOL2 |
3679 |
+ #if defined(__i386__) || defined(__x86_64__) |
3680 |
+ .balign 16, 0x90 |
3681 |
+-#elif defined(__arm__) || defined(__aarch64__) || defined(__mips__) |
3682 |
++#elif defined(__arm__) || defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__) |
3683 |
+ .balign 4, 0x0 |
3684 |
+ #endif |
3685 |
+ |
3686 |
+@@ -419,4 +419,214 @@ CAPTURECONTEXT_SYMBOL2: |
3687 |
+ jr $ra |
3688 |
+ |
3689 |
+ .set at |
3690 |
++#elif defined(__powerpc64__) |
3691 |
++ // Store r0-r31 |
3692 |
++ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0] |
3693 |
++ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1] |
3694 |
++ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2] |
3695 |
++ // note that r3's original value was lost |
3696 |
++ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3] |
3697 |
++ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4] |
3698 |
++ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5] |
3699 |
++ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6] |
3700 |
++ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7] |
3701 |
++ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8] |
3702 |
++ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9] |
3703 |
++ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10] |
3704 |
++ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11] |
3705 |
++ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12] |
3706 |
++ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13] |
3707 |
++ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14] |
3708 |
++ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15] |
3709 |
++ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16] |
3710 |
++ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17] |
3711 |
++ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18] |
3712 |
++ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19] |
3713 |
++ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20] |
3714 |
++ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21] |
3715 |
++ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22] |
3716 |
++ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23] |
3717 |
++ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24] |
3718 |
++ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25] |
3719 |
++ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26] |
3720 |
++ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27] |
3721 |
++ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28] |
3722 |
++ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29] |
3723 |
++ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30] |
3724 |
++ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31] |
3725 |
++ |
3726 |
++ // For NIP, we can use the value in the link register |
3727 |
++ mflr 0 |
3728 |
++ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP] |
3729 |
++ |
3730 |
++ // CTR |
3731 |
++ mfctr 0 |
3732 |
++ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR] |
3733 |
++ |
3734 |
++ // For LNK, we'll use the caller's LR save area (2 stack frames up). |
3735 |
++ // r4 can be used as a scratch register since it has already been saved. |
3736 |
++ ld 4, 0(1) |
3737 |
++ ld 4, 16(4) |
3738 |
++ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK] |
3739 |
++ |
3740 |
++ // XER |
3741 |
++ mfxer 0 |
3742 |
++ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER] |
3743 |
++ |
3744 |
++ // CCR |
3745 |
++ mfcr 0 |
3746 |
++ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR] |
3747 |
++ |
3748 |
++ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR, |
3749 |
++ // not used or not relevant, zero them out. |
3750 |
++ li 4, 0 |
3751 |
++ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR] |
3752 |
++ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3] |
3753 |
++ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ] |
3754 |
++ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP] |
3755 |
++ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR] |
3756 |
++ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR] |
3757 |
++ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT] |
3758 |
++ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR] |
3759 |
++ |
3760 |
++ // Update context->uc_mcontext.regs to point to gp_regs |
3761 |
++ addi 0, 3, 0xe8 |
3762 |
++ std 0, 0xe0(3) |
3763 |
++ |
3764 |
++ // Save floating point registers 0-31 |
3765 |
++ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0] |
3766 |
++ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1] |
3767 |
++ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2] |
3768 |
++ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3] |
3769 |
++ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4] |
3770 |
++ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5] |
3771 |
++ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6] |
3772 |
++ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7] |
3773 |
++ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8] |
3774 |
++ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9] |
3775 |
++ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10] |
3776 |
++ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11] |
3777 |
++ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12] |
3778 |
++ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13] |
3779 |
++ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14] |
3780 |
++ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15] |
3781 |
++ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16] |
3782 |
++ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17] |
3783 |
++ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18] |
3784 |
++ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19] |
3785 |
++ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20] |
3786 |
++ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21] |
3787 |
++ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22] |
3788 |
++ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23] |
3789 |
++ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24] |
3790 |
++ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25] |
3791 |
++ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26] |
3792 |
++ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27] |
3793 |
++ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28] |
3794 |
++ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29] |
3795 |
++ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30] |
3796 |
++ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31] |
3797 |
++ |
3798 |
++ // FPSCR |
3799 |
++ mffs 0 |
3800 |
++ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32] |
3801 |
++ |
3802 |
++ // Save VMX Vector registers |
3803 |
++ // Update r4 to contain the base address of vmx_reserve |
3804 |
++ addi 4, 3, 0x378 |
3805 |
++ // Ensure that it is quadword aligned |
3806 |
++ andi. 5, 4, 0xF |
3807 |
++ beq 1f // No alignment is necessary |
3808 |
++ // Address is doubleword aligned and not quadword aligned, add 8 |
3809 |
++ addi 4, 4, 8 |
3810 |
++ |
3811 |
++1: |
3812 |
++ // Store VMX registers 0-31 |
3813 |
++ // r4 will contain the base address |
3814 |
++ // r5 will contain the index |
3815 |
++ li 5, 0 |
3816 |
++ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0] |
3817 |
++ addi 5, 5, 16 |
3818 |
++ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1] |
3819 |
++ addi 5, 5, 16 |
3820 |
++ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2] |
3821 |
++ addi 5, 5, 16 |
3822 |
++ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3] |
3823 |
++ addi 5, 5, 16 |
3824 |
++ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4] |
3825 |
++ addi 5, 5, 16 |
3826 |
++ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5] |
3827 |
++ addi 5, 5, 16 |
3828 |
++ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6] |
3829 |
++ addi 5, 5, 16 |
3830 |
++ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7] |
3831 |
++ addi 5, 5, 16 |
3832 |
++ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8] |
3833 |
++ addi 5, 5, 16 |
3834 |
++ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9] |
3835 |
++ addi 5, 5, 16 |
3836 |
++ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10] |
3837 |
++ addi 5, 5, 16 |
3838 |
++ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11] |
3839 |
++ addi 5, 5, 16 |
3840 |
++ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12] |
3841 |
++ addi 5, 5, 16 |
3842 |
++ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13] |
3843 |
++ addi 5, 5, 16 |
3844 |
++ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14] |
3845 |
++ addi 5, 5, 16 |
3846 |
++ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15] |
3847 |
++ addi 5, 5, 16 |
3848 |
++ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16] |
3849 |
++ addi 5, 5, 16 |
3850 |
++ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17] |
3851 |
++ addi 5, 5, 16 |
3852 |
++ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18] |
3853 |
++ addi 5, 5, 16 |
3854 |
++ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19] |
3855 |
++ addi 5, 5, 16 |
3856 |
++ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20] |
3857 |
++ addi 5, 5, 16 |
3858 |
++ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21] |
3859 |
++ addi 5, 5, 16 |
3860 |
++ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22] |
3861 |
++ addi 5, 5, 16 |
3862 |
++ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23] |
3863 |
++ addi 5, 5, 16 |
3864 |
++ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24] |
3865 |
++ addi 5, 5, 16 |
3866 |
++ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25] |
3867 |
++ addi 5, 5, 16 |
3868 |
++ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26] |
3869 |
++ addi 5, 5, 16 |
3870 |
++ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27] |
3871 |
++ addi 5, 5, 16 |
3872 |
++ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28] |
3873 |
++ addi 5, 5, 16 |
3874 |
++ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29] |
3875 |
++ addi 5, 5, 16 |
3876 |
++ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30] |
3877 |
++ addi 5, 5, 16 |
3878 |
++ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31] |
3879 |
++ addi 5, 5, 16 |
3880 |
++ |
3881 |
++ // VSCR |
3882 |
++ mfvscr 0 |
3883 |
++ stvx 0, 4, 5 |
3884 |
++ addi 5, 5, 16 |
3885 |
++ |
3886 |
++ // VRSAVE |
3887 |
++ mfvrsave 0 |
3888 |
++ stwx 0, 4, 5 |
3889 |
++ |
3890 |
++ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment. |
3891 |
++ std 4, 0x370(3) |
3892 |
++ |
3893 |
++ // Zero out all unused fields |
3894 |
++ li 4, 0 |
3895 |
++ std 4, 0xc8(3) // context->uc_mcontext.signal |
3896 |
++ std 4, 0xd0(3) // context->uc_mcontext.handler |
3897 |
++ std 4, 0xd8(3) // context->uc_mcontext.oldmask |
3898 |
++ |
3899 |
++ blr |
3900 |
+ #endif // __i386__ |
3901 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test.cc |
3902 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test.cc |
3903 |
+@@ -49,7 +49,8 @@ void TestCaptureContext() { |
3904 |
+ // reference program counter. |
3905 |
+ uintptr_t pc = ProgramCounterFromContext(context_1); |
3906 |
+ |
3907 |
+-#if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) |
3908 |
++#if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \ |
3909 |
++ !defined(ARCH_CPU_PPC64_FAMILY) |
3910 |
+ // AddressSanitizer can cause enough code bloat that the “nearby” check would |
3911 |
+ // likely fail. |
3912 |
+ const uintptr_t kReferencePC = |
3913 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc |
3914 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc |
3915 |
+@@ -36,6 +36,8 @@ void SanityCheckContext(const NativeCPUContext& context) { |
3916 |
+ EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context)); |
3917 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3918 |
+ EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context)); |
3919 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3920 |
++ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context)); |
3921 |
+ #endif |
3922 |
+ } |
3923 |
+ |
3924 |
+@@ -50,6 +52,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) { |
3925 |
+ return context.uc_mcontext.pc; |
3926 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3927 |
+ return context.uc_mcontext.pc; |
3928 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3929 |
++ return context.uc_mcontext.gp_regs[PT_NIP]; |
3930 |
+ #endif |
3931 |
+ } |
3932 |
+ |
3933 |
+@@ -64,6 +68,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) { |
3934 |
+ return context.uc_mcontext.sp; |
3935 |
+ #elif defined(ARCH_CPU_MIPS_FAMILY) |
3936 |
+ return context.uc_mcontext.gregs[29]; |
3937 |
++#elif defined(ARCH_CPU_PPC64_FAMILY) |
3938 |
++ return context.uc_mcontext.gp_regs[1]; |
3939 |
+ #endif |
3940 |
+ } |
3941 |
+ |
3942 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals_test.cc |
3943 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals_test.cc |
3944 |
+@@ -46,12 +46,12 @@ bool CanCauseSignal(int sig) { |
3945 |
+ return sig == SIGABRT || |
3946 |
+ sig == SIGALRM || |
3947 |
+ sig == SIGBUS || |
3948 |
+-#if !defined(ARCH_CPU_ARM64) |
3949 |
++#if !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) |
3950 |
+ sig == SIGFPE || |
3951 |
+-#endif // !defined(ARCH_CPU_ARM64) |
3952 |
++#endif // !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) |
3953 |
+ #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL) |
3954 |
+ sig == SIGILL || |
3955 |
+-#endif // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL |
3956 |
++#endif // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL) |
3957 |
+ sig == SIGPIPE || |
3958 |
+ sig == SIGSEGV || |
3959 |
+ #if defined(OS_MACOSX) |
3960 |
+@@ -117,9 +117,11 @@ void CauseSignal(int sig) { |
3961 |
+ break; |
3962 |
+ } |
3963 |
+ |
3964 |
+-#if !defined(ARCH_CPU_ARM64) |
3965 |
++#if !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) |
3966 |
+ // ARM64 has hardware integer division instructions that don’t generate a |
3967 |
+ // trap for divide-by-zero, so this doesn’t produce SIGFPE. |
3968 |
++ // |
3969 |
++ // PPC64 fixed-point division by zero also doesn't produce a SIGFPE. |
3970 |
+ case SIGFPE: { |
3971 |
+ // Optimization makes this tricky, so get zero from a system call likely |
3972 |
+ // to succeed, and try to do something with the result. |
3973 |
+@@ -137,7 +139,7 @@ void CauseSignal(int sig) { |
3974 |
+ fstat(quotient, &stat_buf); |
3975 |
+ break; |
3976 |
+ } |
3977 |
+-#endif // ARCH_CPU_ARM64 |
3978 |
++#endif // !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) |
3979 |
+ |
3980 |
+ #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL) |
3981 |
+ case SIGILL: { |
3982 |
+--- qtwebengine/src/3rdparty/chromium/third_party/libpng/BUILD.gn |
3983 |
++++ qtwebengine/src/3rdparty/chromium/third_party/libpng/BUILD.gn |
3984 |
+@@ -93,6 +93,11 @@ source_set("libpng_sources") { |
3985 |
+ "mips/filter_msa_intrinsics.c", |
3986 |
+ "mips/mips_init.c", |
3987 |
+ ] |
3988 |
++ } else if (current_cpu == "ppc64") { |
3989 |
++ sources += [ |
3990 |
++ "powerpc/filter_vsx_intrinsics.c", |
3991 |
++ "powerpc/powerpc_init.c", |
3992 |
++ ] |
3993 |
+ } |
3994 |
+ |
3995 |
+ configs -= [ "//build/config/compiler:chromium_code" ] |
3996 |
+new file mode 100644 |
3997 |
+--- /dev/null |
3998 |
++++ qtwebengine/src/3rdparty/chromium/third_party/libpng/powerpc/filter_vsx_intrinsics.c |
3999 |
+@@ -0,0 +1,767 @@ |
4000 |
++/* filter_vsx_intrinsics.c - PowerPC optimised filter functions |
4001 |
++ * |
4002 |
++ * Copyright (c) 2017 Glenn Randers-Pehrson |
4003 |
++ * Written by Vadim Barkov, 2017. |
4004 |
++ * Last changed in libpng 1.6.29 [March 16, 2017] |
4005 |
++ * |
4006 |
++ * This code is released under the libpng license. |
4007 |
++ * For conditions of distribution and use, see the disclaimer |
4008 |
++ * and license in png.h |
4009 |
++ */ |
4010 |
++#include <stdio.h> |
4011 |
++#include <stdint.h> |
4012 |
++#include "../pngpriv.h" |
4013 |
++ |
4014 |
++#ifdef PNG_READ_SUPPORTED |
4015 |
++ |
4016 |
++/* This code requires -maltivec and -mvsx on the command line: */ |
4017 |
++#if PNG_POWERPC_VSX_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */ |
4018 |
++ |
4019 |
++#include <altivec.h> |
4020 |
++ |
4021 |
++#if PNG_POWERPC_VSX_OPT > 0 |
4022 |
++ |
4023 |
++#ifndef __VSX__ |
4024 |
++# error "This code requires VSX support (POWER7 and later). Please provide -mvsx compiler flag." |
4025 |
++#endif |
4026 |
++ |
4027 |
++#define vec_ld_unaligned(vec,data) vec = vec_vsx_ld(0,data) |
4028 |
++#define vec_st_unaligned(vec,data) vec_vsx_st(vec,0,data) |
4029 |
++ |
4030 |
++ |
4031 |
++/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d). |
4032 |
++ * They're positioned like this: |
4033 |
++ * prev: c b |
4034 |
++ * row: a d |
4035 |
++ * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be |
4036 |
++ * whichever of a, b, or c is closest to p=a+b-c. |
4037 |
++ * ( this is taken from ../intel/filter_sse2_intrinsics.c ) |
4038 |
++ */ |
4039 |
++ |
4040 |
++#define vsx_declare_common_vars(row_info,row,prev_row,offset) \ |
4041 |
++ png_byte i;\ |
4042 |
++ png_bytep rp = row + offset;\ |
4043 |
++ png_const_bytep pp = prev_row;\ |
4044 |
++ png_size_t unaligned_top = 16 - (((png_size_t)rp % 16));\ |
4045 |
++ png_size_t istop;\ |
4046 |
++ if(unaligned_top == 16)\ |
4047 |
++ unaligned_top = 0;\ |
4048 |
++ istop = row_info->rowbytes;\ |
4049 |
++ if((unaligned_top < istop))\ |
4050 |
++ istop -= unaligned_top;\ |
4051 |
++ else{\ |
4052 |
++ unaligned_top = istop;\ |
4053 |
++ istop = 0;\ |
4054 |
++ } |
4055 |
++ |
4056 |
++void png_read_filter_row_up_vsx(png_row_infop row_info, png_bytep row, |
4057 |
++ png_const_bytep prev_row) |
4058 |
++{ |
4059 |
++ vector unsigned char rp_vec; |
4060 |
++ vector unsigned char pp_vec; |
4061 |
++ vsx_declare_common_vars(row_info,row,prev_row,0) |
4062 |
++ |
4063 |
++ /* Altivec operations require 16-byte aligned data |
4064 |
++ * but input can be unaligned. So we calculate |
4065 |
++ * unaligned part as usual. |
4066 |
++ */ |
4067 |
++ for (i = 0; i < unaligned_top; i++) |
4068 |
++ { |
4069 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); |
4070 |
++ rp++; |
4071 |
++ } |
4072 |
++ |
4073 |
++ /* Using SIMD while we can */ |
4074 |
++ while( istop >= 16 ) |
4075 |
++ { |
4076 |
++ rp_vec = vec_ld(0,rp); |
4077 |
++ vec_ld_unaligned(pp_vec,pp); |
4078 |
++ |
4079 |
++ rp_vec = vec_add(rp_vec,pp_vec); |
4080 |
++ |
4081 |
++ vec_st(rp_vec,0,rp); |
4082 |
++ |
4083 |
++ pp += 16; |
4084 |
++ rp += 16; |
4085 |
++ istop -= 16; |
4086 |
++ } |
4087 |
++ |
4088 |
++ if(istop > 0) |
4089 |
++ { |
4090 |
++ /* If byte count of row is not divisible by 16 |
4091 |
++ * we will process remaining part as usual |
4092 |
++ */ |
4093 |
++ for (i = 0; i < istop; i++) |
4094 |
++ { |
4095 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); |
4096 |
++ rp++; |
4097 |
++ } |
4098 |
++} |
4099 |
++ |
4100 |
++} |
4101 |
++ |
4102 |
++static const vector unsigned char VSX_LEFTSHIFTED1_4 = {16,16,16,16, 0, 1, 2, 3,16,16,16,16,16,16,16,16}; |
4103 |
++static const vector unsigned char VSX_LEFTSHIFTED2_4 = {16,16,16,16,16,16,16,16, 4, 5, 6, 7,16,16,16,16}; |
4104 |
++static const vector unsigned char VSX_LEFTSHIFTED3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 8, 9,10,11}; |
4105 |
++ |
4106 |
++static const vector unsigned char VSX_LEFTSHIFTED1_3 = {16,16,16, 0, 1, 2,16,16,16,16,16,16,16,16,16,16}; |
4107 |
++static const vector unsigned char VSX_LEFTSHIFTED2_3 = {16,16,16,16,16,16, 3, 4, 5,16,16,16,16,16,16,16}; |
4108 |
++static const vector unsigned char VSX_LEFTSHIFTED3_3 = {16,16,16,16,16,16,16,16,16, 6, 7, 8,16,16,16,16}; |
4109 |
++static const vector unsigned char VSX_LEFTSHIFTED4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 9,10,11,16}; |
4110 |
++ |
4111 |
++static const vector unsigned char VSX_NOT_SHIFTED1_4 = {16,16,16,16, 4, 5, 6, 7,16,16,16,16,16,16,16,16}; |
4112 |
++static const vector unsigned char VSX_NOT_SHIFTED2_4 = {16,16,16,16,16,16,16,16, 8, 9,10,11,16,16,16,16}; |
4113 |
++static const vector unsigned char VSX_NOT_SHIFTED3_4 = {16,16,16,16,16,16,16,16,16,16,16,16,12,13,14,15}; |
4114 |
++ |
4115 |
++static const vector unsigned char VSX_NOT_SHIFTED1_3 = {16,16,16, 3, 4, 5,16,16,16,16,16,16,16,16,16,16}; |
4116 |
++static const vector unsigned char VSX_NOT_SHIFTED2_3 = {16,16,16,16,16,16, 6, 7, 8,16,16,16,16,16,16,16}; |
4117 |
++static const vector unsigned char VSX_NOT_SHIFTED3_3 = {16,16,16,16,16,16,16,16,16, 9,10,11,16,16,16,16}; |
4118 |
++static const vector unsigned char VSX_NOT_SHIFTED4_3 = {16,16,16,16,16,16,16,16,16,16,16,16,12,13,14,16}; |
4119 |
++ |
4120 |
++static const vector unsigned char VSX_CHAR_ZERO = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
4121 |
++#ifdef __LITTLE_ENDIAN__ |
4122 |
++ |
4123 |
++static const vector unsigned char VSX_CHAR_TO_SHORT1_4 = { 4,16, 5,16, 6,16, 7,16,16,16,16,16,16,16,16,16}; |
4124 |
++static const vector unsigned char VSX_CHAR_TO_SHORT2_4 = { 8,16, 9,16,10,16,11,16,16,16,16,16,16,16,16,16}; |
4125 |
++static const vector unsigned char VSX_CHAR_TO_SHORT3_4 = {12,16,13,16,14,16,15,16,16,16,16,16,16,16,16,16}; |
4126 |
++ |
4127 |
++static const vector unsigned char VSX_SHORT_TO_CHAR1_4 = {16,16,16,16, 0, 2, 4, 6,16,16,16,16,16,16,16,16}; |
4128 |
++static const vector unsigned char VSX_SHORT_TO_CHAR2_4 = {16,16,16,16,16,16,16,16, 0, 2, 4, 6,16,16,16,16}; |
4129 |
++static const vector unsigned char VSX_SHORT_TO_CHAR3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 0, 2, 4, 6}; |
4130 |
++ |
4131 |
++static const vector unsigned char VSX_CHAR_TO_SHORT1_3 = { 3,16, 4,16, 5,16,16,16,16,16,16,16,16,16,16,16}; |
4132 |
++static const vector unsigned char VSX_CHAR_TO_SHORT2_3 = { 6,16, 7,16, 8,16,16,16,16,16,16,16,16,16,16,16}; |
4133 |
++static const vector unsigned char VSX_CHAR_TO_SHORT3_3 = { 9,16,10,16,11,16,16,16,16,16,16,16,16,16,16,16}; |
4134 |
++static const vector unsigned char VSX_CHAR_TO_SHORT4_3 = {12,16,13,16,14,16,16,16,16,16,16,16,16,16,16,16}; |
4135 |
++ |
4136 |
++static const vector unsigned char VSX_SHORT_TO_CHAR1_3 = {16,16,16, 0, 2, 4,16,16,16,16,16,16,16,16,16,16}; |
4137 |
++static const vector unsigned char VSX_SHORT_TO_CHAR2_3 = {16,16,16,16,16,16, 0, 2, 4,16,16,16,16,16,16,16}; |
4138 |
++static const vector unsigned char VSX_SHORT_TO_CHAR3_3 = {16,16,16,16,16,16,16,16,16, 0, 2, 4,16,16,16,16}; |
4139 |
++static const vector unsigned char VSX_SHORT_TO_CHAR4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 0, 2, 4,16}; |
4140 |
++ |
4141 |
++#elif defined(__BIG_ENDIAN__) |
4142 |
++ |
4143 |
++static const vector unsigned char VSX_CHAR_TO_SHORT1_4 = {16, 4,16, 5,16, 6,16, 7,16,16,16,16,16,16,16,16}; |
4144 |
++static const vector unsigned char VSX_CHAR_TO_SHORT2_4 = {16, 8,16, 9,16,10,16,11,16,16,16,16,16,16,16,16}; |
4145 |
++static const vector unsigned char VSX_CHAR_TO_SHORT3_4 = {16,12,16,13,16,14,16,15,16,16,16,16,16,16,16,16}; |
4146 |
++ |
4147 |
++static const vector unsigned char VSX_SHORT_TO_CHAR1_4 = {16,16,16,16, 1, 3, 5, 7,16,16,16,16,16,16,16,16}; |
4148 |
++static const vector unsigned char VSX_SHORT_TO_CHAR2_4 = {16,16,16,16,16,16,16,16, 1, 3, 5, 7,16,16,16,16}; |
4149 |
++static const vector unsigned char VSX_SHORT_TO_CHAR3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 1, 3, 5, 7}; |
4150 |
++ |
4151 |
++static const vector unsigned char VSX_CHAR_TO_SHORT1_3 = {16, 3,16, 4,16, 5,16,16,16,16,16,16,16,16,16,16}; |
4152 |
++static const vector unsigned char VSX_CHAR_TO_SHORT2_3 = {16, 6,16, 7,16, 8,16,16,16,16,16,16,16,16,16,16}; |
4153 |
++static const vector unsigned char VSX_CHAR_TO_SHORT3_3 = {16, 9,16,10,16,11,16,16,16,16,16,16,16,16,16,16}; |
4154 |
++static const vector unsigned char VSX_CHAR_TO_SHORT4_3 = {16,12,16,13,16,14,16,16,16,16,16,16,16,16,16,16}; |
4155 |
++ |
4156 |
++static const vector unsigned char VSX_SHORT_TO_CHAR1_3 = {16,16,16, 1, 3, 5,16,16,16,16,16,16,16,16,16,16}; |
4157 |
++static const vector unsigned char VSX_SHORT_TO_CHAR2_3 = {16,16,16,16,16,16, 1, 3, 5,16,16,16,16,16,16,16}; |
4158 |
++static const vector unsigned char VSX_SHORT_TO_CHAR3_3 = {16,16,16,16,16,16,16,16,16, 1, 3, 5,16,16,16,16}; |
4159 |
++static const vector unsigned char VSX_SHORT_TO_CHAR4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 1, 3, 5,16}; |
4160 |
++ |
4161 |
++#endif |
4162 |
++ |
4163 |
++#define vsx_char_to_short(vec,offset,bpp) (vector unsigned short)vec_perm((vec),VSX_CHAR_ZERO,VSX_CHAR_TO_SHORT##offset##_##bpp) |
4164 |
++#define vsx_short_to_char(vec,offset,bpp) vec_perm(((vector unsigned char)(vec)),VSX_CHAR_ZERO,VSX_SHORT_TO_CHAR##offset##_##bpp) |
4165 |
++ |
4166 |
++#ifdef PNG_USE_ABS |
4167 |
++# define vsx_abs(number) abs(number) |
4168 |
++#else |
4169 |
++# define vsx_abs(number) (number > 0) ? (number) : -(number) |
4170 |
++#endif |
4171 |
++ |
4172 |
++void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row, |
4173 |
++ png_const_bytep prev_row) |
4174 |
++{ |
4175 |
++ const png_byte bpp = 4; |
4176 |
++ |
4177 |
++ vector unsigned char rp_vec; |
4178 |
++ vector unsigned char part_vec; |
4179 |
++ |
4180 |
++ vsx_declare_common_vars(row_info,row,prev_row,bpp) |
4181 |
++ |
4182 |
++ PNG_UNUSED(pp) |
4183 |
++ |
4184 |
++ /* Altivec operations require 16-byte aligned data |
4185 |
++ * but input can be unaligned. So we calculate |
4186 |
++ * unaligned part as usual. |
4187 |
++ */ |
4188 |
++ for (i = 0; i < unaligned_top; i++) |
4189 |
++ { |
4190 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); |
4191 |
++ rp++; |
4192 |
++ } |
4193 |
++ |
4194 |
++ /* Using SIMD while we can */ |
4195 |
++ while( istop >= 16 ) |
4196 |
++ { |
4197 |
++ for(i=0;i < bpp ; i++) |
4198 |
++ { |
4199 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); |
4200 |
++ rp++; |
4201 |
++ } |
4202 |
++ rp -= bpp; |
4203 |
++ |
4204 |
++ rp_vec = vec_ld(0,rp); |
4205 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_4); |
4206 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4207 |
++ |
4208 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_4); |
4209 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4210 |
++ |
4211 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_4); |
4212 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4213 |
++ |
4214 |
++ vec_st(rp_vec,0,rp); |
4215 |
++ |
4216 |
++ rp += 16; |
4217 |
++ istop -= 16; |
4218 |
++ } |
4219 |
++ |
4220 |
++ if(istop > 0) |
4221 |
++ for (i = 0; i < istop % 16; i++) |
4222 |
++ { |
4223 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp - bpp))) & 0xff); |
4224 |
++ rp++; |
4225 |
++ } |
4226 |
++ |
4227 |
++} |
4228 |
++ |
4229 |
++void png_read_filter_row_sub3_vsx(png_row_infop row_info, png_bytep row, |
4230 |
++ png_const_bytep prev_row) |
4231 |
++{ |
4232 |
++ const png_byte bpp = 3; |
4233 |
++ |
4234 |
++ vector unsigned char rp_vec; |
4235 |
++ vector unsigned char part_vec; |
4236 |
++ |
4237 |
++ vsx_declare_common_vars(row_info,row,prev_row,bpp) |
4238 |
++ |
4239 |
++ PNG_UNUSED(pp) |
4240 |
++ |
4241 |
++ /* Altivec operations require 16-byte aligned data |
4242 |
++ * but input can be unaligned. So we calculate |
4243 |
++ * unaligned part as usual. |
4244 |
++ */ |
4245 |
++ for (i = 0; i < unaligned_top; i++) |
4246 |
++ { |
4247 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); |
4248 |
++ rp++; |
4249 |
++ } |
4250 |
++ |
4251 |
++ /* Using SIMD while we can */ |
4252 |
++ while( istop >= 16 ) |
4253 |
++ { |
4254 |
++ for(i=0;i < bpp ; i++) |
4255 |
++ { |
4256 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); |
4257 |
++ rp++; |
4258 |
++ } |
4259 |
++ rp -= bpp; |
4260 |
++ |
4261 |
++ rp_vec = vec_ld(0,rp); |
4262 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_3); |
4263 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4264 |
++ |
4265 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_3); |
4266 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4267 |
++ |
4268 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_3); |
4269 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4270 |
++ |
4271 |
++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED4_3); |
4272 |
++ rp_vec = vec_add(rp_vec,part_vec); |
4273 |
++ |
4274 |
++ vec_st(rp_vec,0,rp); |
4275 |
++ rp += 15; |
4276 |
++ istop -= 16; |
4277 |
++ |
4278 |
++ /* Since 16 % bpp = 16 % 3 = 1, last element of array must |
4279 |
++ * be proceeded manually |
4280 |
++ */ |
4281 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); |
4282 |
++ rp++; |
4283 |
++ } |
4284 |
++ |
4285 |
++ if(istop > 0) |
4286 |
++ for (i = 0; i < istop % 16; i++) |
4287 |
++ { |
4288 |
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); |
4289 |
++ rp++; |
4290 |
++ } |
4291 |
++} |
4292 |
++ |
4293 |
++void png_read_filter_row_avg4_vsx(png_row_infop row_info, png_bytep row, |
4294 |
++ png_const_bytep prev_row) |
4295 |
++{ |
4296 |
++ const png_byte bpp = 4; |
4297 |
++ |
4298 |
++ vector unsigned char rp_vec; |
4299 |
++ vector unsigned char pp_vec; |
4300 |
++ vector unsigned char pp_part_vec; |
4301 |
++ vector unsigned char rp_part_vec; |
4302 |
++ vector unsigned char avg_vec; |
4303 |
++ |
4304 |
++ vsx_declare_common_vars(row_info,row,prev_row,bpp) |
4305 |
++ rp -= bpp; |
4306 |
++ if(istop >= bpp) |
4307 |
++ istop -= bpp; |
4308 |
++ |
4309 |
++ for (i = 0; i < bpp; i++) |
4310 |
++ { |
4311 |
++ *rp = (png_byte)(((int)(*rp) + |
4312 |
++ ((int)(*pp++) / 2 )) & 0xff); |
4313 |
++ |
4314 |
++ rp++; |
4315 |
++ } |
4316 |
++ |
4317 |
++ /* Altivec operations require 16-byte aligned data |
4318 |
++ * but input can be unaligned. So we calculate |
4319 |
++ * unaligned part as usual. |
4320 |
++ */ |
4321 |
++ for (i = 0; i < unaligned_top; i++) |
4322 |
++ { |
4323 |
++ *rp = (png_byte)(((int)(*rp) + |
4324 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4325 |
++ |
4326 |
++ rp++; |
4327 |
++ } |
4328 |
++ |
4329 |
++ /* Using SIMD while we can */ |
4330 |
++ while( istop >= 16 ) |
4331 |
++ { |
4332 |
++ for(i=0;i < bpp ; i++) |
4333 |
++ { |
4334 |
++ *rp = (png_byte)(((int)(*rp) + |
4335 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4336 |
++ |
4337 |
++ rp++; |
4338 |
++ } |
4339 |
++ rp -= bpp; |
4340 |
++ pp -= bpp; |
4341 |
++ |
4342 |
++ vec_ld_unaligned(pp_vec,pp); |
4343 |
++ rp_vec = vec_ld(0,rp); |
4344 |
++ |
4345 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_4); |
4346 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED1_4); |
4347 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4348 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4349 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4350 |
++ |
4351 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_4); |
4352 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED2_4); |
4353 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4354 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4355 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4356 |
++ |
4357 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_4); |
4358 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED3_4); |
4359 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4360 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4361 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4362 |
++ |
4363 |
++ vec_st(rp_vec,0,rp); |
4364 |
++ |
4365 |
++ rp += 16; |
4366 |
++ pp += 16; |
4367 |
++ istop -= 16; |
4368 |
++ } |
4369 |
++ |
4370 |
++ if(istop > 0) |
4371 |
++ for (i = 0; i < istop % 16; i++) |
4372 |
++ { |
4373 |
++ *rp = (png_byte)(((int)(*rp) + |
4374 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4375 |
++ |
4376 |
++ rp++; |
4377 |
++ } |
4378 |
++} |
4379 |
++ |
4380 |
++void png_read_filter_row_avg3_vsx(png_row_infop row_info, png_bytep row, |
4381 |
++ png_const_bytep prev_row) |
4382 |
++{ |
4383 |
++ const png_byte bpp = 3; |
4384 |
++ |
4385 |
++ vector unsigned char rp_vec; |
4386 |
++ vector unsigned char pp_vec; |
4387 |
++ vector unsigned char pp_part_vec; |
4388 |
++ vector unsigned char rp_part_vec; |
4389 |
++ vector unsigned char avg_vec; |
4390 |
++ |
4391 |
++ vsx_declare_common_vars(row_info,row,prev_row,bpp) |
4392 |
++ rp -= bpp; |
4393 |
++ if(istop >= bpp) |
4394 |
++ istop -= bpp; |
4395 |
++ |
4396 |
++ for (i = 0; i < bpp; i++) |
4397 |
++ { |
4398 |
++ *rp = (png_byte)(((int)(*rp) + |
4399 |
++ ((int)(*pp++) / 2 )) & 0xff); |
4400 |
++ |
4401 |
++ rp++; |
4402 |
++ } |
4403 |
++ |
4404 |
++ /* Altivec operations require 16-byte aligned data |
4405 |
++ * but input can be unaligned. So we calculate |
4406 |
++ * unaligned part as usual. |
4407 |
++ */ |
4408 |
++ for (i = 0; i < unaligned_top; i++) |
4409 |
++ { |
4410 |
++ *rp = (png_byte)(((int)(*rp) + |
4411 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4412 |
++ |
4413 |
++ rp++; |
4414 |
++ } |
4415 |
++ |
4416 |
++ /* Using SIMD while we can */ |
4417 |
++ while( istop >= 16 ) |
4418 |
++ { |
4419 |
++ for(i=0;i < bpp ; i++) |
4420 |
++ { |
4421 |
++ *rp = (png_byte)(((int)(*rp) + |
4422 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4423 |
++ |
4424 |
++ rp++; |
4425 |
++ } |
4426 |
++ rp -= bpp; |
4427 |
++ pp -= bpp; |
4428 |
++ |
4429 |
++ vec_ld_unaligned(pp_vec,pp); |
4430 |
++ rp_vec = vec_ld(0,rp); |
4431 |
++ |
4432 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_3); |
4433 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED1_3); |
4434 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4435 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4436 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4437 |
++ |
4438 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_3); |
4439 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED2_3); |
4440 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4441 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4442 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4443 |
++ |
4444 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_3); |
4445 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED3_3); |
4446 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4447 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4448 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4449 |
++ |
4450 |
++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED4_3); |
4451 |
++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED4_3); |
4452 |
++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); |
4453 |
++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); |
4454 |
++ rp_vec = vec_add(rp_vec,avg_vec); |
4455 |
++ |
4456 |
++ vec_st(rp_vec,0,rp); |
4457 |
++ |
4458 |
++ rp += 15; |
4459 |
++ pp += 15; |
4460 |
++ istop -= 16; |
4461 |
++ |
4462 |
++ /* Since 16 % bpp = 16 % 3 = 1, last element of array must |
4463 |
++ * be proceeded manually |
4464 |
++ */ |
4465 |
++ *rp = (png_byte)(((int)(*rp) + |
4466 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4467 |
++ rp++; |
4468 |
++ } |
4469 |
++ |
4470 |
++ if(istop > 0) |
4471 |
++ for (i = 0; i < istop % 16; i++) |
4472 |
++ { |
4473 |
++ *rp = (png_byte)(((int)(*rp) + |
4474 |
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); |
4475 |
++ |
4476 |
++ rp++; |
4477 |
++ } |
4478 |
++} |
4479 |
++ |
4480 |
++/* Bytewise c ? t : e. */ |
4481 |
++#define if_then_else(c,t,e) vec_sel(e,t,c) |
4482 |
++ |
4483 |
++#define vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) {\ |
4484 |
++ c = *(pp - bpp);\ |
4485 |
++ a = *(rp - bpp);\ |
4486 |
++ b = *pp++;\ |
4487 |
++ p = b - c;\ |
4488 |
++ pc = a - c;\ |
4489 |
++ pa = vsx_abs(p);\ |
4490 |
++ pb = vsx_abs(pc);\ |
4491 |
++ pc = vsx_abs(p + pc);\ |
4492 |
++ if (pb < pa) pa = pb, a = b;\ |
4493 |
++ if (pc < pa) a = c;\ |
4494 |
++ a += *rp;\ |
4495 |
++ *rp++ = (png_byte)a;\ |
4496 |
++ } |
4497 |
++ |
4498 |
++void png_read_filter_row_paeth4_vsx(png_row_infop row_info, png_bytep row, |
4499 |
++ png_const_bytep prev_row) |
4500 |
++{ |
4501 |
++ const png_byte bpp = 4; |
4502 |
++ |
4503 |
++ int a, b, c, pa, pb, pc, p; |
4504 |
++ vector unsigned char rp_vec; |
4505 |
++ vector unsigned char pp_vec; |
4506 |
++ vector unsigned short a_vec,b_vec,c_vec,nearest_vec; |
4507 |
++ vector signed short pa_vec,pb_vec,pc_vec,smallest_vec; |
4508 |
++ |
4509 |
++ vsx_declare_common_vars(row_info,row,prev_row,bpp) |
4510 |
++ rp -= bpp; |
4511 |
++ if(istop >= bpp) |
4512 |
++ istop -= bpp; |
4513 |
++ |
4514 |
++ /* Process the first pixel in the row completely (this is the same as 'up' |
4515 |
++ * because there is only one candidate predictor for the first row). |
4516 |
++ */ |
4517 |
++ for(i = 0; i < bpp ; i++) |
4518 |
++ { |
4519 |
++ *rp = (png_byte)( *rp + *pp); |
4520 |
++ rp++; |
4521 |
++ pp++; |
4522 |
++ } |
4523 |
++ |
4524 |
++ for(i = 0; i < unaligned_top ; i++) |
4525 |
++ { |
4526 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4527 |
++ } |
4528 |
++ |
4529 |
++ while( istop >= 16) |
4530 |
++ { |
4531 |
++ for(i = 0; i < bpp ; i++) |
4532 |
++ { |
4533 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4534 |
++ } |
4535 |
++ |
4536 |
++ rp -= bpp; |
4537 |
++ pp -= bpp; |
4538 |
++ rp_vec = vec_ld(0,rp); |
4539 |
++ vec_ld_unaligned(pp_vec,pp); |
4540 |
++ |
4541 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_4),1,4); |
4542 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED1_4),1,4); |
4543 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_4),1,4); |
4544 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4545 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4546 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4547 |
++ pa_vec = vec_abs(pa_vec); |
4548 |
++ pb_vec = vec_abs(pb_vec); |
4549 |
++ pc_vec = vec_abs(pc_vec); |
4550 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4551 |
++ nearest_vec = if_then_else( |
4552 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4553 |
++ a_vec, |
4554 |
++ if_then_else( |
4555 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4556 |
++ b_vec, |
4557 |
++ c_vec |
4558 |
++ ) |
4559 |
++ ); |
4560 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,1,4))); |
4561 |
++ |
4562 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_4),2,4); |
4563 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED2_4),2,4); |
4564 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_4),2,4); |
4565 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4566 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4567 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4568 |
++ pa_vec = vec_abs(pa_vec); |
4569 |
++ pb_vec = vec_abs(pb_vec); |
4570 |
++ pc_vec = vec_abs(pc_vec); |
4571 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4572 |
++ nearest_vec = if_then_else( |
4573 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4574 |
++ a_vec, |
4575 |
++ if_then_else( |
4576 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4577 |
++ b_vec, |
4578 |
++ c_vec |
4579 |
++ ) |
4580 |
++ ); |
4581 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,2,4))); |
4582 |
++ |
4583 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_4),3,4); |
4584 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED3_4),3,4); |
4585 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_4),3,4); |
4586 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4587 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4588 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4589 |
++ pa_vec = vec_abs(pa_vec); |
4590 |
++ pb_vec = vec_abs(pb_vec); |
4591 |
++ pc_vec = vec_abs(pc_vec); |
4592 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4593 |
++ nearest_vec = if_then_else( |
4594 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4595 |
++ a_vec, |
4596 |
++ if_then_else( |
4597 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4598 |
++ b_vec, |
4599 |
++ c_vec |
4600 |
++ ) |
4601 |
++ ); |
4602 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,3,4))); |
4603 |
++ |
4604 |
++ vec_st(rp_vec,0,rp); |
4605 |
++ |
4606 |
++ rp += 16; |
4607 |
++ pp += 16; |
4608 |
++ istop -= 16; |
4609 |
++ } |
4610 |
++ |
4611 |
++ if(istop > 0) |
4612 |
++ for (i = 0; i < istop % 16; i++) |
4613 |
++ { |
4614 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4615 |
++ } |
4616 |
++} |
4617 |
++ |
4618 |
++void png_read_filter_row_paeth3_vsx(png_row_infop row_info, png_bytep row, |
4619 |
++ png_const_bytep prev_row) |
4620 |
++{ |
4621 |
++ const png_byte bpp = 3; |
4622 |
++ |
4623 |
++ int a, b, c, pa, pb, pc, p; |
4624 |
++ vector unsigned char rp_vec; |
4625 |
++ vector unsigned char pp_vec; |
4626 |
++ vector unsigned short a_vec,b_vec,c_vec,nearest_vec; |
4627 |
++ vector signed short pa_vec,pb_vec,pc_vec,smallest_vec; |
4628 |
++ |
4629 |
++ vsx_declare_common_vars(row_info,row,prev_row,bpp) |
4630 |
++ rp -= bpp; |
4631 |
++ if(istop >= bpp) |
4632 |
++ istop -= bpp; |
4633 |
++ |
4634 |
++ /* Process the first pixel in the row completely (this is the same as 'up' |
4635 |
++ * because there is only one candidate predictor for the first row). |
4636 |
++ */ |
4637 |
++ for(i = 0; i < bpp ; i++) |
4638 |
++ { |
4639 |
++ *rp = (png_byte)( *rp + *pp); |
4640 |
++ rp++; |
4641 |
++ pp++; |
4642 |
++ } |
4643 |
++ |
4644 |
++ for(i = 0; i < unaligned_top ; i++) |
4645 |
++ { |
4646 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4647 |
++ } |
4648 |
++ |
4649 |
++ while( istop >= 16) |
4650 |
++ { |
4651 |
++ for(i = 0; i < bpp ; i++) |
4652 |
++ { |
4653 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4654 |
++ } |
4655 |
++ |
4656 |
++ rp -= bpp; |
4657 |
++ pp -= bpp; |
4658 |
++ rp_vec = vec_ld(0,rp); |
4659 |
++ vec_ld_unaligned(pp_vec,pp); |
4660 |
++ |
4661 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_3),1,3); |
4662 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED1_3),1,3); |
4663 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_3),1,3); |
4664 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4665 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4666 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4667 |
++ pa_vec = vec_abs(pa_vec); |
4668 |
++ pb_vec = vec_abs(pb_vec); |
4669 |
++ pc_vec = vec_abs(pc_vec); |
4670 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4671 |
++ nearest_vec = if_then_else( |
4672 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4673 |
++ a_vec, |
4674 |
++ if_then_else( |
4675 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4676 |
++ b_vec, |
4677 |
++ c_vec |
4678 |
++ ) |
4679 |
++ ); |
4680 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,1,3))); |
4681 |
++ |
4682 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_3),2,3); |
4683 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED2_3),2,3); |
4684 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_3),2,3); |
4685 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4686 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4687 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4688 |
++ pa_vec = vec_abs(pa_vec); |
4689 |
++ pb_vec = vec_abs(pb_vec); |
4690 |
++ pc_vec = vec_abs(pc_vec); |
4691 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4692 |
++ nearest_vec = if_then_else( |
4693 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4694 |
++ a_vec, |
4695 |
++ if_then_else( |
4696 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4697 |
++ b_vec, |
4698 |
++ c_vec |
4699 |
++ ) |
4700 |
++ ); |
4701 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,2,3))); |
4702 |
++ |
4703 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_3),3,3); |
4704 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED3_3),3,3); |
4705 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_3),3,3); |
4706 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4707 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4708 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4709 |
++ pa_vec = vec_abs(pa_vec); |
4710 |
++ pb_vec = vec_abs(pb_vec); |
4711 |
++ pc_vec = vec_abs(pc_vec); |
4712 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4713 |
++ nearest_vec = if_then_else( |
4714 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4715 |
++ a_vec, |
4716 |
++ if_then_else( |
4717 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4718 |
++ b_vec, |
4719 |
++ c_vec |
4720 |
++ ) |
4721 |
++ ); |
4722 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,3,3))); |
4723 |
++ |
4724 |
++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED4_3),4,3); |
4725 |
++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED4_3),4,3); |
4726 |
++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED4_3),4,3); |
4727 |
++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); |
4728 |
++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); |
4729 |
++ pc_vec = vec_add(pa_vec,pb_vec); |
4730 |
++ pa_vec = vec_abs(pa_vec); |
4731 |
++ pb_vec = vec_abs(pb_vec); |
4732 |
++ pc_vec = vec_abs(pc_vec); |
4733 |
++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); |
4734 |
++ nearest_vec = if_then_else( |
4735 |
++ vec_cmpeq(pa_vec,smallest_vec), |
4736 |
++ a_vec, |
4737 |
++ if_then_else( |
4738 |
++ vec_cmpeq(pb_vec,smallest_vec), |
4739 |
++ b_vec, |
4740 |
++ c_vec |
4741 |
++ ) |
4742 |
++ ); |
4743 |
++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,4,3))); |
4744 |
++ |
4745 |
++ vec_st(rp_vec,0,rp); |
4746 |
++ |
4747 |
++ rp += 15; |
4748 |
++ pp += 15; |
4749 |
++ istop -= 16; |
4750 |
++ |
4751 |
++ /* Since 16 % bpp = 16 % 3 = 1, last element of array must |
4752 |
++ * be proceeded manually |
4753 |
++ */ |
4754 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4755 |
++ } |
4756 |
++ |
4757 |
++ if(istop > 0) |
4758 |
++ for (i = 0; i < istop % 16; i++) |
4759 |
++ { |
4760 |
++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) |
4761 |
++ } |
4762 |
++} |
4763 |
++ |
4764 |
++#endif /* PNG_POWERPC_VSX_OPT > 0 */ |
4765 |
++#endif /* PNG_POWERPC_VSX_IMPLEMENTATION == 1 (intrinsics) */ |
4766 |
++#endif /* READ */ |
4767 |
+new file mode 100644 |
4768 |
+--- /dev/null |
4769 |
++++ qtwebengine/src/3rdparty/chromium/third_party/libpng/powerpc/powerpc_init.c |
4770 |
+@@ -0,0 +1,125 @@ |
4771 |
++ |
4772 |
++/* powerpc_init.c - POWERPC optimised filter functions |
4773 |
++ * |
4774 |
++ * Copyright (c) 2017 Glenn Randers-Pehrson |
4775 |
++ * Written by Vadim Barkov, 2017. |
4776 |
++ * Last changed in libpng 1.6.29 [March 16, 2017] |
4777 |
++ * |
4778 |
++ * This code is released under the libpng license. |
4779 |
++ * For conditions of distribution and use, see the disclaimer |
4780 |
++ * and license in png.h |
4781 |
++ */ |
4782 |
++/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are |
4783 |
++ * called. |
4784 |
++ */ |
4785 |
++#define _POSIX_SOURCE 1 |
4786 |
++ |
4787 |
++#include <stdio.h> |
4788 |
++#include "../pngpriv.h" |
4789 |
++ |
4790 |
++#ifdef PNG_READ_SUPPORTED |
4791 |
++ |
4792 |
++#if PNG_POWERPC_VSX_OPT > 0 |
4793 |
++#ifdef PNG_POWERPC_VSX_CHECK_SUPPORTED /* Do run-time checks */ |
4794 |
++/* WARNING: it is strongly recommended that you do not build libpng with |
4795 |
++ * run-time checks for CPU features if at all possible. In the case of the PowerPC |
4796 |
++ * VSX instructions there is no processor-specific way of detecting the |
4797 |
++ * presence of the required support, therefore run-time detection is extremely |
4798 |
++ * OS specific. |
4799 |
++ * |
4800 |
++ * You may set the macro PNG_POWERPC_VSX_FILE to the file name of file containing |
4801 |
++ * a fragment of C source code which defines the png_have_vsx function. There |
4802 |
++ * are a number of implementations in contrib/powerpc-vsx, but the only one that |
4803 |
++ * has partial support is contrib/powerpc-vsx/linux.c - a generic Linux |
4804 |
++ * implementation which reads /proc/cpufino. |
4805 |
++ */ |
4806 |
++#ifndef PNG_POWERPC_VSX_FILE |
4807 |
++# ifdef __linux__ |
4808 |
++# define PNG_POWERPC_VSX_FILE "contrib/powerpc-vsx/linux_aux.c" |
4809 |
++# endif |
4810 |
++#endif |
4811 |
++ |
4812 |
++#ifdef PNG_POWERPC_VSX_FILE |
4813 |
++ |
4814 |
++#include <signal.h> /* for sig_atomic_t */ |
4815 |
++static int png_have_vsx(png_structp png_ptr); |
4816 |
++#include PNG_POWERPC_VSX_FILE |
4817 |
++ |
4818 |
++#else /* PNG_POWERPC_VSX_FILE */ |
4819 |
++# error "PNG_POWERPC_VSX_FILE undefined: no support for run-time POWERPC VSX checks" |
4820 |
++#endif /* PNG_POWERPC_VSX_FILE */ |
4821 |
++#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */ |
4822 |
++ |
4823 |
++void |
4824 |
++png_init_filter_functions_vsx(png_structp pp, unsigned int bpp) |
4825 |
++{ |
4826 |
++ /* The switch statement is compiled in for POWERPC_VSX_API, the call to |
4827 |
++ * png_have_vsx is compiled in for POWERPC_VSX_CHECK. If both are defined |
4828 |
++ * the check is only performed if the API has not set the PowerPC option on |
4829 |
++ * or off explicitly. In this case the check controls what happens. |
4830 |
++ */ |
4831 |
++ |
4832 |
++#ifdef PNG_POWERPC_VSX_API_SUPPORTED |
4833 |
++ switch ((pp->options >> PNG_POWERPC_VSX) & 3) |
4834 |
++ { |
4835 |
++ case PNG_OPTION_UNSET: |
4836 |
++ /* Allow the run-time check to execute if it has been enabled - |
4837 |
++ * thus both API and CHECK can be turned on. If it isn't supported |
4838 |
++ * this case will fall through to the 'default' below, which just |
4839 |
++ * returns. |
4840 |
++ */ |
4841 |
++#endif /* PNG_POWERPC_VSX_API_SUPPORTED */ |
4842 |
++#ifdef PNG_POWERPC_VSX_CHECK_SUPPORTED |
4843 |
++ { |
4844 |
++ static volatile sig_atomic_t no_vsx = -1; /* not checked */ |
4845 |
++ |
4846 |
++ if (no_vsx < 0) |
4847 |
++ no_vsx = !png_have_vsx(pp); |
4848 |
++ |
4849 |
++ if (no_vsx) |
4850 |
++ return; |
4851 |
++ } |
4852 |
++#ifdef PNG_POWERPC_VSX_API_SUPPORTED |
4853 |
++ break; |
4854 |
++#endif |
4855 |
++#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */ |
4856 |
++ |
4857 |
++#ifdef PNG_POWERPC_VSX_API_SUPPORTED |
4858 |
++ default: /* OFF or INVALID */ |
4859 |
++ return; |
4860 |
++ |
4861 |
++ case PNG_OPTION_ON: |
4862 |
++ /* Option turned on */ |
4863 |
++ break; |
4864 |
++ } |
4865 |
++#endif |
4866 |
++ |
4867 |
++ /* IMPORTANT: any new internal functions used here must be declared using |
4868 |
++ * PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the |
4869 |
++ * 'prefix' option to configure works: |
4870 |
++ * |
4871 |
++ * ./configure --with-libpng-prefix=foobar_ |
4872 |
++ * |
4873 |
++ * Verify you have got this right by running the above command, doing a build |
4874 |
++ * and examining pngprefix.h; it must contain a #define for every external |
4875 |
++ * function you add. (Notice that this happens automatically for the |
4876 |
++ * initialization function.) |
4877 |
++ */ |
4878 |
++ pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_vsx; |
4879 |
++ |
4880 |
++ if (bpp == 3) |
4881 |
++ { |
4882 |
++ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_vsx; |
4883 |
++ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_vsx; |
4884 |
++ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_vsx; |
4885 |
++ } |
4886 |
++ |
4887 |
++ else if (bpp == 4) |
4888 |
++ { |
4889 |
++ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_vsx; |
4890 |
++ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_vsx; |
4891 |
++ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_vsx; |
4892 |
++ } |
4893 |
++} |
4894 |
++#endif /* PNG_POWERPC_VSX_OPT > 0 */ |
4895 |
++#endif /* READ */ |
4896 |
+--- qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h |
4897 |
++++ qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h |
4898 |
+@@ -3914,7 +3914,7 @@ struct kernel_statfs { |
4899 |
+ LSS_REG(2, buf); |
4900 |
+ LSS_BODY(void*, mmap2, "0"(__r2)); |
4901 |
+ } |
4902 |
+-#else |
4903 |
++#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */ |
4904 |
+ #define __NR__mmap2 __NR_mmap2 |
4905 |
+ LSS_INLINE _syscall6(void*, _mmap2, void*, s, |
4906 |
+ size_t, l, int, p, |
4907 |
+@@ -4045,7 +4045,7 @@ struct kernel_statfs { |
4908 |
+ #if defined(__i386__) || \ |
4909 |
+ defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ |
4910 |
+ (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ |
4911 |
+- defined(__PPC__) || \ |
4912 |
++ (defined(__PPC__) && !defined(__powerpc64__)) || \ |
4913 |
+ (defined(__s390__) && !defined(__s390x__)) |
4914 |
+ /* On these architectures, implement mmap() with mmap2(). */ |
4915 |
+ LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, |
4916 |
+--- qtwebengine/src/3rdparty/chromium/third_party/node/node.py |
4917 |
++++ qtwebengine/src/3rdparty/chromium/third_party/node/node.py |
4918 |
+@@ -10,11 +10,12 @@ import sys |
4919 |
+ |
4920 |
+ |
4921 |
+ def GetBinaryPath(): |
4922 |
+- return os_path.join(os_path.dirname(__file__), *{ |
4923 |
+- 'Darwin': ('mac', 'node-darwin-x64', 'bin', 'node'), |
4924 |
+- 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'), |
4925 |
+- 'Windows': ('win', 'node.exe'), |
4926 |
+- }[platform.system()]) |
4927 |
++ return "/usr/bin/node" |
4928 |
++ #return os_path.join(os_path.dirname(__file__), *{ |
4929 |
++ # 'Darwin': ('mac', 'node-darwin-x64', 'bin', 'node'), |
4930 |
++ # 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'), |
4931 |
++ # 'Windows': ('win', 'node.exe'), |
4932 |
++ #}[platform.system()]) |
4933 |
+ |
4934 |
+ |
4935 |
+ def RunNode(cmd_parts, stdout=None): |
4936 |
+--- qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h |
4937 |
++++ qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h |
4938 |
+@@ -11,7 +11,7 @@ |
4939 |
+ |
4940 |
+ namespace pdfium { |
4941 |
+ namespace base { |
4942 |
+-#if defined(OS_WIN) |
4943 |
++#if defined(OS_WIN) || defined(ARCH_CPU_PPC64) |
4944 |
+ static constexpr size_t kPageAllocationGranularityShift = 16; // 64KB |
4945 |
+ #elif defined(_MIPS_ARCH_LOONGSON) |
4946 |
+ static constexpr size_t kPageAllocationGranularityShift = 14; // 16KB |
4947 |
+@@ -27,6 +27,10 @@ static constexpr size_t kPageAllocationGranularityBaseMask = |
4948 |
+ |
4949 |
+ #if defined(_MIPS_ARCH_LOONGSON) |
4950 |
+ static constexpr size_t kSystemPageSize = 16384; |
4951 |
++#elif defined(ARCH_CPU_PPC64) |
4952 |
++// TODO: modern ppc64 can do 4k and 64k page sizes |
4953 |
++// for now, 64k is assumed |
4954 |
++static constexpr size_t kSystemPageSize = 65536; |
4955 |
+ #else |
4956 |
+ static constexpr size_t kSystemPageSize = 4096; |
4957 |
+ #endif |
4958 |
+--- qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc_constants.h |
4959 |
++++ qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc_constants.h |
4960 |
+@@ -33,6 +33,8 @@ static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2; |
4961 |
+ // up against the end of a system page. |
4962 |
+ #if defined(_MIPS_ARCH_LOONGSON) |
4963 |
+ static const size_t kPartitionPageShift = 16; // 64KB |
4964 |
++#elif defined(ARCH_CPU_PPC64) |
4965 |
++static const size_t kPartitionPageShift = 18; // 256KB |
4966 |
+ #else |
4967 |
+ static const size_t kPartitionPageShift = 14; // 16KB |
4968 |
+ #endif |
4969 |
+--- qtwebengine/src/3rdparty/chromium/third_party/sqlite/amalgamation/sqlite3.c |
4970 |
++++ qtwebengine/src/3rdparty/chromium/third_party/sqlite/amalgamation/sqlite3.c |
4971 |
+@@ -13937,7 +13937,8 @@ typedef INT16_TYPE LogEst; |
4972 |
+ # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ |
4973 |
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ |
4974 |
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ |
4975 |
+- defined(__arm__) || defined(_M_ARM64) |
4976 |
++ defined(__arm__) || defined(_M_ARM64) || defined(__powerpc64__) && \ |
4977 |
++ (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) |
4978 |
+ # define SQLITE_BYTEORDER 1234 |
4979 |
+ # elif defined(sparc) || defined(__ppc__) |
4980 |
+ # define SQLITE_BYTEORDER 4321 |
4981 |
+--- qtwebengine/src/3rdparty/chromium/third_party/sqlite/src/src/sqliteInt.h |
4982 |
++++ qtwebengine/src/3rdparty/chromium/third_party/sqlite/src/src/sqliteInt.h |
4983 |
+@@ -833,7 +833,8 @@ typedef INT16_TYPE LogEst; |
4984 |
+ # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ |
4985 |
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ |
4986 |
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ |
4987 |
+- defined(__arm__) || defined(_M_ARM64) |
4988 |
++ defined(__arm__) || defined(_M_ARM64) || defined(__powerpc64__) && \ |
4989 |
++ (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) |
4990 |
+ # define SQLITE_BYTEORDER 1234 |
4991 |
+ # elif defined(sparc) || defined(__ppc__) |
4992 |
+ # define SQLITE_BYTEORDER 4321 |
4993 |
+--- qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/differ_block.cc |
4994 |
++++ qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/differ_block.cc |
4995 |
+@@ -30,11 +30,7 @@ bool VectorDifference(const uint8_t* image1, const uint8_t* image2) { |
4996 |
+ static bool (*diff_proc)(const uint8_t*, const uint8_t*) = nullptr; |
4997 |
+ |
4998 |
+ if (!diff_proc) { |
4999 |
+-#if defined(WEBRTC_ARCH_ARM_FAMILY) || defined(WEBRTC_ARCH_MIPS_FAMILY) |
5000 |
+- // For ARM and MIPS processors, always use C version. |
5001 |
+- // TODO(hclam): Implement a NEON version. |
5002 |
+- diff_proc = &VectorDifference_C; |
5003 |
+-#else |
5004 |
++#if defined(WEBRTC_ARCH_X86_FAMILY) |
5005 |
+ bool have_sse2 = WebRtc_GetCPUInfo(kSSE2) != 0; |
5006 |
+ // For x86 processors, check if SSE2 is supported. |
5007 |
+ if (have_sse2 && kBlockSize == 32) { |
5008 |
+@@ -44,6 +40,10 @@ bool VectorDifference(const uint8_t* image1, const uint8_t* image2) { |
5009 |
+ } else { |
5010 |
+ diff_proc = &VectorDifference_C; |
5011 |
+ } |
5012 |
++#else |
5013 |
++ // For other processors, always use C version. |
5014 |
++ // TODO(hclam): Implement a NEON version. |
5015 |
++ diff_proc = &VectorDifference_C; |
5016 |
+ #endif |
5017 |
+ } |
5018 |
+ |
5019 |
+--- qtwebengine/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/arch.h |
5020 |
++++ qtwebengine/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/arch.h |
5021 |
+@@ -47,6 +47,18 @@ |
5022 |
+ #elif defined(__pnacl__) |
5023 |
+ #define WEBRTC_ARCH_32_BITS |
5024 |
+ #define WEBRTC_ARCH_LITTLE_ENDIAN |
5025 |
++#elif defined(__PPC__) |
5026 |
++#define WEBRTC_ARCH_PPC_FAMILY |
5027 |
++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
5028 |
++#define WEBRTC_ARCH_LITTLE_ENDIAN |
5029 |
++#else |
5030 |
++#define WEBRTC_ARCH_BIG_ENDIAN |
5031 |
++#endif |
5032 |
++#if defined(__LP64__) |
5033 |
++#define WEBRTC_ARCH_64_BITS |
5034 |
++#else |
5035 |
++#define WEBRTC_ARCH_32_BITS |
5036 |
++#endif |
5037 |
+ #else |
5038 |
+ #error Please add support for your architecture in typedefs.h |
5039 |
+ #endif |
5040 |
+--- qtwebengine/src/3rdparty/chromium/v8/BUILD.gn |
5041 |
++++ qtwebengine/src/3rdparty/chromium/v8/BUILD.gn |
5042 |
+@@ -544,6 +544,12 @@ config("toolchain") { |
5043 |
+ } |
5044 |
+ if (host_byteorder == "little") { |
5045 |
+ defines += [ "V8_TARGET_ARCH_PPC_LE" ] |
5046 |
++ cflags += [ |
5047 |
++ # Enable usage of AltiVec, VSX, and other POWER8 and higher features |
5048 |
++ "-mcpu=power8", |
5049 |
++ "-maltivec", |
5050 |
++ "-mvsx", |
5051 |
++ ] |
5052 |
+ } else if (host_byteorder == "big") { |
5053 |
+ defines += [ "V8_TARGET_ARCH_PPC_BE" ] |
5054 |
+ if (current_os == "aix") { |
5055 |
+--- qtwebengine/src/3rdparty/chromium/v8/test/BUILD.gn |
5056 |
++++ qtwebengine/src/3rdparty/chromium/v8/test/BUILD.gn |
5057 |
+@@ -31,7 +31,7 @@ group("gn_all") { |
5058 |
+ deps += [ |
5059 |
+ "cctest:cctest", |
5060 |
+ "cctest:generate-bytecode-expectations", |
5061 |
+- "unittests:unittests", |
5062 |
++ #"unittests:unittests", |
5063 |
+ ] |
5064 |
+ } |
5065 |
+ } |
5066 |
+@@ -80,9 +80,9 @@ group("v8_bot_default") { |
5067 |
+ "mjsunit:v8_mjsunit", |
5068 |
+ "mkgrokdump:mkgrokdump", |
5069 |
+ "preparser:v8_preparser", |
5070 |
+- "unittests:unittests", |
5071 |
++ #"unittests:unittests", |
5072 |
+ "wasm-js:v8_wasm_js", |
5073 |
+- "wasm-spec-tests:v8_wasm_spec_tests", |
5074 |
++ #"wasm-spec-tests:v8_wasm_spec_tests", |
5075 |
+ "webkit:v8_webkit", |
5076 |
+ ] |
5077 |
+ } |
5078 |
+@@ -100,9 +100,9 @@ group("v8_default") { |
5079 |
+ "mjsunit:v8_mjsunit", |
5080 |
+ "mkgrokdump:mkgrokdump", |
5081 |
+ "preparser:v8_preparser", |
5082 |
+- "unittests:unittests", |
5083 |
+- "wasm-js:v8_wasm_js", |
5084 |
+- "wasm-spec-tests:v8_wasm_spec_tests", |
5085 |
++ #"unittests:unittests", |
5086 |
++ #"wasm-js:v8_wasm_js", |
5087 |
++ #"wasm-spec-tests:v8_wasm_spec_tests", |
5088 |
+ ] |
5089 |
+ } |
5090 |
+ |
5091 |
|
5092 |
diff --git a/dev-qt/qtwebengine/files/musl/0091-chromium-ppc64-musl.patch b/dev-qt/qtwebengine/files/musl/0091-chromium-ppc64-musl.patch |
5093 |
new file mode 100644 |
5094 |
index 0000000..df014d8 |
5095 |
--- /dev/null |
5096 |
+++ b/dev-qt/qtwebengine/files/musl/0091-chromium-ppc64-musl.patch |
5097 |
@@ -0,0 +1,141 @@ |
5098 |
+This includes additional build fixes for the musl libc. |
5099 |
+ |
5100 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h |
5101 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h |
5102 |
+@@ -11,12 +11,14 @@ |
5103 |
+ // All x86_64 builds use a new enough bionic to have sys/user.h. |
5104 |
+ #if !defined(__BIONIC__) || defined(__x86_64__) |
5105 |
+ #if !defined(__native_client_nonsfi__) |
5106 |
++#if !defined(__powerpc64__) || defined(__GLIBC__) |
5107 |
+ #include <sys/user.h> |
5108 |
+ #endif |
5109 |
++#endif |
5110 |
+ #if defined(__mips__) |
5111 |
+ // sys/user.h in eglibc misses size_t definition |
5112 |
+ #include <stddef.h> |
5113 |
+-#elif defined(__powerpc64__) |
5114 |
++#elif defined(__powerpc64__) && defined(__GLIBC__) |
5115 |
+ // Manually define greg_t on ppc64 |
5116 |
+ typedef unsigned long long greg_t; |
5117 |
+ #endif |
5118 |
+@@ -361,11 +363,11 @@ typedef struct pt_regs regs_struct; |
5119 |
+ #define SECCOMP_ARCH AUDIT_ARCH_PPC64 |
5120 |
+ #endif |
5121 |
+ |
5122 |
+-#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg]) |
5123 |
++#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg]) |
5124 |
+ |
5125 |
+ #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3) |
5126 |
+ #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0) |
5127 |
+-#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip |
5128 |
++#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip |
5129 |
+ #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3) |
5130 |
+ #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4) |
5131 |
+ #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5) |
5132 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/syscall.cc |
5133 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/syscall.cc |
5134 |
+@@ -497,9 +497,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) { |
5135 |
+ // Same as MIPS, need to invert ret and set error register (cr0.SO) |
5136 |
+ if (ret_val <= -1 && ret_val >= -4095) { |
5137 |
+ ret_val = -ret_val; |
5138 |
+- ctx->uc_mcontext.regs->ccr |= (1 << 28); |
5139 |
++ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28); |
5140 |
+ } else { |
5141 |
+- ctx->uc_mcontext.regs->ccr &= ~(1 << 28); |
5142 |
++ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28); |
5143 |
+ } |
5144 |
+ #endif |
5145 |
+ SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val); |
5146 |
+--- qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc |
5147 |
++++ qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc |
5148 |
+@@ -20,7 +20,7 @@ |
5149 |
+ #include <intrin.h> |
5150 |
+ #endif |
5151 |
+ |
5152 |
+-#if defined(__powerpc__) || defined(__ppc__) |
5153 |
++#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__) |
5154 |
+ #include <sys/platform/ppc.h> |
5155 |
+ #endif |
5156 |
+ |
5157 |
+@@ -53,7 +53,7 @@ double UnscaledCycleClock::Frequency() { |
5158 |
+ return base_internal::NominalCPUFrequency(); |
5159 |
+ } |
5160 |
+ |
5161 |
+-#elif defined(__powerpc__) || defined(__ppc__) |
5162 |
++#elif (defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__) |
5163 |
+ |
5164 |
+ int64_t UnscaledCycleClock::Now() { |
5165 |
+ return __ppc_get_timebase(); |
5166 |
+--- qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h |
5167 |
++++ qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h |
5168 |
+@@ -46,7 +46,7 @@ |
5169 |
+ |
5170 |
+ // The following platforms have an implementation of a hardware counter. |
5171 |
+ #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \ |
5172 |
+- defined(__powerpc__) || defined(__ppc__) || \ |
5173 |
++ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || \ |
5174 |
+ defined(_M_IX86) || defined(_M_X64) |
5175 |
+ #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1 |
5176 |
+ #else |
5177 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc |
5178 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc |
5179 |
+@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const { |
5180 |
+ |
5181 |
+ #elif defined(__powerpc64__) |
5182 |
+ |
5183 |
++#include <asm/elf.h> |
5184 |
++#include <asm/ptrace.h> |
5185 |
++ |
5186 |
+ uintptr_t ThreadInfo::GetInstructionPointer() const { |
5187 |
+ return mcontext.gp_regs[PT_NIP]; |
5188 |
+ } |
5189 |
+@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const { |
5190 |
+ out->ctr = mcontext.gp_regs[PT_CTR]; |
5191 |
+ |
5192 |
+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++) |
5193 |
+- out->float_save.fpregs[i] = mcontext.fp_regs[i]; |
5194 |
++ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i]; |
5195 |
+ |
5196 |
+- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1]; |
5197 |
++ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1]; |
5198 |
+ |
5199 |
+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) |
5200 |
+ out->vector_save.save_vr[i] = \ |
5201 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
5202 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
5203 |
+@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) { |
5204 |
+ |
5205 |
+ #elif defined(__powerpc64__) |
5206 |
+ |
5207 |
++#include <asm/elf.h> |
5208 |
++#include <asm/ptrace.h> |
5209 |
++ |
5210 |
+ uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { |
5211 |
+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]; |
5212 |
+ } |
5213 |
+@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc, |
5214 |
+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR]; |
5215 |
+ |
5216 |
+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++) |
5217 |
+- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i]; |
5218 |
++ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i]; |
5219 |
+ |
5220 |
+- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1]; |
5221 |
++ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1]; |
5222 |
+ |
5223 |
+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) |
5224 |
+ out->vector_save.save_vr[i] = |
5225 |
+--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc |
5226 |
++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc |
5227 |
+@@ -105,6 +105,11 @@ |
5228 |
+ #define PR_SET_PTRACER 0x59616d61 |
5229 |
+ #endif |
5230 |
+ |
5231 |
++/* musl hack, can't include asm/ptrace.h as that causes conflicts */ |
5232 |
++#if defined(__powerpc64__) && !defined(PT_NIP) |
5233 |
++#define PT_NIP 32 |
5234 |
++#endif |
5235 |
++ |
5236 |
+ namespace google_breakpad { |
5237 |
+ |
5238 |
+ namespace { |
5239 |
|
5240 |
diff --git a/dev-qt/qtwebengine/files/musl/0092-chromium-ppc64-be.patch b/dev-qt/qtwebengine/files/musl/0092-chromium-ppc64-be.patch |
5241 |
new file mode 100644 |
5242 |
index 0000000..8eda0f4 |
5243 |
--- /dev/null |
5244 |
+++ b/dev-qt/qtwebengine/files/musl/0092-chromium-ppc64-be.patch |
5245 |
@@ -0,0 +1,2955 @@ |
5246 |
+This adds big endian support/fixes in addition to the base ppc64le patch. |
5247 |
+ |
5248 |
+Ping q66 if you're updating qt5 and the patch does not apply anymore. |
5249 |
+ |
5250 |
+Source: https://wiki.raptorcs.com/w/index.php?title=Porting/Chromium/BE |
5251 |
+ |
5252 |
+--- qtwebengine/src/3rdparty/chromium/base/allocator/partition_allocator/partition_alloc.cc |
5253 |
++++ qtwebengine/src/3rdparty/chromium/base/allocator/partition_allocator/partition_alloc.cc |
5254 |
+@@ -440,7 +440,7 @@ static size_t PartitionPurgePage(internal::PartitionPage* page, bool discard) { |
5255 |
+ #endif |
5256 |
+ } |
5257 |
+ // Terminate the freelist chain. |
5258 |
+- *entry_ptr = nullptr; |
5259 |
++ *entry_ptr = internal::PartitionFreelistEntry::Transform(nullptr); |
5260 |
+ // The freelist head is stored unmasked. |
5261 |
+ page->freelist_head = |
5262 |
+ internal::PartitionFreelistEntry::Transform(page->freelist_head); |
5263 |
+--- qtwebengine/src/3rdparty/chromium/base/i18n/icu_util.cc |
5264 |
++++ qtwebengine/src/3rdparty/chromium/base/i18n/icu_util.cc |
5265 |
+@@ -75,7 +75,11 @@ wchar_t g_debug_icu_pf_filename[_MAX_PATH]; |
5266 |
+ // No need to change the filename in multiple places (gyp files, windows |
5267 |
+ // build pkg configurations, etc). 'l' stands for Little Endian. |
5268 |
+ // This variable is exported through the header file. |
5269 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5270 |
+ const char kIcuDataFileName[] = "icudtl.dat"; |
5271 |
++#else |
5272 |
++const char kIcuDataFileName[] = "icudtb.dat"; |
5273 |
++#endif |
5274 |
+ #if defined(OS_ANDROID) |
5275 |
+ const char kAndroidAssetsIcuDataFileName[] = "assets/icudtl.dat"; |
5276 |
+ #endif |
5277 |
+--- qtwebengine/src/3rdparty/chromium/base/memory/shared_memory_mapping_unittest.cc |
5278 |
++++ qtwebengine/src/3rdparty/chromium/base/memory/shared_memory_mapping_unittest.cc |
5279 |
+@@ -12,6 +12,7 @@ |
5280 |
+ #include "base/containers/span.h" |
5281 |
+ #include "base/memory/read_only_shared_memory_region.h" |
5282 |
+ #include "testing/gtest/include/gtest/gtest.h" |
5283 |
++#include "base/sys_byteorder.h" |
5284 |
+ |
5285 |
+ namespace base { |
5286 |
+ |
5287 |
+@@ -69,8 +70,8 @@ TEST_F(SharedMemoryMappingTest, SpanWithAutoDeducedElementCount) { |
5288 |
+ |
5289 |
+ for (size_t i = 0; i < write_span.size(); ++i) |
5290 |
+ write_span[i] = i + 1; |
5291 |
+- EXPECT_EQ(0x04030201u, read_span[0]); |
5292 |
+- EXPECT_EQ(0x08070605u, read_span[1]); |
5293 |
++ EXPECT_EQ(HostToNet32(0x01020304u), read_span[0]); |
5294 |
++ EXPECT_EQ(HostToNet32(0x05060708u), read_span[1]); |
5295 |
+ } |
5296 |
+ |
5297 |
+ TEST_F(SharedMemoryMappingTest, SpanWithExplicitElementCount) { |
5298 |
+@@ -95,13 +96,13 @@ TEST_F(SharedMemoryMappingTest, SpanWithExplicitElementCount) { |
5299 |
+ |
5300 |
+ for (size_t i = 0; i < write_span.size(); ++i) |
5301 |
+ write_span[i] = i + 1; |
5302 |
+- EXPECT_EQ(0x04030201u, read_span[0]); |
5303 |
+- EXPECT_EQ(0x08070605u, read_span[1]); |
5304 |
+- EXPECT_EQ(0x04030201u, read_span_2[0]); |
5305 |
++ EXPECT_EQ(HostToNet32(0x01020304u), read_span[0]); |
5306 |
++ EXPECT_EQ(HostToNet32(0x05060708u), read_span[1]); |
5307 |
++ EXPECT_EQ(HostToNet32(0x01020304u), read_span_2[0]); |
5308 |
+ |
5309 |
+ std::fill(write_span_2.begin(), write_span_2.end(), 0); |
5310 |
+ EXPECT_EQ(0u, read_span[0]); |
5311 |
+- EXPECT_EQ(0x08070605u, read_span[1]); |
5312 |
++ EXPECT_EQ(HostToNet32(0x05060708u), read_span[1]); |
5313 |
+ EXPECT_EQ(0u, read_span_2[0]); |
5314 |
+ } |
5315 |
+ |
5316 |
+--- qtwebengine/src/3rdparty/chromium/base/metrics/bucket_ranges_unittest.cc |
5317 |
++++ qtwebengine/src/3rdparty/chromium/base/metrics/bucket_ranges_unittest.cc |
5318 |
+@@ -7,6 +7,7 @@ |
5319 |
+ #include <stdint.h> |
5320 |
+ |
5321 |
+ #include "testing/gtest/include/gtest/gtest.h" |
5322 |
++#include "base/sys_byteorder.h" |
5323 |
+ |
5324 |
+ namespace base { |
5325 |
+ namespace { |
5326 |
+@@ -64,13 +65,21 @@ TEST(BucketRangesTest, Checksum) { |
5327 |
+ ranges.set_range(2, 2); |
5328 |
+ |
5329 |
+ ranges.ResetChecksum(); |
5330 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5331 |
+ EXPECT_EQ(289217253u, ranges.checksum()); |
5332 |
++#else |
5333 |
++ EXPECT_EQ(2767231596u, ranges.checksum()); |
5334 |
++#endif |
5335 |
+ |
5336 |
+ ranges.set_range(2, 3); |
5337 |
+ EXPECT_FALSE(ranges.HasValidChecksum()); |
5338 |
+ |
5339 |
+ ranges.ResetChecksum(); |
5340 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5341 |
+ EXPECT_EQ(2843835776u, ranges.checksum()); |
5342 |
++#else |
5343 |
++ EXPECT_EQ(3556223738u, ranges.checksum()); |
5344 |
++#endif |
5345 |
+ EXPECT_TRUE(ranges.HasValidChecksum()); |
5346 |
+ } |
5347 |
+ |
5348 |
+--- qtwebengine/src/3rdparty/chromium/base/pickle.cc |
5349 |
++++ qtwebengine/src/3rdparty/chromium/base/pickle.cc |
5350 |
+@@ -82,7 +82,12 @@ inline const char* PickleIterator::GetReadPointerAndAdvance( |
5351 |
+ } |
5352 |
+ |
5353 |
+ bool PickleIterator::ReadBool(bool* result) { |
5354 |
+- return ReadBuiltinType(result); |
5355 |
++ int int_result; |
5356 |
++ if (ReadBuiltinType(&int_result)) { |
5357 |
++ *result = static_cast<bool>(int_result); |
5358 |
++ return true; |
5359 |
++ } else |
5360 |
++ return false; |
5361 |
+ } |
5362 |
+ |
5363 |
+ bool PickleIterator::ReadInt(int* result) { |
5364 |
+--- qtwebengine/src/3rdparty/chromium/base/sha1.cc |
5365 |
++++ qtwebengine/src/3rdparty/chromium/base/sha1.cc |
5366 |
+@@ -110,8 +110,10 @@ void SecureHashAlgorithm::Final() { |
5367 |
+ Pad(); |
5368 |
+ Process(); |
5369 |
+ |
5370 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5371 |
+ for (auto& t : H) |
5372 |
+ t = ByteSwap(t); |
5373 |
++#endif |
5374 |
+ } |
5375 |
+ |
5376 |
+ void SecureHashAlgorithm::Update(const void* data, size_t nbytes) { |
5377 |
+@@ -157,8 +159,10 @@ void SecureHashAlgorithm::Process() { |
5378 |
+ // |
5379 |
+ // W and M are in a union, so no need to memcpy. |
5380 |
+ // memcpy(W, M, sizeof(M)); |
5381 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5382 |
+ for (t = 0; t < 16; ++t) |
5383 |
+ W[t] = ByteSwap(W[t]); |
5384 |
++#endif |
5385 |
+ |
5386 |
+ // b. |
5387 |
+ for (t = 16; t < 80; ++t) |
5388 |
+--- qtwebengine/src/3rdparty/chromium/base/strings/string_number_conversions_unittest.cc |
5389 |
++++ qtwebengine/src/3rdparty/chromium/base/strings/string_number_conversions_unittest.cc |
5390 |
+@@ -829,12 +829,21 @@ TEST(StringNumberConversionsTest, DoubleToString) { |
5391 |
+ } |
5392 |
+ |
5393 |
+ // The following two values were seen in crashes in the wild. |
5394 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5395 |
+ const char input_bytes[8] = {0, 0, 0, 0, '\xee', '\x6d', '\x73', '\x42'}; |
5396 |
++#else |
5397 |
++ const char input_bytes[8] = {'\x42', '\x73', '\x6d', '\xee', 0, 0, 0, 0}; |
5398 |
++#endif |
5399 |
+ double input = 0; |
5400 |
+ memcpy(&input, input_bytes, base::size(input_bytes)); |
5401 |
+ EXPECT_EQ("1335179083776", NumberToString(input)); |
5402 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
5403 |
+ const char input_bytes2[8] = |
5404 |
+ {0, 0, 0, '\xa0', '\xda', '\x6c', '\x73', '\x42'}; |
5405 |
++#else |
5406 |
++ const char input_bytes2[8] = |
5407 |
++ {'\x42', '\x73', '\x6c', '\xda', '\xa0', 0, 0, 0}; |
5408 |
++#endif |
5409 |
+ input = 0; |
5410 |
+ memcpy(&input, input_bytes2, base::size(input_bytes2)); |
5411 |
+ EXPECT_EQ("1334890332160", NumberToString(input)); |
5412 |
+--- qtwebengine/src/3rdparty/chromium/base/third_party/dmg_fp/dtoa.cc |
5413 |
++++ qtwebengine/src/3rdparty/chromium/base/third_party/dmg_fp/dtoa.cc |
5414 |
+@@ -186,7 +186,11 @@ |
5415 |
+ * used for input more than STRTOD_DIGLIM digits long (default 40). |
5416 |
+ */ |
5417 |
+ |
5418 |
++#ifdef __BIG_ENDIAN__ |
5419 |
++#define IEEE_MC68k |
5420 |
++#else |
5421 |
+ #define IEEE_8087 |
5422 |
++#endif |
5423 |
+ #define NO_HEX_FP |
5424 |
+ |
5425 |
+ #ifndef Long |
5426 |
+--- qtwebengine/src/3rdparty/chromium/components/safe_browsing/db/util_unittest.cc |
5427 |
++++ qtwebengine/src/3rdparty/chromium/components/safe_browsing/db/util_unittest.cc |
5428 |
+@@ -12,6 +12,12 @@ |
5429 |
+ #include "testing/gtest/include/gtest/gtest.h" |
5430 |
+ #include "url/gurl.h" |
5431 |
+ |
5432 |
++#if defined(OS_WIN) |
5433 |
++#include <winsock2.h> |
5434 |
++#elif defined(OS_POSIX) |
5435 |
++#include <arpa/inet.h> |
5436 |
++#endif |
5437 |
++ |
5438 |
+ namespace safe_browsing { |
5439 |
+ |
5440 |
+ TEST(SafeBrowsingDbUtilTest, UrlToFullHashes) { |
5441 |
+@@ -83,7 +89,7 @@ TEST(SafeBrowsingDbUtilTest, StringToSBFullHashAndSBFullHashToString) { |
5442 |
+ // 31 chars plus the last \0 as full_hash. |
5443 |
+ const std::string hash_in = "12345678902234567890323456789012"; |
5444 |
+ SBFullHash hash_out = StringToSBFullHash(hash_in); |
5445 |
+- EXPECT_EQ(0x34333231U, hash_out.prefix); |
5446 |
++ EXPECT_EQ(htonl(0x31323334U), hash_out.prefix); |
5447 |
+ EXPECT_EQ(0, memcmp(hash_in.data(), hash_out.full_hash, sizeof(SBFullHash))); |
5448 |
+ |
5449 |
+ std::string hash_final = SBFullHashToString(hash_out); |
5450 |
+--- qtwebengine/src/3rdparty/chromium/components/safe_browsing/db/v4_rice.cc |
5451 |
++++ qtwebengine/src/3rdparty/chromium/components/safe_browsing/db/v4_rice.cc |
5452 |
+@@ -8,6 +8,7 @@ |
5453 |
+ #include "base/logging.h" |
5454 |
+ #include "base/numerics/safe_math.h" |
5455 |
+ #include "base/strings/stringprintf.h" |
5456 |
++#include "base/sys_byteorder.h" |
5457 |
+ #include "build/build_config.h" |
5458 |
+ #include "components/safe_browsing/db/v4_rice.h" |
5459 |
+ |
5460 |
+@@ -21,10 +22,6 @@ using ::google::protobuf::RepeatedField; |
5461 |
+ using ::google::protobuf::int32; |
5462 |
+ using ::google::protobuf::int64; |
5463 |
+ |
5464 |
+-#if !defined(ARCH_CPU_LITTLE_ENDIAN) || (ARCH_CPU_LITTLE_ENDIAN != 1) |
5465 |
+-#error The code below assumes little-endianness. |
5466 |
+-#endif |
5467 |
+- |
5468 |
+ namespace safe_browsing { |
5469 |
+ |
5470 |
+ namespace { |
5471 |
+@@ -117,7 +114,7 @@ V4DecodeResult V4RiceDecoder::DecodePrefixes(const int64 first_value, |
5472 |
+ out->reserve((num_entries + 1)); |
5473 |
+ |
5474 |
+ base::CheckedNumeric<uint32_t> last_value(first_value); |
5475 |
+- out->push_back(htonl(last_value.ValueOrDie())); |
5476 |
++ out->push_back(base::ByteSwap(static_cast<uint32_t>(last_value.ValueOrDie()))); |
5477 |
+ |
5478 |
+ if (num_entries > 0) { |
5479 |
+ V4RiceDecoder decoder(rice_parameter, num_entries, encoded_data); |
5480 |
+@@ -136,7 +133,7 @@ V4DecodeResult V4RiceDecoder::DecodePrefixes(const int64 first_value, |
5481 |
+ |
5482 |
+ // This flipping is done so that the decoded uint32 is interpreted |
5483 |
+ // correcly as a string of 4 bytes. |
5484 |
+- out->push_back(htonl(last_value.ValueOrDie())); |
5485 |
++ out->push_back(base::ByteSwap(static_cast<uint32_t>(last_value.ValueOrDie()))); |
5486 |
+ } |
5487 |
+ } |
5488 |
+ |
5489 |
+--- qtwebengine/src/3rdparty/chromium/components/safe_browsing/db/v4_rice_unittest.cc |
5490 |
++++ qtwebengine/src/3rdparty/chromium/components/safe_browsing/db/v4_rice_unittest.cc |
5491 |
+@@ -6,6 +6,12 @@ |
5492 |
+ #include "base/logging.h" |
5493 |
+ #include "testing/platform_test.h" |
5494 |
+ |
5495 |
++#if defined(OS_WIN) |
5496 |
++#include <winsock2.h> |
5497 |
++#elif defined(OS_POSIX) |
5498 |
++#include <arpa/inet.h> |
5499 |
++#endif |
5500 |
++ |
5501 |
+ using ::google::protobuf::RepeatedField; |
5502 |
+ using ::google::protobuf::int32; |
5503 |
+ |
5504 |
+@@ -247,7 +253,7 @@ TEST_F(V4RiceTest, TestDecoderPrefixesWithOneValue) { |
5505 |
+ EXPECT_EQ(DECODE_SUCCESS, |
5506 |
+ V4RiceDecoder::DecodePrefixes(0x69F67F51u, 2, 0, "", &out)); |
5507 |
+ EXPECT_EQ(1u, out.size()); |
5508 |
+- EXPECT_EQ(0x69F67F51u, out[0]); |
5509 |
++ EXPECT_EQ(htonl(0x517FF669u), out[0]); |
5510 |
+ } |
5511 |
+ |
5512 |
+ TEST_F(V4RiceTest, TestDecoderPrefixesWithMultipleValues) { |
5513 |
+@@ -256,7 +262,7 @@ TEST_F(V4RiceTest, TestDecoderPrefixesWithMultipleValues) { |
5514 |
+ V4RiceDecoder::DecodePrefixes( |
5515 |
+ 5, 28, 3, "\xbf\xa8\x3f\xfb\xf\xf\x5e\x27\xe6\xc3\x1d\xc6\x38", |
5516 |
+ &out)); |
5517 |
+- std::vector<uint32_t> expected = {5, 0xad934c0cu, 0x6ff67f56u, 0x81316fceu}; |
5518 |
++ std::vector<uint32_t> expected = {htonl(0x05000000), htonl(0x0c4c93adu), htonl(0x567ff66fu), htonl(0xce6f3181u)}; |
5519 |
+ EXPECT_EQ(expected.size(), out.size()); |
5520 |
+ for (unsigned i = 0; i < expected.size(); i++) { |
5521 |
+ EXPECT_EQ(expected[i], out[i]); |
5522 |
+--- qtwebengine/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc |
5523 |
++++ qtwebengine/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc |
5524 |
+@@ -686,10 +686,6 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) { |
5525 |
+ } |
5526 |
+ } |
5527 |
+ |
5528 |
+-#if !defined(ARCH_CPU_LITTLE_ENDIAN) |
5529 |
+-#error The code below assumes little-endianness. |
5530 |
+-#endif |
5531 |
+- |
5532 |
+ VideoPixelFormat AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format) { |
5533 |
+ // The YUVJ alternatives are FFmpeg's (deprecated, but still in use) way to |
5534 |
+ // specify a pixel format and full range color combination. |
5535 |
+--- qtwebengine/src/3rdparty/chromium/media/formats/mp4/box_definitions.cc |
5536 |
++++ qtwebengine/src/3rdparty/chromium/media/formats/mp4/box_definitions.cc |
5537 |
+@@ -1107,15 +1107,14 @@ bool OpusSpecificBox::Parse(BoxReader* reader) { |
5538 |
+ RCHECK(reader->Read4(&sample_rate)); |
5539 |
+ RCHECK(reader->Read2s(&gain_db)); |
5540 |
+ |
5541 |
+-#if !defined(ARCH_CPU_LITTLE_ENDIAN) |
5542 |
+-#error The code below assumes little-endianness. |
5543 |
+-#endif |
5544 |
+- |
5545 |
+- memcpy(&extradata[OPUS_EXTRADATA_SKIP_SAMPLES_OFFSET], &codec_delay_in_frames, |
5546 |
+- sizeof(codec_delay_in_frames)); |
5547 |
+- memcpy(&extradata[OPUS_EXTRADATA_SAMPLE_RATE_OFFSET], &sample_rate, |
5548 |
+- sizeof(sample_rate)); |
5549 |
+- memcpy(&extradata[OPUS_EXTRADATA_GAIN_OFFSET], &gain_db, sizeof(gain_db)); |
5550 |
++ extradata[OPUS_EXTRADATA_SKIP_SAMPLES_OFFSET] = (codec_delay_in_frames >> 0) & 0xff; |
5551 |
++ extradata[OPUS_EXTRADATA_SKIP_SAMPLES_OFFSET+1] = (codec_delay_in_frames >> 8) & 0xff; |
5552 |
++ extradata[OPUS_EXTRADATA_SAMPLE_RATE_OFFSET] = (sample_rate >> 0) & 0xff; |
5553 |
++ extradata[OPUS_EXTRADATA_SAMPLE_RATE_OFFSET+1] = (sample_rate >> 8) & 0xff; |
5554 |
++ extradata[OPUS_EXTRADATA_SAMPLE_RATE_OFFSET+2] = (sample_rate >> 16) & 0xff; |
5555 |
++ extradata[OPUS_EXTRADATA_SAMPLE_RATE_OFFSET+3] = (sample_rate >> 24) & 0xff; |
5556 |
++ extradata[OPUS_EXTRADATA_GAIN_OFFSET] = (gain_db >> 0) & 0xff; |
5557 |
++ extradata[OPUS_EXTRADATA_GAIN_OFFSET+1] = (gain_db >> 8) & 0xff; |
5558 |
+ |
5559 |
+ channel_count = extradata[OPUS_EXTRADATA_CHANNELS_OFFSET]; |
5560 |
+ |
5561 |
+--- qtwebengine/src/3rdparty/chromium/media/renderers/paint_canvas_video_renderer.cc |
5562 |
++++ qtwebengine/src/3rdparty/chromium/media/renderers/paint_canvas_video_renderer.cc |
5563 |
+@@ -31,8 +31,7 @@ |
5564 |
+ |
5565 |
+ // Skia internal format depends on a platform. On Android it is ABGR, on others |
5566 |
+ // it is ARGB. |
5567 |
+-#if SK_B32_SHIFT == 0 && SK_G32_SHIFT == 8 && SK_R32_SHIFT == 16 && \ |
5568 |
+- SK_A32_SHIFT == 24 |
5569 |
++#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
5570 |
+ #define LIBYUV_I420_TO_ARGB libyuv::I420ToARGB |
5571 |
+ #define LIBYUV_I422_TO_ARGB libyuv::I422ToARGB |
5572 |
+ #define LIBYUV_I444_TO_ARGB libyuv::I444ToARGB |
5573 |
+@@ -42,8 +41,7 @@ |
5574 |
+ #define LIBYUV_I010_TO_ARGB libyuv::I010ToARGB |
5575 |
+ #define LIBYUV_H010_TO_ARGB libyuv::H010ToARGB |
5576 |
+ #define LIBYUV_NV12_TO_ARGB libyuv::NV12ToARGB |
5577 |
+-#elif SK_R32_SHIFT == 0 && SK_G32_SHIFT == 8 && SK_B32_SHIFT == 16 && \ |
5578 |
+- SK_A32_SHIFT == 24 |
5579 |
++#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
5580 |
+ #define LIBYUV_I420_TO_ARGB libyuv::I420ToABGR |
5581 |
+ #define LIBYUV_I422_TO_ARGB libyuv::I422ToABGR |
5582 |
+ #define LIBYUV_I444_TO_ARGB libyuv::I444ToABGR |
5583 |
+--- qtwebengine/src/3rdparty/chromium/net/cert/crl_set.cc |
5584 |
++++ qtwebengine/src/3rdparty/chromium/net/cert/crl_set.cc |
5585 |
+@@ -6,6 +6,7 @@ |
5586 |
+ |
5587 |
+ #include "base/base64.h" |
5588 |
+ #include "base/json/json_reader.h" |
5589 |
++#include "base/sys_byteorder.h" |
5590 |
+ #include "base/time/time.h" |
5591 |
+ #include "base/trace_event/trace_event.h" |
5592 |
+ #include "base/values.h" |
5593 |
+@@ -44,9 +45,9 @@ base::DictionaryValue* ReadHeader(base::StringPiece* data) { |
5594 |
+ uint16_t header_len; |
5595 |
+ if (data->size() < sizeof(header_len)) |
5596 |
+ return nullptr; |
5597 |
+- // Assumes little-endian. |
5598 |
+ memcpy(&header_len, data->data(), sizeof(header_len)); |
5599 |
+ data->remove_prefix(sizeof(header_len)); |
5600 |
++ header_len = base::ByteSwapToLE16(header_len); |
5601 |
+ |
5602 |
+ if (data->size() < header_len) |
5603 |
+ return nullptr; |
5604 |
+@@ -79,9 +80,9 @@ bool ReadCRL(base::StringPiece* data, |
5605 |
+ uint32_t num_serials; |
5606 |
+ if (data->size() < sizeof(num_serials)) |
5607 |
+ return false; |
5608 |
+- // Assumes little endian. |
5609 |
+ memcpy(&num_serials, data->data(), sizeof(num_serials)); |
5610 |
+ data->remove_prefix(sizeof(num_serials)); |
5611 |
++ num_serials = base::ByteSwapToLE32(num_serials); |
5612 |
+ |
5613 |
+ if (num_serials > 32 * 1024 * 1024) // Sanity check. |
5614 |
+ return false; |
5615 |
+@@ -192,15 +193,6 @@ CRLSet::~CRLSet() = default; |
5616 |
+ // static |
5617 |
+ bool CRLSet::Parse(base::StringPiece data, scoped_refptr<CRLSet>* out_crl_set) { |
5618 |
+ TRACE_EVENT0(NetTracingCategory(), "CRLSet::Parse"); |
5619 |
+-// Other parts of Chrome assume that we're little endian, so we don't lose |
5620 |
+-// anything by doing this. |
5621 |
+-#if defined(__BYTE_ORDER) |
5622 |
+- // Linux check |
5623 |
+- static_assert(__BYTE_ORDER == __LITTLE_ENDIAN, "assumes little endian"); |
5624 |
+-#elif defined(__BIG_ENDIAN__) |
5625 |
+-// Mac check |
5626 |
+-#error assumes little endian |
5627 |
+-#endif |
5628 |
+ |
5629 |
+ std::unique_ptr<base::DictionaryValue> header_dict(ReadHeader(&data)); |
5630 |
+ if (!header_dict.get()) |
5631 |
+--- qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h |
5632 |
++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h |
5633 |
+@@ -377,6 +377,7 @@ typedef struct pt_regs regs_struct; |
5634 |
+ |
5635 |
+ #define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr)) |
5636 |
+ #define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch)) |
5637 |
++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
5638 |
+ #define SECCOMP_IP_MSB_IDX \ |
5639 |
+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4) |
5640 |
+ #define SECCOMP_IP_LSB_IDX \ |
5641 |
+@@ -385,6 +386,16 @@ typedef struct pt_regs regs_struct; |
5642 |
+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4) |
5643 |
+ #define SECCOMP_ARG_LSB_IDX(nr) \ |
5644 |
+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0) |
5645 |
++#else |
5646 |
++#define SECCOMP_IP_MSB_IDX \ |
5647 |
++ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0) |
5648 |
++#define SECCOMP_IP_LSB_IDX \ |
5649 |
++ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4) |
5650 |
++#define SECCOMP_ARG_MSB_IDX(nr) \ |
5651 |
++ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0) |
5652 |
++#define SECCOMP_ARG_LSB_IDX(nr) \ |
5653 |
++ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4) |
5654 |
++#endif |
5655 |
+ |
5656 |
+ #define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3] |
5657 |
+ #define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0] |
5658 |
+--- qtwebengine/src/3rdparty/chromium/skia/config/SkUserConfig.h |
5659 |
++++ qtwebengine/src/3rdparty/chromium/skia/config/SkUserConfig.h |
5660 |
+@@ -90,11 +90,18 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, |
5661 |
+ __FILE__, __LINE__, #cond); } } while (false) |
5662 |
+ |
5663 |
+ #if !defined(ANDROID) // On Android, we use the skia default settings. |
5664 |
++#if defined(SK_CPU_BENDIAN) |
5665 |
++#define SK_A32_SHIFT 0 |
5666 |
++#define SK_R32_SHIFT 8 |
5667 |
++#define SK_G32_SHIFT 16 |
5668 |
++#define SK_B32_SHIFT 24 |
5669 |
++#else |
5670 |
+ #define SK_A32_SHIFT 24 |
5671 |
+ #define SK_R32_SHIFT 16 |
5672 |
+ #define SK_G32_SHIFT 8 |
5673 |
+ #define SK_B32_SHIFT 0 |
5674 |
+ #endif |
5675 |
++#endif |
5676 |
+ |
5677 |
+ #if defined(SK_BUILD_FOR_MAC) |
5678 |
+ |
5679 |
+@@ -108,17 +115,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, |
5680 |
+ // we should revisit this choice... |
5681 |
+ #define SK_USE_FREETYPE_EMBOLDEN |
5682 |
+ |
5683 |
+-#if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN) |
5684 |
+-// Above we set the order for ARGB channels in registers. I suspect that, on |
5685 |
+-// big endian machines, you can keep this the same and everything will work. |
5686 |
+-// The in-memory order will be different, of course, but as long as everything |
5687 |
+-// is reading memory as words rather than bytes, it will all work. However, if |
5688 |
+-// you find that colours are messed up I thought that I would leave a helpful |
5689 |
+-// locator for you. Also see the comments in |
5690 |
+-// base/gfx/bitmap_platform_device_linux.h |
5691 |
+-#error Read the comment at this location |
5692 |
+-#endif |
5693 |
+- |
5694 |
+ #endif |
5695 |
+ |
5696 |
+ // The default crash macro writes to badbeef which can cause some strange |
5697 |
+--- qtwebengine/src/3rdparty/chromium/skia/ext/image_operations_unittest.cc |
5698 |
++++ qtwebengine/src/3rdparty/chromium/skia/ext/image_operations_unittest.cc |
5699 |
+@@ -18,9 +18,11 @@ |
5700 |
+ #include "skia/ext/image_operations.h" |
5701 |
+ #include "testing/gtest/include/gtest/gtest.h" |
5702 |
+ #include "third_party/skia/include/core/SkBitmap.h" |
5703 |
++#include "third_party/skia/include/core/SkColorPriv.h" |
5704 |
+ #include "third_party/skia/include/core/SkColorSpace.h" |
5705 |
+ #include "third_party/skia/include/core/SkImageInfo.h" |
5706 |
+ #include "third_party/skia/include/core/SkRect.h" |
5707 |
++#include "third_party/skia/include/core/SkUnPreMultiply.h" |
5708 |
+ #include "ui/gfx/codec/png_codec.h" |
5709 |
+ #include "ui/gfx/geometry/size.h" |
5710 |
+ |
5711 |
+@@ -151,7 +153,7 @@ void DrawCheckerToBitmap(int w, int h, |
5712 |
+ |
5713 |
+ bool use_color2 = (x_bit != y_bit); // xor |
5714 |
+ |
5715 |
+- *bmp->getAddr32(x, y) = (use_color2 ? color2 : color1); |
5716 |
++ *bmp->getAddr32(x, y) = SkPreMultiplyColor(use_color2 ? color2 : color1); |
5717 |
+ } |
5718 |
+ } |
5719 |
+ } |
5720 |
+@@ -273,7 +275,7 @@ void CheckResizeMethodShouldAverageGrid( |
5721 |
+ std::max(tested_pixel.max_color_distance, |
5722 |
+ tested_method.max_color_distance_override); |
5723 |
+ |
5724 |
+- const SkColor actual_color = *dest.getAddr32(x, y); |
5725 |
++ const SkColor actual_color = SkUnPreMultiply::PMColorToColor(*dest.getAddr32(x, y)); |
5726 |
+ |
5727 |
+ // Check that the pixels away from the border region are very close |
5728 |
+ // to the expected average color |
5729 |
+@@ -528,7 +530,7 @@ TEST(ImageOperations, ScaleUp) { |
5730 |
+ for (int src_y = 0; src_y < src_h; ++src_y) { |
5731 |
+ for (int src_x = 0; src_x < src_w; ++src_x) { |
5732 |
+ *src.getAddr32(src_x, src_y) = |
5733 |
+- SkColorSetARGB(255, 10 + src_x * 100, 10 + src_y * 100, 0); |
5734 |
++ SkPackARGB32(255, 10 + src_x * 100, 10 + src_y * 100, 0); |
5735 |
+ } |
5736 |
+ } |
5737 |
+ |
5738 |
+@@ -552,7 +554,7 @@ TEST(ImageOperations, ScaleUp) { |
5739 |
+ lanczos3(src_x + 0.5 - dst_x_in_src) * |
5740 |
+ lanczos3(src_y + 0.5 - dst_y_in_src); |
5741 |
+ sum += coeff; |
5742 |
+- SkColor tmp = *src.getAddr32(src_x, src_y); |
5743 |
++ SkColor tmp = SkUnPreMultiply::PMColorToColor(*src.getAddr32(src_x, src_y)); |
5744 |
+ a += coeff * SkColorGetA(tmp); |
5745 |
+ r += coeff * SkColorGetR(tmp); |
5746 |
+ g += coeff * SkColorGetG(tmp); |
5747 |
+@@ -571,7 +573,7 @@ TEST(ImageOperations, ScaleUp) { |
5748 |
+ if (r > 255.0f) r = 255.0f; |
5749 |
+ if (g > 255.0f) g = 255.0f; |
5750 |
+ if (b > 255.0f) b = 255.0f; |
5751 |
+- SkColor dst_color = *dst.getAddr32(dst_x, dst_y); |
5752 |
++ SkColor dst_color = SkUnPreMultiply::PMColorToColor(*dst.getAddr32(dst_x, dst_y)); |
5753 |
+ EXPECT_LE(fabs(SkColorGetA(dst_color) - a), 1.5f); |
5754 |
+ EXPECT_LE(fabs(SkColorGetR(dst_color) - r), 1.5f); |
5755 |
+ EXPECT_LE(fabs(SkColorGetG(dst_color) - g), 1.5f); |
5756 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc |
5757 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc |
5758 |
+@@ -456,8 +456,8 @@ void Unpack<WebGLImageConversion::kDataFormatBGRA8, uint8_t, uint8_t>( |
5759 |
+ for (unsigned i = 0; i < pixels_per_row; ++i) { |
5760 |
+ uint32_t bgra = source32[i]; |
5761 |
+ #if defined(ARCH_CPU_BIG_ENDIAN) |
5762 |
+- uint32_t brMask = 0xff00ff00; |
5763 |
+- uint32_t gaMask = 0x00ff00ff; |
5764 |
++ uint32_t br_mask = 0xff00ff00; |
5765 |
++ uint32_t ga_mask = 0x00ff00ff; |
5766 |
+ #else |
5767 |
+ uint32_t br_mask = 0x00ff00ff; |
5768 |
+ uint32_t ga_mask = 0xff00ff00; |
5769 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion_test.cc |
5770 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion_test.cc |
5771 |
+@@ -76,9 +76,9 @@ TEST_F(WebGLImageConversionTest, convertBGRA8toRGBA8) { |
5772 |
+ 0x34567888, 0x12345678, 0x34567888, |
5773 |
+ 0x12345678, 0x34567888, 0x12345678}; |
5774 |
+ #if defined(ARCH_CPU_BIG_ENDIAN) |
5775 |
+- uint32_t expectedData[9] = {0x56341278, 0x78563488, 0x56341278, |
5776 |
+- 0x78563488, 0x56341278, 0x78563488, |
5777 |
+- 0x56341278, 0x78563488, 0x56341278}; |
5778 |
++ uint32_t expected_data[9] = {0x56341278, 0x78563488, 0x56341278, |
5779 |
++ 0x78563488, 0x56341278, 0x78563488, |
5780 |
++ 0x56341278, 0x78563488, 0x56341278}; |
5781 |
+ #else |
5782 |
+ uint32_t expected_data[9] = {0x12785634, 0x34887856, 0x12785634, |
5783 |
+ 0x34887856, 0x12785634, 0x34887856, |
5784 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/graphics_context_test.cc |
5785 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/graphics_context_test.cc |
5786 |
+@@ -52,7 +52,7 @@ namespace blink { |
5787 |
+ { \ |
5788 |
+ for (int y = opaqueRect.Y(); y < opaqueRect.MaxY(); ++y) \ |
5789 |
+ for (int x = opaqueRect.X(); x < opaqueRect.MaxX(); ++x) { \ |
5790 |
+- int alpha = *bitmap.getAddr32(x, y) >> 24; \ |
5791 |
++ int alpha = SkGetPackedA32(*bitmap.getAddr32(x, y)); \ |
5792 |
+ EXPECT_EQ(255, alpha); \ |
5793 |
+ } \ |
5794 |
+ } |
5795 |
+@@ -61,12 +61,16 @@ namespace blink { |
5796 |
+ { \ |
5797 |
+ for (int y = 0; y < bitmap.height(); ++y) \ |
5798 |
+ for (int x = 0; x < bitmap.width(); ++x) { \ |
5799 |
+- int alpha = *bitmap.getAddr32(x, y) >> 24; \ |
5800 |
++ int alpha = SkGetPackedA32(*bitmap.getAddr32(x, y)); \ |
5801 |
+ bool opaque = opaqueRect.Contains(x, y); \ |
5802 |
+ EXPECT_EQ(opaque, alpha == 255); \ |
5803 |
+ } \ |
5804 |
+ } |
5805 |
+ |
5806 |
++static inline uint32_t PackARGB32(uint32_t argb) { |
5807 |
++ return SkPackARGB32NoCheck(argb>>24, (argb<<8)>>24, (argb<<16)>>24, (argb<<24)>>24); |
5808 |
++} |
5809 |
++ |
5810 |
+ TEST(GraphicsContextTest, Recording) { |
5811 |
+ SkBitmap bitmap; |
5812 |
+ bitmap.allocN32Pixels(100, 100); |
5813 |
+@@ -184,10 +188,10 @@ class GraphicsContextHighConstrastTest : public testing::Test { |
5814 |
+ TEST_F(GraphicsContextHighConstrastTest, MAYBE_NoHighContrast) { |
5815 |
+ DrawColorsToContext(); |
5816 |
+ |
5817 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(0, 0)); |
5818 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(1, 0)); |
5819 |
+- EXPECT_EQ(0xffff0000, *bitmap_.getAddr32(2, 0)); |
5820 |
+- EXPECT_EQ(0xff808080, *bitmap_.getAddr32(3, 0)); |
5821 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(0, 0)); |
5822 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(1, 0)); |
5823 |
++ EXPECT_EQ(PackARGB32(0xffff0000), *bitmap_.getAddr32(2, 0)); |
5824 |
++ EXPECT_EQ(PackARGB32(0xff808080), *bitmap_.getAddr32(3, 0)); |
5825 |
+ } |
5826 |
+ |
5827 |
+ // TODO(crbug.com/850782): Reenable this. |
5828 |
+@@ -205,10 +209,10 @@ TEST_F(GraphicsContextHighConstrastTest, MAYBE_HighContrastOff) { |
5829 |
+ |
5830 |
+ DrawColorsToContext(); |
5831 |
+ |
5832 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(0, 0)); |
5833 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(1, 0)); |
5834 |
+- EXPECT_EQ(0xffff0000, *bitmap_.getAddr32(2, 0)); |
5835 |
+- EXPECT_EQ(0xff808080, *bitmap_.getAddr32(3, 0)); |
5836 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(0, 0)); |
5837 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(1, 0)); |
5838 |
++ EXPECT_EQ(PackARGB32(0xffff0000), *bitmap_.getAddr32(2, 0)); |
5839 |
++ EXPECT_EQ(PackARGB32(0xff808080), *bitmap_.getAddr32(3, 0)); |
5840 |
+ } |
5841 |
+ |
5842 |
+ // Simple invert for testing. Each color component |c| |
5843 |
+@@ -228,10 +232,10 @@ TEST_F(GraphicsContextHighConstrastTest, MAYBE_SimpleInvertForTesting) { |
5844 |
+ |
5845 |
+ DrawColorsToContext(); |
5846 |
+ |
5847 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(0, 0)); |
5848 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(1, 0)); |
5849 |
+- EXPECT_EQ(0xff00ffff, *bitmap_.getAddr32(2, 0)); |
5850 |
+- EXPECT_EQ(0xff7f7f7f, *bitmap_.getAddr32(3, 0)); |
5851 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(0, 0)); |
5852 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(1, 0)); |
5853 |
++ EXPECT_EQ(PackARGB32(0xff00ffff), *bitmap_.getAddr32(2, 0)); |
5854 |
++ EXPECT_EQ(PackARGB32(0xff7f7f7f), *bitmap_.getAddr32(3, 0)); |
5855 |
+ } |
5856 |
+ |
5857 |
+ // Invert brightness (with gamma correction). |
5858 |
+@@ -250,10 +254,10 @@ TEST_F(GraphicsContextHighConstrastTest, MAYBE_InvertBrightness) { |
5859 |
+ |
5860 |
+ DrawColorsToContext(); |
5861 |
+ |
5862 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(0, 0)); |
5863 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(1, 0)); |
5864 |
+- EXPECT_EQ(0xff00ffff, *bitmap_.getAddr32(2, 0)); |
5865 |
+- EXPECT_EQ(0xffdddddd, *bitmap_.getAddr32(3, 0)); |
5866 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(0, 0)); |
5867 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(1, 0)); |
5868 |
++ EXPECT_EQ(PackARGB32(0xff00ffff), *bitmap_.getAddr32(2, 0)); |
5869 |
++ EXPECT_EQ(PackARGB32(0xffdddddd), *bitmap_.getAddr32(3, 0)); |
5870 |
+ } |
5871 |
+ |
5872 |
+ // Invert lightness (in HSL space). |
5873 |
+@@ -272,10 +276,10 @@ TEST_F(GraphicsContextHighConstrastTest, MAYBE_InvertLightness) { |
5874 |
+ |
5875 |
+ DrawColorsToContext(); |
5876 |
+ |
5877 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(0, 0)); |
5878 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(1, 0)); |
5879 |
+- EXPECT_EQ(0xffff0000, *bitmap_.getAddr32(2, 0)); |
5880 |
+- EXPECT_EQ(0xffdddddd, *bitmap_.getAddr32(3, 0)); |
5881 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(0, 0)); |
5882 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(1, 0)); |
5883 |
++ EXPECT_EQ(PackARGB32(0xffff0000), *bitmap_.getAddr32(2, 0)); |
5884 |
++ EXPECT_EQ(PackARGB32(0xffdddddd), *bitmap_.getAddr32(3, 0)); |
5885 |
+ } |
5886 |
+ |
5887 |
+ // Invert lightness plus grayscale. |
5888 |
+@@ -288,10 +292,10 @@ TEST_F(GraphicsContextHighConstrastTest, InvertLightnessPlusGrayscale) { |
5889 |
+ |
5890 |
+ DrawColorsToContext(); |
5891 |
+ |
5892 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(0, 0)); |
5893 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(1, 0)); |
5894 |
+- EXPECT_EQ(0xffe2e2e2, *bitmap_.getAddr32(2, 0)); |
5895 |
+- EXPECT_EQ(0xffdddddd, *bitmap_.getAddr32(3, 0)); |
5896 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(0, 0)); |
5897 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(1, 0)); |
5898 |
++ EXPECT_EQ(PackARGB32(0xffe2e2e2), *bitmap_.getAddr32(2, 0)); |
5899 |
++ EXPECT_EQ(PackARGB32(0xffdddddd), *bitmap_.getAddr32(3, 0)); |
5900 |
+ } |
5901 |
+ |
5902 |
+ // TODO(crbug.com/850782): Reenable this. |
5903 |
+@@ -309,10 +313,10 @@ TEST_F(GraphicsContextHighConstrastTest, MAYBE_InvertLightnessPlusContrast) { |
5904 |
+ |
5905 |
+ DrawColorsToContext(); |
5906 |
+ |
5907 |
+- EXPECT_EQ(0xffffffff, *bitmap_.getAddr32(0, 0)); |
5908 |
+- EXPECT_EQ(0xff000000, *bitmap_.getAddr32(1, 0)); |
5909 |
+- EXPECT_EQ(0xffff0000, *bitmap_.getAddr32(2, 0)); |
5910 |
+- EXPECT_EQ(0xffeeeeee, *bitmap_.getAddr32(3, 0)); |
5911 |
++ EXPECT_EQ(PackARGB32(0xffffffff), *bitmap_.getAddr32(0, 0)); |
5912 |
++ EXPECT_EQ(PackARGB32(0xff000000), *bitmap_.getAddr32(1, 0)); |
5913 |
++ EXPECT_EQ(PackARGB32(0xffff0000), *bitmap_.getAddr32(2, 0)); |
5914 |
++ EXPECT_EQ(PackARGB32(0xffeeeeee), *bitmap_.getAddr32(3, 0)); |
5915 |
+ } |
5916 |
+ |
5917 |
+ } // namespace blink |
5918 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/highcontrast/highcontrast_classifier.cc |
5919 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/highcontrast/highcontrast_classifier.cc |
5920 |
+@@ -1060,55 +1060,47 @@ void DequantizeMinFirst(const int32_t rank, |
5921 |
+ |
5922 |
+ // ----------------------------------------------------------------------------- |
5923 |
+ // CONSTANTS |
5924 |
+-// Note that for now, endianness of the target machine needs to match that of |
5925 |
+-// the one training was performed on. |
5926 |
+ // ----------------------------------------------------------------------------- |
5927 |
+ const int32_t dnn_hiddenlayer_0_weights_part_0_shape[2] = {4, 10}; |
5928 |
+ const union { |
5929 |
+- uint8_t bytes[160]; |
5930 |
+ float values[40]; |
5931 |
+ } dnn_hiddenlayer_0_weights_part_0 = {{ |
5932 |
+- 0xbc, 0x22, 0x0a, 0xbf, 0xb4, 0x46, 0x8c, 0x3f, 0xba, 0x31, 0x34, 0xbe, |
5933 |
+- 0x4c, 0x65, 0xdb, 0xbe, 0xf0, 0x54, 0x5e, 0xbe, 0xc1, 0x5d, 0xb3, 0x3f, |
5934 |
+- 0xf4, 0xe6, 0x15, 0xbf, 0x05, 0xc6, 0x34, 0xbf, 0xc0, 0x37, 0x7e, 0xbd, |
5935 |
+- 0x6c, 0x35, 0x0b, 0xbf, 0xca, 0x53, 0x26, 0xbf, 0x58, 0xb4, 0x87, 0x3f, |
5936 |
+- 0x37, 0xee, 0x39, 0xbf, 0xda, 0xfa, 0xf9, 0xbe, 0x97, 0xc1, 0x06, 0xbf, |
5937 |
+- 0xf9, 0x4e, 0x81, 0x3f, 0xb2, 0x44, 0x85, 0xbf, 0x7f, 0x98, 0x7c, 0x3d, |
5938 |
+- 0x15, 0x26, 0xbc, 0xbe, 0x5c, 0x48, 0x05, 0x3f, 0xc8, 0xaa, 0xa1, 0xbd, |
5939 |
+- 0x35, 0xb3, 0x43, 0xbe, 0xeb, 0x46, 0x91, 0x3f, 0x80, 0x71, 0xe3, 0x3c, |
5940 |
+- 0xd1, 0x98, 0x79, 0x3f, 0x3c, 0xd0, 0x0d, 0xbf, 0x1e, 0x02, 0xd3, 0x3e, |
5941 |
+- 0x5d, 0x4b, 0xa2, 0xbf, 0x68, 0xac, 0xaa, 0xbd, 0xf8, 0xe1, 0x75, 0x3e, |
5942 |
+- 0x4a, 0x9c, 0x27, 0xbe, 0xf8, 0xae, 0xb2, 0xbe, 0x7f, 0x9d, 0x91, 0x3f, |
5943 |
+- 0x1e, 0x8b, 0xa8, 0xbe, 0x35, 0x7e, 0xb2, 0x3f, 0xbe, 0x8c, 0xd3, 0xbe, |
5944 |
+- 0xf9, 0xcd, 0xb5, 0x3f, 0xa1, 0x50, 0xaa, 0x3f, 0xe4, 0x6d, 0xdd, 0xbe, |
5945 |
+- 0x0d, 0xce, 0xd3, 0xbe, |
5946 |
++ -0.539592504501343, 1.09590768814087, -0.175970941781998, -0.428507208824158, |
5947 |
++ -0.217120885848999, 1.40129864215851, -0.5855553150177, -0.706146538257599, |
5948 |
++ -0.0620648860931396, -0.543783903121948, -0.649716019630432, 1.06019115447998, |
5949 |
++ -0.726291120052338, -0.488241970539093, -0.526391446590424, 1.01022255420685, |
5950 |
++ -1.04115891456604, 0.0616688691079617, -0.367478042840958, 0.520635366439819, |
5951 |
++ -0.0789390206336975, -0.19111330807209, 1.13497674465179, 0.0277640819549561, |
5952 |
++ 0.974988043308258, -0.553958654403687, 0.412125527858734, -1.2679249048233, |
5953 |
++ -0.0833366513252258, 0.240119814872742, -0.163682132959366, -0.34899115562439, |
5954 |
++ 1.1376188993454, -0.329186379909515, 1.3944765329361, -0.413183152675629, |
5955 |
++ 1.42034828662872, 1.33058559894562, -0.432479023933411, -0.413681417703629 |
5956 |
+ }}; |
5957 |
+ const int32_t dnn_hiddenlayer_0_biases_part_0_shape[1] = {10}; |
5958 |
+ const union { |
5959 |
+- uint8_t bytes[40]; |
5960 |
+ float values[10]; |
5961 |
+ } dnn_hiddenlayer_0_biases_part_0 = {{ |
5962 |
+- 0x00, 0x00, 0x00, 0x00, 0xbf, 0x6a, 0x53, 0x3e, 0xd3, 0xc1, |
5963 |
+- 0xd0, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xd8, 0xc0, 0x3e, |
5964 |
+- 0xca, 0xe7, 0x35, 0x3e, 0x23, 0xa5, 0x44, 0x3f, 0x61, 0xfd, |
5965 |
+- 0xd2, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xe0, 0x43, 0x3c, |
5966 |
++ 0.0, 0.206461891531944, |
5967 |
++ 0.407728761434555, 0.0, |
5968 |
++ 0.376653373241425, 0.177642017602921, |
5969 |
++ 0.76814478635788, 0.412089377641678, |
5970 |
++ 0.0, 0.0119554307311773 |
5971 |
+ }}; |
5972 |
+ const int32_t dnn_logits_biases_part_0_shape[1] = {1}; |
5973 |
+ const union { |
5974 |
+- uint8_t bytes[4]; |
5975 |
+ float values[1]; |
5976 |
+ } dnn_logits_biases_part_0 = {{ |
5977 |
+- 0x75, 0xca, 0xd7, 0xbe, |
5978 |
++ -0.421466499567032 |
5979 |
+ }}; |
5980 |
+ const int32_t dnn_logits_weights_part_0_shape[2] = {10, 1}; |
5981 |
+ const union { |
5982 |
+- uint8_t bytes[40]; |
5983 |
+ float values[10]; |
5984 |
+ } dnn_logits_weights_part_0 = {{ |
5985 |
+- 0x13, 0x12, 0x39, 0x3f, 0xf3, 0xa5, 0xc2, 0xbf, 0x81, 0x7f, |
5986 |
+- 0xbe, 0x3f, 0xf8, 0x17, 0x26, 0x3e, 0xa4, 0x19, 0xa6, 0x3f, |
5987 |
+- 0xf0, 0xc9, 0xb7, 0xbf, 0x6a, 0x99, 0xd2, 0x3f, 0x8a, 0x7d, |
5988 |
+- 0xe9, 0x3f, 0x83, 0x9a, 0x3a, 0xbf, 0xf1, 0x6c, 0x08, 0x3e, |
5989 |
++ 0.722932040691376, -1.52068936824799, |
5990 |
++ 1.48826611042023, 0.162200808525085, |
5991 |
++ 1.29765748977661, -1.43585014343262, |
5992 |
++ 1.64530682563782, 1.82414364814758, |
5993 |
++ -0.728920161724091, 0.133228078484535 |
5994 |
+ }}; |
5995 |
+ |
5996 |
+ } // anonymous namespace |
5997 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.h |
5998 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.h |
5999 |
+@@ -37,6 +37,7 @@ |
6000 |
+ #include "third_party/blink/renderer/platform/wtf/allocator.h" |
6001 |
+ #include "third_party/blink/renderer/platform/wtf/cpu.h" |
6002 |
+ #include "third_party/blink/renderer/platform/wtf/noncopyable.h" |
6003 |
++#include "base/sys_byteorder.h" |
6004 |
+ |
6005 |
+ namespace blink { |
6006 |
+ |
6007 |
+@@ -50,11 +51,11 @@ class PLATFORM_EXPORT BMPImageReader final { |
6008 |
+ // Read a value from |buffer|, converting to an int assuming little |
6009 |
+ // endianness |
6010 |
+ static inline uint16_t ReadUint16(const char* buffer) { |
6011 |
+- return *reinterpret_cast<const uint16_t*>(buffer); |
6012 |
++ return base::ByteSwapToLE16(*reinterpret_cast<const uint16_t*>(buffer)); |
6013 |
+ } |
6014 |
+ |
6015 |
+ static inline uint32_t ReadUint32(const char* buffer) { |
6016 |
+- return *reinterpret_cast<const uint32_t*>(buffer); |
6017 |
++ return base::ByteSwapToLE32(*reinterpret_cast<const uint32_t*>(buffer)); |
6018 |
+ } |
6019 |
+ |
6020 |
+ // |parent| is the decoder that owns us. |
6021 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc |
6022 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc |
6023 |
+@@ -49,23 +49,30 @@ extern "C" { |
6024 |
+ #include <setjmp.h> |
6025 |
+ } |
6026 |
+ |
6027 |
+-#if defined(ARCH_CPU_BIG_ENDIAN) |
6028 |
+-#error Blink assumes a little-endian target. |
6029 |
+-#endif |
6030 |
+- |
6031 |
+ #if defined(JCS_ALPHA_EXTENSIONS) |
6032 |
+ #define TURBO_JPEG_RGB_SWIZZLE |
6033 |
+-#if SK_B32_SHIFT // Output little-endian RGBA pixels (Android). |
6034 |
++#if SK_PMCOLOR_BYTE_ORDER(R, G, B, A) |
6035 |
+ inline J_COLOR_SPACE rgbOutputColorSpace() { |
6036 |
+ return JCS_EXT_RGBA; |
6037 |
+ } |
6038 |
+-#else // Output little-endian BGRA pixels. |
6039 |
++#elif SK_PMCOLOR_BYTE_ORDER(B, G, R, A) |
6040 |
+ inline J_COLOR_SPACE rgbOutputColorSpace() { |
6041 |
+ return JCS_EXT_BGRA; |
6042 |
+ } |
6043 |
++#elif SK_PMCOLOR_BYTE_ORDER(A, R, G, B) |
6044 |
++inline J_COLOR_SPACE rgbOutputColorSpace() { |
6045 |
++ return JCS_EXT_ARGB; |
6046 |
++} |
6047 |
++#elif SK_PMCOLOR_BYTE_ORDER(A, B, G, R) |
6048 |
++inline J_COLOR_SPACE rgbOutputColorSpace() { |
6049 |
++ return JCS_EXT_ABGR; |
6050 |
++} |
6051 |
++#else |
6052 |
++#error Component order not supported by libjpeg_turbo |
6053 |
+ #endif |
6054 |
+ inline bool turboSwizzled(J_COLOR_SPACE colorSpace) { |
6055 |
+- return colorSpace == JCS_EXT_RGBA || colorSpace == JCS_EXT_BGRA; |
6056 |
++ return colorSpace == JCS_EXT_RGBA || colorSpace == JCS_EXT_BGRA || |
6057 |
++ colorSpace == JCS_EXT_ABGR || colorSpace == JCS_EXT_ARGB; |
6058 |
+ } |
6059 |
+ #else |
6060 |
+ inline J_COLOR_SPACE rgbOutputColorSpace() { |
6061 |
+--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc |
6062 |
++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc |
6063 |
+@@ -32,18 +32,20 @@ |
6064 |
+ #include "third_party/blink/renderer/platform/histogram.h" |
6065 |
+ #include "third_party/skia/include/core/SkData.h" |
6066 |
+ |
6067 |
+-#if defined(ARCH_CPU_BIG_ENDIAN) |
6068 |
+-#error Blink assumes a little-endian target. |
6069 |
+-#endif |
6070 |
+- |
6071 |
+-#if SK_B32_SHIFT // Output little-endian RGBA pixels (Android). |
6072 |
++#if SK_PMCOLOR_BYTE_ORDER(R, G, B, A) |
6073 |
+ inline WEBP_CSP_MODE outputMode(bool hasAlpha) { |
6074 |
+ return hasAlpha ? MODE_rgbA : MODE_RGBA; |
6075 |
+ } |
6076 |
+-#else // Output little-endian BGRA pixels. |
6077 |
++#elif SK_PMCOLOR_BYTE_ORDER(B, G, R, A) |
6078 |
+ inline WEBP_CSP_MODE outputMode(bool hasAlpha) { |
6079 |
+ return hasAlpha ? MODE_bgrA : MODE_BGRA; |
6080 |
+ } |
6081 |
++#elif SK_PMCOLOR_BYTE_ORDER(A, R, G, B) |
6082 |
++inline WEBP_CSP_MODE outputMode(bool hasAlpha) { |
6083 |
++ return hasAlpha ? MODE_Argb : MODE_ARGB; |
6084 |
++} |
6085 |
++#else |
6086 |
++#error Component order not supported by libwebp |
6087 |
+ #endif |
6088 |
+ |
6089 |
+ namespace { |
6090 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/asn1/a_int.c |
6091 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/asn1/a_int.c |
6092 |
+@@ -369,7 +369,9 @@ int ASN1_INTEGER_set_uint64(ASN1_INTEGER *out, uint64_t v) |
6093 |
+ |
6094 |
+ OPENSSL_free(out->data); |
6095 |
+ out->data = newdata; |
6096 |
++#ifndef OPENSSL_BIGENDIAN |
6097 |
+ v = CRYPTO_bswap8(v); |
6098 |
++#endif |
6099 |
+ memcpy(out->data, &v, sizeof(v)); |
6100 |
+ |
6101 |
+ out->type = V_ASN1_INTEGER; |
6102 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/chacha/chacha.c |
6103 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/chacha/chacha.c |
6104 |
+@@ -29,6 +29,14 @@ |
6105 |
+ (((uint32_t)((p)[0])) | ((uint32_t)((p)[1]) << 8) | \ |
6106 |
+ ((uint32_t)((p)[2]) << 16) | ((uint32_t)((p)[3]) << 24)) |
6107 |
+ |
6108 |
++#define U32TO8_LITTLE(p, v) \ |
6109 |
++ { \ |
6110 |
++ (p)[0] = (v >> 0) & 0xff; \ |
6111 |
++ (p)[1] = (v >> 8) & 0xff; \ |
6112 |
++ (p)[2] = (v >> 16) & 0xff; \ |
6113 |
++ (p)[3] = (v >> 24) & 0xff; \ |
6114 |
++ } |
6115 |
++ |
6116 |
+ // sigma contains the ChaCha constants, which happen to be an ASCII string. |
6117 |
+ static const uint8_t sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', |
6118 |
+ '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; |
6119 |
+@@ -45,9 +53,27 @@ static const uint8_t sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', |
6120 |
+ void CRYPTO_hchacha20(uint8_t out[32], const uint8_t key[32], |
6121 |
+ const uint8_t nonce[16]) { |
6122 |
+ uint32_t x[16]; |
6123 |
+- OPENSSL_memcpy(x, sigma, sizeof(sigma)); |
6124 |
+- OPENSSL_memcpy(&x[4], key, 32); |
6125 |
+- OPENSSL_memcpy(&x[12], nonce, 16); |
6126 |
++ int i; |
6127 |
++ |
6128 |
++ x[0] = U8TO32_LITTLE(sigma + 0); |
6129 |
++ x[1] = U8TO32_LITTLE(sigma + 4); |
6130 |
++ x[2] = U8TO32_LITTLE(sigma + 8); |
6131 |
++ x[3] = U8TO32_LITTLE(sigma + 12); |
6132 |
++ |
6133 |
++ x[4] = U8TO32_LITTLE(key + 0); |
6134 |
++ x[5] = U8TO32_LITTLE(key + 4); |
6135 |
++ x[6] = U8TO32_LITTLE(key + 8); |
6136 |
++ x[7] = U8TO32_LITTLE(key + 12); |
6137 |
++ |
6138 |
++ x[8] = U8TO32_LITTLE(key + 16); |
6139 |
++ x[9] = U8TO32_LITTLE(key + 20); |
6140 |
++ x[10] = U8TO32_LITTLE(key + 24); |
6141 |
++ x[11] = U8TO32_LITTLE(key + 28); |
6142 |
++ |
6143 |
++ x[12] = U8TO32_LITTLE(nonce + 0); |
6144 |
++ x[13] = U8TO32_LITTLE(nonce + 4); |
6145 |
++ x[14] = U8TO32_LITTLE(nonce + 8); |
6146 |
++ x[15] = U8TO32_LITTLE(nonce + 12); |
6147 |
+ |
6148 |
+ for (size_t i = 0; i < 20; i += 2) { |
6149 |
+ QUARTERROUND(0, 4, 8, 12) |
6150 |
+@@ -60,8 +86,10 @@ void CRYPTO_hchacha20(uint8_t out[32], const uint8_t key[32], |
6151 |
+ QUARTERROUND(3, 4, 9, 14) |
6152 |
+ } |
6153 |
+ |
6154 |
+- OPENSSL_memcpy(out, &x[0], sizeof(uint32_t) * 4); |
6155 |
+- OPENSSL_memcpy(&out[16], &x[12], sizeof(uint32_t) * 4); |
6156 |
++ for (i = 0; i < 4; ++i) { |
6157 |
++ U32TO8_LITTLE(out + 4 * i, x[i]); |
6158 |
++ U32TO8_LITTLE(&out[16] + 4 * i, x[12+i]); |
6159 |
++ } |
6160 |
+ } |
6161 |
+ |
6162 |
+ #if !defined(OPENSSL_NO_ASM) && \ |
6163 |
+@@ -105,14 +133,6 @@ void CRYPTO_chacha_20(uint8_t *out, const uint8_t *in, size_t in_len, |
6164 |
+ |
6165 |
+ #else |
6166 |
+ |
6167 |
+-#define U32TO8_LITTLE(p, v) \ |
6168 |
+- { \ |
6169 |
+- (p)[0] = (v >> 0) & 0xff; \ |
6170 |
+- (p)[1] = (v >> 8) & 0xff; \ |
6171 |
+- (p)[2] = (v >> 16) & 0xff; \ |
6172 |
+- (p)[3] = (v >> 24) & 0xff; \ |
6173 |
+- } |
6174 |
+- |
6175 |
+ // chacha_core performs 20 rounds of ChaCha on the input words in |
6176 |
+ // |input| and writes the 64 output bytes to |output|. |
6177 |
+ static void chacha_core(uint8_t output[64], const uint32_t input[16]) { |
6178 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c |
6179 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c |
6180 |
+@@ -625,7 +625,11 @@ static void gcm_siv_crypt(uint8_t *out, const uint8_t *in, size_t in_len, |
6181 |
+ for (size_t done = 0; done < in_len;) { |
6182 |
+ uint8_t keystream[AES_BLOCK_SIZE]; |
6183 |
+ enc_block(counter.c, keystream, key); |
6184 |
++#ifdef OPENSSL_BIGENDIAN |
6185 |
++ counter.w[0] = CRYPTO_bswap4(CRYPTO_bswap4(counter.w[0]) + 1); |
6186 |
++#else |
6187 |
+ counter.w[0]++; |
6188 |
++#endif |
6189 |
+ |
6190 |
+ size_t todo = AES_BLOCK_SIZE; |
6191 |
+ if (in_len - done < todo) { |
6192 |
+@@ -673,8 +677,13 @@ static void gcm_siv_polyval( |
6193 |
+ } bitlens; |
6194 |
+ } length_block; |
6195 |
+ |
6196 |
++#ifdef OPENSSL_BIGENDIAN |
6197 |
++ length_block.bitlens.ad = CRYPTO_bswap8(ad_len * 8); |
6198 |
++ length_block.bitlens.in = CRYPTO_bswap8(in_len * 8); |
6199 |
++#else |
6200 |
+ length_block.bitlens.ad = ad_len * 8; |
6201 |
+ length_block.bitlens.in = in_len * 8; |
6202 |
++#endif |
6203 |
+ CRYPTO_POLYVAL_update_blocks(&polyval_ctx, length_block.c, |
6204 |
+ sizeof(length_block)); |
6205 |
+ |
6206 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/compiler_test.cc |
6207 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/compiler_test.cc |
6208 |
+@@ -40,9 +40,13 @@ static void CheckRepresentation(T value) { |
6209 |
+ UnsignedT value_u = static_cast<UnsignedT>(value); |
6210 |
+ EXPECT_EQ(sizeof(UnsignedT), sizeof(T)); |
6211 |
+ |
6212 |
+- // Integers must be little-endian. |
6213 |
++ // Integers must be either big-endian or little-endian. |
6214 |
+ uint8_t expected[sizeof(UnsignedT)]; |
6215 |
++#ifdef OPENSSL_BIGENDIAN |
6216 |
++ for (size_t i = sizeof(UnsignedT); i-- > 0; ) { |
6217 |
++#else |
6218 |
+ for (size_t i = 0; i < sizeof(UnsignedT); i++) { |
6219 |
++#endif |
6220 |
+ expected[i] = static_cast<uint8_t>(value_u); |
6221 |
+ // Divide instead of right-shift to appease compilers that warn if |T| is a |
6222 |
+ // char. The explicit cast is also needed to appease MSVC if integer |
6223 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/curve25519/spake25519.c |
6224 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/curve25519/spake25519.c |
6225 |
+@@ -339,8 +339,17 @@ static void scalar_double(scalar *s) { |
6226 |
+ uint32_t carry = 0; |
6227 |
+ |
6228 |
+ for (size_t i = 0; i < 8; i++) { |
6229 |
+- const uint32_t carry_out = s->words[i] >> 31; |
6230 |
+- s->words[i] = (s->words[i] << 1) | carry; |
6231 |
++#ifdef OPENSSL_BIGENDIAN |
6232 |
++ const uint32_t si = CRYPTO_bswap4(s->words[i]); |
6233 |
++#else |
6234 |
++ const uint32_t si = s->words[i]; |
6235 |
++#endif |
6236 |
++ const uint32_t carry_out = si >> 31; |
6237 |
++#ifdef OPENSSL_BIGENDIAN |
6238 |
++ s->words[i] = CRYPTO_bswap4((si << 1) | carry); |
6239 |
++#else |
6240 |
++ s->words[i] = (si << 1) | carry; |
6241 |
++#endif |
6242 |
+ carry = carry_out; |
6243 |
+ } |
6244 |
+ } |
6245 |
+@@ -350,8 +359,13 @@ static void scalar_add(scalar *dest, const scalar *src) { |
6246 |
+ uint32_t carry = 0; |
6247 |
+ |
6248 |
+ for (size_t i = 0; i < 8; i++) { |
6249 |
++#ifdef OPENSSL_BIGENDIAN |
6250 |
++ uint64_t tmp = ((uint64_t)CRYPTO_bswap4(dest->words[i]) + CRYPTO_bswap4(src->words[i])) + carry; |
6251 |
++ dest->words[i] = CRYPTO_bswap4((uint32_t)tmp); |
6252 |
++#else |
6253 |
+ uint64_t tmp = ((uint64_t)dest->words[i] + src->words[i]) + carry; |
6254 |
+ dest->words[i] = (uint32_t)tmp; |
6255 |
++#endif |
6256 |
+ carry = (uint32_t)(tmp >> 32); |
6257 |
+ } |
6258 |
+ } |
6259 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/evp/scrypt.c |
6260 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/evp/scrypt.c |
6261 |
+@@ -196,10 +196,28 @@ int EVP_PBE_scrypt(const char *password, size_t password_len, |
6262 |
+ goto err; |
6263 |
+ } |
6264 |
+ |
6265 |
++#ifdef OPENSSL_BIGENDIAN |
6266 |
++ uint32_t *B32 = B->words; |
6267 |
++ size_t B_words = B_bytes >> 2; |
6268 |
++ do { |
6269 |
++ *B32 = CRYPTO_bswap4(*B32); |
6270 |
++ B32++; |
6271 |
++ } while(--B_words); |
6272 |
++#endif |
6273 |
++ |
6274 |
+ for (uint64_t i = 0; i < p; i++) { |
6275 |
+ scryptROMix(B + 2 * r * i, r, N, T, V); |
6276 |
+ } |
6277 |
+ |
6278 |
++#ifdef OPENSSL_BIGENDIAN |
6279 |
++ B32 = B->words; |
6280 |
++ B_words = B_bytes >> 2; |
6281 |
++ do { |
6282 |
++ *B32 = CRYPTO_bswap4(*B32); |
6283 |
++ B32++; |
6284 |
++ } while(--B_words); |
6285 |
++#endif |
6286 |
++ |
6287 |
+ if (!PKCS5_PBKDF2_HMAC(password, password_len, (const uint8_t *)B, B_bytes, 1, |
6288 |
+ EVP_sha256(), key_len, out_key)) { |
6289 |
+ goto err; |
6290 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c |
6291 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c |
6292 |
+@@ -136,9 +136,13 @@ BIGNUM *BN_le2bn(const uint8_t *in, size_t len, BIGNUM *ret) { |
6293 |
+ // Make sure the top bytes will be zeroed. |
6294 |
+ ret->d[num_words - 1] = 0; |
6295 |
+ |
6296 |
+- // We only support little-endian platforms, so we can simply memcpy the |
6297 |
+- // internal representation. |
6298 |
++#ifdef OPENSSL_BIGENDIAN |
6299 |
++ uint8_t *out = (uint8_t *)ret->d; |
6300 |
++ for (size_t i = 0; i < len; i++) |
6301 |
++ out[i ^ (BN_BYTES-1)] = in[i]; |
6302 |
++#else |
6303 |
+ OPENSSL_memcpy(ret->d, in, len); |
6304 |
++#endif |
6305 |
+ return ret; |
6306 |
+ } |
6307 |
+ |
6308 |
+@@ -157,7 +161,11 @@ size_t BN_bn2bin(const BIGNUM *in, uint8_t *out) { |
6309 |
+ static int fits_in_bytes(const uint8_t *bytes, size_t num_bytes, size_t len) { |
6310 |
+ uint8_t mask = 0; |
6311 |
+ for (size_t i = len; i < num_bytes; i++) { |
6312 |
++#ifdef OPENSSL_BIGENDIAN |
6313 |
++ mask |= bytes[i ^ (BN_BYTES-1)]; |
6314 |
++#else |
6315 |
+ mask |= bytes[i]; |
6316 |
++#endif |
6317 |
+ } |
6318 |
+ return mask == 0; |
6319 |
+ } |
6320 |
+@@ -172,9 +180,13 @@ int BN_bn2le_padded(uint8_t *out, size_t len, const BIGNUM *in) { |
6321 |
+ num_bytes = len; |
6322 |
+ } |
6323 |
+ |
6324 |
+- // We only support little-endian platforms, so we can simply memcpy into the |
6325 |
+- // internal representation. |
6326 |
++#ifdef OPENSSL_BIGENDIAN |
6327 |
++ for (size_t i = 0; i < num_bytes; i++) { |
6328 |
++ out[i] = bytes[i ^ (BN_BYTES-1)]; |
6329 |
++ } |
6330 |
++#else |
6331 |
+ OPENSSL_memcpy(out, bytes, num_bytes); |
6332 |
++#endif |
6333 |
+ // Pad out the rest of the buffer with zeroes. |
6334 |
+ OPENSSL_memset(out + num_bytes, 0, len - num_bytes); |
6335 |
+ return 1; |
6336 |
+@@ -190,11 +202,15 @@ int BN_bn2bin_padded(uint8_t *out, size_t len, const BIGNUM *in) { |
6337 |
+ num_bytes = len; |
6338 |
+ } |
6339 |
+ |
6340 |
+- // We only support little-endian platforms, so we can simply write the buffer |
6341 |
+- // in reverse. |
6342 |
++#ifdef OPENSSL_BIGENDIAN |
6343 |
++ for (size_t i = 0; i < num_bytes; i++) { |
6344 |
++ out[len - i - 1] = bytes[i ^ (BN_BYTES-1)]; |
6345 |
++ } |
6346 |
++#else |
6347 |
+ for (size_t i = 0; i < num_bytes; i++) { |
6348 |
+ out[len - i - 1] = bytes[i]; |
6349 |
+ } |
6350 |
++#endif |
6351 |
+ // Pad out the rest of the buffer with zeroes. |
6352 |
+ OPENSSL_memset(out, 0, len - num_bytes); |
6353 |
+ return 1; |
6354 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c |
6355 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c |
6356 |
+@@ -80,7 +80,11 @@ static void digest_to_scalar(const EC_GROUP *group, EC_SCALAR *out, |
6357 |
+ } |
6358 |
+ OPENSSL_memset(out, 0, sizeof(EC_SCALAR)); |
6359 |
+ for (size_t i = 0; i < digest_len; i++) { |
6360 |
++#ifdef OPENSSL_BIGENDIAN |
6361 |
++ out->bytes[i ^ (BN_BYTES-1)] = digest[digest_len - 1 - i]; |
6362 |
++#else |
6363 |
+ out->bytes[i] = digest[digest_len - 1 - i]; |
6364 |
++#endif |
6365 |
+ } |
6366 |
+ |
6367 |
+ // If it is still too long, truncate remaining bits with a shift. |
6368 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/gcm.c |
6369 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/gcm.c |
6370 |
+@@ -78,6 +78,14 @@ |
6371 |
+ } \ |
6372 |
+ } while (0) |
6373 |
+ |
6374 |
++#ifdef OPENSSL_BIGENDIAN |
6375 |
++#define GCM_bswap4(x) (x) |
6376 |
++#define GCM_bswap8(x) (x) |
6377 |
++#else |
6378 |
++#define GCM_bswap4 CRYPTO_bswap4 |
6379 |
++#define GCM_bswap8 CRYPTO_bswap8 |
6380 |
++#endif |
6381 |
++ |
6382 |
+ // kSizeTWithoutLower4Bits is a mask that can be used to zero the lower four |
6383 |
+ // bits of a |size_t|. |
6384 |
+ static const size_t kSizeTWithoutLower4Bits = (size_t) -16; |
6385 |
+@@ -173,8 +181,8 @@ static void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]) { |
6386 |
+ Z.lo ^= Htable[nlo].lo; |
6387 |
+ } |
6388 |
+ |
6389 |
+- Xi[0] = CRYPTO_bswap8(Z.hi); |
6390 |
+- Xi[1] = CRYPTO_bswap8(Z.lo); |
6391 |
++ Xi[0] = GCM_bswap8(Z.hi); |
6392 |
++ Xi[1] = GCM_bswap8(Z.lo); |
6393 |
+ } |
6394 |
+ |
6395 |
+ // Streamed gcm_mult_4bit, see CRYPTO_gcm128_[en|de]crypt for |
6396 |
+@@ -233,8 +241,8 @@ static void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], |
6397 |
+ Z.lo ^= Htable[nlo].lo; |
6398 |
+ } |
6399 |
+ |
6400 |
+- Xi[0] = CRYPTO_bswap8(Z.hi); |
6401 |
+- Xi[1] = CRYPTO_bswap8(Z.lo); |
6402 |
++ Xi[0] = GCM_bswap8(Z.hi); |
6403 |
++ Xi[1] = GCM_bswap8(Z.lo); |
6404 |
+ } while (inp += 16, len -= 16); |
6405 |
+ } |
6406 |
+ #else // GHASH_ASM |
6407 |
+@@ -360,8 +368,8 @@ void CRYPTO_ghash_init(gmult_func *out_mult, ghash_func *out_hash, |
6408 |
+ OPENSSL_memcpy(H.c, gcm_key, 16); |
6409 |
+ |
6410 |
+ // H is stored in host byte order |
6411 |
+- H.u[0] = CRYPTO_bswap8(H.u[0]); |
6412 |
+- H.u[1] = CRYPTO_bswap8(H.u[1]); |
6413 |
++ H.u[0] = GCM_bswap8(H.u[0]); |
6414 |
++ H.u[1] = GCM_bswap8(H.u[1]); |
6415 |
+ |
6416 |
+ OPENSSL_memcpy(out_key, H.c, 16); |
6417 |
+ |
6418 |
+@@ -474,15 +482,15 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6419 |
+ GCM_MUL(ctx, Yi); |
6420 |
+ } |
6421 |
+ len0 <<= 3; |
6422 |
+- ctx->Yi.u[1] ^= CRYPTO_bswap8(len0); |
6423 |
++ ctx->Yi.u[1] ^= GCM_bswap8(len0); |
6424 |
+ |
6425 |
+ GCM_MUL(ctx, Yi); |
6426 |
+- ctr = CRYPTO_bswap4(ctx->Yi.d[3]); |
6427 |
++ ctr = GCM_bswap4(ctx->Yi.d[3]); |
6428 |
+ } |
6429 |
+ |
6430 |
+ (*ctx->gcm_key.block)(ctx->Yi.c, ctx->EK0.c, key); |
6431 |
+ ++ctr; |
6432 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6433 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6434 |
+ } |
6435 |
+ |
6436 |
+ int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const uint8_t *aad, size_t len) { |
6437 |
+@@ -580,7 +588,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6438 |
+ ctx->ares = 0; |
6439 |
+ } |
6440 |
+ |
6441 |
+- ctr = CRYPTO_bswap4(ctx->Yi.d[3]); |
6442 |
++ ctr = GCM_bswap4(ctx->Yi.d[3]); |
6443 |
+ |
6444 |
+ n = ctx->mres; |
6445 |
+ if (n) { |
6446 |
+@@ -602,7 +610,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6447 |
+ if (n == 0) { |
6448 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6449 |
+ ++ctr; |
6450 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6451 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6452 |
+ } |
6453 |
+ ctx->Xi.c[n] ^= out[i] = in[i] ^ ctx->EKi.c[n]; |
6454 |
+ n = (n + 1) % 16; |
6455 |
+@@ -621,7 +629,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6456 |
+ while (j) { |
6457 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6458 |
+ ++ctr; |
6459 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6460 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6461 |
+ for (size_t i = 0; i < 16; i += sizeof(size_t)) { |
6462 |
+ store_word_le(out + i, |
6463 |
+ load_word_le(in + i) ^ ctx->EKi.t[i / sizeof(size_t)]); |
6464 |
+@@ -638,7 +646,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6465 |
+ while (len >= 16) { |
6466 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6467 |
+ ++ctr; |
6468 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6469 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6470 |
+ for (size_t i = 0; i < 16; i += sizeof(size_t)) { |
6471 |
+ store_word_le(out + i, |
6472 |
+ load_word_le(in + i) ^ ctx->EKi.t[i / sizeof(size_t)]); |
6473 |
+@@ -653,7 +661,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6474 |
+ while (len >= 16) { |
6475 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6476 |
+ ++ctr; |
6477 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6478 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6479 |
+ for (size_t i = 0; i < 16; i += sizeof(size_t)) { |
6480 |
+ size_t tmp = load_word_le(in + i) ^ ctx->EKi.t[i / sizeof(size_t)]; |
6481 |
+ store_word_le(out + i, tmp); |
6482 |
+@@ -668,7 +676,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6483 |
+ if (len) { |
6484 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6485 |
+ ++ctr; |
6486 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6487 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6488 |
+ while (len--) { |
6489 |
+ ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n]; |
6490 |
+ ++n; |
6491 |
+@@ -707,7 +715,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6492 |
+ ctx->ares = 0; |
6493 |
+ } |
6494 |
+ |
6495 |
+- ctr = CRYPTO_bswap4(ctx->Yi.d[3]); |
6496 |
++ ctr = GCM_bswap4(ctx->Yi.d[3]); |
6497 |
+ |
6498 |
+ n = ctx->mres; |
6499 |
+ if (n) { |
6500 |
+@@ -732,7 +740,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6501 |
+ if (n == 0) { |
6502 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6503 |
+ ++ctr; |
6504 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6505 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6506 |
+ } |
6507 |
+ c = in[i]; |
6508 |
+ out[i] = c ^ ctx->EKi.c[n]; |
6509 |
+@@ -754,7 +762,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6510 |
+ while (j) { |
6511 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6512 |
+ ++ctr; |
6513 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6514 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6515 |
+ for (size_t i = 0; i < 16; i += sizeof(size_t)) { |
6516 |
+ store_word_le(out + i, |
6517 |
+ load_word_le(in + i) ^ ctx->EKi.t[i / sizeof(size_t)]); |
6518 |
+@@ -771,7 +779,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6519 |
+ while (len >= 16) { |
6520 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6521 |
+ ++ctr; |
6522 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6523 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6524 |
+ for (size_t i = 0; i < 16; i += sizeof(size_t)) { |
6525 |
+ store_word_le(out + i, |
6526 |
+ load_word_le(in + i) ^ ctx->EKi.t[i / sizeof(size_t)]); |
6527 |
+@@ -785,7 +793,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6528 |
+ while (len >= 16) { |
6529 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6530 |
+ ++ctr; |
6531 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6532 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6533 |
+ for (size_t i = 0; i < 16; i += sizeof(size_t)) { |
6534 |
+ size_t c = load_word_le(in + i); |
6535 |
+ store_word_le(out + i, c ^ ctx->EKi.t[i / sizeof(size_t)]); |
6536 |
+@@ -800,7 +808,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6537 |
+ if (len) { |
6538 |
+ (*block)(ctx->Yi.c, ctx->EKi.c, key); |
6539 |
+ ++ctr; |
6540 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6541 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6542 |
+ while (len--) { |
6543 |
+ uint8_t c = in[n]; |
6544 |
+ ctx->Xi.c[n] ^= c; |
6545 |
+@@ -866,13 +874,13 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6546 |
+ } |
6547 |
+ #endif |
6548 |
+ |
6549 |
+- ctr = CRYPTO_bswap4(ctx->Yi.d[3]); |
6550 |
++ ctr = GCM_bswap4(ctx->Yi.d[3]); |
6551 |
+ |
6552 |
+ #if defined(GHASH) |
6553 |
+ while (len >= GHASH_CHUNK) { |
6554 |
+ (*stream)(in, out, GHASH_CHUNK / 16, key, ctx->Yi.c); |
6555 |
+ ctr += GHASH_CHUNK / 16; |
6556 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6557 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6558 |
+ GHASH(ctx, out, GHASH_CHUNK); |
6559 |
+ out += GHASH_CHUNK; |
6560 |
+ in += GHASH_CHUNK; |
6561 |
+@@ -885,7 +893,7 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6562 |
+ |
6563 |
+ (*stream)(in, out, j, key, ctx->Yi.c); |
6564 |
+ ctr += (unsigned int)j; |
6565 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6566 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6567 |
+ in += i; |
6568 |
+ len -= i; |
6569 |
+ #if defined(GHASH) |
6570 |
+@@ -904,7 +912,7 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6571 |
+ if (len) { |
6572 |
+ (*ctx->gcm_key.block)(ctx->Yi.c, ctx->EKi.c, key); |
6573 |
+ ++ctr; |
6574 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6575 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6576 |
+ while (len--) { |
6577 |
+ ctx->Xi.c[n] ^= out[n] = in[n] ^ ctx->EKi.c[n]; |
6578 |
+ ++n; |
6579 |
+@@ -970,14 +978,14 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6580 |
+ } |
6581 |
+ #endif |
6582 |
+ |
6583 |
+- ctr = CRYPTO_bswap4(ctx->Yi.d[3]); |
6584 |
++ ctr = GCM_bswap4(ctx->Yi.d[3]); |
6585 |
+ |
6586 |
+ #if defined(GHASH) |
6587 |
+ while (len >= GHASH_CHUNK) { |
6588 |
+ GHASH(ctx, in, GHASH_CHUNK); |
6589 |
+ (*stream)(in, out, GHASH_CHUNK / 16, key, ctx->Yi.c); |
6590 |
+ ctr += GHASH_CHUNK / 16; |
6591 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6592 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6593 |
+ out += GHASH_CHUNK; |
6594 |
+ in += GHASH_CHUNK; |
6595 |
+ len -= GHASH_CHUNK; |
6596 |
+@@ -1003,7 +1011,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6597 |
+ #endif |
6598 |
+ (*stream)(in, out, j, key, ctx->Yi.c); |
6599 |
+ ctr += (unsigned int)j; |
6600 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6601 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6602 |
+ out += i; |
6603 |
+ in += i; |
6604 |
+ len -= i; |
6605 |
+@@ -1011,7 +1019,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key, |
6606 |
+ if (len) { |
6607 |
+ (*ctx->gcm_key.block)(ctx->Yi.c, ctx->EKi.c, key); |
6608 |
+ ++ctr; |
6609 |
+- ctx->Yi.d[3] = CRYPTO_bswap4(ctr); |
6610 |
++ ctx->Yi.d[3] = GCM_bswap4(ctr); |
6611 |
+ while (len--) { |
6612 |
+ uint8_t c = in[n]; |
6613 |
+ ctx->Xi.c[n] ^= c; |
6614 |
+@@ -1036,8 +1044,8 @@ int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const uint8_t *tag, size_t len) { |
6615 |
+ GCM_MUL(ctx, Xi); |
6616 |
+ } |
6617 |
+ |
6618 |
+- alen = CRYPTO_bswap8(alen); |
6619 |
+- clen = CRYPTO_bswap8(clen); |
6620 |
++ alen = GCM_bswap8(alen); |
6621 |
++ clen = GCM_bswap8(clen); |
6622 |
+ |
6623 |
+ ctx->Xi.u[0] ^= alen; |
6624 |
+ ctx->Xi.u[1] ^= clen; |
6625 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/internal.h |
6626 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/internal.h |
6627 |
+@@ -70,11 +70,17 @@ extern "C" { |
6628 |
+ static inline uint32_t GETU32(const void *in) { |
6629 |
+ uint32_t v; |
6630 |
+ OPENSSL_memcpy(&v, in, sizeof(v)); |
6631 |
++#ifdef OPENSSL_BIGENDIAN |
6632 |
++ return v; |
6633 |
++#else |
6634 |
+ return CRYPTO_bswap4(v); |
6635 |
++#endif |
6636 |
+ } |
6637 |
+ |
6638 |
+ static inline void PUTU32(void *out, uint32_t v) { |
6639 |
++#ifndef OPENSSL_BIGENDIAN |
6640 |
+ v = CRYPTO_bswap4(v); |
6641 |
++#endif |
6642 |
+ OPENSSL_memcpy(out, &v, sizeof(v)); |
6643 |
+ } |
6644 |
+ |
6645 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/polyval.c |
6646 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/polyval.c |
6647 |
+@@ -32,16 +32,26 @@ static void byte_reverse(polyval_block *b) { |
6648 |
+ // the GHASH field, multiplies that by 'x' and serialises the result back into |
6649 |
+ // |b|, but with GHASH's backwards bit ordering. |
6650 |
+ static void reverse_and_mulX_ghash(polyval_block *b) { |
6651 |
++#ifdef OPENSSL_BIGENDIAN |
6652 |
++ uint64_t hi = CRYPTO_bswap8(b->u[0]); |
6653 |
++ uint64_t lo = CRYPTO_bswap8(b->u[1]); |
6654 |
++#else |
6655 |
+ uint64_t hi = b->u[0]; |
6656 |
+ uint64_t lo = b->u[1]; |
6657 |
++#endif |
6658 |
+ const crypto_word_t carry = constant_time_eq_w(hi & 1, 1); |
6659 |
+ hi >>= 1; |
6660 |
+ hi |= lo << 63; |
6661 |
+ lo >>= 1; |
6662 |
+ lo ^= ((uint64_t) constant_time_select_w(carry, 0xe1, 0)) << 56; |
6663 |
+ |
6664 |
++#ifdef OPENSSL_BIGENDIAN |
6665 |
++ b->u[0] = lo; |
6666 |
++ b->u[1] = hi; |
6667 |
++#else |
6668 |
+ b->u[0] = CRYPTO_bswap8(lo); |
6669 |
+ b->u[1] = CRYPTO_bswap8(hi); |
6670 |
++#endif |
6671 |
+ } |
6672 |
+ |
6673 |
+ // POLYVAL(H, X_1, ..., X_n) = |
6674 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c |
6675 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c |
6676 |
+@@ -70,8 +70,12 @@ OPENSSL_STATIC_ASSERT(CTR_DRBG_ENTROPY_LEN % AES_BLOCK_SIZE == 0, |
6677 |
+ // ctr_inc adds |n| to the last four bytes of |drbg->counter|, treated as a |
6678 |
+ // big-endian number. |
6679 |
+ static void ctr32_add(CTR_DRBG_STATE *drbg, uint32_t n) { |
6680 |
++#ifdef OPENSSL_BIGENDIAN |
6681 |
++ drbg->counter.words[3] += n; |
6682 |
++#else |
6683 |
+ drbg->counter.words[3] = |
6684 |
+ CRYPTO_bswap4(CRYPTO_bswap4(drbg->counter.words[3]) + n); |
6685 |
++#endif |
6686 |
+ } |
6687 |
+ |
6688 |
+ static int ctr_drbg_update(CTR_DRBG_STATE *drbg, const uint8_t *data, |
6689 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/poly1305/poly1305.c |
6690 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/crypto/poly1305/poly1305.c |
6691 |
+@@ -32,10 +32,16 @@ |
6692 |
+ static uint32_t U8TO32_LE(const uint8_t *m) { |
6693 |
+ uint32_t r; |
6694 |
+ OPENSSL_memcpy(&r, m, sizeof(r)); |
6695 |
++#ifdef OPENSSL_BIGENDIAN |
6696 |
++ r = CRYPTO_bswap4(r); |
6697 |
++#endif |
6698 |
+ return r; |
6699 |
+ } |
6700 |
+ |
6701 |
+ static void U32TO8_LE(uint8_t *m, uint32_t v) { |
6702 |
++#ifdef OPENSSL_BIGENDIAN |
6703 |
++ v = CRYPTO_bswap4(v); |
6704 |
++#endif |
6705 |
+ OPENSSL_memcpy(m, &v, sizeof(v)); |
6706 |
+ } |
6707 |
+ |
6708 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include/openssl/base.h |
6709 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include/openssl/base.h |
6710 |
+@@ -99,6 +99,10 @@ extern "C" { |
6711 |
+ #elif (defined(__PPC64__) || defined(__powerpc64__)) && defined(_LITTLE_ENDIAN) |
6712 |
+ #define OPENSSL_64_BIT |
6713 |
+ #define OPENSSL_PPC64LE |
6714 |
++#elif (defined(__PPC64__) || defined(__powerpc64__)) |
6715 |
++#define OPENSSL_64_BIT |
6716 |
++#define OPENSSL_PPC64 |
6717 |
++#define OPENSSL_BIGENDIAN |
6718 |
+ #elif defined(__mips__) && !defined(__LP64__) |
6719 |
+ #define OPENSSL_32_BIT |
6720 |
+ #define OPENSSL_MIPS |
6721 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/curve25519.c |
6722 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/curve25519.c |
6723 |
+@@ -3032,9 +3032,14 @@ int ED25519_verify(const uint8_t *message, size_t message_len, |
6724 |
+ UINT64_C(0x1000000000000000), |
6725 |
+ }; |
6726 |
+ for (size_t i = 3;; i--) { |
6727 |
+- if (scopy.u64[i] > kOrder[i]) { |
6728 |
++#ifdef OPENSSL_BIGENDIAN |
6729 |
++ const uint64_t n = CRYPTO_bswap8(scopy.u64[i]); |
6730 |
++#else |
6731 |
++ const uint64_t n = scopy.u64[i]; |
6732 |
++#endif |
6733 |
++ if (n > kOrder[i]) { |
6734 |
+ return 0; |
6735 |
+- } else if (scopy.u64[i] < kOrder[i]) { |
6736 |
++ } else if (n < kOrder[i]) { |
6737 |
+ break; |
6738 |
+ } else if (i == 0) { |
6739 |
+ return 0; |
6740 |
+--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/p256.c |
6741 |
++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/p256.c |
6742 |
+@@ -882,12 +882,24 @@ static void fe_tobytes(uint8_t out[NBYTES], const fe in) { |
6743 |
+ } |
6744 |
+ } |
6745 |
+ |
6746 |
++#ifdef OPENSSL_BIGENDIAN |
6747 |
++static void fe_tobytes_be(uint8_t out[NBYTES], const fe in) { |
6748 |
++ for (int i = 0; i<NBYTES; i++) { |
6749 |
++ out[i ^ (BN_BYTES-1)] = (uint8_t)(in[i/sizeof(in[0])] >> (8*(i%sizeof(in[0])))); |
6750 |
++ } |
6751 |
++} |
6752 |
++#endif |
6753 |
++ |
6754 |
+ static void fe_frombytes(fe out, const uint8_t in[NBYTES]) { |
6755 |
+ for (int i = 0; i<NLIMBS; i++) { |
6756 |
+ out[i] = 0; |
6757 |
+ } |
6758 |
+ for (int i = 0; i<NBYTES; i++) { |
6759 |
++#ifdef OPENSSL_BIGENDIAN |
6760 |
++ out[i/sizeof(out[0])] |= ((limb_t)in[i ^ (BN_BYTES-1)]) << (8*(i%sizeof(out[0]))); |
6761 |
++#else |
6762 |
+ out[i/sizeof(out[0])] |= ((limb_t)in[i]) << (8*(i%sizeof(out[0]))); |
6763 |
++#endif |
6764 |
+ } |
6765 |
+ } |
6766 |
+ |
6767 |
+@@ -906,7 +918,11 @@ static void fe_to_generic(EC_FELEM *out, const fe in) { |
6768 |
+ OPENSSL_STATIC_ASSERT( |
6769 |
+ 256 / 8 == sizeof(BN_ULONG) * ((256 + BN_BITS2 - 1) / BN_BITS2), |
6770 |
+ "fe_tobytes leaves bytes uninitialized"); |
6771 |
++#ifdef OPENSSL_BIGENDIAN |
6772 |
++ fe_tobytes_be(out->bytes, in); |
6773 |
++#else |
6774 |
+ fe_tobytes(out->bytes, in); |
6775 |
++#endif |
6776 |
+ } |
6777 |
+ |
6778 |
+ // fe_inv calculates |out| = |in|^{-1} |
6779 |
+@@ -1524,7 +1540,11 @@ static char get_bit(const uint8_t *in, int i) { |
6780 |
+ if (i < 0 || i >= 256) { |
6781 |
+ return 0; |
6782 |
+ } |
6783 |
++#ifdef OPENSSL_BIGENDIAN |
6784 |
++ return (in[(i >> 3) ^ (sizeof(BN_ULONG)-1)] >> (i & 7)) & 1; |
6785 |
++#else |
6786 |
+ return (in[i >> 3] >> (i & 7)) & 1; |
6787 |
++#endif |
6788 |
+ } |
6789 |
+ |
6790 |
+ // Interleaved point multiplication using precomputed point multiples: The |
6791 |
+--- qtwebengine/src/3rdparty/chromium/third_party/crc32c/BUILD.gn |
6792 |
++++ qtwebengine/src/3rdparty/chromium/third_party/crc32c/BUILD.gn |
6793 |
+@@ -15,13 +15,10 @@ config("crc32c_config") { |
6794 |
+ ] |
6795 |
+ |
6796 |
+ defines = [ |
6797 |
+- "BYTE_ORDER_BIG_ENDIAN=0", |
6798 |
++ "BYTE_ORDER_BIG_ENDIAN=__BYTE_ORDER__==__ORDER_BIG_ENDIAN__", |
6799 |
+ "CRC32C_TESTS_BUILT_WITH_GLOG=0", |
6800 |
+ ] |
6801 |
+ |
6802 |
+- # If we ever support big-endian builds, add logic to conditionally enable |
6803 |
+- # BYTE_ORDER_BIG_ENDIAN. |
6804 |
+- |
6805 |
+ if (target_cpu == "x86" || target_cpu == "x64") { |
6806 |
+ defines += [ |
6807 |
+ "HAVE_MM_PREFETCH=1", |
6808 |
+--- qtwebengine/src/3rdparty/chromium/third_party/flatbuffers/src/include/flatbuffers/base.h |
6809 |
++++ qtwebengine/src/3rdparty/chromium/third_party/flatbuffers/src/include/flatbuffers/base.h |
6810 |
+@@ -220,18 +220,15 @@ template<typename T> T EndianSwap(T t) { |
6811 |
+ if (sizeof(T) == 1) { // Compile-time if-then's. |
6812 |
+ return t; |
6813 |
+ } else if (sizeof(T) == 2) { |
6814 |
+- union { T t; uint16_t i; } u; |
6815 |
+- u.t = t; |
6816 |
++ union U { T t; uint16_t i; U(const T& t_) : t(t_) {}} u(t); |
6817 |
+ u.i = FLATBUFFERS_BYTESWAP16(u.i); |
6818 |
+ return u.t; |
6819 |
+ } else if (sizeof(T) == 4) { |
6820 |
+- union { T t; uint32_t i; } u; |
6821 |
+- u.t = t; |
6822 |
++ union U { T t; uint32_t i; U(const T& t_) : t(t_) {}} u(t); |
6823 |
+ u.i = FLATBUFFERS_BYTESWAP32(u.i); |
6824 |
+ return u.t; |
6825 |
+ } else if (sizeof(T) == 8) { |
6826 |
+- union { T t; uint64_t i; } u; |
6827 |
+- u.t = t; |
6828 |
++ union U { T t; uint64_t i; U(const T& t_) : t(t_) {}} u(t); |
6829 |
+ u.i = FLATBUFFERS_BYTESWAP64(u.i); |
6830 |
+ return u.t; |
6831 |
+ } else { |
6832 |
+--- qtwebengine/src/3rdparty/chromium/third_party/flatbuffers/src/include/flatbuffers/minireflect.h |
6833 |
++++ qtwebengine/src/3rdparty/chromium/third_party/flatbuffers/src/include/flatbuffers/minireflect.h |
6834 |
+@@ -122,58 +122,58 @@ inline void IterateValue(ElementaryType type, const uint8_t *val, |
6835 |
+ soffset_t vector_index, IterationVisitor *visitor) { |
6836 |
+ switch (type) { |
6837 |
+ case ET_UTYPE: { |
6838 |
+- auto tval = *reinterpret_cast<const uint8_t *>(val); |
6839 |
++ auto tval = ReadScalar<uint8_t>(val); |
6840 |
+ visitor->UType(tval, EnumName(tval, type_table)); |
6841 |
+ break; |
6842 |
+ } |
6843 |
+ case ET_BOOL: { |
6844 |
+- visitor->Bool(*reinterpret_cast<const uint8_t *>(val) != 0); |
6845 |
++ visitor->Bool(ReadScalar<uint8_t>(val) != 0); |
6846 |
+ break; |
6847 |
+ } |
6848 |
+ case ET_CHAR: { |
6849 |
+- auto tval = *reinterpret_cast<const int8_t *>(val); |
6850 |
++ auto tval = ReadScalar<int8_t>(val); |
6851 |
+ visitor->Char(tval, EnumName(tval, type_table)); |
6852 |
+ break; |
6853 |
+ } |
6854 |
+ case ET_UCHAR: { |
6855 |
+- auto tval = *reinterpret_cast<const uint8_t *>(val); |
6856 |
++ auto tval = ReadScalar<uint8_t>(val); |
6857 |
+ visitor->UChar(tval, EnumName(tval, type_table)); |
6858 |
+ break; |
6859 |
+ } |
6860 |
+ case ET_SHORT: { |
6861 |
+- auto tval = *reinterpret_cast<const int16_t *>(val); |
6862 |
++ auto tval = ReadScalar<int16_t>(val); |
6863 |
+ visitor->Short(tval, EnumName(tval, type_table)); |
6864 |
+ break; |
6865 |
+ } |
6866 |
+ case ET_USHORT: { |
6867 |
+- auto tval = *reinterpret_cast<const uint16_t *>(val); |
6868 |
++ auto tval = ReadScalar<uint16_t>(val); |
6869 |
+ visitor->UShort(tval, EnumName(tval, type_table)); |
6870 |
+ break; |
6871 |
+ } |
6872 |
+ case ET_INT: { |
6873 |
+- auto tval = *reinterpret_cast<const int32_t *>(val); |
6874 |
++ auto tval = ReadScalar<int32_t>(val); |
6875 |
+ visitor->Int(tval, EnumName(tval, type_table)); |
6876 |
+ break; |
6877 |
+ } |
6878 |
+ case ET_UINT: { |
6879 |
+- auto tval = *reinterpret_cast<const uint32_t *>(val); |
6880 |
++ auto tval = ReadScalar<uint32_t>(val); |
6881 |
+ visitor->UInt(tval, EnumName(tval, type_table)); |
6882 |
+ break; |
6883 |
+ } |
6884 |
+ case ET_LONG: { |
6885 |
+- visitor->Long(*reinterpret_cast<const int64_t *>(val)); |
6886 |
++ visitor->Long(ReadScalar<int64_t>(val)); |
6887 |
+ break; |
6888 |
+ } |
6889 |
+ case ET_ULONG: { |
6890 |
+- visitor->ULong(*reinterpret_cast<const uint64_t *>(val)); |
6891 |
++ visitor->ULong(ReadScalar<uint64_t>(val)); |
6892 |
+ break; |
6893 |
+ } |
6894 |
+ case ET_FLOAT: { |
6895 |
+- visitor->Float(*reinterpret_cast<const float *>(val)); |
6896 |
++ visitor->Float(ReadScalar<float>(val)); |
6897 |
+ break; |
6898 |
+ } |
6899 |
+ case ET_DOUBLE: { |
6900 |
+- visitor->Double(*reinterpret_cast<const double *>(val)); |
6901 |
++ visitor->Double(ReadScalar<double>(val)); |
6902 |
+ break; |
6903 |
+ } |
6904 |
+ case ET_STRING: { |
6905 |
+--- qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/port/port_chromium.h |
6906 |
++++ qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/port/port_chromium.h |
6907 |
+@@ -23,8 +23,11 @@ |
6908 |
+ namespace leveldb { |
6909 |
+ namespace port { |
6910 |
+ |
6911 |
+-// Chromium only supports little endian. |
6912 |
++#if ARCH_CPU_LITTLE_ENDIAN |
6913 |
+ static const bool kLittleEndian = true; |
6914 |
++#else |
6915 |
++static const bool kLittleEndian = false; |
6916 |
++#endif |
6917 |
+ |
6918 |
+ class LOCKABLE Mutex { |
6919 |
+ public: |
6920 |
+--- qtwebengine/src/3rdparty/chromium/third_party/modp_b64/BUILD.gn |
6921 |
++++ qtwebengine/src/3rdparty/chromium/third_party/modp_b64/BUILD.gn |
6922 |
+@@ -2,10 +2,16 @@ |
6923 |
+ # Use of this source code is governed by a BSD-style license that can be |
6924 |
+ # found in the LICENSE file. |
6925 |
+ |
6926 |
++import("//build/config/host_byteorder.gni") |
6927 |
++ |
6928 |
+ static_library("modp_b64") { |
6929 |
+ sources = [ |
6930 |
+ "modp_b64.cc", |
6931 |
+ "modp_b64.h", |
6932 |
+ "modp_b64_data.h", |
6933 |
+ ] |
6934 |
++ |
6935 |
++ if (host_byteorder == "big") { |
6936 |
++ defines = [ "WORDS_BIGENDIAN=1" ] |
6937 |
++ } |
6938 |
+ } |
6939 |
+--- qtwebengine/src/3rdparty/chromium/third_party/modp_b64/modp_b64.cc |
6940 |
++++ qtwebengine/src/3rdparty/chromium/third_party/modp_b64/modp_b64.cc |
6941 |
+@@ -118,7 +118,7 @@ size_t modp_b64_encode(char* dest, const char* str, size_t len) |
6942 |
+ } |
6943 |
+ |
6944 |
+ #ifdef WORDS_BIGENDIAN /* BIG ENDIAN -- SUN / IBM / MOTOROLA */ |
6945 |
+-int modp_b64_decode(char* dest, const char* src, int len) |
6946 |
++size_t modp_b64_decode(char* dest, const char* src, size_t len) |
6947 |
+ { |
6948 |
+ if (len == 0) return 0; |
6949 |
+ |
6950 |
+--- qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/utils.h |
6951 |
++++ qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/utils.h |
6952 |
+@@ -22,6 +22,7 @@ |
6953 |
+ #include <errno.h> |
6954 |
+ #include <stddef.h> |
6955 |
+ #include <stdlib.h> |
6956 |
++#include <type_traits> |
6957 |
+ #if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) |
6958 |
+ #include <sys/types.h> |
6959 |
+ #endif |
6960 |
+@@ -91,7 +92,7 @@ struct FreeDeleter { |
6961 |
+ |
6962 |
+ template <typename T> |
6963 |
+ constexpr T AssumeLittleEndian(T value) { |
6964 |
+- static_assert(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__, |
6965 |
++ static_assert(std::is_same<T,T>::value && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__, |
6966 |
+ "Unimplemented on big-endian archs"); |
6967 |
+ return value; |
6968 |
+ } |
6969 |
+--- qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/protozero/message.h |
6970 |
++++ qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/protozero/message.h |
6971 |
+@@ -138,6 +138,13 @@ class PERFETTO_EXPORT Message { |
6972 |
+ |
6973 |
+ pos = proto_utils::WriteVarInt(proto_utils::MakeTagFixed<T>(field_id), pos); |
6974 |
+ memcpy(pos, &value, sizeof(T)); |
6975 |
++#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ |
6976 |
++ for (size_t i = sizeof(T)/2; i--; ) { |
6977 |
++ uint8_t tmp = pos[i]; |
6978 |
++ pos[i] = pos[sizeof(T)-1-i]; |
6979 |
++ pos[sizeof(T)-1-i] = tmp; |
6980 |
++ } |
6981 |
++#endif |
6982 |
+ pos += sizeof(T); |
6983 |
+ // TODO: Optimize memcpy performance, see http://crbug.com/624311 . |
6984 |
+ WriteToStream(buffer, pos); |
6985 |
+--- qtwebengine/src/3rdparty/chromium/third_party/perfetto/src/protozero/message.cc |
6986 |
++++ qtwebengine/src/3rdparty/chromium/third_party/perfetto/src/protozero/message.cc |
6987 |
+@@ -21,12 +21,6 @@ |
6988 |
+ #include "perfetto/base/logging.h" |
6989 |
+ #include "perfetto/protozero/message_handle.h" |
6990 |
+ |
6991 |
+-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ |
6992 |
+-// The memcpy() for float and double below needs to be adjusted if we want to |
6993 |
+-// support big endian CPUs. There doesn't seem to be a compelling need today. |
6994 |
+-#error Unimplemented for big endian archs. |
6995 |
+-#endif |
6996 |
+- |
6997 |
+ namespace protozero { |
6998 |
+ |
6999 |
+ // static |
7000 |
+--- qtwebengine/src/3rdparty/chromium/third_party/perfetto/src/protozero/proto_decoder.cc |
7001 |
++++ qtwebengine/src/3rdparty/chromium/third_party/perfetto/src/protozero/proto_decoder.cc |
7002 |
+@@ -29,7 +29,8 @@ using namespace proto_utils; |
7003 |
+ #define BYTE_SWAP_TO_LE32(x) (x) |
7004 |
+ #define BYTE_SWAP_TO_LE64(x) (x) |
7005 |
+ #else |
7006 |
+-#error Unimplemented for big endian archs. |
7007 |
++#define BYTE_SWAP_TO_LE32(x) __builtin_bswap32(x) |
7008 |
++#define BYTE_SWAP_TO_LE64(x) __builtin_bswap64(x) |
7009 |
+ #endif |
7010 |
+ |
7011 |
+ ProtoDecoder::Field ProtoDecoder::ReadField() { |
7012 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/include/core/SkPostConfig.h |
7013 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/include/core/SkPostConfig.h |
7014 |
+@@ -40,12 +40,6 @@ |
7015 |
+ # error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN" |
7016 |
+ #endif |
7017 |
+ |
7018 |
+-#if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN) |
7019 |
+- #error "The Skia team is not endian-savvy enough to support big-endian CPUs." |
7020 |
+- #error "If you still want to use Skia," |
7021 |
+- #error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN." |
7022 |
+-#endif |
7023 |
+- |
7024 |
+ /** |
7025 |
+ * Ensure the port has defined all of SK_X32_SHIFT, or none of them. |
7026 |
+ */ |
7027 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/include/private/GrTypesPriv.h |
7028 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/include/private/GrTypesPriv.h |
7029 |
+@@ -65,9 +65,6 @@ enum GrPixelConfig { |
7030 |
+ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; |
7031 |
+ |
7032 |
+ // Aliases for pixel configs that match skia's byte order. |
7033 |
+-#ifndef SK_CPU_LENDIAN |
7034 |
+-#error "Skia gpu currently assumes little endian" |
7035 |
+-#endif |
7036 |
+ #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
7037 |
+ static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig; |
7038 |
+ #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
7039 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/codec/SkCodecPriv.h |
7040 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/codec/SkCodecPriv.h |
7041 |
+@@ -14,6 +14,7 @@ |
7042 |
+ #include "SkEncodedOrigin.h" |
7043 |
+ #include "SkImageInfo.h" |
7044 |
+ #include "SkTypes.h" |
7045 |
++#include "SkEndian.h" |
7046 |
+ |
7047 |
+ #ifdef SK_PRINT_CODEC_MESSAGES |
7048 |
+ #define SkCodecPrintf SkDebugf |
7049 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/core/SkColor.cpp |
7050 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/core/SkColor.cpp |
7051 |
+@@ -108,13 +108,29 @@ SkColor SkHSVToColor(U8CPU a, const SkScalar hsv[3]) { |
7052 |
+ template <> |
7053 |
+ SkColor4f SkColor4f::FromColor(SkColor bgra) { |
7054 |
+ SkColor4f rgba; |
7055 |
+- swizzle_rb(Sk4f_fromL32(bgra)).store(rgba.vec()); |
7056 |
++ Sk4f c4f = Sk4f_fromL32(bgra); |
7057 |
++#ifdef SK_CPU_BENDIAN |
7058 |
++ // ARGB -> RGBA |
7059 |
++ c4f = SkNx_shuffle<1, 2, 3, 0>(c4f); |
7060 |
++#else |
7061 |
++ // BGRA -> RGBA |
7062 |
++ c4f = swizzle_rb(c4f); |
7063 |
++#endif |
7064 |
++ c4f.store(rgba.vec()); |
7065 |
+ return rgba; |
7066 |
+ } |
7067 |
+ |
7068 |
+ template <> |
7069 |
+ SkColor SkColor4f::toSkColor() const { |
7070 |
+- return Sk4f_toL32(swizzle_rb(Sk4f::Load(this->vec()))); |
7071 |
++ Sk4f c4f = Sk4f::Load(this->vec()); |
7072 |
++#ifdef SK_CPU_BENDIAN |
7073 |
++ // RGBA -> ARGB |
7074 |
++ c4f = SkNx_shuffle<3, 0, 1, 2>(c4f); |
7075 |
++#else |
7076 |
++ // RGBA -> BGRA |
7077 |
++ c4f = swizzle_rb(c4f); |
7078 |
++#endif |
7079 |
++ return Sk4f_toL32(c4f); |
7080 |
+ } |
7081 |
+ |
7082 |
+ template <> |
7083 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/core/SkPixmap.cpp |
7084 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/core/SkPixmap.cpp |
7085 |
+@@ -246,7 +246,8 @@ SkColor SkPixmap::getColor(int x, int y) const { |
7086 |
+ const bool needsUnpremul = (kPremul_SkAlphaType == fInfo.alphaType()); |
7087 |
+ auto toColor = [needsUnpremul](uint32_t maybePremulColor) { |
7088 |
+ return needsUnpremul ? SkUnPreMultiply::PMColorToColor(maybePremulColor) |
7089 |
+- : SkSwizzle_BGRA_to_PMColor(maybePremulColor); |
7090 |
++ : SkColorSetARGB(SkGetPackedA32(maybePremulColor), SkGetPackedR32(maybePremulColor), |
7091 |
++ SkGetPackedG32(maybePremulColor), SkGetPackedB32(maybePremulColor)); |
7092 |
+ }; |
7093 |
+ |
7094 |
+ switch (this->colorType()) { |
7095 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/opts/Sk4px_none.h |
7096 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/opts/Sk4px_none.h |
7097 |
+@@ -35,7 +35,6 @@ inline Sk4px Sk4px::Wide::div255() const { |
7098 |
+ } |
7099 |
+ |
7100 |
+ inline Sk4px Sk4px::alphas() const { |
7101 |
+- static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); |
7102 |
+ return Sk16b((*this)[ 3], (*this)[ 3], (*this)[ 3], (*this)[ 3], |
7103 |
+ (*this)[ 7], (*this)[ 7], (*this)[ 7], (*this)[ 7], |
7104 |
+ (*this)[11], (*this)[11], (*this)[11], (*this)[11], |
7105 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/opts/SkBlitRow_opts.h |
7106 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/opts/SkBlitRow_opts.h |
7107 |
+@@ -237,8 +237,8 @@ void blit_row_s32a_opaque(SkPMColor* dst, const SkPMColor* src, int len, U8CPU a |
7108 |
+ // with chromium:611002 we need to keep it until we figure out where |
7109 |
+ // the non-premultiplied src values (like 0x00FFFFFF) are coming from. |
7110 |
+ // TODO(mtklein): sort this out and assert *src is premul here. |
7111 |
+- if (*src & 0xFF000000) { |
7112 |
+- *dst = (*src >= 0xFF000000) ? *src : SkPMSrcOver(*src, *dst); |
7113 |
++ if (*src & (0xFF << SK_A32_SHIFT)) { |
7114 |
++ *dst = ((*src << (24 - SK_A32_SHIFT)) >= 0xFF000000) ? *src : SkPMSrcOver(*src, *dst); |
7115 |
+ } |
7116 |
+ src++; |
7117 |
+ dst++; |
7118 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h |
7119 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h |
7120 |
+@@ -948,10 +948,17 @@ SI void from_4444(U16 _4444, F* r, F* g, F* b, F* a) { |
7121 |
+ *a = cast(wide & (15<< 0)) * (1.0f / (15<< 0)); |
7122 |
+ } |
7123 |
+ SI void from_8888(U32 _8888, F* r, F* g, F* b, F* a) { |
7124 |
++#ifdef SK_CPU_BENDIAN |
7125 |
++ *r = cast((_8888 >> 24) ) * (1/255.0f); |
7126 |
++ *g = cast((_8888 >> 16) & 0xff) * (1/255.0f); |
7127 |
++ *b = cast((_8888 >> 8) & 0xff) * (1/255.0f); |
7128 |
++ *a = cast((_8888 ) & 0xff) * (1/255.0f); |
7129 |
++#else |
7130 |
+ *r = cast((_8888 ) & 0xff) * (1/255.0f); |
7131 |
+ *g = cast((_8888 >> 8) & 0xff) * (1/255.0f); |
7132 |
+ *b = cast((_8888 >> 16) & 0xff) * (1/255.0f); |
7133 |
+ *a = cast((_8888 >> 24) ) * (1/255.0f); |
7134 |
++#endif |
7135 |
+ } |
7136 |
+ SI void from_1010102(U32 rgba, F* r, F* g, F* b, F* a) { |
7137 |
+ *r = cast((rgba ) & 0x3ff) * (1/1023.0f); |
7138 |
+@@ -1278,10 +1285,17 @@ STAGE(srcover_rgba_8888, const SkRasterPipeline_MemoryCtx* ctx) { |
7139 |
+ auto ptr = ptr_at_xy<uint32_t>(ctx, dx,dy); |
7140 |
+ |
7141 |
+ U32 dst = load<U32>(ptr, tail); |
7142 |
++#ifdef SK_CPU_BENDIAN |
7143 |
++ dr = cast((dst >> 24) ); |
7144 |
++ dg = cast((dst >> 16) & 0xff); |
7145 |
++ db = cast((dst >> 8) & 0xff); |
7146 |
++ da = cast((dst ) & 0xff); |
7147 |
++#else |
7148 |
+ dr = cast((dst ) & 0xff); |
7149 |
+ dg = cast((dst >> 8) & 0xff); |
7150 |
+ db = cast((dst >> 16) & 0xff); |
7151 |
+ da = cast((dst >> 24) ); |
7152 |
++#endif |
7153 |
+ // {dr,dg,db,da} are in [0,255] |
7154 |
+ // { r, g, b, a} are in [0, 1] (but may be out of gamut) |
7155 |
+ |
7156 |
+@@ -1292,10 +1306,17 @@ STAGE(srcover_rgba_8888, const SkRasterPipeline_MemoryCtx* ctx) { |
7157 |
+ // { r, g, b, a} are now in [0,255] (but may be out of gamut) |
7158 |
+ |
7159 |
+ // to_unorm() clamps back to gamut. Scaling by 1 since we're already 255-biased. |
7160 |
++#ifdef SK_CPU_BENDIAN |
7161 |
++ dst = to_unorm(r, 1, 255) << 24 |
7162 |
++ | to_unorm(g, 1, 255) << 16 |
7163 |
++ | to_unorm(b, 1, 255) << 8 |
7164 |
++ | to_unorm(a, 1, 255); |
7165 |
++#else |
7166 |
+ dst = to_unorm(r, 1, 255) |
7167 |
+ | to_unorm(g, 1, 255) << 8 |
7168 |
+ | to_unorm(b, 1, 255) << 16 |
7169 |
+ | to_unorm(a, 1, 255) << 24; |
7170 |
++#endif |
7171 |
+ store(ptr, dst, tail); |
7172 |
+ } |
7173 |
+ |
7174 |
+@@ -1694,10 +1715,17 @@ STAGE(gather_8888, const SkRasterPipeline_GatherCtx* ctx) { |
7175 |
+ STAGE(store_8888, const SkRasterPipeline_MemoryCtx* ctx) { |
7176 |
+ auto ptr = ptr_at_xy<uint32_t>(ctx, dx,dy); |
7177 |
+ |
7178 |
++#ifdef SK_CPU_BENDIAN |
7179 |
++ U32 px = to_unorm(r, 255) << 24 |
7180 |
++ | to_unorm(g, 255) << 16 |
7181 |
++ | to_unorm(b, 255) << 8 |
7182 |
++ | to_unorm(a, 255); |
7183 |
++#else |
7184 |
+ U32 px = to_unorm(r, 255) |
7185 |
+ | to_unorm(g, 255) << 8 |
7186 |
+ | to_unorm(b, 255) << 16 |
7187 |
+ | to_unorm(a, 255) << 24; |
7188 |
++#endif |
7189 |
+ store(ptr, px, tail); |
7190 |
+ } |
7191 |
+ |
7192 |
+@@ -2852,10 +2880,17 @@ SI void from_8888(U32 rgba, U16* r, U16* g, U16* b, U16* a) { |
7193 |
+ return cast<U16>(v); |
7194 |
+ }; |
7195 |
+ #endif |
7196 |
++#ifdef SK_CPU_BENDIAN |
7197 |
++ *r = cast_U16(rgba >> 16) >> 8; |
7198 |
++ *g = cast_U16(rgba >> 16) & 255; |
7199 |
++ *b = cast_U16(rgba & 65535) >> 8; |
7200 |
++ *a = cast_U16(rgba & 65535) & 255; |
7201 |
++#else |
7202 |
+ *r = cast_U16(rgba & 65535) & 255; |
7203 |
+ *g = cast_U16(rgba & 65535) >> 8; |
7204 |
+ *b = cast_U16(rgba >> 16) & 255; |
7205 |
+ *a = cast_U16(rgba >> 16) >> 8; |
7206 |
++#endif |
7207 |
+ } |
7208 |
+ |
7209 |
+ SI void load_8888_(const uint32_t* ptr, size_t tail, U16* r, U16* g, U16* b, U16* a) { |
7210 |
+@@ -2897,10 +2932,15 @@ SI void store_8888_(uint32_t* ptr, size_t tail, U16 r, U16 g, U16 b, U16 a) { |
7211 |
+ case 2: vst4_lane_u8((uint8_t*)(ptr+1), rgba, 1); |
7212 |
+ case 1: vst4_lane_u8((uint8_t*)(ptr+0), rgba, 0); |
7213 |
+ } |
7214 |
++#else |
7215 |
++#ifdef SK_CPU_BENDIAN |
7216 |
++ store(ptr, tail, cast<U32>((r<<8) | g) << 16 |
7217 |
++ | cast<U32>((b<<8) | a) << 0); |
7218 |
+ #else |
7219 |
+ store(ptr, tail, cast<U32>(r | (g<<8)) << 0 |
7220 |
+ | cast<U32>(b | (a<<8)) << 16); |
7221 |
+ #endif |
7222 |
++#endif |
7223 |
+ } |
7224 |
+ |
7225 |
+ STAGE_PP(load_8888, const SkRasterPipeline_MemoryCtx* ctx) { |
7226 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/utils/SkJSON.cpp |
7227 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/utils/SkJSON.cpp |
7228 |
+@@ -34,6 +34,10 @@ void Value::init_tagged(Tag t) { |
7229 |
+ |
7230 |
+ // Pointer values store a type (in the upper kTagBits bits) and a pointer. |
7231 |
+ void Value::init_tagged_pointer(Tag t, void* p) { |
7232 |
++#if !defined(SK_CPU_LENDIAN) |
7233 |
++ // Check that kRecAlign is large enough to leave room for the tag |
7234 |
++ static_assert(sizeof(Value) > sizeof(uintptr_t) || !(kRecAlign & Value::kTagMask), "kRecAlign is not a multiple of kTagMask+1"); |
7235 |
++#endif |
7236 |
+ *this->cast<uintptr_t>() = reinterpret_cast<uintptr_t>(p); |
7237 |
+ |
7238 |
+ if (sizeof(Value) == sizeof(uintptr_t)) { |
7239 |
+@@ -169,7 +173,7 @@ private: |
7240 |
+ #if defined(SK_CPU_LENDIAN) |
7241 |
+ *s64 &= 0x00ffffffffffffffULL >> ((kMaxInlineStringSize - size) * 8); |
7242 |
+ #else |
7243 |
+- static_assert(false, "Big-endian builds are not supported at this time."); |
7244 |
++ *s64 &= 0xffffffffffffff00ULL << ((kMaxInlineStringSize - size) * 8); |
7245 |
+ #endif |
7246 |
+ } |
7247 |
+ }; |
7248 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/src/utils/SkJSON.h |
7249 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/src/utils/SkJSON.h |
7250 |
+@@ -120,6 +120,7 @@ protected: |
7251 |
+ -- highest 3 bits reserved for type storage |
7252 |
+ |
7253 |
+ */ |
7254 |
++#if defined(SK_CPU_LENDIAN) |
7255 |
+ enum class Tag : uint8_t { |
7256 |
+ // We picked kShortString == 0 so that tag 0x00 and stored max_size-size (7-7=0) |
7257 |
+ // conveniently overlap the '\0' terminator, allowing us to store a 7 character |
7258 |
+@@ -134,6 +135,22 @@ protected: |
7259 |
+ kObject = 0b11100000, // ptr to external storage |
7260 |
+ }; |
7261 |
+ static constexpr uint8_t kTagMask = 0b11100000; |
7262 |
++#else |
7263 |
++ enum class Tag : uint8_t { |
7264 |
++ // We picked kShortString == 0 so that tag 0x00 and stored max_size-size (7-7=0) |
7265 |
++ // conveniently overlap the '\0' terminator, allowing us to store a 7 character |
7266 |
++ // C string inline. |
7267 |
++ kShortString = 0b00000000, // inline payload |
7268 |
++ kNull = 0b00000001, // no payload |
7269 |
++ kBool = 0b00000010, // inline payload |
7270 |
++ kInt = 0b00000011, // inline payload |
7271 |
++ kFloat = 0b00000100, // inline payload |
7272 |
++ kString = 0b00000101, // ptr to external storage |
7273 |
++ kArray = 0b00000110, // ptr to external storage |
7274 |
++ kObject = 0b00000111, // ptr to external storage |
7275 |
++ }; |
7276 |
++ static constexpr uint8_t kTagMask = 0b00000111; |
7277 |
++#endif |
7278 |
+ |
7279 |
+ void init_tagged(Tag); |
7280 |
+ void init_tagged_pointer(Tag, void*); |
7281 |
+@@ -192,14 +209,14 @@ private: |
7282 |
+ |
7283 |
+ uint8_t fData8[kValueSize]; |
7284 |
+ |
7285 |
+-#if defined(SK_CPU_LENDIAN) |
7286 |
+ static constexpr size_t kTagOffset = kValueSize - 1; |
7287 |
+ |
7288 |
++#if defined(SK_CPU_LENDIAN) |
7289 |
+ static constexpr uintptr_t kTagPointerMask = |
7290 |
+ ~(static_cast<uintptr_t>(kTagMask) << ((sizeof(uintptr_t) - 1) * 8)); |
7291 |
+ #else |
7292 |
+- // The current value layout assumes LE and will take some tweaking for BE. |
7293 |
+- static_assert(false, "Big-endian builds are not supported at this time."); |
7294 |
++ static constexpr uintptr_t kTagPointerMask = |
7295 |
++ ~static_cast<uintptr_t>(kTagMask); |
7296 |
+ #endif |
7297 |
+ }; |
7298 |
+ |
7299 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/skcms/skcms.cc |
7300 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/skcms/skcms.cc |
7301 |
+@@ -66,10 +66,15 @@ static float eval_curve(const skcms_Curve* curve, float x) { |
7302 |
+ uint16_t be_l, be_h; |
7303 |
+ memcpy(&be_l, curve->table_16 + 2*lo, 2); |
7304 |
+ memcpy(&be_h, curve->table_16 + 2*hi, 2); |
7305 |
++#if __BIG_ENDIAN__ |
7306 |
++ l = be_l * (1/65535.0f); |
7307 |
++ h = be_h * (1/65535.0f); |
7308 |
++#else |
7309 |
+ uint16_t le_l = ((be_l << 8) | (be_l >> 8)) & 0xffff; |
7310 |
+ uint16_t le_h = ((be_h << 8) | (be_h >> 8)) & 0xffff; |
7311 |
+ l = le_l * (1/65535.0f); |
7312 |
+ h = le_h * (1/65535.0f); |
7313 |
++#endif |
7314 |
+ } |
7315 |
+ return l + (h-l)*t; |
7316 |
+ } |
7317 |
+@@ -124,21 +129,29 @@ enum { |
7318 |
+ static uint16_t read_big_u16(const uint8_t* ptr) { |
7319 |
+ uint16_t be; |
7320 |
+ memcpy(&be, ptr, sizeof(be)); |
7321 |
++#if __BIG_ENDIAN__ |
7322 |
++ return be; |
7323 |
++#else |
7324 |
+ #if defined(_MSC_VER) |
7325 |
+ return _byteswap_ushort(be); |
7326 |
+ #else |
7327 |
+ return __builtin_bswap16(be); |
7328 |
+ #endif |
7329 |
++#endif |
7330 |
+ } |
7331 |
+ |
7332 |
+ static uint32_t read_big_u32(const uint8_t* ptr) { |
7333 |
+ uint32_t be; |
7334 |
+ memcpy(&be, ptr, sizeof(be)); |
7335 |
++#if __BIG_ENDIAN__ |
7336 |
++ return be; |
7337 |
++#else |
7338 |
+ #if defined(_MSC_VER) |
7339 |
+ return _byteswap_ulong(be); |
7340 |
+ #else |
7341 |
+ return __builtin_bswap32(be); |
7342 |
+ #endif |
7343 |
++#endif |
7344 |
+ } |
7345 |
+ |
7346 |
+ static int32_t read_big_i32(const uint8_t* ptr) { |
7347 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/skcms/src/Transform_inl.h |
7348 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/skcms/src/Transform_inl.h |
7349 |
+@@ -392,9 +392,11 @@ SI U32 gather_32(const uint8_t* p, I32 ix) { |
7350 |
+ } |
7351 |
+ |
7352 |
+ SI U32 gather_24(const uint8_t* p, I32 ix) { |
7353 |
++#if !__BIG_ENDIAN__ |
7354 |
+ // First, back up a byte. Any place we're gathering from has a safe junk byte to read |
7355 |
+ // in front of it, either a previous table value, or some tag metadata. |
7356 |
+ p -= 1; |
7357 |
++#endif |
7358 |
+ |
7359 |
+ // Load the i'th 24-bit value from p, and 1 extra byte. |
7360 |
+ auto load_24_32 = [p](int i) { |
7361 |
+@@ -435,8 +437,10 @@ SI U32 gather_24(const uint8_t* p, I32 ix) { |
7362 |
+ |
7363 |
+ #if !defined(__arm__) |
7364 |
+ SI void gather_48(const uint8_t* p, I32 ix, U64* v) { |
7365 |
++#if !__BIG_ENDIAN__ |
7366 |
+ // As in gather_24(), with everything doubled. |
7367 |
+ p -= 2; |
7368 |
++#endif |
7369 |
+ |
7370 |
+ // Load the i'th 48-bit value from p, and 2 extra bytes. |
7371 |
+ auto load_48_64 = [p](int i) { |
7372 |
+@@ -499,7 +503,9 @@ SI F F_from_U8(U8 v) { |
7373 |
+ SI F F_from_U16_BE(U16 v) { |
7374 |
+ // All 16-bit ICC values are big-endian, so we byte swap before converting to float. |
7375 |
+ // MSVC catches the "loss" of data here in the portable path, so we also make sure to mask. |
7376 |
++#if !__BIG_ENDIAN__ |
7377 |
+ v = U16( 0 | ((v & 0x00ff) << 8) | ((v & 0xff00) >> 8) ); |
7378 |
++#endif |
7379 |
+ return cast<F>(v) * (1/65535.0f); |
7380 |
+ } |
7381 |
+ |
7382 |
+@@ -534,9 +540,15 @@ SI F table(const skcms_Curve* curve, F v) { |
7383 |
+ SI void sample_clut_8(const skcms_A2B* a2b, I32 ix, F* r, F* g, F* b) { |
7384 |
+ U32 rgb = gather_24(a2b->grid_8, ix); |
7385 |
+ |
7386 |
++#if __BIG_ENDIAN__ |
7387 |
++ *r = cast<F>((rgb >> 16) & 0xff) * (1/255.0f); |
7388 |
++ *g = cast<F>((rgb >> 8) & 0xff) * (1/255.0f); |
7389 |
++ *b = cast<F>((rgb >> 0) & 0xff) * (1/255.0f); |
7390 |
++#else |
7391 |
+ *r = cast<F>((rgb >> 0) & 0xff) * (1/255.0f); |
7392 |
+ *g = cast<F>((rgb >> 8) & 0xff) * (1/255.0f); |
7393 |
+ *b = cast<F>((rgb >> 16) & 0xff) * (1/255.0f); |
7394 |
++#endif |
7395 |
+ } |
7396 |
+ |
7397 |
+ SI void sample_clut_16(const skcms_A2B* a2b, I32 ix, F* r, F* g, F* b) { |
7398 |
+@@ -549,12 +561,18 @@ SI void sample_clut_16(const skcms_A2B* a2b, I32 ix, F* r, F* g, F* b) { |
7399 |
+ // This strategy is much faster for 64-bit builds, and fine for 32-bit x86 too. |
7400 |
+ U64 rgb; |
7401 |
+ gather_48(a2b->grid_16, ix, &rgb); |
7402 |
++#if __BIG_ENDIAN__ |
7403 |
++ *r = cast<F>((rgb >> 32) & 0xffff) * (1/65535.0f); |
7404 |
++ *g = cast<F>((rgb >> 16) & 0xffff) * (1/65535.0f); |
7405 |
++ *b = cast<F>((rgb >> 0) & 0xffff) * (1/65535.0f); |
7406 |
++#else |
7407 |
+ rgb = swap_endian_16x4(rgb); |
7408 |
+ |
7409 |
+ *r = cast<F>((rgb >> 0) & 0xffff) * (1/65535.0f); |
7410 |
+ *g = cast<F>((rgb >> 16) & 0xffff) * (1/65535.0f); |
7411 |
+ *b = cast<F>((rgb >> 32) & 0xffff) * (1/65535.0f); |
7412 |
+ #endif |
7413 |
++#endif |
7414 |
+ } |
7415 |
+ |
7416 |
+ // GCC 7.2.0 hits an internal compiler error with -finline-functions (or -O3) |
7417 |
+@@ -695,10 +713,17 @@ static void exec_ops(const Op* ops, const void** args, |
7418 |
+ case Op_load_8888:{ |
7419 |
+ U32 rgba = load<U32>(src + 4*i); |
7420 |
+ |
7421 |
++#if __BIG_ENDIAN__ |
7422 |
++ r = cast<F>((rgba >> 24) & 0xff) * (1/255.0f); |
7423 |
++ g = cast<F>((rgba >> 16) & 0xff) * (1/255.0f); |
7424 |
++ b = cast<F>((rgba >> 8) & 0xff) * (1/255.0f); |
7425 |
++ a = cast<F>((rgba >> 0) & 0xff) * (1/255.0f); |
7426 |
++#else |
7427 |
+ r = cast<F>((rgba >> 0) & 0xff) * (1/255.0f); |
7428 |
+ g = cast<F>((rgba >> 8) & 0xff) * (1/255.0f); |
7429 |
+ b = cast<F>((rgba >> 16) & 0xff) * (1/255.0f); |
7430 |
+ a = cast<F>((rgba >> 24) & 0xff) * (1/255.0f); |
7431 |
++#endif |
7432 |
+ } break; |
7433 |
+ |
7434 |
+ case Op_load_8888_palette8:{ |
7435 |
+@@ -727,13 +752,29 @@ static void exec_ops(const Op* ops, const void** args, |
7436 |
+ const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. |
7437 |
+ #if defined(USING_NEON) |
7438 |
+ uint16x4x3_t v = vld3_u16(rgb); |
7439 |
++#if __BIG_ENDIAN__ |
7440 |
++ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f); |
7441 |
++ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f); |
7442 |
++ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f); |
7443 |
++#else |
7444 |
+ r = cast<F>((U16)v.val[0]) * (1/65535.0f); |
7445 |
+ g = cast<F>((U16)v.val[1]) * (1/65535.0f); |
7446 |
+ b = cast<F>((U16)v.val[2]) * (1/65535.0f); |
7447 |
++#endif |
7448 |
+ #else |
7449 |
++#if __BIG_ENDIAN__ |
7450 |
++ U32 R = load_3<U32>(rgb+0), |
7451 |
++ G = load_3<U32>(rgb+1), |
7452 |
++ B = load_3<U32>(rgb+2); |
7453 |
++ // R,G,B are little-endian 16-bit, so byte swap them before converting to float. |
7454 |
++ r = cast<F>((R & 0x00ff)<<8 | (R & 0xff00)>>8) * (1/65535.0f); |
7455 |
++ g = cast<F>((G & 0x00ff)<<8 | (G & 0xff00)>>8) * (1/65535.0f); |
7456 |
++ b = cast<F>((B & 0x00ff)<<8 | (B & 0xff00)>>8) * (1/65535.0f); |
7457 |
++#else |
7458 |
+ r = cast<F>(load_3<U32>(rgb+0)) * (1/65535.0f); |
7459 |
+ g = cast<F>(load_3<U32>(rgb+1)) * (1/65535.0f); |
7460 |
+ b = cast<F>(load_3<U32>(rgb+2)) * (1/65535.0f); |
7461 |
++#endif |
7462 |
+ #endif |
7463 |
+ } break; |
7464 |
+ |
7465 |
+@@ -743,17 +784,33 @@ static void exec_ops(const Op* ops, const void** args, |
7466 |
+ const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. |
7467 |
+ #if defined(USING_NEON) |
7468 |
+ uint16x4x4_t v = vld4_u16(rgba); |
7469 |
++#if __BIG_ENDIAN__ |
7470 |
++ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f); |
7471 |
++ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f); |
7472 |
++ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f); |
7473 |
++ a = cast<F>(swap_endian_16((U16)v.val[3])) * (1/65535.0f); |
7474 |
++#else |
7475 |
+ r = cast<F>((U16)v.val[0]) * (1/65535.0f); |
7476 |
+ g = cast<F>((U16)v.val[1]) * (1/65535.0f); |
7477 |
+ b = cast<F>((U16)v.val[2]) * (1/65535.0f); |
7478 |
+ a = cast<F>((U16)v.val[3]) * (1/65535.0f); |
7479 |
++#endif |
7480 |
+ #else |
7481 |
++#if __BIG_ENDIAN__ |
7482 |
++ U64 px = swap_endian_16x4(load<U64>(rgba)); |
7483 |
++ |
7484 |
++ r = cast<F>((px >> 48) & 0xffff) * (1/65535.0f); |
7485 |
++ g = cast<F>((px >> 32) & 0xffff) * (1/65535.0f); |
7486 |
++ b = cast<F>((px >> 16) & 0xffff) * (1/65535.0f); |
7487 |
++ a = cast<F>((px >> 0) & 0xffff) * (1/65535.0f); |
7488 |
++#else |
7489 |
+ U64 px = load<U64>(rgba); |
7490 |
+ |
7491 |
+ r = cast<F>((px >> 0) & 0xffff) * (1/65535.0f); |
7492 |
+ g = cast<F>((px >> 16) & 0xffff) * (1/65535.0f); |
7493 |
+ b = cast<F>((px >> 32) & 0xffff) * (1/65535.0f); |
7494 |
+ a = cast<F>((px >> 48) & 0xffff) * (1/65535.0f); |
7495 |
++#endif |
7496 |
+ #endif |
7497 |
+ } break; |
7498 |
+ |
7499 |
+@@ -763,10 +820,21 @@ static void exec_ops(const Op* ops, const void** args, |
7500 |
+ const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. |
7501 |
+ #if defined(USING_NEON) |
7502 |
+ uint16x4x3_t v = vld3_u16(rgb); |
7503 |
++#if __BIG_ENDIAN__ |
7504 |
++ r = cast<F>((U16)v.val[0]) * (1/65535.0f); |
7505 |
++ g = cast<F>((U16)v.val[1]) * (1/65535.0f); |
7506 |
++ b = cast<F>((U16)v.val[2]) * (1/65535.0f); |
7507 |
++#else |
7508 |
+ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f); |
7509 |
+ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f); |
7510 |
+ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f); |
7511 |
++#endif |
7512 |
+ #else |
7513 |
++#if __BIG_ENDIAN__ |
7514 |
++ r = cast<F>(load_3<U32>(rgb+0)) * (1/65535.0f); |
7515 |
++ g = cast<F>(load_3<U32>(rgb+1)) * (1/65535.0f); |
7516 |
++ b = cast<F>(load_3<U32>(rgb+2)) * (1/65535.0f); |
7517 |
++#else |
7518 |
+ U32 R = load_3<U32>(rgb+0), |
7519 |
+ G = load_3<U32>(rgb+1), |
7520 |
+ B = load_3<U32>(rgb+2); |
7521 |
+@@ -774,6 +842,7 @@ static void exec_ops(const Op* ops, const void** args, |
7522 |
+ r = cast<F>((R & 0x00ff)<<8 | (R & 0xff00)>>8) * (1/65535.0f); |
7523 |
+ g = cast<F>((G & 0x00ff)<<8 | (G & 0xff00)>>8) * (1/65535.0f); |
7524 |
+ b = cast<F>((B & 0x00ff)<<8 | (B & 0xff00)>>8) * (1/65535.0f); |
7525 |
++#endif |
7526 |
+ #endif |
7527 |
+ } break; |
7528 |
+ |
7529 |
+@@ -783,17 +852,33 @@ static void exec_ops(const Op* ops, const void** args, |
7530 |
+ const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. |
7531 |
+ #if defined(USING_NEON) |
7532 |
+ uint16x4x4_t v = vld4_u16(rgba); |
7533 |
++#if __BIG_ENDIAN__ |
7534 |
++ r = cast<F>((U16)v.val[0]) * (1/65535.0f); |
7535 |
++ g = cast<F>((U16)v.val[1]) * (1/65535.0f); |
7536 |
++ b = cast<F>((U16)v.val[2]) * (1/65535.0f); |
7537 |
++ a = cast<F>((U16)v.val[3]) * (1/65535.0f); |
7538 |
++#else |
7539 |
+ r = cast<F>(swap_endian_16((U16)v.val[0])) * (1/65535.0f); |
7540 |
+ g = cast<F>(swap_endian_16((U16)v.val[1])) * (1/65535.0f); |
7541 |
+ b = cast<F>(swap_endian_16((U16)v.val[2])) * (1/65535.0f); |
7542 |
+ a = cast<F>(swap_endian_16((U16)v.val[3])) * (1/65535.0f); |
7543 |
++#endif |
7544 |
+ #else |
7545 |
++#if __BIG_ENDIAN__ |
7546 |
++ U64 px = load<U64>(rgba); |
7547 |
++ |
7548 |
++ r = cast<F>((px >> 48) & 0xffff) * (1/65535.0f); |
7549 |
++ g = cast<F>((px >> 32) & 0xffff) * (1/65535.0f); |
7550 |
++ b = cast<F>((px >> 16) & 0xffff) * (1/65535.0f); |
7551 |
++ a = cast<F>((px >> 0) & 0xffff) * (1/65535.0f); |
7552 |
++#else |
7553 |
+ U64 px = swap_endian_16x4(load<U64>(rgba)); |
7554 |
+ |
7555 |
+ r = cast<F>((px >> 0) & 0xffff) * (1/65535.0f); |
7556 |
+ g = cast<F>((px >> 16) & 0xffff) * (1/65535.0f); |
7557 |
+ b = cast<F>((px >> 32) & 0xffff) * (1/65535.0f); |
7558 |
+ a = cast<F>((px >> 48) & 0xffff) * (1/65535.0f); |
7559 |
++#endif |
7560 |
+ #endif |
7561 |
+ } break; |
7562 |
+ |
7563 |
+@@ -828,10 +913,17 @@ static void exec_ops(const Op* ops, const void** args, |
7564 |
+ A = (U16)v.val[3]; |
7565 |
+ #else |
7566 |
+ U64 px = load<U64>(rgba); |
7567 |
++#if __BIG_ENDIAN__ |
7568 |
++ U16 R = cast<U16>((px >> 48) & 0xffff), |
7569 |
++ G = cast<U16>((px >> 32) & 0xffff), |
7570 |
++ B = cast<U16>((px >> 16) & 0xffff), |
7571 |
++ A = cast<U16>((px >> 0) & 0xffff); |
7572 |
++#else |
7573 |
+ U16 R = cast<U16>((px >> 0) & 0xffff), |
7574 |
+ G = cast<U16>((px >> 16) & 0xffff), |
7575 |
+ B = cast<U16>((px >> 32) & 0xffff), |
7576 |
+ A = cast<U16>((px >> 48) & 0xffff); |
7577 |
++#endif |
7578 |
+ #endif |
7579 |
+ r = F_from_Half(R); |
7580 |
+ g = F_from_Half(G); |
7581 |
+@@ -1024,10 +1116,17 @@ static void exec_ops(const Op* ops, const void** args, |
7582 |
+ } return; |
7583 |
+ |
7584 |
+ case Op_store_8888: { |
7585 |
++#if __BIG_ENDIAN__ |
7586 |
++ store(dst + 4*i, cast<U32>(to_fixed(r * 255) << 24) |
7587 |
++ | cast<U32>(to_fixed(g * 255) << 16) |
7588 |
++ | cast<U32>(to_fixed(b * 255) << 8) |
7589 |
++ | cast<U32>(to_fixed(a * 255) << 0)); |
7590 |
++#else |
7591 |
+ store(dst + 4*i, cast<U32>(to_fixed(r * 255) << 0) |
7592 |
+ | cast<U32>(to_fixed(g * 255) << 8) |
7593 |
+ | cast<U32>(to_fixed(b * 255) << 16) |
7594 |
+ | cast<U32>(to_fixed(a * 255) << 24)); |
7595 |
++#endif |
7596 |
+ } return; |
7597 |
+ |
7598 |
+ case Op_store_1010102: { |
7599 |
+@@ -1043,15 +1142,30 @@ static void exec_ops(const Op* ops, const void** args, |
7600 |
+ uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. |
7601 |
+ #if defined(USING_NEON) |
7602 |
+ uint16x4x3_t v = {{ |
7603 |
++#if __BIG_ENDIAN__ |
7604 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(r * 65535))), |
7605 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(g * 65535))), |
7606 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(b * 65535))), |
7607 |
++#else |
7608 |
+ (uint16x4_t)cast<U16>(to_fixed(r * 65535)), |
7609 |
+ (uint16x4_t)cast<U16>(to_fixed(g * 65535)), |
7610 |
+ (uint16x4_t)cast<U16>(to_fixed(b * 65535)), |
7611 |
++#endif |
7612 |
+ }}; |
7613 |
+ vst3_u16(rgb, v); |
7614 |
+ #else |
7615 |
++#if __BIG_ENDIAN__ |
7616 |
++ I32 R = to_fixed(r * 65535), |
7617 |
++ G = to_fixed(g * 65535), |
7618 |
++ B = to_fixed(b * 65535); |
7619 |
++ store_3(rgb+0, cast<U16>((R & 0x00ff) << 8 | (R & 0xff00) >> 8) ); |
7620 |
++ store_3(rgb+1, cast<U16>((G & 0x00ff) << 8 | (G & 0xff00) >> 8) ); |
7621 |
++ store_3(rgb+2, cast<U16>((B & 0x00ff) << 8 | (B & 0xff00) >> 8) ); |
7622 |
++#else |
7623 |
+ store_3(rgb+0, cast<U16>(to_fixed(r * 65535))); |
7624 |
+ store_3(rgb+1, cast<U16>(to_fixed(g * 65535))); |
7625 |
+ store_3(rgb+2, cast<U16>(to_fixed(b * 65535))); |
7626 |
++#endif |
7627 |
+ #endif |
7628 |
+ |
7629 |
+ } return; |
7630 |
+@@ -1062,18 +1176,33 @@ static void exec_ops(const Op* ops, const void** args, |
7631 |
+ uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. |
7632 |
+ #if defined(USING_NEON) |
7633 |
+ uint16x4x4_t v = {{ |
7634 |
++#if __BIG_ENDIAN__ |
7635 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(r * 65535))), |
7636 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(g * 65535))), |
7637 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(b * 65535))), |
7638 |
++ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(a * 65535))), |
7639 |
++#else |
7640 |
+ (uint16x4_t)cast<U16>(to_fixed(r * 65535)), |
7641 |
+ (uint16x4_t)cast<U16>(to_fixed(g * 65535)), |
7642 |
+ (uint16x4_t)cast<U16>(to_fixed(b * 65535)), |
7643 |
+ (uint16x4_t)cast<U16>(to_fixed(a * 65535)), |
7644 |
++#endif |
7645 |
+ }}; |
7646 |
+ vst4_u16(rgba, v); |
7647 |
+ #else |
7648 |
++#if __BIG_ENDIAN__ |
7649 |
++ U64 px = cast<U64>(to_fixed(r * 65535)) << 48 |
7650 |
++ | cast<U64>(to_fixed(g * 65535)) << 32 |
7651 |
++ | cast<U64>(to_fixed(b * 65535)) << 16 |
7652 |
++ | cast<U64>(to_fixed(a * 65535)) << 0; |
7653 |
++ store(rgba, swap_endian_16x4(px)); |
7654 |
++#else |
7655 |
+ U64 px = cast<U64>(to_fixed(r * 65535)) << 0 |
7656 |
+ | cast<U64>(to_fixed(g * 65535)) << 16 |
7657 |
+ | cast<U64>(to_fixed(b * 65535)) << 32 |
7658 |
+ | cast<U64>(to_fixed(a * 65535)) << 48; |
7659 |
+ store(rgba, px); |
7660 |
++#endif |
7661 |
+ #endif |
7662 |
+ } return; |
7663 |
+ |
7664 |
+@@ -1083,18 +1212,30 @@ static void exec_ops(const Op* ops, const void** args, |
7665 |
+ uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. |
7666 |
+ #if defined(USING_NEON) |
7667 |
+ uint16x4x3_t v = {{ |
7668 |
++#if __BIG_ENDIAN__ |
7669 |
++ (uint16x4_t)cast<U16>(to_fixed(r * 65535)), |
7670 |
++ (uint16x4_t)cast<U16>(to_fixed(g * 65535)), |
7671 |
++ (uint16x4_t)cast<U16>(to_fixed(b * 65535)), |
7672 |
++#else |
7673 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(r * 65535))), |
7674 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(g * 65535))), |
7675 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(b * 65535))), |
7676 |
++#endif |
7677 |
+ }}; |
7678 |
+ vst3_u16(rgb, v); |
7679 |
+ #else |
7680 |
++#if __BIG_ENDIAN__ |
7681 |
++ store_3(rgb+0, cast<U16>(to_fixed(r * 65535))); |
7682 |
++ store_3(rgb+1, cast<U16>(to_fixed(g * 65535))); |
7683 |
++ store_3(rgb+2, cast<U16>(to_fixed(b * 65535))); |
7684 |
++#else |
7685 |
+ I32 R = to_fixed(r * 65535), |
7686 |
+ G = to_fixed(g * 65535), |
7687 |
+ B = to_fixed(b * 65535); |
7688 |
+ store_3(rgb+0, cast<U16>((R & 0x00ff) << 8 | (R & 0xff00) >> 8) ); |
7689 |
+ store_3(rgb+1, cast<U16>((G & 0x00ff) << 8 | (G & 0xff00) >> 8) ); |
7690 |
+ store_3(rgb+2, cast<U16>((B & 0x00ff) << 8 | (B & 0xff00) >> 8) ); |
7691 |
++#endif |
7692 |
+ #endif |
7693 |
+ |
7694 |
+ } return; |
7695 |
+@@ -1105,18 +1246,33 @@ static void exec_ops(const Op* ops, const void** args, |
7696 |
+ uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. |
7697 |
+ #if defined(USING_NEON) |
7698 |
+ uint16x4x4_t v = {{ |
7699 |
++#if __BIG_ENDIAN__ |
7700 |
++ (uint16x4_t)cast<U16>(to_fixed(r * 65535)), |
7701 |
++ (uint16x4_t)cast<U16>(to_fixed(g * 65535)), |
7702 |
++ (uint16x4_t)cast<U16>(to_fixed(b * 65535)), |
7703 |
++ (uint16x4_t)cast<U16>(to_fixed(a * 65535)), |
7704 |
++#else |
7705 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(r * 65535))), |
7706 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(g * 65535))), |
7707 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(b * 65535))), |
7708 |
+ (uint16x4_t)swap_endian_16(cast<U16>(to_fixed(a * 65535))), |
7709 |
++#endif |
7710 |
+ }}; |
7711 |
+ vst4_u16(rgba, v); |
7712 |
+ #else |
7713 |
++#if __BIG_ENDIAN__ |
7714 |
++ U64 px = cast<U64>(to_fixed(r * 65535)) << 48 |
7715 |
++ | cast<U64>(to_fixed(g * 65535)) << 32 |
7716 |
++ | cast<U64>(to_fixed(b * 65535)) << 16 |
7717 |
++ | cast<U64>(to_fixed(a * 65535)) << 0; |
7718 |
++ store(rgba, px); |
7719 |
++#else |
7720 |
+ U64 px = cast<U64>(to_fixed(r * 65535)) << 0 |
7721 |
+ | cast<U64>(to_fixed(g * 65535)) << 16 |
7722 |
+ | cast<U64>(to_fixed(b * 65535)) << 32 |
7723 |
+ | cast<U64>(to_fixed(a * 65535)) << 48; |
7724 |
+ store(rgba, swap_endian_16x4(px)); |
7725 |
++#endif |
7726 |
+ #endif |
7727 |
+ } return; |
7728 |
+ |
7729 |
+@@ -1160,10 +1316,17 @@ static void exec_ops(const Op* ops, const void** args, |
7730 |
+ }}; |
7731 |
+ vst4_u16(rgba, v); |
7732 |
+ #else |
7733 |
++#if __BIG_ENDIAN__ |
7734 |
++ store(rgba, cast<U64>(R) << 48 |
7735 |
++ | cast<U64>(G) << 32 |
7736 |
++ | cast<U64>(B) << 16 |
7737 |
++ | cast<U64>(A) << 0); |
7738 |
++#else |
7739 |
+ store(rgba, cast<U64>(R) << 0 |
7740 |
+ | cast<U64>(G) << 16 |
7741 |
+ | cast<U64>(B) << 32 |
7742 |
+ | cast<U64>(A) << 48); |
7743 |
++#endif |
7744 |
+ #endif |
7745 |
+ |
7746 |
+ } return; |
7747 |
+--- qtwebengine/src/3rdparty/chromium/third_party/webrtc/common_audio/wav_file.cc |
7748 |
++++ qtwebengine/src/3rdparty/chromium/third_party/webrtc/common_audio/wav_file.cc |
7749 |
+@@ -93,13 +93,15 @@ size_t WavReader::num_samples() const { |
7750 |
+ } |
7751 |
+ |
7752 |
+ size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) { |
7753 |
+-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN |
7754 |
+-#error "Need to convert samples to big-endian when reading from WAV file" |
7755 |
+-#endif |
7756 |
+ // There could be metadata after the audio; ensure we don't read it. |
7757 |
+ num_samples = std::min(num_samples, num_samples_remaining_); |
7758 |
+ const size_t read = |
7759 |
+ fread(samples, sizeof(*samples), num_samples, file_handle_); |
7760 |
++#ifndef WEBRTC_ARCH_LITTLE_ENDIAN |
7761 |
++ for (size_t i = 0; i < read; i++) { |
7762 |
++ samples[i] = __builtin_bswap16(samples[i]); |
7763 |
++ } |
7764 |
++#endif |
7765 |
+ // If we didn't read what was requested, ensure we've reached the EOF. |
7766 |
+ RTC_CHECK(read == num_samples || feof(file_handle_)); |
7767 |
+ RTC_CHECK_LE(read, num_samples_remaining_); |
7768 |
+@@ -178,13 +180,26 @@ size_t WavWriter::num_samples() const { |
7769 |
+ |
7770 |
+ void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) { |
7771 |
+ #ifndef WEBRTC_ARCH_LITTLE_ENDIAN |
7772 |
+-#error "Need to convert samples to little-endian when writing to WAV file" |
7773 |
+-#endif |
7774 |
++ static const size_t kChunksize = 4096 / sizeof(uint16_t); |
7775 |
++ for (size_t i = 0; i < num_samples; i += kChunksize) { |
7776 |
++ int16_t isamples[kChunksize]; |
7777 |
++ const size_t chunk = std::min(kChunksize, num_samples - i); |
7778 |
++ for (size_t j = 0; j < chunk; j++) { |
7779 |
++ isamples[j] = __builtin_bswap16(samples[i + j]); |
7780 |
++ } |
7781 |
++ const size_t written = |
7782 |
++ fwrite(isamples, sizeof(*isamples), chunk, file_handle_); |
7783 |
++ RTC_CHECK_EQ(chunk, written); |
7784 |
++ num_samples_ += written; |
7785 |
++ RTC_CHECK(num_samples_ >= written); // detect size_t overflow |
7786 |
++ } |
7787 |
++#else |
7788 |
+ const size_t written = |
7789 |
+ fwrite(samples, sizeof(*samples), num_samples, file_handle_); |
7790 |
+ RTC_CHECK_EQ(num_samples, written); |
7791 |
+ num_samples_ += written; |
7792 |
+ RTC_CHECK(num_samples_ >= written); // detect size_t overflow |
7793 |
++#endif |
7794 |
+ } |
7795 |
+ |
7796 |
+ void WavWriter::WriteSamples(const float* samples, size_t num_samples) { |
7797 |
+--- qtwebengine/src/3rdparty/chromium/third_party/webrtc/common_audio/wav_header.cc |
7798 |
++++ qtwebengine/src/3rdparty/chromium/third_party/webrtc/common_audio/wav_header.cc |
7799 |
+@@ -86,7 +86,26 @@ static inline std::string ReadFourCC(uint32_t x) { |
7800 |
+ return std::string(reinterpret_cast<char*>(&x), 4); |
7801 |
+ } |
7802 |
+ #else |
7803 |
+-#error "Write be-to-le conversion functions" |
7804 |
++static inline void WriteLE16(uint16_t* f, uint16_t x) { |
7805 |
++ *f = __builtin_bswap16(x); |
7806 |
++} |
7807 |
++static inline void WriteLE32(uint32_t* f, uint32_t x) { |
7808 |
++ *f = __builtin_bswap32(x); |
7809 |
++} |
7810 |
++static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) { |
7811 |
++ *f = static_cast<uint32_t>(d) | static_cast<uint32_t>(c) << 8 | |
7812 |
++ static_cast<uint32_t>(b) << 16 | static_cast<uint32_t>(a) << 24; |
7813 |
++} |
7814 |
++ |
7815 |
++static inline uint16_t ReadLE16(uint16_t x) { |
7816 |
++ return __builtin_bswap16(x); |
7817 |
++} |
7818 |
++static inline uint32_t ReadLE32(uint32_t x) { |
7819 |
++ return __builtin_bswap32(x); |
7820 |
++} |
7821 |
++static inline std::string ReadFourCC(uint32_t x) { |
7822 |
++ return std::string(reinterpret_cast<char*>(&x), 4); |
7823 |
++} |
7824 |
+ #endif |
7825 |
+ |
7826 |
+ static inline uint32_t RiffChunkSize(size_t bytes_in_payload) { |
7827 |
+--- qtwebengine/src/3rdparty/chromium/ui/aura/mus/os_exchange_data_provider_mus.cc |
7828 |
++++ qtwebengine/src/3rdparty/chromium/ui/aura/mus/os_exchange_data_provider_mus.cc |
7829 |
+@@ -14,6 +14,7 @@ |
7830 |
+ #include "base/strings/string_split.h" |
7831 |
+ #include "base/strings/string_util.h" |
7832 |
+ #include "base/strings/utf_string_conversions.h" |
7833 |
++#include "base/sys_byteorder.h" |
7834 |
+ #include "net/base/filename_util.h" |
7835 |
+ #include "ui/base/clipboard/clipboard_constants.h" |
7836 |
+ #include "ui/base/clipboard/clipboard_format_type.h" |
7837 |
+@@ -279,8 +280,13 @@ void OSExchangeDataProviderMus::SetHtml(const base::string16& html, |
7838 |
+ std::vector<unsigned char> bytes; |
7839 |
+ // Manually jam a UTF16 BOM into bytes because otherwise, other programs will |
7840 |
+ // assume UTF-8. |
7841 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
7842 |
+ bytes.push_back(0xFF); |
7843 |
+ bytes.push_back(0xFE); |
7844 |
++#else |
7845 |
++ bytes.push_back(0xFE); |
7846 |
++ bytes.push_back(0xFF); |
7847 |
++#endif |
7848 |
+ AddString16ToVector(html, &bytes); |
7849 |
+ mime_data_[ui::kMimeTypeHTML] = bytes; |
7850 |
+ } |
7851 |
+--- qtwebengine/src/3rdparty/chromium/ui/base/resource/data_pack.cc |
7852 |
++++ qtwebengine/src/3rdparty/chromium/ui/base/resource/data_pack.cc |
7853 |
+@@ -154,16 +154,42 @@ class ScopedFileWriter { |
7854 |
+ DISALLOW_COPY_AND_ASSIGN(ScopedFileWriter); |
7855 |
+ }; |
7856 |
+ |
7857 |
++static inline uint16_t byteswap(uint16_t v) { return __builtin_bswap16(v); } |
7858 |
++static inline uint32_t byteswap(uint32_t v) { return __builtin_bswap32(v); } |
7859 |
++ |
7860 |
++template<class T> class byteswapped_t { |
7861 |
++private: |
7862 |
++ T value; |
7863 |
++public: |
7864 |
++ inline byteswapped_t(T v) : value(byteswap(v)) { } |
7865 |
++ inline T operator=(T v) { value = byteswap(v); return v; } |
7866 |
++ inline T operator+=(T v) { v += byteswap(value); value = byteswap(v); return v; } |
7867 |
++ inline operator T() const { return byteswap(value); } |
7868 |
++}; |
7869 |
++ |
7870 |
++#if !defined(ARCH_CPU_LITTLE_ENDIAN) |
7871 |
++ |
7872 |
++typedef byteswapped_t<uint16_t> uint16le_t; |
7873 |
++typedef byteswapped_t<uint32_t> uint32le_t; |
7874 |
++ |
7875 |
++#else |
7876 |
++ |
7877 |
++typedef uint16_t uint16le_t; |
7878 |
++typedef uint32_t uint32le_t; |
7879 |
++ |
7880 |
++#endif |
7881 |
++ |
7882 |
+ } // namespace |
7883 |
+ |
7884 |
+ namespace ui { |
7885 |
+ |
7886 |
+ #pragma pack(push, 2) |
7887 |
+ struct DataPack::Entry { |
7888 |
+- uint16_t resource_id; |
7889 |
+- uint32_t file_offset; |
7890 |
++ uint16le_t resource_id; |
7891 |
++ uint32le_t file_offset; |
7892 |
+ |
7893 |
+ static int CompareById(const void* void_key, const void* void_entry) { |
7894 |
++ // Key is host endian |
7895 |
+ uint16_t key = *reinterpret_cast<const uint16_t*>(void_key); |
7896 |
+ const Entry* entry = reinterpret_cast<const Entry*>(void_entry); |
7897 |
+ return key - entry->resource_id; |
7898 |
+@@ -171,10 +197,11 @@ struct DataPack::Entry { |
7899 |
+ }; |
7900 |
+ |
7901 |
+ struct DataPack::Alias { |
7902 |
+- uint16_t resource_id; |
7903 |
+- uint16_t entry_index; |
7904 |
++ uint16le_t resource_id; |
7905 |
++ uint16le_t entry_index; |
7906 |
+ |
7907 |
+ static int CompareById(const void* void_key, const void* void_entry) { |
7908 |
++ // Key is host endian |
7909 |
+ uint16_t key = *reinterpret_cast<const uint16_t*>(void_key); |
7910 |
+ const Alias* entry = reinterpret_cast<const Alias*>(void_entry); |
7911 |
+ return key - entry->resource_id; |
7912 |
+@@ -284,7 +311,7 @@ bool DataPack::LoadImpl(std::unique_ptr<DataPack::DataSource> data_source) { |
7913 |
+ // Parse the version and check for truncated header. |
7914 |
+ uint32_t version = 0; |
7915 |
+ if (data_length > sizeof(version)) |
7916 |
+- version = reinterpret_cast<const uint32_t*>(data)[0]; |
7917 |
++ version = reinterpret_cast<const uint32le_t*>(data)[0]; |
7918 |
+ size_t header_length = |
7919 |
+ version == kFileFormatV4 ? kHeaderLengthV4 : kHeaderLengthV5; |
7920 |
+ if (version == 0 || data_length < header_length) { |
7921 |
+@@ -295,14 +322,14 @@ bool DataPack::LoadImpl(std::unique_ptr<DataPack::DataSource> data_source) { |
7922 |
+ |
7923 |
+ // Parse the header of the file. |
7924 |
+ if (version == kFileFormatV4) { |
7925 |
+- resource_count_ = reinterpret_cast<const uint32_t*>(data)[1]; |
7926 |
++ resource_count_ = reinterpret_cast<const uint32le_t*>(data)[1]; |
7927 |
+ alias_count_ = 0; |
7928 |
+ text_encoding_type_ = static_cast<TextEncodingType>(data[8]); |
7929 |
+ } else if (version == kFileFormatV5) { |
7930 |
+ // Version 5 added the alias table and changed the header format. |
7931 |
+ text_encoding_type_ = static_cast<TextEncodingType>(data[4]); |
7932 |
+- resource_count_ = reinterpret_cast<const uint16_t*>(data)[4]; |
7933 |
+- alias_count_ = reinterpret_cast<const uint16_t*>(data)[5]; |
7934 |
++ resource_count_ = reinterpret_cast<const uint16le_t*>(data)[4]; |
7935 |
++ alias_count_ = reinterpret_cast<const uint16le_t*>(data)[5]; |
7936 |
+ } else { |
7937 |
+ LOG(ERROR) << "Bad data pack version: got " << version << ", expected " |
7938 |
+ << kFileFormatV4 << " or " << kFileFormatV5; |
7939 |
+@@ -447,9 +474,6 @@ void DataPack::CheckForDuplicateResources( |
7940 |
+ bool DataPack::WritePack(const base::FilePath& path, |
7941 |
+ const std::map<uint16_t, base::StringPiece>& resources, |
7942 |
+ TextEncodingType text_encoding_type) { |
7943 |
+-#if !defined(ARCH_CPU_LITTLE_ENDIAN) |
7944 |
+-#error "datapack assumes little endian" |
7945 |
+-#endif |
7946 |
+ if (text_encoding_type != UTF8 && text_encoding_type != UTF16 && |
7947 |
+ text_encoding_type != BINARY) { |
7948 |
+ LOG(ERROR) << "Invalid text encoding type, got " << text_encoding_type |
7949 |
+@@ -467,7 +491,7 @@ bool DataPack::WritePack(const base::FilePath& path, |
7950 |
+ if (!file.valid()) |
7951 |
+ return false; |
7952 |
+ |
7953 |
+- uint32_t encoding = static_cast<uint32_t>(text_encoding_type); |
7954 |
++ uint32le_t encoding = static_cast<uint32le_t>(text_encoding_type); |
7955 |
+ |
7956 |
+ // Build a list of final resource aliases, and an alias map at the same time. |
7957 |
+ std::vector<uint16_t> resource_ids; |
7958 |
+@@ -494,13 +518,14 @@ bool DataPack::WritePack(const base::FilePath& path, |
7959 |
+ |
7960 |
+ // These values are guaranteed to fit in a uint16_t due to the earlier |
7961 |
+ // check of |resources_count|. |
7962 |
+- const uint16_t alias_count = static_cast<uint16_t>(aliases.size()); |
7963 |
+- const uint16_t entry_count = static_cast<uint16_t>(resource_ids.size()); |
7964 |
++ const uint16le_t alias_count = static_cast<uint16le_t>(aliases.size()); |
7965 |
++ const uint16le_t entry_count = static_cast<uint16le_t>(resource_ids.size()); |
7966 |
+ DCHECK_EQ(static_cast<size_t>(entry_count) + static_cast<size_t>(alias_count), |
7967 |
+ resources_count); |
7968 |
+ |
7969 |
+- file.Write(&kFileFormatV5, sizeof(kFileFormatV5)); |
7970 |
+- file.Write(&encoding, sizeof(uint32_t)); |
7971 |
++ uint32le_t version = kFileFormatV5; |
7972 |
++ file.Write(&version, sizeof(version)); |
7973 |
++ file.Write(&encoding, sizeof(uint32le_t)); |
7974 |
+ file.Write(&entry_count, sizeof(entry_count)); |
7975 |
+ file.Write(&alias_count, sizeof(alias_count)); |
7976 |
+ |
7977 |
+@@ -508,8 +533,8 @@ bool DataPack::WritePack(const base::FilePath& path, |
7978 |
+ // last item so we can compute the size of the list item. |
7979 |
+ const uint32_t index_length = (entry_count + 1) * sizeof(Entry); |
7980 |
+ const uint32_t alias_table_length = alias_count * sizeof(Alias); |
7981 |
+- uint32_t data_offset = kHeaderLengthV5 + index_length + alias_table_length; |
7982 |
+- for (const uint16_t resource_id : resource_ids) { |
7983 |
++ uint32le_t data_offset = kHeaderLengthV5 + index_length + alias_table_length; |
7984 |
++ for (const uint16le_t resource_id : resource_ids) { |
7985 |
+ file.Write(&resource_id, sizeof(resource_id)); |
7986 |
+ file.Write(&data_offset, sizeof(data_offset)); |
7987 |
+ data_offset += resources.find(resource_id)->second.length(); |
7988 |
+@@ -517,13 +542,13 @@ bool DataPack::WritePack(const base::FilePath& path, |
7989 |
+ |
7990 |
+ // We place an extra entry after the last item that allows us to read the |
7991 |
+ // size of the last item. |
7992 |
+- const uint16_t resource_id = 0; |
7993 |
++ const uint16le_t resource_id = 0; |
7994 |
+ file.Write(&resource_id, sizeof(resource_id)); |
7995 |
+ file.Write(&data_offset, sizeof(data_offset)); |
7996 |
+ |
7997 |
+ // Write the aliases table, if any. Note: |aliases| is an std::map, |
7998 |
+ // ensuring values are written in increasing order. |
7999 |
+- for (const std::pair<uint16_t, uint16_t>& alias : aliases) { |
8000 |
++ for (const std::pair<uint16le_t, uint16le_t> alias : aliases) { |
8001 |
+ file.Write(&alias, sizeof(alias)); |
8002 |
+ } |
8003 |
+ |
8004 |
+--- qtwebengine/src/3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc |
8005 |
++++ qtwebengine/src/3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc |
8006 |
+@@ -212,11 +212,11 @@ bool JPEGCodec::Decode(const unsigned char* input, size_t input_size, |
8007 |
+ // used by Chromium (i.e. RGBA and BGRA) and we just map the input |
8008 |
+ // parameters to a colorspace. |
8009 |
+ if (format == FORMAT_RGBA || |
8010 |
+- (format == FORMAT_SkBitmap && SK_R32_SHIFT == 0)) { |
8011 |
++ (format == FORMAT_SkBitmap && SK_PMCOLOR_BYTE_ORDER(R, G, B, A))) { |
8012 |
+ cinfo->out_color_space = JCS_EXT_RGBX; |
8013 |
+ cinfo->output_components = 4; |
8014 |
+ } else if (format == FORMAT_BGRA || |
8015 |
+- (format == FORMAT_SkBitmap && SK_B32_SHIFT == 0)) { |
8016 |
++ (format == FORMAT_SkBitmap && SK_PMCOLOR_BYTE_ORDER(B, G, R, A))) { |
8017 |
+ cinfo->out_color_space = JCS_EXT_BGRX; |
8018 |
+ cinfo->output_components = 4; |
8019 |
+ } else { |
8020 |
+--- qtwebengine/src/3rdparty/chromium/ui/gfx/codec/png_codec.cc |
8021 |
++++ qtwebengine/src/3rdparty/chromium/ui/gfx/codec/png_codec.cc |
8022 |
+@@ -169,6 +169,10 @@ void DecodeInfoCallback(png_struct* png_ptr, png_info* info_ptr) { |
8023 |
+ png_set_bgr(png_ptr); |
8024 |
+ png_set_add_alpha(png_ptr, 0xFF, PNG_FILLER_AFTER); |
8025 |
+ break; |
8026 |
++ case PNGCodec::FORMAT_ARGB: |
8027 |
++ state->output_channels = 4; |
8028 |
++ png_set_add_alpha(png_ptr, 0xFF, PNG_FILLER_BEFORE); |
8029 |
++ break; |
8030 |
+ case PNGCodec::FORMAT_SkBitmap: |
8031 |
+ state->output_channels = 4; |
8032 |
+ png_set_add_alpha(png_ptr, 0xFF, PNG_FILLER_AFTER); |
8033 |
+@@ -183,6 +187,10 @@ void DecodeInfoCallback(png_struct* png_ptr, png_info* info_ptr) { |
8034 |
+ state->output_channels = 4; |
8035 |
+ png_set_bgr(png_ptr); |
8036 |
+ break; |
8037 |
++ case PNGCodec::FORMAT_ARGB: |
8038 |
++ state->output_channels = 4; |
8039 |
++ png_set_swap_alpha(png_ptr); |
8040 |
++ break; |
8041 |
+ case PNGCodec::FORMAT_SkBitmap: |
8042 |
+ state->output_channels = 4; |
8043 |
+ break; |
8044 |
+@@ -475,6 +483,8 @@ bool PNGCodec::Encode(const unsigned char* input, |
8045 |
+ case FORMAT_BGRA: |
8046 |
+ colorType = kBGRA_8888_SkColorType; |
8047 |
+ break; |
8048 |
++ case FORMAT_ARGB: |
8049 |
++ return false; |
8050 |
+ case FORMAT_SkBitmap: |
8051 |
+ colorType = kN32_SkColorType; |
8052 |
+ break; |
8053 |
+--- qtwebengine/src/3rdparty/chromium/ui/gfx/codec/png_codec.h |
8054 |
++++ qtwebengine/src/3rdparty/chromium/ui/gfx/codec/png_codec.h |
8055 |
+@@ -37,6 +37,10 @@ class CODEC_EXPORT PNGCodec { |
8056 |
+ // This is the default Windows DIB order. |
8057 |
+ FORMAT_BGRA, |
8058 |
+ |
8059 |
++ // 4 bytes per pixel, in ARGB order in memory regardless of endianness. |
8060 |
++ // Only supported for decoding |
8061 |
++ FORMAT_ARGB, |
8062 |
++ |
8063 |
+ // SkBitmap format. For Encode() kN32_SkColorType (4 bytes per pixel) and |
8064 |
+ // kAlpha_8_SkColorType (1 byte per pixel) formats are supported. |
8065 |
+ // kAlpha_8_SkColorType gets encoded into a grayscale PNG treating alpha as |
8066 |
+--- qtwebengine/src/3rdparty/chromium/ui/gfx/codec/png_codec_unittest.cc |
8067 |
++++ qtwebengine/src/3rdparty/chromium/ui/gfx/codec/png_codec_unittest.cc |
8068 |
+@@ -853,7 +853,7 @@ TEST(PNGCodec, EncodeA8SkBitmap) { |
8069 |
+ for (int y = 0; y < h; y++) { |
8070 |
+ uint8_t original_pixel = *original_bitmap.getAddr8(x, y); |
8071 |
+ uint32_t decoded_pixel = *decoded_bitmap.getAddr32(x, y); |
8072 |
+- EXPECT_TRUE(BGRAGrayEqualsA8Gray(decoded_pixel, original_pixel)); |
8073 |
++ EXPECT_TRUE(BGRAGrayEqualsA8Gray(SkUnPreMultiply::PMColorToColor(decoded_pixel), original_pixel)); |
8074 |
+ } |
8075 |
+ } |
8076 |
+ } |
8077 |
+--- qtwebengine/src/3rdparty/chromium/ui/gfx/color_analysis.cc |
8078 |
++++ qtwebengine/src/3rdparty/chromium/ui/gfx/color_analysis.cc |
8079 |
+@@ -16,6 +16,7 @@ |
8080 |
+ #include <vector> |
8081 |
+ |
8082 |
+ #include "base/logging.h" |
8083 |
++#include "base/sys_byteorder.h" |
8084 |
+ #include "third_party/skia/include/core/SkBitmap.h" |
8085 |
+ #include "third_party/skia/include/core/SkUnPreMultiply.h" |
8086 |
+ #include "ui/gfx/codec/png_codec.h" |
8087 |
+@@ -506,10 +507,17 @@ SkColor FindClosestColor(const uint8_t* image, |
8088 |
+ SkColor best_color = color; |
8089 |
+ const uint8_t* byte = image; |
8090 |
+ for (int i = 0; i < width * height; ++i) { |
8091 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
8092 |
+ uint8_t b = *(byte++); |
8093 |
+ uint8_t g = *(byte++); |
8094 |
+ uint8_t r = *(byte++); |
8095 |
+ uint8_t a = *(byte++); |
8096 |
++#else |
8097 |
++ uint8_t a = *(byte++); |
8098 |
++ uint8_t r = *(byte++); |
8099 |
++ uint8_t g = *(byte++); |
8100 |
++ uint8_t b = *(byte++); |
8101 |
++#endif |
8102 |
+ // Ignore fully transparent pixels. |
8103 |
+ if (a == 0) |
8104 |
+ continue; |
8105 |
+@@ -527,7 +535,6 @@ SkColor FindClosestColor(const uint8_t* image, |
8106 |
+ |
8107 |
+ // For a 16x16 icon on an Intel Core i5 this function takes approximately |
8108 |
+ // 0.5 ms to run. |
8109 |
+-// TODO(port): This code assumes the CPU architecture is little-endian. |
8110 |
+ SkColor CalculateKMeanColorOfBuffer(uint8_t* decoded_data, |
8111 |
+ int img_width, |
8112 |
+ int img_height, |
8113 |
+@@ -550,10 +557,17 @@ SkColor CalculateKMeanColorOfBuffer(uint8_t* decoded_data, |
8114 |
+ int pixel_pos = sampler->GetSample(img_width, img_height) % |
8115 |
+ (img_width * img_height); |
8116 |
+ |
8117 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
8118 |
+ uint8_t b = decoded_data[pixel_pos * 4]; |
8119 |
+ uint8_t g = decoded_data[pixel_pos * 4 + 1]; |
8120 |
+ uint8_t r = decoded_data[pixel_pos * 4 + 2]; |
8121 |
+ uint8_t a = decoded_data[pixel_pos * 4 + 3]; |
8122 |
++#else |
8123 |
++ uint8_t a = decoded_data[pixel_pos * 4]; |
8124 |
++ uint8_t r = decoded_data[pixel_pos * 4 + 1]; |
8125 |
++ uint8_t g = decoded_data[pixel_pos * 4 + 2]; |
8126 |
++ uint8_t b = decoded_data[pixel_pos * 4 + 3]; |
8127 |
++#endif |
8128 |
+ // Skip fully transparent pixels as they usually contain black in their |
8129 |
+ // RGB channels but do not contribute to the visual image. |
8130 |
+ if (a == 0) |
8131 |
+@@ -602,10 +616,17 @@ SkColor CalculateKMeanColorOfBuffer(uint8_t* decoded_data, |
8132 |
+ uint8_t* pixel = decoded_data; |
8133 |
+ uint8_t* decoded_data_end = decoded_data + (img_width * img_height * 4); |
8134 |
+ while (pixel < decoded_data_end) { |
8135 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
8136 |
+ uint8_t b = *(pixel++); |
8137 |
+ uint8_t g = *(pixel++); |
8138 |
+ uint8_t r = *(pixel++); |
8139 |
+ uint8_t a = *(pixel++); |
8140 |
++#else |
8141 |
++ uint8_t a = *(pixel++); |
8142 |
++ uint8_t r = *(pixel++); |
8143 |
++ uint8_t g = *(pixel++); |
8144 |
++ uint8_t b = *(pixel++); |
8145 |
++#endif |
8146 |
+ // Skip transparent pixels, see above. |
8147 |
+ if (a == 0) |
8148 |
+ continue; |
8149 |
+@@ -683,8 +704,12 @@ SkColor CalculateKMeanColorOfPNG(scoped_refptr<base::RefCountedMemory> png, |
8150 |
+ |
8151 |
+ if (png.get() && png->size() && |
8152 |
+ gfx::PNGCodec::Decode(png->front(), png->size(), |
8153 |
+- gfx::PNGCodec::FORMAT_BGRA, &decoded_data, |
8154 |
+- &img_width, &img_height)) { |
8155 |
++#if defined(ARCH_CPU_LITTLE_ENDIAN) |
8156 |
++ gfx::PNGCodec::FORMAT_BGRA, |
8157 |
++#else |
8158 |
++ gfx::PNGCodec::FORMAT_ARGB, |
8159 |
++#endif |
8160 |
++ &decoded_data, &img_width, &img_height)) { |
8161 |
+ return CalculateKMeanColorOfBuffer(&decoded_data[0], img_width, img_height, |
8162 |
+ lower_bound, upper_bound, sampler, true); |
8163 |
+ } |
8164 |
+--- qtwebengine/src/3rdparty/chromium/ui/gfx/skbitmap_operations_unittest.cc |
8165 |
++++ qtwebengine/src/3rdparty/chromium/ui/gfx/skbitmap_operations_unittest.cc |
8166 |
+@@ -238,7 +238,7 @@ TEST(SkBitmapOperationsTest, CreateHSLShiftedBitmapHueOnly) { |
8167 |
+ |
8168 |
+ for (int y = 0, i = 0; y < src_h; y++) { |
8169 |
+ for (int x = 0; x < src_w; x++) { |
8170 |
+- *src.getAddr32(x, y) = SkColorSetARGB(255, 0, 0, i % 255); |
8171 |
++ *src.getAddr32(x, y) = SkPackARGB32(255, 0, 0, i % 255); |
8172 |
+ i++; |
8173 |
+ } |
8174 |
+ } |
8175 |
+--- qtwebengine/src/3rdparty/chromium/url/url_canon_host.cc |
8176 |
++++ qtwebengine/src/3rdparty/chromium/url/url_canon_host.cc |
8177 |
+@@ -135,8 +135,7 @@ bool DoSimpleHost(const INCHAR* host, |
8178 |
+ if (source == '%') { |
8179 |
+ // Unescape first, if possible. |
8180 |
+ // Source will be used only if decode operation was successful. |
8181 |
+- if (!DecodeEscaped(host, &i, host_len, |
8182 |
+- reinterpret_cast<unsigned char*>(&source))) { |
8183 |
++ if (!DecodeEscaped(host, &i, host_len, &source)) { |
8184 |
+ // Invalid escaped character. There is nothing that can make this |
8185 |
+ // host valid. We append an escaped percent so the URL looks reasonable |
8186 |
+ // and mark as failed. |
8187 |
+--- qtwebengine/src/3rdparty/chromium/url/url_canon_internal.h |
8188 |
++++ qtwebengine/src/3rdparty/chromium/url/url_canon_internal.h |
8189 |
+@@ -305,9 +305,9 @@ inline bool Is8BitChar(base::char16 c) { |
8190 |
+ return c <= 255; |
8191 |
+ } |
8192 |
+ |
8193 |
+-template<typename CHAR> |
8194 |
++template<typename CHAR, typename DST> |
8195 |
+ inline bool DecodeEscaped(const CHAR* spec, int* begin, int end, |
8196 |
+- unsigned char* unescaped_value) { |
8197 |
++ DST* unescaped_value) { |
8198 |
+ if (*begin + 3 > end || |
8199 |
+ !Is8BitChar(spec[*begin + 1]) || !Is8BitChar(spec[*begin + 2])) { |
8200 |
+ // Invalid escape sequence because there's not enough room, or the |
8201 |
|
8202 |
diff --git a/dev-qt/qtwebengine/files/musl/0093-chromium-v8-elfv2.patch b/dev-qt/qtwebengine/files/musl/0093-chromium-v8-elfv2.patch |
8203 |
new file mode 100644 |
8204 |
index 0000000..f580c81 |
8205 |
--- /dev/null |
8206 |
+++ b/dev-qt/qtwebengine/files/musl/0093-chromium-v8-elfv2.patch |
8207 |
@@ -0,0 +1,43 @@ |
8208 |
+This fixes v8 on big endian ppc64 ELFv2. |
8209 |
+--- qtwebengine/src/3rdparty/chromium/v8/src/ppc/constants-ppc.h |
8210 |
++++ qtwebengine/src/3rdparty/chromium/v8/src/ppc/constants-ppc.h |
8211 |
+@@ -21,7 +21,8 @@ |
8212 |
+ #endif |
8213 |
+ |
8214 |
+ #if V8_HOST_ARCH_PPC && \ |
8215 |
+- (V8_OS_AIX || (V8_TARGET_ARCH_PPC64 && V8_TARGET_BIG_ENDIAN)) |
8216 |
++ (V8_OS_AIX || (V8_TARGET_ARCH_PPC64 && \ |
8217 |
++ (V8_TARGET_BIG_ENDIAN && (!defined(_CALL_ELF) || _CALL_ELF == 1)))) |
8218 |
+ #define ABI_USES_FUNCTION_DESCRIPTORS 1 |
8219 |
+ #else |
8220 |
+ #define ABI_USES_FUNCTION_DESCRIPTORS 0 |
8221 |
+@@ -33,13 +34,15 @@ |
8222 |
+ #define ABI_PASSES_HANDLES_IN_REGS 0 |
8223 |
+ #endif |
8224 |
+ |
8225 |
+-#if !V8_HOST_ARCH_PPC || !V8_TARGET_ARCH_PPC64 || V8_TARGET_LITTLE_ENDIAN |
8226 |
++#if !V8_HOST_ARCH_PPC || !V8_TARGET_ARCH_PPC64 || \ |
8227 |
++ (V8_TARGET_LITTLE_ENDIAN || (defined(_CALL_ELF) && _CALL_ELF == 2)) |
8228 |
+ #define ABI_RETURNS_OBJECT_PAIRS_IN_REGS 1 |
8229 |
+ #else |
8230 |
+ #define ABI_RETURNS_OBJECT_PAIRS_IN_REGS 0 |
8231 |
+ #endif |
8232 |
+ |
8233 |
+-#if !V8_HOST_ARCH_PPC || (V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN) |
8234 |
++#if !V8_HOST_ARCH_PPC || (V8_TARGET_ARCH_PPC64 && \ |
8235 |
++ (V8_TARGET_LITTLE_ENDIAN || (defined(_CALL_ELF) && _CALL_ELF == 2))) |
8236 |
+ #define ABI_CALL_VIA_IP 1 |
8237 |
+ #else |
8238 |
+ #define ABI_CALL_VIA_IP 0 |
8239 |
+--- qtwebengine/src/3rdparty/chromium/v8/src/ppc/register-ppc.h |
8240 |
++++ qtwebengine/src/3rdparty/chromium/v8/src/ppc/register-ppc.h |
8241 |
+@@ -145,7 +145,8 @@ const int kNumSafepointRegisters = 32; |
8242 |
+ // The following constants describe the stack frame linkage area as |
8243 |
+ // defined by the ABI. Note that kNumRequiredStackFrameSlots must |
8244 |
+ // satisfy alignment requirements (rounding up if required). |
8245 |
+-#if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN // ppc64le linux |
8246 |
++#if V8_TARGET_ARCH_PPC64 && (V8_TARGET_LITTLE_ENDIAN || \ |
8247 |
++ defined(_CALL_ELF) && _CALL_ELF == 2) |
8248 |
+ // [0] back chain |
8249 |
+ // [1] condition register save area |
8250 |
+ // [2] link register save area |
8251 |
|
8252 |
diff --git a/dev-qt/qtwebengine/files/musl/0094-big-endian-skia-portable.patch b/dev-qt/qtwebengine/files/musl/0094-big-endian-skia-portable.patch |
8253 |
new file mode 100644 |
8254 |
index 0000000..ea269d3 |
8255 |
--- /dev/null |
8256 |
+++ b/dev-qt/qtwebengine/files/musl/0094-big-endian-skia-portable.patch |
8257 |
@@ -0,0 +1,17 @@ |
8258 |
+--- qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/skcms/skcms.cc |
8259 |
++++ qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/skcms/skcms.cc |
8260 |
+@@ -1828,6 +1828,14 @@ typedef enum { |
8261 |
+ #endif |
8262 |
+ #endif |
8263 |
+ |
8264 |
++// with current gcc 8.3.0 we get an internal compiler error when compiling |
8265 |
++// for ppc64 big endian - so switch to portable until this is resolved |
8266 |
++#if defined(__powerpc64__) |
8267 |
++# if defined(__BIG_ENDIAN__) && !defined(SKCMS_PORTABLE) |
8268 |
++# define SKCMS_PORTABLE |
8269 |
++# endif |
8270 |
++#endif |
8271 |
++ |
8272 |
+ #if defined(__clang__) |
8273 |
+ template <int N, typename T> using Vec = T __attribute__((ext_vector_type(N))); |
8274 |
+ #elif defined(__GNUC__) |
8275 |
|
8276 |
diff --git a/dev-qt/qtwebengine/files/musl/0100-sandbox-sched_getparam.patch b/dev-qt/qtwebengine/files/musl/0100-sandbox-sched_getparam.patch |
8277 |
new file mode 100644 |
8278 |
index 0000000..15c33a5 |
8279 |
--- /dev/null |
8280 |
+++ b/dev-qt/qtwebengine/files/musl/0100-sandbox-sched_getparam.patch |
8281 |
@@ -0,0 +1,24 @@ |
8282 |
+Allow SYS_sched_getparam and SYS_sched_getscheduler |
8283 |
+musl uses them for pthread_getschedparam() |
8284 |
+ |
8285 |
+source: https://git.alpinelinux.org/aports/commit/community/chromium?id=54af9f8ac24f52d382c5758e2445bf0206eff40e |
8286 |
+ |
8287 |
+--- qtwebengine/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc 2019-11-12 20:48:20.013724661 +0100 |
8288 |
++++ qtwebengine/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc.patched 2019-11-12 20:58:57.330695676 +0100 |
8289 |
+@@ -93,10 +93,16 @@ |
8290 |
+ case __NR_sysinfo: |
8291 |
+ case __NR_times: |
8292 |
+ case __NR_uname: |
8293 |
++#if !defined(__GLIBC__) |
8294 |
++ case __NR_sched_getparam: |
8295 |
++ case __NR_sched_getscheduler: |
8296 |
++#endif |
8297 |
+ return Allow(); |
8298 |
+ case __NR_sched_getaffinity: |
8299 |
++#if defined(__GLIBC__) |
8300 |
+ case __NR_sched_getparam: |
8301 |
+ case __NR_sched_getscheduler: |
8302 |
++#endif |
8303 |
+ case __NR_sched_setscheduler: |
8304 |
+ return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); |
8305 |
+ case __NR_prlimit64: |
8306 |
|
8307 |
diff --git a/dev-qt/qtwebengine/files/musl/musl-crashpad.patch b/dev-qt/qtwebengine/files/musl/musl-crashpad.patch |
8308 |
new file mode 100644 |
8309 |
index 0000000..68e1893 |
8310 |
--- /dev/null |
8311 |
+++ b/dev-qt/qtwebengine/files/musl/musl-crashpad.patch |
8312 |
@@ -0,0 +1,23 @@ |
8313 |
+--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc |
8314 |
++++ a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc |
8315 |
+@@ -26,6 +26,7 @@ |
8316 |
+ |
8317 |
+ #if defined(ARCH_CPU_X86_FAMILY) |
8318 |
+ #include <asm/ldt.h> |
8319 |
++#include <asm/ptrace-abi.h> |
8320 |
+ #endif |
8321 |
+ |
8322 |
+ namespace crashpad { |
8323 |
+ |
8324 |
+--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h |
8325 |
++++ a/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h |
8326 |
+@@ -17,7 +17,9 @@ |
8327 |
+ |
8328 |
+ #include_next <sys/ptrace.h> |
8329 |
+ |
8330 |
++#if defined(__GLIBC__) |
8331 |
+ #include <sys/cdefs.h> |
8332 |
++#endif |
8333 |
+ |
8334 |
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433 |
8335 |
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \ |
8336 |
|
8337 |
diff --git a/dev-qt/qtwebengine/files/musl/musl-sandbox.patch b/dev-qt/qtwebengine/files/musl/musl-sandbox.patch |
8338 |
deleted file mode 100644 |
8339 |
index 45e3d93..0000000 |
8340 |
--- a/dev-qt/qtwebengine/files/musl/musl-sandbox.patch |
8341 |
+++ /dev/null |
8342 |
@@ -1,153 +0,0 @@ |
8343 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc |
8344 |
-index 2577f02..b27300c 100644 |
8345 |
---- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc |
8346 |
-+++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc |
8347 |
-@@ -129,23 +129,13 @@ namespace sandbox { |
8348 |
- // CLONE_VM, nor CLONE_THREAD, which includes all fork() implementations. |
8349 |
- ResultExpr RestrictCloneToThreadsAndEPERMFork() { |
8350 |
- const Arg<unsigned long> flags(0); |
8351 |
-+ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | |
8352 |
-+ CLONE_THREAD | CLONE_SYSVSEM; |
8353 |
-+ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | |
8354 |
-+ CLONE_DETACHED; |
8355 |
-+ const BoolExpr thread_clone_ok = (flags&~safe)==required; |
8356 |
- |
8357 |
-- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. |
8358 |
-- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | |
8359 |
-- CLONE_SIGHAND | CLONE_THREAD | |
8360 |
-- CLONE_SYSVSEM; |
8361 |
-- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; |
8362 |
-- |
8363 |
-- const uint64_t kGlibcPthreadFlags = |
8364 |
-- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | |
8365 |
-- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; |
8366 |
-- const BoolExpr glibc_test = flags == kGlibcPthreadFlags; |
8367 |
-- |
8368 |
-- const BoolExpr android_test = |
8369 |
-- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, |
8370 |
-- flags == kGlibcPthreadFlags); |
8371 |
-- |
8372 |
-- return If(IsAndroid() ? android_test : glibc_test, Allow()) |
8373 |
-+ return If(thread_clone_ok, Allow()) |
8374 |
- .ElseIf((flags & (CLONE_VM | CLONE_THREAD)) == 0, Error(EPERM)) |
8375 |
- .Else(CrashSIGSYSClone()); |
8376 |
- } |
8377 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
8378 |
-index 9f1cdef..a2d703b 100644 |
8379 |
---- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
8380 |
-+++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc |
8381 |
-@@ -375,6 +375,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { |
8382 |
- #if defined(__i386__) |
8383 |
- case __NR_waitpid: |
8384 |
- #endif |
8385 |
-+ case __NR_set_tid_address: |
8386 |
- return true; |
8387 |
- case __NR_clone: // Should be parameter-restricted. |
8388 |
- case __NR_setns: // Privileged. |
8389 |
-@@ -387,7 +388,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { |
8390 |
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
8391 |
- case __NR_set_thread_area: |
8392 |
- #endif |
8393 |
-- case __NR_set_tid_address: |
8394 |
- case __NR_unshare: |
8395 |
- #if !defined(__mips__) && !defined(__aarch64__) |
8396 |
- case __NR_vfork: |
8397 |
-@@ -496,6 +496,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { |
8398 |
- case __NR_mlock: |
8399 |
- case __NR_munlock: |
8400 |
- case __NR_munmap: |
8401 |
-+ case __NR_mremap: |
8402 |
-+ case __NR_membarrier: |
8403 |
- return true; |
8404 |
- case __NR_madvise: |
8405 |
- case __NR_mincore: |
8406 |
-@@ -511,7 +513,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { |
8407 |
- case __NR_modify_ldt: |
8408 |
- #endif |
8409 |
- case __NR_mprotect: |
8410 |
-- case __NR_mremap: |
8411 |
- case __NR_msync: |
8412 |
- case __NR_munlockall: |
8413 |
- case __NR_readahead: |
8414 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h |
8415 |
-index 59d0eab..7ae7002 100644 |
8416 |
---- a/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h |
8417 |
-+++ b/src/3rdparty/chromium/sandbox/linux/system_headers/arm64_linux_syscalls.h |
8418 |
-@@ -1063,4 +1063,8 @@ |
8419 |
- #define __NR_memfd_create 279 |
8420 |
- #endif |
8421 |
- |
8422 |
-+#if !defined(__NR_membarrier) |
8423 |
-+#define __NR_membarrier 283 |
8424 |
-+#endif |
8425 |
-+ |
8426 |
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_ |
8427 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h |
8428 |
-index 1addd53..7843b5e 100644 |
8429 |
---- a/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h |
8430 |
-+++ b/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h |
8431 |
-@@ -1385,6 +1385,10 @@ |
8432 |
- #define __NR_memfd_create (__NR_SYSCALL_BASE+385) |
8433 |
- #endif |
8434 |
- |
8435 |
-+#if !defined(__NR_membarrier) |
8436 |
-+#define __NR_membarrier (__NR_SYSCALL_BASE+389) |
8437 |
-+#endif |
8438 |
-+ |
8439 |
- // ARM private syscalls. |
8440 |
- #if !defined(__ARM_NR_BASE) |
8441 |
- #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) |
8442 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h |
8443 |
-index ec75815..612fcfa 100644 |
8444 |
---- a/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h |
8445 |
-+++ b/src/3rdparty/chromium/sandbox/linux/system_headers/mips64_linux_syscalls.h |
8446 |
-@@ -1271,4 +1271,8 @@ |
8447 |
- #define __NR_memfd_create (__NR_Linux + 314) |
8448 |
- #endif |
8449 |
- |
8450 |
-+#if !defined(__NR_membarrier) |
8451 |
-+#define __NR_membarrier (__NR_Linux + 318) |
8452 |
-+#endif |
8453 |
-+ |
8454 |
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_ |
8455 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h |
8456 |
-index ddbf97f..1742acd 100644 |
8457 |
---- a/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h |
8458 |
-+++ b/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h |
8459 |
-@@ -1433,4 +1433,8 @@ |
8460 |
- #define __NR_memfd_create (__NR_Linux + 354) |
8461 |
- #endif |
8462 |
- |
8463 |
-+#if !defined(__NR_membarrier) |
8464 |
-+#define __NR_membarrier (__NR_Linux + 358) |
8465 |
-+#endif |
8466 |
-+ |
8467 |
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_ |
8468 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h |
8469 |
-index a6afc62..7ed0a3b 100644 |
8470 |
---- a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h |
8471 |
-+++ b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h |
8472 |
-@@ -1422,5 +1422,9 @@ |
8473 |
- #define __NR_memfd_create 356 |
8474 |
- #endif |
8475 |
- |
8476 |
-+#if !defined(__NR_membarrier) |
8477 |
-+#define __NR_membarrier 375 |
8478 |
-+#endif |
8479 |
-+ |
8480 |
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_ |
8481 |
- |
8482 |
-diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h |
8483 |
-index 349504a..ea3c7c9 100644 |
8484 |
---- a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h |
8485 |
-+++ b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h |
8486 |
-@@ -1290,5 +1290,9 @@ |
8487 |
- #define __NR_memfd_create 319 |
8488 |
- #endif |
8489 |
- |
8490 |
-+#if !defined(__NR_membarrier) |
8491 |
-+#define __NR_membarrier 324 |
8492 |
-+#endif |
8493 |
-+ |
8494 |
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ |
8495 |
- |
8496 |
|
8497 |
diff --git a/dev-qt/qtwebengine/files/musl/musl-sync.patch b/dev-qt/qtwebengine/files/musl/musl-sync.patch |
8498 |
new file mode 100644 |
8499 |
index 0000000..be3a3d1 |
8500 |
--- /dev/null |
8501 |
+++ b/dev-qt/qtwebengine/files/musl/musl-sync.patch |
8502 |
@@ -0,0 +1,30 @@ |
8503 |
+--- a/src/3rdparty/chromium/third_party/libsync/src/include/sync/sync.h.orig 2020-02-21 07:43:33.748325175 -0500 |
8504 |
++++ a/src/3rdparty/chromium/third_party/libsync/src/include/sync/sync.h 2020-02-21 07:44:07.288328784 -0500 |
8505 |
+@@ -19,12 +19,16 @@ |
8506 |
+ #ifndef __SYS_CORE_SYNC_H |
8507 |
+ #define __SYS_CORE_SYNC_H |
8508 |
+ |
8509 |
++#if defined(__GLIBC__) |
8510 |
+ #include <sys/cdefs.h> |
8511 |
++#endif |
8512 |
+ #include <stdint.h> |
8513 |
+ |
8514 |
+ #include <linux/types.h> |
8515 |
+ |
8516 |
+-__BEGIN_DECLS |
8517 |
++#ifdef __cplusplus |
8518 |
++extern "C" { |
8519 |
++#endif |
8520 |
+ |
8521 |
+ struct sync_legacy_merge_data { |
8522 |
+ int32_t fd2; |
8523 |
+@@ -158,6 +162,8 @@ |
8524 |
+ struct sync_pt_info *itr); |
8525 |
+ void sync_fence_info_free(struct sync_fence_info_data *info); |
8526 |
+ |
8527 |
+-__END_DECLS |
8528 |
++#ifdef __cplusplus |
8529 |
++} |
8530 |
++#endif |
8531 |
+ |
8532 |
+ #endif /* __SYS_CORE_SYNC_H */ |
8533 |
|
8534 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-fpstate.patch b/dev-qt/qtwebengine/files/musl/qt-musl-fpstate.patch |
8535 |
deleted file mode 100644 |
8536 |
index 42fe157..0000000 |
8537 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-fpstate.patch |
8538 |
+++ /dev/null |
8539 |
@@ -1,48 +0,0 @@ |
8540 |
-diff --git a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
8541 |
-index 052ce37..95b0fb4 100644 |
8542 |
---- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
8543 |
-+++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc |
8544 |
-@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { |
8545 |
- } |
8546 |
- |
8547 |
- void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
8548 |
-- const struct _libc_fpstate* fp) { |
8549 |
-+ const struct _fpstate* fp) { |
8550 |
- const greg_t* regs = uc->uc_mcontext.gregs; |
8551 |
- |
8552 |
- out->context_flags = MD_CONTEXT_X86_FULL | |
8553 |
-@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { |
8554 |
- } |
8555 |
- |
8556 |
- void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
8557 |
-- const struct _libc_fpstate* fpregs) { |
8558 |
-+ const struct _fpstate* fpregs) { |
8559 |
- const greg_t* regs = uc->uc_mcontext.gregs; |
8560 |
- |
8561 |
- out->context_flags = MD_CONTEXT_AMD64_FULL; |
8562 |
-diff --git a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h |
8563 |
-index f830618..f3dde1f 100644 |
8564 |
---- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h |
8565 |
-+++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h |
8566 |
-@@ -50,7 +50,7 @@ struct UContextReader { |
8567 |
- // info: the collection of register structures. |
8568 |
- #if defined(__i386__) || defined(__x86_64) |
8569 |
- static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
8570 |
-- const struct _libc_fpstate* fp); |
8571 |
-+ const struct _fpstate* fp); |
8572 |
- #elif defined(__aarch64__) |
8573 |
- static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, |
8574 |
- const struct fpsimd_context* fpregs); |
8575 |
-diff --git a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h |
8576 |
-index d1dc331..d1cc562 100644 |
8577 |
---- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h |
8578 |
-+++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h |
8579 |
-@@ -48,7 +48,7 @@ class ExceptionHandler; |
8580 |
- #if defined(__aarch64__) |
8581 |
- typedef struct fpsimd_context fpstate_t; |
8582 |
- #elif !defined(__ARM_EABI__) && !defined(__mips__) |
8583 |
--typedef struct _libc_fpstate fpstate_t; |
8584 |
-+typedef struct _fpstate fpstate_t; |
8585 |
- #endif |
8586 |
- |
8587 |
- // These entries store a list of memory regions that the client wants included |
8588 |
|
8589 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-resolve.patch b/dev-qt/qtwebengine/files/musl/qt-musl-resolve.patch |
8590 |
deleted file mode 100644 |
8591 |
index a481e50..0000000 |
8592 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-resolve.patch |
8593 |
+++ /dev/null |
8594 |
@@ -1,61 +0,0 @@ |
8595 |
---- qtwebengine/src/3rdparty/chromium/net/dns/dns_reloader.cc 2016-11-07 15:46:18.000000000 +0100 |
8596 |
-+++ qtwebengine/src/3rdparty/chromium/net/dns/dns_reloader.cc 2016-12-20 03:33:11.749059656 +0100 |
8597 |
-@@ -9,6 +9,10 @@ |
8598 |
- |
8599 |
- #include <resolv.h> |
8600 |
- |
8601 |
-+#if !defined(__GLIBC__) |
8602 |
-+#include "resolv_compat.h" |
8603 |
-+#endif |
8604 |
-+ |
8605 |
- #include "base/lazy_instance.h" |
8606 |
- #include "base/logging.h" |
8607 |
- #include "base/macros.h" |
8608 |
---- qtwebengine/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc 2016-11-07 15:46:18.000000000 +0100 |
8609 |
-+++ qtwebengine/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc 2016-12-20 03:40:07.671953098 +0100 |
8610 |
-@@ -6,6 +6,10 @@ |
8611 |
- |
8612 |
- #include <string> |
8613 |
- |
8614 |
-+#if !defined(__GLIBC__) |
8615 |
-+#include "resolv_compat.h" |
8616 |
-+#endif |
8617 |
-+ |
8618 |
- #include "base/bind.h" |
8619 |
- #include "base/files/file.h" |
8620 |
- #include "base/files/file_path.h" |
8621 |
-diff --git a/src/3rdparty/chromium/net/dns/resolv_compat.h b/src/3rdparty/chromium/net/dns/resolv_compat.h |
8622 |
-new file mode 100644 |
8623 |
-index 0000000..4f0e852 |
8624 |
---- /dev/null |
8625 |
-+++ b/src/3rdparty/chromium/net/dns/resolv_compat.h |
8626 |
-@@ -0,0 +1,29 @@ |
8627 |
-+#if !defined(__GLIBC__) |
8628 |
-+/*************************************************************************** |
8629 |
-+ * resolv_compat.h |
8630 |
-+ * |
8631 |
-+ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc |
8632 |
-+ * Note: res_init() is actually deprecated according to |
8633 |
-+ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html |
8634 |
-+ **************************************************************************/ |
8635 |
-+#include <string.h> |
8636 |
-+ |
8637 |
-+static inline int res_ninit(res_state statp) |
8638 |
-+{ |
8639 |
-+ int rc = res_init(); |
8640 |
-+ if (statp != &_res) { |
8641 |
-+ memcpy(statp, &_res, sizeof(*statp)); |
8642 |
-+ } |
8643 |
-+ return rc; |
8644 |
-+} |
8645 |
-+ |
8646 |
-+static inline int res_nclose(res_state statp) |
8647 |
-+{ |
8648 |
-+ if (!statp) |
8649 |
-+ return -1; |
8650 |
-+ if (statp != &_res) { |
8651 |
-+ memset(statp, 0, sizeof(*statp)); |
8652 |
-+ } |
8653 |
-+ return 0; |
8654 |
-+} |
8655 |
-+#endif |
8656 |
|
8657 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-serialio.patch b/dev-qt/qtwebengine/files/musl/qt-musl-serialio.patch |
8658 |
deleted file mode 100644 |
8659 |
index cf0e0fa..0000000 |
8660 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-serialio.patch |
8661 |
+++ /dev/null |
8662 |
@@ -1,12 +0,0 @@ |
8663 |
---- qtwebengine/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc 2017-01-03 10:28:53.000000000 +0100 |
8664 |
-+++ qtwebengine/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc 2017-02-23 21:20:42.650669563 +0100 |
8665 |
-@@ -12,6 +12,9 @@ |
8666 |
- |
8667 |
- #if defined(OS_LINUX) |
8668 |
- #include <linux/serial.h> |
8669 |
-+#if !defined(__GLIBC__) |
8670 |
-+#include <asm-generic/ioctls.h> |
8671 |
-+#endif |
8672 |
- |
8673 |
- // The definition of struct termios2 is copied from asm-generic/termbits.h |
8674 |
- // because including that header directly conflicts with termios.h. |
8675 |
|
8676 |
diff --git a/dev-qt/qtwebengine/files/musl/qt-musl-sysreg-for__WORDSIZE.patch b/dev-qt/qtwebengine/files/musl/qt-musl-sysreg-for__WORDSIZE.patch |
8677 |
deleted file mode 100644 |
8678 |
index a8b74e4..0000000 |
8679 |
--- a/dev-qt/qtwebengine/files/musl/qt-musl-sysreg-for__WORDSIZE.patch |
8680 |
+++ /dev/null |
8681 |
@@ -1,14 +0,0 @@ |
8682 |
-diff --git a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h |
8683 |
-index d03c7a8..d43fda0 100644 |
8684 |
---- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h |
8685 |
-+++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h |
8686 |
-@@ -36,6 +36,9 @@ |
8687 |
- #include <elf.h> |
8688 |
- #include <link.h> |
8689 |
- #include <stddef.h> |
8690 |
-+#ifndef __GLIBC__ |
8691 |
-+#include <sys/reg.h> |
8692 |
-+#endif |
8693 |
- |
8694 |
- #include "common/memory_range.h" |
8695 |
- |
8696 |
|
8697 |
diff --git a/dev-qt/qtwebengine/files/musl/resolv_compat.h b/dev-qt/qtwebengine/files/musl/resolv_compat.h |
8698 |
new file mode 100644 |
8699 |
index 0000000..4f0e852 |
8700 |
--- /dev/null |
8701 |
+++ b/dev-qt/qtwebengine/files/musl/resolv_compat.h |
8702 |
@@ -0,0 +1,29 @@ |
8703 |
+#if !defined(__GLIBC__) |
8704 |
+/*************************************************************************** |
8705 |
+ * resolv_compat.h |
8706 |
+ * |
8707 |
+ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc |
8708 |
+ * Note: res_init() is actually deprecated according to |
8709 |
+ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html |
8710 |
+ **************************************************************************/ |
8711 |
+#include <string.h> |
8712 |
+ |
8713 |
+static inline int res_ninit(res_state statp) |
8714 |
+{ |
8715 |
+ int rc = res_init(); |
8716 |
+ if (statp != &_res) { |
8717 |
+ memcpy(statp, &_res, sizeof(*statp)); |
8718 |
+ } |
8719 |
+ return rc; |
8720 |
+} |
8721 |
+ |
8722 |
+static inline int res_nclose(res_state statp) |
8723 |
+{ |
8724 |
+ if (!statp) |
8725 |
+ return -1; |
8726 |
+ if (statp != &_res) { |
8727 |
+ memset(statp, 0, sizeof(*statp)); |
8728 |
+ } |
8729 |
+ return 0; |
8730 |
+} |
8731 |
+#endif |
8732 |
|
8733 |
diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.11.2-paxmark-mksnapshot.patch b/dev-qt/qtwebengine/files/qtwebengine-5.11.2-paxmark-mksnapshot.patch |
8734 |
deleted file mode 100644 |
8735 |
index f7a5c06..0000000 |
8736 |
--- a/dev-qt/qtwebengine/files/qtwebengine-5.11.2-paxmark-mksnapshot.patch |
8737 |
+++ /dev/null |
8738 |
@@ -1,41 +0,0 @@ |
8739 |
-Bug: https://bugs.gentoo.org/634220 |
8740 |
- |
8741 |
---- a/src/3rdparty/chromium/v8/BUILD.gn |
8742 |
-+++ b/src/3rdparty/chromium/v8/BUILD.gn |
8743 |
-@@ -803,6 +803,7 @@ |
8744 |
- |
8745 |
- deps = [ |
8746 |
- ":mksnapshot($v8_snapshot_toolchain)", |
8747 |
-+ ":run_paxmark", |
8748 |
- ] |
8749 |
- |
8750 |
- script = "tools/run.py" |
8751 |
-@@ -854,6 +855,28 @@ |
8752 |
- } |
8753 |
- } |
8754 |
- } |
8755 |
-+action("run_paxmark") { |
8756 |
-+ visibility = [ ":*" ] # Only targets in this file can depend on this. |
8757 |
-+ |
8758 |
-+ deps = [ |
8759 |
-+ ":mksnapshot($v8_snapshot_toolchain)", |
8760 |
-+ ] |
8761 |
-+ |
8762 |
-+ script = "/usr/sbin/pypaxctl" |
8763 |
-+ |
8764 |
-+ sources = [] |
8765 |
-+ |
8766 |
-+ outputs = [ |
8767 |
-+ "$target_out_dir/mksnapshot", |
8768 |
-+ ] |
8769 |
-+ |
8770 |
-+ args = [ |
8771 |
-+ "-sm", |
8772 |
-+ "./" + rebase_path(get_label_info(":mksnapshot($v8_snapshot_toolchain)", |
8773 |
-+ "root_out_dir") + "/mksnapshot", |
8774 |
-+ root_build_dir), |
8775 |
-+ ] |
8776 |
-+} |
8777 |
- |
8778 |
- action("v8_dump_build_config") { |
8779 |
- script = "tools/testrunner/utils/dump_build_config.py" |
8780 |
|
8781 |
diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.12.0-nouveau-disable-gpu.patch b/dev-qt/qtwebengine/files/qtwebengine-5.12.0-nouveau-disable-gpu.patch |
8782 |
deleted file mode 100644 |
8783 |
index ec315ca..0000000 |
8784 |
--- a/dev-qt/qtwebengine/files/qtwebengine-5.12.0-nouveau-disable-gpu.patch |
8785 |
+++ /dev/null |
8786 |
@@ -1,98 +0,0 @@ |
8787 |
-From: Antonio Larrosa <alarrosa@××××.com> |
8788 |
-Subject: Disable GPU when using nouveau or running on wayland |
8789 |
-References: boo#1005323, boo#1060990 |
8790 |
- |
8791 |
-Qt WebEngine uses multi-threaded OpenGL, which nouveau does not support. |
8792 |
-It also crashes when running on wayland, the cause is not yet known. |
8793 |
-Work around these issues by not doing GPU-accelerated rendering in such |
8794 |
-cases. |
8795 |
- |
8796 |
-Index: qtwebengine-everywhere-src-5.12.0-alpha/src/core/web_engine_context.cpp |
8797 |
-=================================================================== |
8798 |
---- qtwebengine-everywhere-src-5.12.0-alpha.orig/src/core/web_engine_context.cpp |
8799 |
-+++ qtwebengine-everywhere-src-5.12.0-alpha/src/core/web_engine_context.cpp |
8800 |
-@@ -101,6 +101,7 @@ |
8801 |
- #include <QOffscreenSurface> |
8802 |
- #ifndef QT_NO_OPENGL |
8803 |
- # include <QOpenGLContext> |
8804 |
-+# include <QOpenGLFunctions> |
8805 |
- #endif |
8806 |
- #include <QQuickWindow> |
8807 |
- #include <QStringList> |
8808 |
-@@ -162,6 +163,39 @@ void dummyGetPluginCallback(const std::v |
8809 |
- } |
8810 |
- #endif |
8811 |
- |
8812 |
-+#ifndef QT_NO_OPENGL |
8813 |
-+QString openGLVendor() |
8814 |
-+{ |
8815 |
-+ QString vendor; |
8816 |
-+ |
8817 |
-+ QOpenGLContext *oldContext = QOpenGLContext::currentContext(); |
8818 |
-+ QSurface *oldSurface = 0; |
8819 |
-+ if (oldContext) |
8820 |
-+ oldSurface = oldContext->surface(); |
8821 |
-+ |
8822 |
-+ QScopedPointer<QOffscreenSurface> surface( new QOffscreenSurface ); |
8823 |
-+ surface->create(); |
8824 |
-+ QOpenGLContext context; |
8825 |
-+ if (!context.create()) { |
8826 |
-+ qDebug() << "Error creating openGL context"; |
8827 |
-+ } |
8828 |
-+ else if (!context.makeCurrent(surface.data())) { |
8829 |
-+ qDebug() << "Error making openGL context current context"; |
8830 |
-+ } else { |
8831 |
-+ const GLubyte *p; |
8832 |
-+ QOpenGLFunctions *f = context.functions(); |
8833 |
-+ if ((p = f->glGetString(GL_VENDOR))) |
8834 |
-+ vendor = QString::fromLatin1(reinterpret_cast<const char *>(p)); |
8835 |
-+ } |
8836 |
-+ |
8837 |
-+ context.doneCurrent(); |
8838 |
-+ if (oldContext && oldSurface) |
8839 |
-+ oldContext->makeCurrent(oldSurface); |
8840 |
-+ |
8841 |
-+ return vendor; |
8842 |
-+} |
8843 |
-+#endif |
8844 |
-+ |
8845 |
- } // namespace |
8846 |
- |
8847 |
- namespace QtWebEngineCore { |
8848 |
-@@ -440,6 +474,27 @@ WebEngineContext::WebEngineContext() |
8849 |
- const char *glType = 0; |
8850 |
- #ifndef QT_NO_OPENGL |
8851 |
- |
8852 |
-+ bool disableGpu = qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_GPU"); |
8853 |
-+ |
8854 |
-+ if (!qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_WAYLAND_WORKAROUND") && qApp->platformName().startsWith("wayland", Qt::CaseInsensitive)) |
8855 |
-+ { |
8856 |
-+ qWarning() << "Running on wayland. Qt WebEngine will disable usage of the GPU.\n" |
8857 |
-+ "Note: you can set the QT_WEBENGINE_DISABLE_WAYLAND_WORKAROUND\n" |
8858 |
-+ "environment variable before running this application, but this is \n" |
8859 |
-+ "not recommended since this usually causes applications to crash."; |
8860 |
-+ disableGpu = true; |
8861 |
-+ } |
8862 |
-+ |
8863 |
-+ if (!qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND") && openGLVendor() == QStringLiteral("nouveau")) |
8864 |
-+ { |
8865 |
-+ qWarning() << "Nouveau openGL driver detected. Qt WebEngine will disable usage of the GPU.\n" |
8866 |
-+ "Note: you can set the QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND\n" |
8867 |
-+ "environment variable before running this application, but this is \n" |
8868 |
-+ "not recommended since this usually causes applications to crash as\n" |
8869 |
-+ "Nouveau openGL drivers don't support multithreaded rendering"; |
8870 |
-+ disableGpu = true; |
8871 |
-+ } |
8872 |
-+ |
8873 |
- bool tryGL = |
8874 |
- !usingANGLE() |
8875 |
- && (!usingSoftwareDynamicGL() |
8876 |
-@@ -450,7 +505,7 @@ WebEngineContext::WebEngineContext() |
8877 |
- || enableWebGLSoftwareRendering |
8878 |
- #endif |
8879 |
- ) |
8880 |
-- && !usingQtQuick2DRenderer(); |
8881 |
-+ && !usingQtQuick2DRenderer() && !disableGpu; |
8882 |
- |
8883 |
- if (tryGL) { |
8884 |
- if (qt_gl_global_share_context() && qt_gl_global_share_context()->isValid()) { |
8885 |
|
8886 |
diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.12.5-icu-65.patch b/dev-qt/qtwebengine/files/qtwebengine-5.12.5-icu-65.patch |
8887 |
new file mode 100644 |
8888 |
index 0000000..d7fdaeb |
8889 |
--- /dev/null |
8890 |
+++ b/dev-qt/qtwebengine/files/qtwebengine-5.12.5-icu-65.patch |
8891 |
@@ -0,0 +1,33 @@ |
8892 |
+From 27947d92157b0987ceef9ae31fe0d3e7f8b653df Mon Sep 17 00:00:00 2001 |
8893 |
+From: Kirill Burtsev <kirill.burtsev@××.io> |
8894 |
+Date: Fri, 23 Aug 2019 15:09:25 +0200 |
8895 |
+Subject: Fix compilation with system ICU |
8896 |
+ |
8897 |
+ICU upstream now requires that ICU4C API macros are used with a |
8898 |
+trailing semicolon. |
8899 |
+ |
8900 |
+- https://unicode-org.atlassian.net/browse/ICU-20601 |
8901 |
+- https://github.com/unicode-org/icu/pull/759 |
8902 |
+ |
8903 |
+Change-Id: Ie05c005ebcded9a228386db5d9abe9863787ec2b |
8904 |
+Fixes: QTBUG-78911 |
8905 |
+Reviewed-by: Jimi Huotari <chiitoo@g.o> |
8906 |
+Reviewed-by: Allan Sandfeld Jensen <allan.jensen@××.io> |
8907 |
+--- |
8908 |
+ .../blink/renderer/core/dom/document.cc | 2 +- |
8909 |
+ chromium/third_party/icu/BUILD.gn | 28 +++++++++++++++------- |
8910 |
+ 2 files changed, 21 insertions(+), 9 deletions(-) |
8911 |
+ |
8912 |
+diff --git a/chromium/third_party/blink/renderer/core/dom/document.cc b/chromium/third_party/blink/renderer/core/dom/document.cc |
8913 |
+index 920dab7c48d..43fd422393c 100644 |
8914 |
+--- a/src/3rdparty/chromium/third_party/blink/renderer/core/dom/document.cc |
8915 |
++++ b/src/3rdparty/chromium/third_party/blink/renderer/core/dom/document.cc |
8916 |
+@@ -6065,7 +6065,7 @@ static ParseQualifiedNameResult ParseQualifiedNameInternal( |
8917 |
+ |
8918 |
+ for (unsigned i = 0; i < length;) { |
8919 |
+ UChar32 c; |
8920 |
+- U16_NEXT(characters, i, length, c) |
8921 |
++ U16_NEXT(characters, i, length, c); |
8922 |
+ if (c == ':') { |
8923 |
+ if (saw_colon) |
8924 |
+ return ParseQualifiedNameResult(kQNMultipleColons); |
8925 |
|
8926 |
diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.12.5-pulseaudio-13.patch b/dev-qt/qtwebengine/files/qtwebengine-5.12.5-pulseaudio-13.patch |
8927 |
deleted file mode 100644 |
8928 |
index 1e57f0e..0000000 |
8929 |
--- a/dev-qt/qtwebengine/files/qtwebengine-5.12.5-pulseaudio-13.patch |
8930 |
+++ /dev/null |
8931 |
@@ -1,88 +0,0 @@ |
8932 |
-From 7ac85fb4cc6f44a21761a591ac497ae3d6bf966d Mon Sep 17 00:00:00 2001 |
8933 |
-From: Allan Sandfeld Jensen <allan.jensen@××.io> |
8934 |
-Date: Mon, 23 Sep 2019 13:49:53 +0200 |
8935 |
-Subject: [PATCH] Fix building with pulseaudio 13 |
8936 |
-MIME-Version: 1.0 |
8937 |
-Content-Type: text/plain; charset=utf8 |
8938 |
-Content-Transfer-Encoding: 8bit |
8939 |
- |
8940 |
-The function signature changed though the ABI stayed the same. |
8941 |
- |
8942 |
-Change-Id: I86ca361b5e4f0c523e1031910df438c23beee876 |
8943 |
-Fixes: QTBUG-77037 |
8944 |
-Reviewed-by: Jüri Valdmann <juri.valdmann@××.io> |
8945 |
---- |
8946 |
- src/3rdparty/chromium/media/audio/pulse/pulse.sigs | 16 ++++++++-------- |
8947 |
- src/3rdparty/chromium/media/audio/pulse/pulse_stub_header.fragment | 11 +++++++++++ |
8948 |
- 2 files changed, 19 insertions(+), 8 deletions(-) |
8949 |
- |
8950 |
-diff --git a/src/3rdparty/chromium/media/audio/pulse/pulse.sigs b/src/3rdparty/chromium/media/audio/pulse/pulse.sigs |
8951 |
-index 8b5888786a9..daaeb149c13 100644 |
8952 |
---- a/src/3rdparty/chromium/media/audio/pulse/pulse.sigs |
8953 |
-+++ b/src/3rdparty/chromium/media/audio/pulse/pulse.sigs |
8954 |
-@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p |
8955 |
- pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata); |
8956 |
- pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata); |
8957 |
- pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata); |
8958 |
--pa_context_state_t pa_context_get_state(pa_context* c); |
8959 |
-+pa_context_state_t pa_context_get_state(const_pa_context_ptr c); |
8960 |
- pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name); |
8961 |
- pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata); |
8962 |
- void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata); |
8963 |
--pa_operation_state_t pa_operation_get_state(pa_operation* o); |
8964 |
-+pa_operation_state_t pa_operation_get_state(const_pa_operation_ptr o); |
8965 |
- void pa_context_unref(pa_context* c); |
8966 |
- void pa_operation_unref(pa_operation* o); |
8967 |
- int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes); |
8968 |
-@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi |
8969 |
- int pa_stream_disconnect(pa_stream* s); |
8970 |
- int pa_stream_drop(pa_stream *p); |
8971 |
- pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata); |
8972 |
--uint32_t pa_stream_get_device_index(pa_stream* s); |
8973 |
-+uint32_t pa_stream_get_device_index(const_pa_stream_ptr s); |
8974 |
- int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative); |
8975 |
--pa_stream_state_t pa_stream_get_state(pa_stream* p); |
8976 |
-+pa_stream_state_t pa_stream_get_state(const_pa_stream_ptr p); |
8977 |
- pa_stream* pa_stream_new(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map * map); |
8978 |
- pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p); |
8979 |
- pa_proplist* pa_proplist_new(void); |
8980 |
--int pa_proplist_contains(pa_proplist* p, const char* key); |
8981 |
-+int pa_proplist_contains(const_pa_proplist_ptr p, const char* key); |
8982 |
- void pa_proplist_free(pa_proplist* p); |
8983 |
--const char* pa_proplist_gets(pa_proplist* p, const char* key); |
8984 |
-+const char* pa_proplist_gets(const_pa_proplist_ptr p, const char* key); |
8985 |
- int pa_proplist_sets(pa_proplist* p, const char* key, const char* value); |
8986 |
--size_t pa_stream_readable_size(pa_stream *p); |
8987 |
-+size_t pa_stream_readable_size(const_pa_stream_ptr p); |
8988 |
- int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes); |
8989 |
- void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata); |
8990 |
- void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata); |
8991 |
- int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek); |
8992 |
- void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata); |
8993 |
- void pa_stream_unref(pa_stream* s); |
8994 |
--int pa_context_errno(pa_context *c); |
8995 |
-+int pa_context_errno(const_pa_context_ptr c); |
8996 |
- const char* pa_strerror(int error); |
8997 |
- pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned channels, pa_volume_t v); |
8998 |
-diff --git a/src/3rdparty/chromium/media/audio/pulse/pulse_stub_header.fragment b/src/3rdparty/chromium/media/audio/pulse/pulse_stub_header.fragment |
8999 |
-index 2a2d3e7552b..cdaa841b29f 100644 |
9000 |
---- a/src/3rdparty/chromium/media/audio/pulse/pulse_stub_header.fragment |
9001 |
-+++ b/src/3rdparty/chromium/media/audio/pulse/pulse_stub_header.fragment |
9002 |
-@@ -5,4 +5,15 @@ extern "C" { |
9003 |
- |
9004 |
- #include <pulse/pulseaudio.h> |
9005 |
- |
9006 |
-+#if PA_MAJOR > 12 |
9007 |
-+typedef const pa_context* const_pa_context_ptr; |
9008 |
-+typedef const pa_operation* const_pa_operation_ptr; |
9009 |
-+typedef const pa_proplist* const_pa_proplist_ptr; |
9010 |
-+typedef const pa_stream* const_pa_stream_ptr; |
9011 |
-+#else |
9012 |
-+typedef pa_context* const_pa_context_ptr; |
9013 |
-+typedef pa_operation* const_pa_operation_ptr; |
9014 |
-+typedef pa_proplist* const_pa_proplist_ptr; |
9015 |
-+typedef pa_stream* const_pa_stream_ptr; |
9016 |
-+#endif |
9017 |
- } |
9018 |
--- |
9019 |
-2.16.3 |
9020 |
|
9021 |
diff --git a/dev-qt/qtwebengine/metadata.xml b/dev-qt/qtwebengine/metadata.xml |
9022 |
index 75d11c0..380559a 100644 |
9023 |
--- a/dev-qt/qtwebengine/metadata.xml |
9024 |
+++ b/dev-qt/qtwebengine/metadata.xml |
9025 |
@@ -9,7 +9,6 @@ |
9026 |
<flag name="designer">Install the QWebEngineView plugin used to add widgets in |
9027 |
<pkg>dev-qt/designer</pkg> forms that display web pages.</flag> |
9028 |
<flag name="jumbo-build">Combine source files to speed up build process.</flag> |
9029 |
- <flag name="pax_kernel">Enable building under a PaX enabled kernel</flag> |
9030 |
<flag name="system-ffmpeg">Use the system-wide <pkg>media-video/ffmpeg</pkg> |
9031 |
instead of bundled.</flag> |
9032 |
<flag name="system-icu">Use the system-wide <pkg>dev-libs/icu</pkg> |
9033 |
|
9034 |
diff --git a/dev-qt/qtwebengine/qtwebengine-5.12.5.ebuild b/dev-qt/qtwebengine/qtwebengine-5.13.2.ebuild |
9035 |
similarity index 82% |
9036 |
rename from dev-qt/qtwebengine/qtwebengine-5.12.5.ebuild |
9037 |
rename to dev-qt/qtwebengine/qtwebengine-5.13.2.ebuild |
9038 |
index 08f58e9..67f9db1 100644 |
9039 |
--- a/dev-qt/qtwebengine/qtwebengine-5.12.5.ebuild |
9040 |
+++ b/dev-qt/qtwebengine/qtwebengine-5.13.2.ebuild |
9041 |
@@ -1,18 +1,18 @@ |
9042 |
-# Copyright 1999-2019 Gentoo Authors |
9043 |
+# Copyright 1999-2020 Gentoo Authors |
9044 |
# Distributed under the terms of the GNU General Public License v2 |
9045 |
|
9046 |
EAPI=7 |
9047 |
+ |
9048 |
PYTHON_COMPAT=( python2_7 ) |
9049 |
-inherit multiprocessing pax-utils python-any-r1 qt5-build |
9050 |
+inherit multiprocessing python-any-r1 qt5-build |
9051 |
|
9052 |
DESCRIPTION="Library for rendering dynamic web content in Qt5 C++ and QML applications" |
9053 |
|
9054 |
if [[ ${QT5_BUILD_TYPE} == release ]]; then |
9055 |
- KEYWORDS="amd64 ~arm ~arm64 ~x86" |
9056 |
+ KEYWORDS="amd64 arm arm64 ~ppc64 ~x86" |
9057 |
fi |
9058 |
|
9059 |
-IUSE="alsa bindist designer jumbo-build pax_kernel pulseaudio |
9060 |
- +system-ffmpeg +system-icu widgets" |
9061 |
+IUSE="alsa bindist designer jumbo-build pulseaudio +system-ffmpeg +system-icu widgets" |
9062 |
REQUIRED_USE="designer? ( widgets )" |
9063 |
|
9064 |
RDEPEND=" |
9065 |
@@ -75,24 +75,23 @@ DEPEND="${RDEPEND} |
9066 |
dev-util/ninja |
9067 |
dev-util/re2c |
9068 |
sys-devel/bison |
9069 |
- pax_kernel? ( sys-apps/elfix ) |
9070 |
" |
9071 |
|
9072 |
-PATCHES+=( |
9073 |
- "${FILESDIR}/${PN}-5.12.0-nouveau-disable-gpu.patch" # bug 609752 |
9074 |
- "${FILESDIR}/${P}-pulseaudio-13.patch" # bug 694960 |
9075 |
-) |
9076 |
+PATCHES+=( "${FILESDIR}/${PN}-5.12.5-icu-65.patch" ) |
9077 |
|
9078 |
src_prepare() { |
9079 |
- use pax_kernel && PATCHES+=( "${FILESDIR}/${PN}-5.11.2-paxmark-mksnapshot.patch" ) |
9080 |
- |
9081 |
- eapply "${FILESDIR}/musl" |
9082 |
- |
9083 |
if ! use jumbo-build; then |
9084 |
sed -i -e 's|use_jumbo_build=true|use_jumbo_build=false|' \ |
9085 |
src/core/config/common.pri || die |
9086 |
fi |
9087 |
|
9088 |
+ if use elibc_musl; then |
9089 |
+ eapply "${FILESDIR}/musl" |
9090 |
+ sed -i -e "s;\(use_allocator_shim\) = .*;\1 = false;" src/3rdparty/chromium/build/config/allocator.gni || die |
9091 |
+ # Compatibility functions res_ninit() and res_nclose() for musl libc |
9092 |
+ cp -v "${FILESDIR}"/musl/resolv_compat.h "${S}"/src/3rdparty/chromium/net/dns || die |
9093 |
+ fi |
9094 |
+ |
9095 |
# bug 620444 - ensure local headers are used |
9096 |
find "${S}" -type f -name "*.pr[fio]" | xargs sed -i -e 's|INCLUDEPATH += |&$$QTWEBENGINE_ROOT/include |' || die |
9097 |
|
9098 |
@@ -131,6 +130,4 @@ src_install() { |
9099 |
if [[ ! -f ${D}${QT5_LIBDIR}/libQt5WebEngine.so ]]; then |
9100 |
die "${CATEGORY}/${PF} failed to build anything. Please report to https://bugs.gentoo.org/" |
9101 |
fi |
9102 |
- |
9103 |
- pax-mark m "${D}${QT5_LIBEXECDIR}"/QtWebEngineProcess |
9104 |
} |