#37 Support ppc64le architecture
Closed 2 months ago by than. Opened 8 months ago by tle.
rpms/ tle/chromium ppc64le  into  rawhide

file modified
+6 -9
@@ -1,4 +1,3 @@ 

- /chromium-52.0.2743.75-clean.tar.xz

  /depot_tools.git-master.tar.gz

  /policy_templates.zip

  /chromium-*.tar.xz
@@ -19,15 +18,13 @@ 

  /Tinos-Italic.ttf

  /Tinos-Regular.ttf

  /Ahem.ttf

- /node-v8.9.1-linux-x64.tar.gz

- /node-v10.15.3-linux-x64.tar.gz

  /xcb-proto-1.14.tar.xz

  /NotoSansSymbols2-Regular.ttf

  /NotoSansTibetan-Regular.ttf

- /node-v12.22.6-linux-arm64.tar.xz

- /node-v12.22.6-linux-x64.tar.xz

- /node-v16.17.0-linux-x64.tar.xz

- /node-v16.17.0-linux-arm64.tar.xz

+ /node-*-linux-arm64.tar.xz

+ /node-*-linux-x64.tar.xz

+ /node-*-linux-ppc64le.tar.xz

+ /linux-arm64-*.tgz

+ /linux-x64-*.tgz

+ /linux-ppc64-*.tgz

  /testupload

- /node-v19.8.1-linux-arm64.tar.xz

- /node-v19.8.1-linux-x64.tar.xz

file modified
+262 -41
@@ -40,8 +40,16 @@ 

  # enable|disable chrome-remote-desktop build

  %global build_remoting 0

  

- # set nodejs_version

- %global nodejs_version v19.8.1

+ %global esbuild_version 0.19.2

+ 

+ # install nodejs from Nodesource

+ %global nodejs_version v18.17.1

+ %global use_nodesource_binary 0

+ 

+ # RHEL 8 NodeJS RPM is out of date

+ %if 0%{?rhel} == 8

+ %global use_nodesource_binary 1

+ %endif

  

  # set version for devtoolset and gcc-toolset

  %global dts_version 12
@@ -236,7 +244,7 @@ 

  

  Name:	chromium%{chromium_channel}

  Version: 116.0.5845.179

- Release: 1%{?dist}

+ Release: 2%{?dist}

  Summary: A WebKit (Blink) powered web browser that Google doesn't want you to use

  Url: http://www.chromium.org/Home

  License: BSD-3-Clause AND LGPL-2.1-or-later AND Apache-2.0 AND IJG AND MIT AND GPL-2.0-or-later AND ISC AND OpenSSL AND (MPL-1.1 OR GPL-2.0-only OR LGPL-2.0-only)
@@ -382,6 +390,96 @@ 

  # in fedora < 39

  Patch352: chromium-116-v4l2-num_delta_pocs_of_ref_rps_idx.patch

  

+ 

+ # PowerPC64 LE support

+ # Patches taken from Timothy Pearson's patchset

+ # https://quickbuild.io/~raptor-engineering-public/+archive/ubuntu/chromium/+files/chromium_115.0.5790.102-1raptor0~deb11u2.debian.tar.xz

+ Patch353: ppc64le/sandbox/0001-linux-seccomp-bpf-ppc64-glibc-workaround-in-SIGSYS-h.patch

+ Patch354: ppc64le/sandbox/0001-sandbox-Enable-seccomp_bpf-for-ppc64.patch

+ Patch355: ppc64le/sandbox/0001-services-service_manager-sandbox-linux-Fix-TCGETS-de.patch

+ Patch356: ppc64le/sandbox/0001-sandbox-linux-bpf_dsl-Update-syscall-ranges-for-ppc6.patch

+ Patch357: ppc64le/sandbox/0001-sandbox-linux-Implement-partial-support-for-ppc64-sy.patch

+ Patch358: ppc64le/sandbox/0001-sandbox-linux-Update-IsSyscallAllowed-in-broker_proc.patch

+ Patch359: ppc64le/sandbox/0001-sandbox-linux-Update-syscall-helpers-lists-for-ppc64.patch

+ Patch360: ppc64le/sandbox/0002-sandbox-linux-bpf_dsl-Modify-seccomp_macros-to-add-s.patch

+ Patch361: ppc64le/sandbox/0003-sandbox-linux-system_headers-Update-linux-seccomp-he.patch

+ Patch362: ppc64le/sandbox/0004-sandbox-linux-system_headers-Update-linux-signal-hea.patch

+ Patch363: ppc64le/sandbox/0005-sandbox-linux-seccomp-bpf-Add-ppc64-syscall-stub.patch

+ Patch364: ppc64le/sandbox/0005-sandbox-linux-update-unit-test-for-ppc64.patch

+ Patch365: ppc64le/sandbox/0006-sandbox-linux-disable-timedwait-time64-ppc64.patch

+ Patch366: ppc64le/sandbox/0007-sandbox-linux-add-ppc64-stat.patch

+ Patch367: ppc64le/sandbox/Sandbox-linux-services-credentials.cc-PPC.patch

+ Patch368: ppc64le/sandbox/0008-sandbox-fix-ppc64le-glibc234.patch

+ 

+ Patch369: ppc64le/third_party/0001-third_party-angle-Include-missing-header-cstddef-in-.patch

+ Patch370: ppc64le/third_party/0001-Add-PPC64-support-for-boringssl.patch

+ Patch371: ppc64le/third_party/0001-third_party-boringssl-Properly-detect-ppc64le-in-BUI.patch

+ Patch372: ppc64le/third_party/0001-third_party-libvpx-Properly-generate-gni-on-ppc64.patch

+ Patch373: ppc64le/third_party/0001-third_party-lss-Don-t-look-for-mmap2-on-ppc64.patch

+ Patch374: ppc64le/third_party/0001-third_party-pffft-Include-altivec.h-on-ppc64-with-SI.patch

+ Patch375: ppc64le/third_party/0002-third_party-lss-kernel-structs.patch

+ 

+ Patch376: ppc64le/webrtc/Rtc_base-system-arch.h-PPC.patch

+ 

+ Patch377: ppc64le/crashpad/0002-Include-cstddef-to-fix-build.patch

+ Patch378: ppc64le/third_party/0004-third_party-crashpad-port-curl-transport-ppc64.patch

+ 

+ Patch379: ppc64le/workarounds/HACK-third_party-libvpx-use-generic-gnu.patch

+ Patch380: ppc64le/workarounds/HACK-debian-clang-disable-skia-musttail.patch

+ 

+ Patch381: ppc64le/libaom/0001-Add-ppc64-target-to-libaom.patch

+ Patch382: ppc64le/libaom/0001-Add-pregenerated-config-for-libaom-on-ppc64.patch

+ 

+ Patch383: ppc64le/third_party/0002-third_party-libvpx-Remove-bad-ppc64-config.patch

+ Patch384: ppc64le/third_party/0002-third-party-boringssl-add-generated-files.patch

+ Patch385: ppc64le/third_party/0003-third_party-libvpx-Add-ppc64-generated-config.patch

+ # Enabling VSX causes artifacts to appear in VP9 videos

+ # Patch386: ppc64le/third_party/0003-third_party-libvpx-Add-ppc64-vsx-files.patch

+ Patch387: ppc64le/third_party/0003-third_party-ffmpeg-Add-ppc64-generated-config.patch

+ Patch388: ppc64le/third_party/0004-third_party-libvpx-work-around-ambiguous-vsx.patch

+ 

+ # Enable VSX acceleration in Skia. Requires POWER8 or higher.

+ Patch389: ppc64le/third_party/skia-vsx-instructions.patch

+ 

+ Patch390: ppc64le/ffmpeg/0001-Add-support-for-ppc64.patch

+ Patch391: ppc64le/breakpad/0001-Implement-support-for-ppc64-on-Linux.patch

+ Patch392: ppc64le/crashpad/0001-Implement-support-for-PPC64-on-Linux.patch

+ Patch393: ppc64le/database/0001-Properly-detect-little-endian-PPC64-systems.patch

+ Patch394: ppc64le/third_party/0001-Force-baseline-POWER8-AltiVec-VSX-CPU-features-when-.patch

+ Patch395: ppc64le/fixes/fix-breakpad-compile.patch

+ Patch396: ppc64le/fixes/fix-partition-alloc-compile.patch

+ Patch397: ppc64le/v8/0002-Add-ppc64-trap-instructions.patch

+ Patch398: ppc64le/third_party/0001-Fix-highway-ppc-hwcap.patch

+ 

+ Patch399: ppc64le/third_party/0001-Add-PPC64-support-for-libdav1d.patch

+ Patch400: ppc64le/third_party/0001-Fix-libdav1d-compilation-on-clang-ppc.patch

+ Patch401: ppc64le/sandbox/fix-ppc64-linux-syscalls-headers.patch

+ Patch402: ppc64le/third_party/0003-thirdparty-fix-dav1d-gn.patch

+ Patch403: ppc64le/third_party/use-sysconf-page-size-on-ppc64.patch

+ 

+ Patch404: ppc64le/third_party/dawn-fix-typos.patch

+ Patch405: ppc64le/third_party/dawn-fix-ppc64le-detection.patch

+ 

+ # Suppress harmless compiler warning messages that appear on ppc64 due to arch-specific warning flags being passed

+ Patch406: ppc64le/fixes/fix-unknown-warning-option-messages.patch

+ 

+ # While POWER8 remains the build target

+ # POWER9 enables hardware 128 bit vector support (ISA 3.0),

+ # and Highway gets confused when building in POWER8 mode

+ # (POWER8 compiler flags) on POWER9 hosts.

+ Patch407: ppc64le/third_party/0002-Highway-disable-128-bit-vsx.patch

+ 

+ # These patches enable full POWER ISA 3.0 (POWER9) acceleration when applied

+ # They will not work on POWER8 (ISA 2.07) or below

+ Patch408: ppc64le/core/baseline-isa-3-0.patch

+ 

+ Patch409: ppc64le/fixes/fix-swiftshader-compile.patch

+ 

+ # Patches taken from https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/chromium-116.0.5845.96.ebuild

+ Patch410: ppc64le/third_party/0005-chromium-ppc64-libpng.patch

+ Patch411: ppc64le/third_party/0005-libpng-pdfium-compile-98.patch

+ 

+ 

  # Use chromium-latest.py to generate clean tarball from released build tarballs, found here:

  # http://build.chromium.org/buildbot/official/

  # For Chromium Fedora use chromium-latest.py --stable --ffmpegclean --ffmpegarm
@@ -404,10 +502,18 @@ 

  Source11: chrome-remote-desktop@.service

  Source13: master_preferences

  

- # RHEL 8 needs newer nodejs

- %if 0%{?rhel} == 8

- Source19: https://nodejs.org/dist/latest-v16.x/node-%{nodejs_version}-linux-x64.tar.xz

- Source21: https://nodejs.org/dist/latest-v16.x/node-%{nodejs_version}-linux-arm64.tar.xz

+ %if %{use_nodesource_binary}

+ Source19: https://nodejs.org/dist/${nodejs_version}/node-%{nodejs_version}-linux-x64.tar.xz

+ Source20: https://nodejs.org/dist/${nodejs_version}/node-%{nodejs_version}-linux-arm64.tar.xz

+ Source21: https://nodejs.org/dist/${nodejs_version}/node-%{nodejs_version}-linux-ppc64le.tar.xz

+ %endif

+ 

+ %if 0%{?fedora}

+ BuildRequires: golang-github-evanw-esbuild-%{esbuild_version}

+ %else

+ Source22: https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-%{esbuild_version}.tgz

+ Source23: https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-%{esbuild_version}.tgz

+ Source24: https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-%{esbuild_version}.tgz

  %endif

  

  %if %{clang}
@@ -504,10 +610,7 @@ 

  %endif

  %endif

  

- # RHEL 8 needs newer nodejs

- %if 0%{?rhel} == 8

- # nothing

- %else

+ %if ! %{use_nodesource_binary}

  BuildRequires: nodejs

  %endif

  
@@ -532,7 +635,7 @@ 

  BuildRequires: libstdc++-static

  %endif

  

- # Fedora tries to use system libs whenever it can.

+ ## Fedora tries to use system libs whenever it can.

  BuildRequires:	bzip2-devel

  BuildRequires:	dbus-glib-devel

  # For eu-strip
@@ -678,15 +781,14 @@ 

  

  Requires: chromium-common%{_isa} = %{version}-%{release}

  

- # rhel 7: ia32 x86_64

- # rhel 8+: ia32, x86_64, aarch64

- # fedora 32 or older: ia32, x86_64, aarch64

- # fedora 33+: x86_64 aarch64 only

+ # rhel 7: x86_64

+ # fedora 37 or older: x86_64, aarch64

+ # fedora 38 or newer: x86_64, aarch64, ppc64le

  %if 0%{?rhel} == 7

  ExclusiveArch: x86_64

  %else

- %if 0%{?fedora} > 32

- ExclusiveArch: x86_64 aarch64

+ %if 0%{?fedora} >= 38

+ ExclusiveArch: x86_64 aarch64 ppc64le

  %else

  ExclusiveArch: x86_64 aarch64

  %endif
@@ -987,30 +1089,135 @@ 

  %endif 

  %endif

  

+ %ifarch ppc64le

+ cp %{_sourcedir}/ppc64le/**/*.patch %{_sourcedir}/

+ 

+ %patch -P353 -p1 -b .ppc64le_sandbox_0001-linux-seccomp-bpf-ppc64-glibc-workaround-in-SIGSYS-h

+ %patch -P354 -p1 -b .ppc64le_sandbox_0001-sandbox-Enable-seccomp_bpf-for-ppc64

+ %patch -P355 -p1 -b .ppc64le_sandbox_0001-services-service_manager-sandbox-linux-Fix-TCGETS-de

+ %patch -P356 -p1 -b .ppc64le_sandbox_0001-sandbox-linux-bpf_dsl-Update-syscall-ranges-for-ppc6

+ %patch -P357 -p1 -b .ppc64le_sandbox_0001-sandbox-linux-Implement-partial-support-for-ppc64-sy

+ %patch -P358 -p1 -b .ppc64le_sandbox_0001-sandbox-linux-Update-IsSyscallAllowed-in-broker_proc

+ %patch -P359 -p1 -b .ppc64le_sandbox_0001-sandbox-linux-Update-syscall-helpers-lists-for-ppc64

+ %patch -P360 -p1 -b .ppc64le_sandbox_0002-sandbox-linux-bpf_dsl-Modify-seccomp_macros-to-add-s

+ %patch -P361 -p1 -b .ppc64le_sandbox_0003-sandbox-linux-system_headers-Update-linux-seccomp-he

+ %patch -P362 -p1 -b .ppc64le_sandbox_0004-sandbox-linux-system_headers-Update-linux-signal-hea

+ %patch -P363 -p1 -b .ppc64le_sandbox_0005-sandbox-linux-seccomp-bpf-Add-ppc64-syscall-stub

+ %patch -P364 -p1 -b .ppc64le_sandbox_0005-sandbox-linux-update-unit-test-for-ppc64

+ %patch -P365 -p1 -b .ppc64le_sandbox_0006-sandbox-linux-disable-timedwait-time64-ppc64

+ %patch -P366 -p1 -b .ppc64le_sandbox_0007-sandbox-linux-add-ppc64-stat

+ %patch -P367 -p1 -b .ppc64le_sandbox_Sandbox-linux-services-credentials.cc-PPC

+ %patch -P368 -p1 -b .ppc64le_sandbox_0008-sandbox-fix-ppc64le-glibc234

+ 

+ %patch -P369 -p1 -b .ppc64le_third_party_0001-third_party-angle-Include-missing-header-cstddef-in-

+ %patch -P370 -p1 -b .ppc64le_third_party_0001-Add-PPC64-support-for-boringssl

+ %patch -P371 -p1 -b .ppc64le_third_party_0001-third_party-boringssl-Properly-detect-ppc64le-in-BUI

+ %patch -P372 -p1 -b .ppc64le_third_party_0001-third_party-libvpx-Properly-generate-gni-on-ppc64

+ %patch -P373 -p1 -b .ppc64le_third_party_0001-third_party-lss-Don-t-look-for-mmap2-on-ppc64

+ %patch -P374 -p1 -b .ppc64le_third_party_0001-third_party-pffft-Include-altivec.h-on-ppc64-with-SI

+ %patch -P375 -p1 -b .ppc64le_third_party_0002-third_party-lss-kernel-structs

+ 

+ %patch -P376 -p1 -b .ppc64le_webrtc_Rtc_base-system-arch.h-PPC

+ 

+ %patch -P377 -p1 -b .ppc64le_crashpad_0002-Include-cstddef-to-fix-build

+ %patch -P378 -p1 -b .ppc64le_third_party_0004-third_party-crashpad-port-curl-transport-ppc64

+ 

+ %patch -P379 -p1 -b .ppc64le_workarounds_HACK-third_party-libvpx-use-generic-gnu

+ %patch -P380 -p1 -b .ppc64le_workarounds_HACK-debian-clang-disable-skia-musttail

+ 

+ %patch -P381 -p1 -b .ppc64le_libaom_0001-Add-ppc64-target-to-libaom

+ %patch -P382 -p1 -b .ppc64le_libaom_0001-Add-pregenerated-config-for-libaom-on-ppc64

+ 

+ %patch -P383 -p1 -b .ppc64le_third_party_0002-third_party-libvpx-Remove-bad-ppc64-config

+ %patch -P384 -p1 -b .ppc64le_third_party_0002-third-party-boringssl-add-generated-files

+ %patch -P385 -p1 -b .ppc64le_third_party_0003-third_party-libvpx-Add-ppc64-generated-config

+ # %patch -P386 -p1 -b .ppc64le_third_party_0003-third_party-libvpx-Add-ppc64-vsx-files

+ %patch -P387 -p1 -b .ppc64le_third_party_0003-third_party-ffmpeg-Add-ppc64-generated-config

+ %patch -P388 -p1 -b .ppc64le_third_party_0004-third_party-libvpx-work-around-ambiguous-vsx

+ 

+ %patch -P389 -p1 -b .ppc64le_third_party_skia-vsx-instructions

+ 

+ %patch -P390 -p1 -b .ppc64le_ffmpeg_0001-Add-support-for-ppc64

+ %patch -P391 -p1 -b .ppc64le_breakpad_0001-Implement-support-for-ppc64-on-Linux

+ %patch -P392 -p1 -b .ppc64le_crashpad_0001-Implement-support-for-PPC64-on-Linux

+ %patch -P393 -p1 -b .ppc64le_database_0001-Properly-detect-little-endian-PPC64-systems

+ %patch -P394 -p1 -b .ppc64le_third_party_0001-Force-baseline-POWER8-AltiVec-VSX-CPU-features-when-

+ %patch -P395 -p1 -b .ppc64le_fixes_fix-breakpad-compile

+ %patch -P396 -p1 -b .ppc64le_fixes_fix-partition-alloc-compile

+ %patch -P397 -p1 -b .ppc64le_v8_0002-Add-ppc64-trap-instructions

+ %patch -P398 -p1 -b .ppc64le_third_party_0001-Fix-highway-ppc-hwcap

+ 

+ %patch -P399 -p1 -b .ppc64le_third_party_0001-Add-PPC64-support-for-libdav1d

+ %patch -P400 -p1 -b .ppc64le_third_party_0001-Fix-libdav1d-compilation-on-clang-ppc

+ %patch -P401 -p1 -b .ppc64le_sandbox_fix-ppc64-linux-syscalls-headers

+ %patch -P402 -p1 -b .ppc64le_third_party_0003-thirdparty-fix-dav1d-gn

+ %patch -P403 -p1 -b .ppc64le_third_party_use-sysconf-page-size-on-ppc64

+ 

+ %patch -P404 -p1 -b .ppc64le_third_party_dawn-fix-typos

+ %patch -P405 -p1 -b .ppc64le_third_party_dawn-fix-ppc64le-detection

+ 

+ %patch -P406 -p1 -b .ppc64le_fixes_fix-unknown-warning-option-messages

+ 

+ %patch -P407 -p1 -b .ppc64le_third_party_0002-Highway-disable-128-bit-vsx

+ 

+ # Uncomment this line when the distro officially cease support for POWER8

+ # %patch -P408 -p1 -b .ppc64le_core_baseline-isa-3-0

+ 

+ %patch -P409 -p1 -b .ppc64le_fixes_fix-swiftshader-compile

+ 

+ %if %{bundlelibpng}

+ %patch -P410 -p1 -b .ppc64le_third_party_0005-chromium-ppc64-libpng

+ %patch -P411 -p1 -b .ppc64le_third_party_0005-libpng-pdfium-compile-98

+ %endif

+ 

+ %endif

  

  # Change shebang in all relevant files in this directory and all subdirectories

  # See `man find` for how the `-exec command {} +` syntax works

  find -type f \( -iname "*.py" \) -exec sed -i '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} +

  

- 

- %if 0%{?rhel} == 8

+ %if %{use_nodesource_binary}

    pushd third_party/node/linux

- %ifarch x86_64

-   tar xf %{SOURCE19}

-   mv node-%{nodejs_version}-linux-x64 node-linux-x64

- %endif

- %ifarch aarch64

-   tar xf %{SOURCE21}

-   mv node-%{nodejs_version}-linux-arm64 node-linux-arm64

-   # This is weird, but whatever

-   ln -s node-linux-arm64 node-linux-x64

- %endif

- popd

+   %ifarch x86_64

+     tar xf %{SOURCE19}

+     mv node-%{nodejs_version}-linux-x64 node-linux-x64

+   %endif

+   %ifarch aarch64

+     tar xf %{SOURCE20}

+     mv node-%{nodejs_version}-linux-arm64 node-linux-arm64

+     # This is weird, but whatever

+     ln -s node-linux-arm64 node-linux-x64

+   %endif

+   %ifarch ppc64le

+     tar xf %{SOURCE21}

+     mv node-%{nodejs_version}-linux-ppc64le node-linux-ppc64le

+     # This is weird, but whatever

+     ln -s node-linux-ppc64le node-linux-x64

+   %endif

+   popd

  %else

+   # use system nodejs

    mkdir -p third_party/node/linux/node-linux-x64/bin

    ln -s %{_bindir}/node third_party/node/linux/node-linux-x64/bin/node

  %endif

  

+ # Get rid of the bundled esbuild, it only support x86_64

+ %if 0%{?fedora}

+   ln -sf %{_bindir}/esbuild third_party/devtools-frontend/src/third_party/esbuild/esbuild

+ %else

+   pushd third_party/devtools-frontend/src/third_party/esbuild/

+   %ifarch x86_64

+     tar -zxf %{SOURCE22} --directory %{_tmppath}

+   %endif

+   %ifarch aarch64

+     tar -zxf %{SOURCE23} --directory %{_tmppath}

+   %endif

+   %ifarch ppc64le

+     tar -zxf %{SOURCE24} --directory %{_tmppath}

+   %endif

+   mv %{_tmppath}/package/bin/esbuild third_party/devtools-frontend/src/third_party/esbuild/esbuild

+ %endif

+ 

  # Get rid of the pre-built eu-strip binary, it is x86_64 and of mysterious origin

  rm -rf buildtools/third_party/eu-strip/bin/eu-strip

    
@@ -1145,6 +1352,10 @@ 

  CHROMIUM_CORE_GN_DEFINES+=' target_cpu="arm64"'

  %endif

  

+ %ifarch ppc64le

+ CHROMIUM_CORE_GN_DEFINES+=' target_cpu="ppc64"'

+ %endif

+ 

  CHROMIUM_CORE_GN_DEFINES+=' icu_use_data_file=true'

  CHROMIUM_CORE_GN_DEFINES+=' target_os="linux"'

  CHROMIUM_CORE_GN_DEFINES+=' current_os="linux"'
@@ -1351,7 +1562,7 @@ 

  pushd %{builddir}

  	cp -a chrom*.pak resources.pak icudtl.dat %{buildroot}%{chromium_path}

  	cp -a locales/*.pak %{buildroot}%{chromium_path}/locales/

- 	%ifarch x86_64 aarch64

+ 	%ifarch x86_64 aarch64 ppc64le

  		cp -a libvk_swiftshader.so %{buildroot}%{chromium_path}

  		strip %{buildroot}%{chromium_path}/libvk_swiftshader.so

  		cp -a libvulkan.so.1 %{buildroot}%{chromium_path}
@@ -1386,12 +1597,18 @@ 

  	%if %{build_clear_key_cdm}

  		%ifarch x86_64

  			cp -a ClearKeyCdm/_platform_specific/linux_x64/libclearkeycdm.so %{buildroot}%{chromium_path}

- 		%else

- 			%ifarch aarch64

- 				cp -a ClearKeyCdm/_platform_specific/linux_arm64/libclearkeycdm.so %{buildroot}%{chromium_path}

- 			%else

- 				cp -a libclearkeycdm.so %{buildroot}%{chromium_path}

- 			%endif

+ 		%endif

+ 

+ 		%ifarch aarch64

+ 			cp -a ClearKeyCdm/_platform_specific/linux_arm64/libclearkeycdm.so %{buildroot}%{chromium_path}

+ 		%endif

+ 

+ 		%ifarch ppc64le

+ 			cp -a ClearKeyCdm/_platform_specific/linux_ppc64/libclearkeycdm.so %{buildroot}%{chromium_path}

+ 		%endif

+ 

+ 		%ifnarch x86_64 aarch64 ppc64le

+ 			cp -a libclearkeycdm.so %{buildroot}%{chromium_path}

  		%endif

  		strip %{buildroot}%{chromium_path}/libclearkeycdm.so

  	%endif
@@ -1561,7 +1778,7 @@ 

  %if %{build_clear_key_cdm}

  %{chromium_path}/libclearkeycdm.so

  %endif

- %ifarch x86_64 aarch64

+ %ifarch x86_64 aarch64 ppc64le

  %{chromium_path}/libvk_swiftshader.so*

  %{chromium_path}/libvulkan.so*

  %{chromium_path}/vk_swiftshader_icd.json
@@ -1668,11 +1885,16 @@ 

  %{chromium_path}/chromedriver

  

  %changelog

+ * Mon Sep 11 2023 Trung Lê <8@tle.id.au> - 116.0.5845.179-2

+ - use Node LTS 18.17.1 instead of non-LTS 19.8.1

+ - use SHA256 checksums for NodeJS sources

+ - support PowerPC64 LE

+ 

  * Fri Sep 08 2023 Than Ngo <than@redhat.com> - 116.0.5845.179-1

  - update to 116.0.5845.179

  

  * Tue Aug 15 2023 Than Ngo <than@redhat.com> - 116.0.5845.96-1

- - update to 116.0.5845.96 

+ - update to 116.0.5845.96

  

  * Wed Aug 09 2023 Than Ngo <than@redhat.com> - 115.0.5790.170-2

  - set use_all_cpus=1 for aarch64
@@ -3140,4 +3362,3 @@ 

  

  * Mon Sep 9 2013 Tomas Popela <tpopela@redhat.com> 29.0.1547.65-1

  - Initial version based on Tom Callaway's <spot@fedoraproject.org> work

- 

@@ -0,0 +1,728 @@ 

+ From cda9400739dfa064907d822f00578bb51b24a404 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Fri, 17 Aug 2018 14:18:33 -0500

+ Subject: [PATCH] Implement support for ppc64 on Linux

+ 

+ This patch implements support for the ppc64 architecture on Linux systems.

+ 

+ Notable changes include:

+ * Modification of tests to support non-4K page sizes

+ * minidump_writer: Determine size of stack to capture based on page size

+ * dump_writer_common: Introduce member function GetVectorRegisters to

+   ThreadInfo on ppc64 systems. This allows Altivec/VMX registers to be

+   dumped like they are on OS X. linux_ptrace_dumper has been updated

+   to utilize this function along with the ptrace mode NT_PPC_VMX.

+ * processor/exploitability_unittest.cc: Tests were disabled on

+   non-x86 systems. They assume the system objdump is capable of

+   disassembling x86 binaries which is not the case on other

+   architectures.

+ 

+ To-do:

+ * tools/linux/md2core has been updated as well, but functionality

+   has not been confirmed and restoration of Altivec/VMX registers

+   has not been implemented

+ 

+ Note that proper functionality depends on updates to third_party/LSS

+ that introduce PPC64 support. An in-progress patch that allows

+ breakpad to build and run successfully is available at:

+ https://wiki.raptorcs.com/wiki/Porting/Chromium

+ ---

+  .../dump_writer_common/raw_context_cpu.h      |  2 +

+  .../linux/dump_writer_common/thread_info.cc   | 56 ++++++++++++++++++-

+  .../linux/dump_writer_common/thread_info.h    |  9 +++

+  .../dump_writer_common/ucontext_reader.cc     | 42 ++++++++++++++

+  .../dump_writer_common/ucontext_reader.h      |  3 +

+  src/client/linux/handler/exception_handler.cc | 22 +++++++-

+  src/client/linux/handler/exception_handler.h  |  6 +-

+  .../handler/exception_handler_unittest.cc     |  8 ++-

+  .../microdump_writer/microdump_writer.cc      | 14 ++++-

+  .../microdump_writer_unittest.cc              | 15 ++++-

+  .../minidump_writer/linux_core_dumper.cc      |  8 ++-

+  .../linux/minidump_writer/linux_dumper.cc     |  4 +-

+  .../linux/minidump_writer/linux_dumper.h      |  3 +-

+  .../linux_dumper_unittest_helper.cc           |  2 +

+  .../minidump_writer/linux_ptrace_dumper.cc    | 19 +++++--

+  .../linux_ptrace_dumper_unittest.cc           |  5 ++

+  .../linux/minidump_writer/minidump_writer.cc  | 18 ++++--

+  .../linux/minidump_writer/minidump_writer.h   |  2 +

+  .../minidump_writer_unittest.cc               |  3 +

+  src/common/linux/memory_mapped_file.cc        |  3 +-

+  .../linux/memory_mapped_file_unittest.cc      |  7 ++-

+  src/common/memory_allocator_unittest.cc       |  3 +-

+  src/processor/exploitability_linux.cc         |  2 +

+  src/processor/exploitability_unittest.cc      | 15 +++--

+  src/tools/linux/md2core/minidump-2-core.cc    | 45 +++++++++++++++

+  25 files changed, 281 insertions(+), 35 deletions(-)

+ 

+ --- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h

+ +++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h

+ @@ -51,6 +51,8 @@ typedef MDRawContextRISCV64 RawContextCP

+  # else

+  #  error "Unexpected __riscv_xlen"

+  # endif

+ +#elif defined(__powerpc64__)

+ +typedef MDRawContextPPC64 RawContextCPU;

+  #else

+  #error "This code has not been ported to your platform yet."

+  #endif

+ --- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc

+ @@ -336,7 +336,42 @@ void ThreadInfo::FillCPUContext(RawConte

+  #error "Unexpected __riscv_xlen"

+  #endif

+  }

+ -#endif  // __riscv

+ +

+ +#elif defined(__powerpc64__)

+ +

+ +uintptr_t ThreadInfo::GetInstructionPointer() const {

+ +    return mcontext.gp_regs[PT_NIP];

+ +}

+ +

+ +void ThreadInfo::FillCPUContext(RawContextCPU* out) const {

+ +    out->context_flags = MD_CONTEXT_PPC64_FULL;

+ +    for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)

+ +        out->gpr[i] = mcontext.gp_regs[i];

+ +

+ +    out->lr = mcontext.gp_regs[PT_LNK];

+ +    out->srr0 = mcontext.gp_regs[PT_NIP];

+ +    out->srr1 = mcontext.gp_regs[PT_MSR];

+ +    out->cr = mcontext.gp_regs[PT_CCR];

+ +    out->xer = mcontext.gp_regs[PT_XER];

+ +    out->ctr = mcontext.gp_regs[PT_CTR];

+ +    

+ +    for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)

+ +        out->float_save.fpregs[i] = mcontext.fp_regs[i];

+ +

+ +    out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];

+ +

+ +    for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)

+ +        out->vector_save.save_vr[i] = \

+ +            {(((uint64_t)vregs.vrregs[i][0]) << 32) 

+ +                          | vregs.vrregs[i][1], 

+ +            (((uint64_t)vregs.vrregs[i][2]) << 32)

+ +                         | vregs.vrregs[i][3]};

+ +

+ +    out->vrsave = vregs.vrsave;

+ +    out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};

+ +    out->vector_save.save_vrvalid = 0xFFFFFFFF; 

+ +}

+ +#endif  // __powerpc64__

+  

+  void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {

+    assert(gp_regs || size);

+ @@ -350,6 +385,11 @@ void ThreadInfo::GetGeneralPurposeRegist

+      *gp_regs = mcontext.__gregs;

+    if (size)

+      *size = sizeof(mcontext.__gregs);

+ +#elif defined(__powerpc64__)

+ +  if (gp_regs)

+ +    *gp_regs = mcontext.gp_regs;

+ +  if (size)

+ +    *size = sizeof(mcontext.gp_regs);

+  #else

+    if (gp_regs)

+      *gp_regs = &regs;

+ @@ -384,6 +424,11 @@ void ThreadInfo::GetFloatingPointRegiste

+  # else

+  #  error "Unexpected __riscv_flen"

+  # endif

+ +#elif defined(__powerpc64__)

+ +  if (fp_regs)

+ +    *fp_regs = &mcontext.fp_regs;

+ +  if (size)

+ +    *size = sizeof(mcontext.fp_regs);

+  #else

+    if (fp_regs)

+      *fp_regs = &fpregs;

+ @@ -392,4 +437,13 @@ void ThreadInfo::GetFloatingPointRegiste

+  #endif

+  }

+  

+ +#if defined(__powerpc64__)

+ +void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {

+ +    if (v_regs)

+ +        *v_regs = &vregs;

+ +    if (size)

+ +        *size = sizeof(vregs);

+ +}

+ +#endif

+ +

+  }  // namespace google_breakpad

+ --- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h

+ +++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h

+ @@ -67,6 +67,10 @@ struct ThreadInfo {

+    // Use the structures defined in <sys/user.h>

+    struct user_regs_struct regs;

+    struct user_fpsimd_struct fpregs;

+ +#elif defined(__powerpc64__)

+ +  // Use the structures defined in <sys/ucontext.h>.

+ +  mcontext_t mcontext;

+ +  struct _libc_vrstate vregs;

+  #elif defined(__mips__) || defined(__riscv)

+    // Use the structure defined in <sys/ucontext.h>.

+    mcontext_t mcontext;

+ @@ -83,6 +87,11 @@ struct ThreadInfo {

+  

+    // Returns the pointer and size of float point register area.

+    void GetFloatingPointRegisters(void** fp_regs, size_t* size);

+ +

+ +#if defined(__powerpc64__)

+ +  // Returns the pointer and size of the vector register area. (PPC64 only)

+ +  void GetVectorRegisters(void** v_regs, size_t* size);

+ +#endif

+  };

+  

+  }  // namespace google_breakpad

+ --- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc

+ @@ -324,6 +324,48 @@ void UContextReader::FillCPUContext(RawC

+  #error "Unexpected __riscv_xlen"

+  #endif

+  }

+ +

+ +#elif defined(__powerpc64__)

+ +

+ +uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {

+ +    return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];

+ +}

+ +

+ +uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {

+ +    return uc->uc_mcontext.gp_regs[PT_NIP];

+ +}

+ +

+ +void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,

+ +                                    const struct _libc_vrstate* vregs) {

+ +    out->context_flags = MD_CONTEXT_PPC64_FULL;

+ +

+ +    for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)

+ +        out->gpr[i] = uc->uc_mcontext.gp_regs[i];

+ +

+ +    out->lr = uc->uc_mcontext.gp_regs[PT_LNK];    

+ +    out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];

+ +    out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];

+ +    out->cr = uc->uc_mcontext.gp_regs[PT_CCR];

+ +    out->xer = uc->uc_mcontext.gp_regs[PT_XER];

+ +    out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];

+ +    

+ +    for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)

+ +        out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];

+ +

+ +    out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];

+ +

+ +    for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)

+ +        out->vector_save.save_vr[i] =

+ +            {(((uint64_t)vregs->vrregs[i][0]) << 32) 

+ +                         | vregs->vrregs[i][1], 

+ +             (((uint64_t)vregs->vrregs[i][2]) << 32)

+ +                         | vregs->vrregs[i][3]};

+ +

+ +    out->vrsave = vregs->vrsave;

+ +    out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};

+ +    out->vector_save.save_vrvalid = 0xFFFFFFFF; 

+ +}

+ +

+  #endif

+  

+  }  // namespace google_breakpad

+ --- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h

+ +++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h

+ @@ -54,6 +54,9 @@ struct UContextReader {

+  #elif defined(__aarch64__)

+    static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,

+                               const struct fpsimd_context* fpregs);

+ +#elif defined(__powerpc64__)

+ +  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,

+ +                             const struct _libc_vrstate* vregs);

+  #else

+    static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);

+  #endif

+ --- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc

+ @@ -464,6 +464,13 @@ bool ExceptionHandler::HandleSignal(int

+      memcpy(&g_crash_context_.float_state, fp_ptr,

+             sizeof(g_crash_context_.float_state));

+    }

+ +#elif defined(__powerpc64__)

+ +  // On PPC64, we must copy VR state

+ +  ucontext_t* uc_ptr = (ucontext_t*)uc;

+ +  if (uc_ptr->uc_mcontext.v_regs) {

+ +    memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,

+ +           sizeof(g_crash_context_.vector_state));

+ +  }

+  #elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+    ucontext_t* uc_ptr = (ucontext_t*)uc;

+    if (uc_ptr->uc_mcontext.fpregs) {

+ @@ -701,10 +708,18 @@ bool ExceptionHandler::WriteMinidump() {

+    }

+  #endif

+  

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE && !defined(__aarch64__)

+ +#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE && !defined(__aarch64__) \

+ +    && !defined(__powerpc64__)

+    memcpy(&context.float_state, context.context.uc_mcontext.fpregs,

+           sizeof(context.float_state));

+  #endif

+ +

+ +#if defined(__powerpc64__)

+ +  // Vector registers must be copied on PPC64

+ +  memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,

+ +         sizeof(context.vector_state));

+ +#endif

+ +

+    context.tid = sys_gettid();

+  

+    // Add an exception stream to the minidump for better reporting.

+ @@ -725,6 +740,9 @@ bool ExceptionHandler::WriteMinidump() {

+  #elif defined(__mips__)

+    context.siginfo.si_addr =

+        reinterpret_cast<void*>(context.context.uc_mcontext.pc);

+ +#elif defined(__powerpc64__)

+ +  context.siginfo.si_addr =

+ +      reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);

+  #elif defined(__riscv)

+    context.siginfo.si_addr =

+        reinterpret_cast<void*>(context.context.uc_mcontext.__gregs[REG_PC]);

+ --- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h

+ +++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h

+ @@ -200,7 +200,11 @@ class ExceptionHandler {

+      siginfo_t siginfo;

+      pid_t tid;  // the crashing thread.

+      ucontext_t context;

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +    // PPC64's FP state is a part of ucontext_t like MIPS but the vector

+ +    // state is not, so a struct is needed.

+ +    vstate_t vector_state;

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+      fpstate_t float_state;

+  #endif

+    };

+ --- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc

+ @@ -321,7 +321,7 @@ TEST(ExceptionHandlerTest, ParallelChild

+        ASSERT_EQ(SIGSEGV, WTERMSIG(status));

+        return;

+      } else {

+ -      usleep(100000);

+ +      usleep(200000);

+      }

+    }

+  

+ @@ -576,6 +576,8 @@ const unsigned char kIllegalInstruction[

+  #if defined(__mips__)

+    // mfc2 zero,Impl - usually illegal in userspace.

+    0x48, 0x00, 0x00, 0x48

+ +#elif defined(__powerpc64__)

+ +  0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu

+  #else

+    // This crashes with SIGILL on x86/x86-64/arm.

+    0xff, 0xff, 0xff, 0xff

+ @@ -771,10 +773,10 @@ TEST(ExceptionHandlerTest, InstructionPo

+  

+    // These are defined here so the parent can use them to check the

+    // data from the minidump afterwards.

+ -  // Use 4k here because the OS will hand out a single page even

+ +  // Use the page size here because the OS will hand out a single page even

+    // if a smaller size is requested, and this test wants to

+    // test the upper bound of the memory range.

+ -  const uint32_t kMemorySize = 4096;  // bytes

+ +  const uint32_t kMemorySize = getpagesize();  // bytes

+    const int kOffset = kMemorySize - sizeof(kIllegalInstruction);

+  

+    const pid_t child = fork();

+ --- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc

+ @@ -141,7 +141,9 @@ class MicrodumpWriter {

+                    const MicrodumpExtraInfo& microdump_extra_info,

+                    LinuxDumper* dumper)

+        : ucontext_(context ? &context->context : NULL),

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +        vector_state_(context ? &context->vector_state : NULL),

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+          float_state_(context ? &context->float_state : NULL),

+  #endif

+          dumper_(dumper),

+ @@ -348,6 +350,8 @@ class MicrodumpWriter {

+  # else

+  #  error "Unexpected __riscv_xlen"

+  # endif

+ +#elif defined(__powerpc64__)

+ +    const char kArch[] = "ppc64";

+  #else

+  # error "This code has not been ported to your platform yet"

+  #endif

+ @@ -420,7 +424,9 @@ class MicrodumpWriter {

+    void DumpCPUState() {

+      RawContextCPU cpu;

+      my_memset(&cpu, 0, sizeof(RawContextCPU));

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +    UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+      UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);

+  #else

+      UContextReader::FillCPUContext(&cpu, ucontext_);

+ @@ -616,7 +622,9 @@ class MicrodumpWriter {

+    void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }

+  

+    const ucontext_t* const ucontext_;

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +  const google_breakpad::vstate_t* const vector_state_;

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+    const google_breakpad::fpstate_t* const float_state_;

+  #endif

+    LinuxDumper* dumper_;

+ --- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc

+ @@ -282,10 +282,19 @@ TEST(MicrodumpWriterTest, BasicWithMappi

+    CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);

+    ASSERT_TRUE(ContainsMicrodump(buf));

+  

+ +  int page_size = getpagesize();

+  #ifdef __LP64__

+ -  ASSERT_NE(std::string::npos,

+ -            buf.find("M 0000000000001000 000000000000002A 0000000000001000 "

+ -                     "33221100554477668899AABBCCDDEEFF0 libfoo.so"));

+ +  // This test is only available for the following page sizes

+ +  ASSERT_TRUE((page_size == 4096) || (page_size == 65536));

+ +  if (page_size == 4096) { 

+ +    ASSERT_NE(std::string::npos,

+ +              buf.find("M 0000000000001000 000000000000002A 0000000000001000 "

+ +                       "33221100554477668899AABBCCDDEEFF0 libfoo.so"));

+ +  } else {

+ +    ASSERT_NE(std::string::npos,

+ +              buf.find("M 0000000000010000 000000000000002A 0000000000010000 "

+ +                       "33221100554477668899AABBCCDDEEFF0 libfoo.so"));

+ +  }

+  #else

+    ASSERT_NE(std::string::npos,

+              buf.find("M 00001000 0000002A 00001000 "

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc

+ @@ -118,6 +118,9 @@ bool LinuxCoreDumper::GetThreadInfoByInd

+  #elif defined(__riscv)

+      stack_pointer = reinterpret_cast<uint8_t*>(

+          info->mcontext.__gregs[MD_CONTEXT_RISCV_REG_SP]);

+ +#elif defined(__powerpc64__)

+ +  stack_pointer =

+ +      reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);

+  #else

+  # error "This code hasn't been ported to your platform yet."

+  #endif

+ @@ -213,7 +216,10 @@ bool LinuxCoreDumper::EnumerateThreads()

+          memset(&info, 0, sizeof(ThreadInfo));

+          info.tgid = status->pr_pgrp;

+          info.ppid = status->pr_ppid;

+ -#if defined(__mips__)

+ +#if defined(__powerpc64__)

+ +        for (int i = 0; i < 31; i++)

+ +            info.mcontext.gp_regs[i] = status->pr_reg[i];

+ +#elif defined(__mips__)

+  # if defined(__ANDROID__)

+          for (int i = EF_R0; i <= EF_R31; i++)

+            info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc

+ @@ -770,7 +770,9 @@ bool LinuxDumper::GetStackInfo(const voi

+        reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));

+  

+    // The number of bytes of stack which we try to capture.

+ -  static const ptrdiff_t kStackToCapture = 32 * 1024;

+ +  // This now depends on page_size to avoid missing data

+ +  // on systems with larger page sizes.

+ +  static const ptrdiff_t kStackToCapture = 8 * page_size;

+  

+    const MappingInfo* mapping = FindMapping(stack_pointer);

+    if (!mapping)

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h

+ @@ -64,7 +64,8 @@ namespace google_breakpad {

+  typedef Elf32_auxv_t elf_aux_entry;

+  #elif defined(__x86_64) || defined(__aarch64__) || \

+       (defined(__mips__) && _MIPS_SIM != _ABIO32) || \

+ -     (defined(__riscv) && __riscv_xlen == 64)

+ +     (defined(__riscv) && __riscv_xlen == 64) || \

+ +     defined(__powerpc64__)

+  typedef Elf64_auxv_t elf_aux_entry;

+  #endif

+  

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc

+ @@ -56,6 +56,8 @@

+  #define TID_PTR_REGISTER "$1"

+  #elif defined(__riscv)

+  #define TID_PTR_REGISTER "x4"

+ +#elif defined(__powerpc64__)

+ +#define TID_PTR_REGISTER "r8"

+  #else

+  #error This test has not been ported to this platform.

+  #endif

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc

+ @@ -152,19 +152,27 @@ bool LinuxPtraceDumper::CopyFromProcess(

+    return true;

+  }

+  

+ -bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)

+ -{

+ +bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {

+  #ifdef PTRACE_GETREGSET

+    struct iovec io;

+    info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);

+ -  if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {

+ +  if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {

+      return false;

+    }

+  

+    info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);

+ -  if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {

+ +  if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {

+      return false;

+    }

+ +

+ +#if defined(__powerpc64__)

+ +  // Grab the vector registers on PPC64 too

+ +  info->GetVectorRegisters(&io.iov_base, &io.iov_len);

+ +  if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {

+ +    return false;

+ +  }

+ +#endif // defined(__powerpc64__)

+ +

+    return true;

+  #else

+    return false;

+ @@ -312,6 +320,9 @@ bool LinuxPtraceDumper::GetThreadInfoByI

+  #elif defined(__riscv)

+    stack_pointer = reinterpret_cast<uint8_t*>(

+        info->mcontext.__gregs[MD_CONTEXT_RISCV_REG_SP]);

+ +#elif defined(__powerpc64__)

+ +  stack_pointer =

+ +      reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);

+  #else

+  # error "This code hasn't been ported to your platform yet."

+  #endif

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc

+ @@ -470,6 +470,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackR

+  #elif defined(__riscv)

+      pid_t* process_tid_location =

+          reinterpret_cast<pid_t*>(one_thread.mcontext.__gregs[4]);

+ +#elif defined(__powerpc64__)

+ +    pid_t* process_tid_location =

+ +        reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);

+  #else

+  #error This test has not been ported to this platform.

+  #endif

+ @@ -569,6 +572,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeSt

+    uintptr_t heap_addr = thread_info.mcontext.gregs[1];

+  #elif defined(__riscv)

+    uintptr_t heap_addr = thread_info.mcontext.__gregs[4];

+ +#elif defined(__powerpc64__)

+ +  uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];

+  #else

+  #error This test has not been ported to this platform.

+  #endif

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc

+ @@ -144,7 +144,9 @@ class MinidumpWriter {

+        : fd_(minidump_fd),

+          path_(minidump_path),

+          ucontext_(context ? &context->context : NULL),

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +        vector_state_(context ? &context->vector_state : NULL),

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+          float_state_(context ? &context->float_state : NULL),

+  #endif

+          dumper_(dumper),

+ @@ -476,7 +478,9 @@ class MinidumpWriter {

+          if (!cpu.Allocate())

+            return false;

+          my_memset(cpu.get(), 0, sizeof(RawContextCPU));

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +        UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+          UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);

+  #else

+          UContextReader::FillCPUContext(cpu.get(), ucontext_);

+ @@ -953,7 +957,7 @@ class MinidumpWriter {

+      dirent->location.rva = 0;

+    }

+  

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)

+    bool WriteCPUInformation(MDRawSystemInfo* sys_info) {

+      char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};

+      static const char vendor_id_name[] = "vendor_id";

+ @@ -973,7 +977,9 @@ class MinidumpWriter {

+  

+      // processor_architecture should always be set, do this first

+      sys_info->processor_architecture =

+ -#if defined(__mips__)

+ +#if defined(__powerpc64__)

+ +        MD_CPU_ARCHITECTURE_PPC64;

+ +#elif defined(__mips__)

+  # if _MIPS_SIM == _ABIO32

+          MD_CPU_ARCHITECTURE_MIPS;

+  # elif _MIPS_SIM == _ABI64

+ @@ -1440,7 +1446,9 @@ class MinidumpWriter {

+    const char* path_;  // Path to the file where the minidum should be written.

+  

+    const ucontext_t* const ucontext_;  // also from the signal handler

+ -#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+ +#if defined(__powerpc64__)

+ +  const google_breakpad::vstate_t* const vector_state_;

+ +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE

+    const google_breakpad::fpstate_t* const float_state_;  // ditto

+  #endif

+    LinuxDumper* dumper_;

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h

+ @@ -47,6 +47,8 @@ class ExceptionHandler;

+  

+  #if defined(__aarch64__)

+  typedef struct fpsimd_context fpstate_t;

+ +#elif defined(__powerpc64__)

+ +typedef struct _libc_vrstate vstate_t;

+  #elif !defined(__ARM_EABI__) && !defined(__mips__)

+  typedef std::remove_pointer<fpregset_t>::type fpstate_t;

+  #endif

+ --- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc

+ +++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc

+ @@ -723,6 +723,9 @@ TEST(MinidumpWriterTest, InvalidStackPoi

+  #elif defined(__riscv)

+    context.context.uc_mcontext.__gregs[MD_CONTEXT_RISCV_REG_SP] =

+        invalid_stack_pointer;

+ +#elif defined(__powerpc64__)

+ +  context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =

+ +      invalid_stack_pointer;

+  #else

+  # error "This code has not been ported to your platform yet."

+  #endif

+ --- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc

+ +++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc

+ @@ -72,8 +72,7 @@ bool MemoryMappedFile::Map(const char* p

+  

+  #if defined(__x86_64__) || defined(__aarch64__) || \

+     (defined(__mips__) && _MIPS_SIM == _ABI64) || \

+ -   (defined(__riscv) && __riscv_xlen == 64)

+ -

+ +      (defined(__riscv) && __riscv_xlen == 64) || defined(__powerpc64__)

+    struct kernel_stat st;

+    if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {

+  #else

+ --- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc

+ +++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc

+ @@ -179,9 +179,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterM

+  TEST_F(MemoryMappedFileTest, MapWithOffset) {

+    // Put more data in the test file this time. Offsets can only be

+    // done on page boundaries, so we need a two page file to test this.

+ -  const int page_size = 4096;

+ -  char data1[2 * page_size];

+ -  size_t data1_size = sizeof(data1);

+ +  const int page_size = getpagesize();

+ +  char *data1 = static_cast<char*>(malloc(2 * page_size));

+ +  EXPECT_TRUE(data1 != NULL);

+ +  size_t data1_size = (2 * page_size);

+    for (size_t i = 0; i < data1_size; ++i) {

+      data1[i] = i & 0x7f;

+    }

+ --- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc

+ +++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc

+ @@ -60,8 +60,9 @@ TEST(PageAllocatorTest, LargeObject) {

+  

+    EXPECT_EQ(0U, allocator.pages_allocated());

+    uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));

+ +  uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());

+    ASSERT_FALSE(p == NULL);

+ -  EXPECT_EQ(3U, allocator.pages_allocated());

+ +  EXPECT_EQ(expected_pages, allocator.pages_allocated());

+    for (unsigned i = 1; i < 10; ++i) {

+      uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));

+      ASSERT_FALSE(p == NULL);

+ --- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc

+ +++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc

+ @@ -82,6 +82,8 @@

+    #define ELF_ARCH  EM_AARCH64

+  #elif defined(__riscv)

+    #define ELF_ARCH  EM_RISCV

+ +#elif defined(__powerpc64__)

+ +  #define ELF_ARCH  EM_PPC64

+  #endif

+  

+  #if defined(__arm__)

+ @@ -92,6 +94,8 @@ typedef user_regs user_regs_struct;

+  #elif defined (__mips__) || defined(__riscv)

+  // This file-local typedef simplifies the source code.

+  typedef gregset_t user_regs_struct;

+ +#elif defined(__powerpc64__)

+ +typedef struct pt_regs user_regs_struct;

+  #endif

+  

+  using google_breakpad::MDTypeHelper;

+ @@ -324,6 +328,9 @@ struct CrashedProcess {

+  #if defined(__aarch64__)

+      user_fpsimd_struct fpregs;

+  #endif

+ +#if defined(__powerpc64__)

+ +    mcontext_t mcontext;

+ +#endif

+      uintptr_t stack_addr;

+      const uint8_t* stack;

+      size_t stack_length;

+ @@ -599,6 +606,38 @@ ParseThreadRegisters(CrashedProcess::Thr

+  #error "Unexpected __riscv_xlen"

+  #endif

+  }

+ +#elif defined(__powerpc64__)

+ +static void

+ +ParseThreadRegisters(CrashedProcess::Thread* thread,

+ +                     const MinidumpMemoryRange& range) {

+ +  const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);

+ +

+ +  for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)

+ +    thread->mcontext.gp_regs[i] = rawregs->gpr[i];

+ +

+ +  thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;

+ +  thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;

+ +  thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;

+ +  thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;

+ +  thread->mcontext.gp_regs[PT_XER] = rawregs->xer;

+ +  thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;

+ +  thread->mcontext.v_regs->vrsave = rawregs->vrsave;

+ +

+ +  for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)

+ +      thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];

+ +

+ +  thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;

+ +

+ +  for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {

+ +      thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;

+ +      thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;

+ +      thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;

+ +      thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;

+ +  }

+ +

+ +  thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;

+ +}

+ +

+  #else

+  #error "This code has not been ported to your platform yet"

+  #endif

+ @@ -704,6 +743,12 @@ ParseSystemInfo(const Options& options,

+  # else

+  #  error "Unexpected __riscv_xlen"

+  # endif

+ +#elif defined(__powerpc64__)

+ +  if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {

+ +    fprintf(stderr,

+ +            "This version of minidump-2-core only supports PPC64.\n");

+ +    exit(1);

+ +  }

+  #else

+  #error "This code has not been ported to your platform yet"

+  #endif

@@ -0,0 +1,33 @@ 

+ --- a/build/config/compiler/BUILD.gn

+ +++ b/build/config/compiler/BUILD.gn

+ @@ -1250,7 +1250,7 @@

+          cflags += [ "-maix64" ]

+          ldflags += [ "-maix64" ]

+        } else {

+ -        cflags += [ "-m64" ]

+ +        cflags += [ "-m64", "-mcpu=power9", "-mtune=power9" ]

+          ldflags += [ "-m64" ]

+        }

+      } else if (current_cpu == "riscv64") {

+ --- a/third_party/libvpx/BUILD.gn

+ +++ b/third_party/libvpx/BUILD.gn

+ @@ -93,7 +93,7 @@

+  

+    if (current_cpu == "ppc64") {

+      cflags += [

+ -      "-mcpu=power8",

+ +      "-mcpu=power9",

+        "-maltivec",

+        "-mvsx",

+      ]

+ --- a/v8/BUILD.gn

+ +++ b/v8/BUILD.gn

+ @@ -1251,7 +1251,7 @@

+        defines += [ "V8_TARGET_ARCH_PPC_LE" ]

+          cflags += [

+          # Enable usage of AltiVec, VSX, and other POWER8 and higher features

+ -        "-mcpu=power8",

+ +        "-mcpu=power9",

+          "-maltivec",

+          "-mvsx",

+        ]

@@ -0,0 +1,21 @@ 

+ From 82922bf486e9926a171152f61030dfcd53f017b8 Mon Sep 17 00:00:00 2001

+ From: Timothy Pearson <tpearson@raptorengineering.com>

+ Date: Thu, 30 Aug 2018 17:32:05 -0500

+ Subject: [PATCH] Include cstddef to fix build

+ 

+ size_t is not defined unless cstddef is included.

+ ---

+  third_party/crashpad/crashpad/compat/linux/sys/user.h  |   1 +

+ 

+ Index: chromium-110.0.5481.77/third_party/crashpad/crashpad/compat/linux/sys/user.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/crashpad/crashpad/compat/linux/sys/user.h

+ +++ chromium-110.0.5481.77/third_party/crashpad/crashpad/compat/linux/sys/user.h

+ @@ -15,6 +15,7 @@

+  #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_

+  #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_

+  

+ +#include <cstddef>

+  #include_next <sys/user.h>

+  

+  #include <features.h>

@@ -0,0 +1,56 @@ 

+ Index: chromium-110.0.5481.77/third_party/sqlite/src/amalgamation/sqlite3.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/sqlite/src/amalgamation/sqlite3.c

+ +++ chromium-110.0.5481.77/third_party/sqlite/src/amalgamation/sqlite3.c

+ @@ -14390,7 +14390,8 @@ typedef INT16_TYPE LogEst;

+  # if defined(i386)      || defined(__i386__)      || defined(_M_IX86) ||    \

+       defined(__x86_64)  || defined(__x86_64__)    || defined(_M_X64)  ||    \

+       defined(_M_AMD64)  || defined(_M_ARM)        || defined(__x86)   ||    \

+ -     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)

+ +     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) ||   \

+ +     defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)

+  #   define SQLITE_BYTEORDER    1234

+  # elif defined(sparc)     || defined(__ppc__) || \

+         defined(__ARMEB__) || defined(__AARCH64EB__)

+ Index: chromium-110.0.5481.77/third_party/sqlite/src/amalgamation_dev/sqlite3.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/sqlite/src/amalgamation_dev/sqlite3.c

+ +++ chromium-110.0.5481.77/third_party/sqlite/src/amalgamation_dev/sqlite3.c

+ @@ -14403,7 +14403,8 @@ typedef INT16_TYPE LogEst;

+  # if defined(i386)      || defined(__i386__)      || defined(_M_IX86) ||    \

+       defined(__x86_64)  || defined(__x86_64__)    || defined(_M_X64)  ||    \

+       defined(_M_AMD64)  || defined(_M_ARM)        || defined(__x86)   ||    \

+ -     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)

+ +     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) ||   \

+ +     defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)

+  #   define SQLITE_BYTEORDER    1234

+  # elif defined(sparc)     || defined(__ppc__) || \

+         defined(__ARMEB__) || defined(__AARCH64EB__)

+ Index: chromium-110.0.5481.77/third_party/sqlite/src/ext/rtree/rtree.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/sqlite/src/ext/rtree/rtree.c

+ +++ chromium-110.0.5481.77/third_party/sqlite/src/ext/rtree/rtree.c

+ @@ -474,7 +474,8 @@ struct RtreeMatchArg {

+  # if defined(i386)      || defined(__i386__)      || defined(_M_IX86) ||    \

+       defined(__x86_64)  || defined(__x86_64__)    || defined(_M_X64)  ||    \

+       defined(_M_AMD64)  || defined(_M_ARM)        || defined(__x86)   ||    \

+ -     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)

+ +     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) ||  \

+ +     defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)

+  #   define SQLITE_BYTEORDER    1234

+  # elif defined(sparc)     || defined(__ppc__) || \

+         defined(__ARMEB__) || defined(__AARCH64EB__)

+ Index: chromium-110.0.5481.77/third_party/sqlite/src/src/sqliteInt.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/sqlite/src/src/sqliteInt.h

+ +++ chromium-110.0.5481.77/third_party/sqlite/src/src/sqliteInt.h

+ @@ -904,7 +904,8 @@ typedef INT16_TYPE LogEst;

+  # if defined(i386)      || defined(__i386__)      || defined(_M_IX86) ||    \

+       defined(__x86_64)  || defined(__x86_64__)    || defined(_M_X64)  ||    \

+       defined(_M_AMD64)  || defined(_M_ARM)        || defined(__x86)   ||    \

+ -     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)

+ +     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) ||   \

+ +     defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)

+  #   define SQLITE_BYTEORDER    1234

+  # elif defined(sparc)     || defined(__ppc__) || \

+         defined(__ARMEB__) || defined(__AARCH64EB__)

@@ -0,0 +1,114 @@ 

+ From bfdb97e53b1b6d037d00711f4601aabf167dbfbf Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Sat, 1 Sep 2018 16:43:48 -0500

+ Subject: [PATCH] Add support for ppc64

+ 

+ ---

+  chromium/scripts/build_ffmpeg.py         | 11 +++++++++--

+  chromium/scripts/copy_config.sh          |  2 +-

+  chromium/scripts/generate_gn.py          |  2 +-

+  chromium/scripts/generate_gn_unittest.py | 10 ++++++++--

+  4 files changed, 19 insertions(+), 6 deletions(-)

+ 

+ Index: chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py

+ +++ chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py

+ @@ -40,7 +40,7 @@ BRANDINGS = [

+  ARCH_MAP = {

+      'android': ['ia32', 'x64', 'arm-neon', 'arm64'],

+      'linux': [

+ -        'ia32', 'x64', 'noasm-x64', 'arm', 'arm-neon', 'arm64'

+ +        'ia32', 'x64', 'noasm-x64', 'arm', 'arm-neon', 'arm64', 'ppc64'

+      ],

+      'mac': ['x64', 'arm64'],

+      'win': ['ia32', 'x64', 'arm64'],

+ @@ -142,6 +142,8 @@ def DetermineHostOsAndArch():

+      host_arch = 'mips64el'

+    elif platform.machine().startswith('arm'):

+      host_arch = 'arm'

+ +  elif platform.machine() == 'ppc64le':

+ +    host_arch = 'ppc64'

+    else:

+      return None

+  

+ @@ -911,6 +913,11 @@ def ConfigureAndBuild(target_arch, targe

+              '--extra-cflags=--target=mips64el-linux-gnuabi64',

+              '--extra-ldflags=--target=mips64el-linux-gnuabi64',

+          ])

+ +    elif target_arch == 'ppc64':

+ +      configure_flags['Common'].extend([

+ +        '--arch=ppc64le',

+ +        '--extra-cflags=-mcpu=power8'

+ +      ])

+      else:

+        print(

+            'Error: Unknown target arch %r for target OS %r!' % (target_arch,

+ Index: chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/copy_config.sh

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/ffmpeg/chromium/scripts/copy_config.sh

+ +++ chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/copy_config.sh

+ @@ -10,7 +10,7 @@ for os in android linux linux-noasm mac

+      # Copy config files for various architectures:

+      #   - ia32/x64 have config.asm, config.h

+      #   - arm/arm-neon have config.h

+ -    for arch in arm arm-neon arm64 ia32 x64 mipsel mips64el; do

+ +    for arch in arm arm-neon arm64 ia32 x64 mipsel mips64el ppc64; do

+        # Don't waste time on non-existent configs, if no config.h then skip.

+        [ ! -e "build.$arch.$os/$target/config.h" ] && continue

+        for f in config.h config_components.h config.asm libavutil/avconfig.h libavutil/ffversion.h libavcodec/bsf_list.c libavcodec/codec_list.c libavcodec/parser_list.c libavformat/demuxer_list.c libavformat/muxer_list.c libavformat/protocol_list.c; do

+ Index: chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/generate_gn.py

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/ffmpeg/chromium/scripts/generate_gn.py

+ +++ chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/generate_gn.py

+ @@ -78,7 +78,7 @@ _Attrs = ('ARCHITECTURE', 'TARGET', 'PLA

+  Attr = collections.namedtuple('Attr', _Attrs)(*_Attrs)

+  SUPPORT_MATRIX = {

+      Attr.ARCHITECTURE:

+ -        set(['ia32', 'x64', 'arm', 'arm64', 'arm-neon']),

+ +        set(['ia32', 'x64', 'arm', 'arm64', 'arm-neon', 'ppc64']),

+      Attr.TARGET:

+          set(['Chromium', 'Chrome', 'ChromeOS']),

+      Attr.PLATFORM:

+ Index: chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/generate_gn_unittest.py

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/ffmpeg/chromium/scripts/generate_gn_unittest.py

+ +++ chromium-110.0.5481.77/third_party/ffmpeg/chromium/scripts/generate_gn_unittest.py

+ @@ -323,6 +323,10 @@ class SourceSetUnittest(unittest.TestCas

+      f = SourceSet(

+          set(['common', 'arm-neon', 'chrome', 'chromeos']),

+          set([SourceListCondition('arm-neon', 'ChromeOS', 'linux')]))

+ +    g = SourceSet(

+ +        set(['common']),

+ +        set([SourceListCondition('ppc64', 'Chromium', 'linux')]))

+ +

+  

+      expected = set()

+      expected.add(

+ @@ -334,7 +338,8 @@ class SourceSetUnittest(unittest.TestCas

+                  SourceListCondition('x64', 'Chromium', 'linux'),

+                  SourceListCondition('x64', 'Chrome', 'linux'),

+                  SourceListCondition('arm', 'Chromium', 'linux'),

+ -                SourceListCondition('arm-neon', 'ChromeOS', 'linux')

+ +                SourceListCondition('arm-neon', 'ChromeOS', 'linux'),

+ +                SourceListCondition('ppc64', 'Chromium', 'linux')

+              ])))

+      expected.add(

+          SourceSet(

+ @@ -362,7 +367,7 @@ class SourceSetUnittest(unittest.TestCas

+              set(['arm-neon', 'chromeos']),

+              set([SourceListCondition('arm-neon', 'ChromeOS', 'linux')])))

+  

+ -    source_sets = gg.CreatePairwiseDisjointSets([a, b, c, d, e, f])

+ +    source_sets = gg.CreatePairwiseDisjointSets([a, b, c, d, e, f, g])

+      self.assertEqualSourceSets(expected, set(source_sets))

+  

+    def testReduceConditions(self):

+ @@ -375,6 +380,7 @@ class SourceSetUnittest(unittest.TestCas

+              SourceListCondition('arm', 'Chromium', 'linux'),

+              SourceListCondition('arm64', 'Chromium', 'linux'),

+              SourceListCondition('arm-neon', 'Chromium', 'linux'),

+ +            SourceListCondition('ppc64', 'Chromium', 'linux'),

+          ]))

+      gg.ReduceConditionalLogic(a)

+  

@@ -0,0 +1,29 @@ 

+ diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn

+ index ca8ac723d..0dcc78653 100644

+ --- a/third_party/breakpad/BUILD.gn

+ +++ b/third_party/breakpad/BUILD.gn

+ @@ -593,7 +593,6 @@ if (is_linux || is_chromeos || is_android) {

+        "breakpad/src/client/minidump_file_writer.h",

+        "breakpad/src/common/convert_UTF.cc",

+        "breakpad/src/common/convert_UTF.h",

+ -      "breakpad/src/common/linux/breakpad_getcontext.S",

+        "breakpad/src/common/linux/elf_core_dump.cc",

+        "breakpad/src/common/linux/elf_core_dump.h",

+        "breakpad/src/common/linux/elfutils.cc",

+ @@ -625,6 +624,8 @@ if (is_linux || is_chromeos || is_android) {

+      configs += [ "//build/config/compiler:no_chromium_code" ]

+      public_configs = [ ":client_config" ]

+  

+ +    defines = [ "HAVE_GETCONTEXT" ]

+ +

+      if (current_cpu == "arm" && is_chromeos_ash) {

+        # Avoid running out of registers in

+        # linux_syscall_support.h:sys_clone()'s inline assembly.

+ @@ -682,7 +683,6 @@ if (is_linux || is_chromeos || is_android) {

+        "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",

+        "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",

+        "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",

+ -      "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",

+        "breakpad/src/common/linux/elf_core_dump_unittest.cc",

+        "breakpad/src/common/linux/file_id_unittest.cc",

+        "breakpad/src/common/linux/linux_libc_support_unittest.cc",

@@ -0,0 +1,16 @@ 

+ kIndex: chromium-114.0.5735.45/base/allocator/partition_allocator/partition_alloc.gni

+ ===================================================================

+ Index: chromium-115.0.5790.56/base/allocator/partition_allocator/partition_alloc.gni

+ ===================================================================

+ --- chromium-115.0.5790.56.orig/base/allocator/partition_allocator/partition_alloc.gni

+ +++ chromium-115.0.5790.56/base/allocator/partition_allocator/partition_alloc.gni

+ @@ -16,7 +16,8 @@ if (is_nacl) {

+    # NaCl targets don't use 64-bit pointers.

+    has_64_bit_pointers = false

+  } else if (current_cpu == "x64" || current_cpu == "arm64" ||

+ -           current_cpu == "loong64" || current_cpu == "riscv64") {

+ +           current_cpu == "loong64" || current_cpu == "riscv64" ||

+ +           current_cpu == "ppc64") {

+    has_64_bit_pointers = true

+  } else if (current_cpu == "x86" || current_cpu == "arm") {

+    has_64_bit_pointers = false

@@ -0,0 +1,26 @@ 

+ --- chromium-101.0.4951.54/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn.orig	2022-05-15 10:30:50.887333316 +0200

+ +++ chromium-101.0.4951.54/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn	2022-05-15 10:31:43.477318032 +0200

+ @@ -133,7 +133,6 @@ swiftshader_llvm_source_set("swiftshader_llvm") {

+    if (is_ubsan_vptr) {

+      sources = [

+        "llvm/lib/MC/MCWasmObjectTargetWriter.cpp",

+ -      "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",

+        "llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp",

+        "llvm/lib/Target/TargetIntrinsicInfo.cpp",

+      ]

+ @@ -583,6 +582,7 @@ swiftshader_llvm_source_set("swiftshader_llvm_most") {

+      "llvm/lib/MC/MCAsmInfoCOFF.cpp",

+      "llvm/lib/MC/MCAsmInfoDarwin.cpp",

+      "llvm/lib/MC/MCAsmInfoELF.cpp",

+ +    "llvm/lib/MC/MCAsmInfoXCOFF.cpp",

+      "llvm/lib/MC/MCAsmMacro.cpp",

+      "llvm/lib/MC/MCAsmStreamer.cpp",

+      "llvm/lib/MC/MCAssembler.cpp",

+ @@ -637,6 +637,7 @@ swiftshader_llvm_source_set("swiftshader_llvm_most") {

+      "llvm/lib/MC/MCWin64EH.cpp",

+      "llvm/lib/MC/MCWinCOFFStreamer.cpp",

+      "llvm/lib/MC/MCWinEH.cpp",

+ +    "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",

+      "llvm/lib/MC/MCXCOFFStreamer.cpp",

+      "llvm/lib/MC/MachObjectWriter.cpp",

+      "llvm/lib/MC/StringTableBuilder.cpp",

@@ -0,0 +1,33 @@ 

+ --- ./build/config/compiler/BUILD.gn

+ +++ ./build/config/compiler/BUILD.gn

+ @@ -1565,7 +1565,7 @@

+  

+        # -Wno-class-memaccess warns about hash table and vector in blink.

+        # But the violation is intentional.

+ -      if (!is_nacl) {

+ +      if ((!is_nacl) && (current_cpu != "ppc64")) {

+          cflags_cc += [ "-Wno-class-memaccess" ]

+        }

+  

+ @@ -1575,7 +1575,9 @@

+  

+        # Don't warn about "maybe" uninitialized. Clang doesn't include this

+        # in -Wall but gcc does, and it gives false positives.

+ -      cflags += [ "-Wno-maybe-uninitialized" ]

+ +      if (current_cpu != "ppc64") {

+ +        cflags += [ "-Wno-maybe-uninitialized" ]

+ +      }

+        cflags += [ "-Wno-deprecated-declarations" ]

+  

+        # -Wcomment gives too many false positives in the case a

+ @@ -1586,7 +1588,9 @@

+  

+        # -Wpacked-not-aligned complains all generated mojom-shared-internal.h

+        # files.

+ -      cflags += [ "-Wno-packed-not-aligned" ]

+ +      if (current_cpu != "ppc64") {

+ +        cflags += [ "-Wno-packed-not-aligned" ]

+ +      }

+      }

+    }

+  

@@ -0,0 +1,53 @@ 

+ From 40309fb53e39477490fd6928ebe67c4fb78de380 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@gmail.com>

+ Date: Sun, 10 Mar 2019 21:01:37 -0500

+ Subject: [PATCH] Add ppc64 target to libaom

+ 

+ ---

+  third_party/libaom/BUILD.gn        | 12 ++++++++++++

+  third_party/libaom/cmake_update.sh |  3 +++

+  2 files changed, 15 insertions(+)

+ 

+ --- a/third_party/libaom/BUILD.gn

+ +++ b/third_party/libaom/BUILD.gn

+ @@ -209,6 +209,18 @@ if (current_cpu == "arm64" || cpu_arch_f

+    }

+  }

+  

+ +if (current_cpu == "ppc64") {

+ +  source_set("libaom_intrinsics_vsx") {

+ +    configs -= [ "//build/config/compiler:chromium_code" ]

+ +    configs += [ "//build/config/compiler:no_chromium_code" ]

+ +    configs += [ ":libaom_config" ]

+ +    sources = [

+ +      "//third_party/libaom/source/libaom/aom_ports/ppc_cpudetect.c",

+ +    ]

+ +    sources += aom_av1_common_intrin_vsx

+ +  }

+ +}

+ +

+  static_library("libaom") {

+    check_includes = false

+    if (!is_debug && is_win) {

+ @@ -265,6 +277,9 @@ static_library("libaom") {

+      sources +=

+          [ "//third_party/libaom/source/libaom/aom_ports/arm_cpudetect.c" ]

+    }

+ +  if (current_cpu == "ppc64") {

+ +    deps += [ ":libaom_intrinsics_vsx" ]

+ +  }

+    if (is_android) {

+      deps += [ "//third_party/cpu_features:ndk_compat" ]

+    }

+ --- a/third_party/libaom/cmake_update.sh

+ +++ b/third_party/libaom/cmake_update.sh

+ @@ -204,6 +204,9 @@ gen_config_files ios/arm64 \

+    "${toolchain}/arm64-ios.cmake -DCMAKE_INSTALL_NAME_TOOL=no-such-command \

+     ${all_platforms}"

+  

+ +reset_dirs linux/ppc64

+ +gen_config_files linux/ppc64 "${toolchain}/ppc-linux-gcc.cmake ${all_platforms}"

+ +

+  # Copy linux configurations and modify for Windows.

+  reset_dirs win/arm64

+  cp "${CFG}/linux/arm64/config"/* "${CFG}/win/arm64/config/"

@@ -0,0 +1,37 @@ 

+ From b3a14db7637232d30c878cc1f1ad6d8037e81379 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawn@anastas.io>

+ Date: Tue, 15 Jan 2019 22:42:21 -0600

+ Subject: [PATCH] linux/seccomp-bpf: ppc64+glibc workaround in SIGSYS handler

+ 

+ Workaround for an apparent issue with glibc negating syscall

+ parameters. Observed on a ppc64le machine with glibc.

+ More investigation required.

+ ---

+  sandbox/linux/seccomp-bpf/trap.cc | 14 ++++++++++++++

+  1 file changed, 14 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf/trap.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf/trap.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf/trap.cc

+ @@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo*

+        SetIsInSigHandler();

+      }

+  

+ +#if defined(__powerpc64__)

+ +    // On ppc64+glibc, some syscalls seem to accidentally negate the first

+ +    // parameter which causes checks against it to fail. For now, manually

+ +    // negate them back.

+ +    // TODO(shawn@anastas.io): investigate this issue further

+ +    auto nr = SECCOMP_SYSCALL(ctx);

+ +    if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||

+ +        nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {

+ +        if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {

+ +            SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);

+ +        }

+ +    }

+ +#endif

+ +

+      // Copy the seccomp-specific data into a arch_seccomp_data structure. This

+      // is what we are showing to TrapFnc callbacks that the system call

+      // evaluator registered with the sandbox.

@@ -0,0 +1,23 @@ 

+ From 0c65e40ae578b743b5f06956597ebc9700768d18 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 22:45:47 -0500

+ Subject: [PATCH 1/1] sandbox: Enable seccomp_bpf for ppc64

+ 

+ ---

+  sandbox/features.gni | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ Index: chromium-110.0.5481.77/sandbox/features.gni

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/features.gni

+ +++ chromium-110.0.5481.77/sandbox/features.gni

+ @@ -9,7 +9,8 @@

+  use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&

+                    (current_cpu == "x86" || current_cpu == "x64" ||

+                     current_cpu == "arm" || current_cpu == "arm64" ||

+ -                   current_cpu == "mipsel" || current_cpu == "mips64el")

+ +                   current_cpu == "mipsel" || current_cpu == "mips64el" ||

+ +                   current_cpu == "ppc64")

+  

+  # SSBD (Speculative Store Bypass Disable) is a mitigation of Spectre Variant 4.

+  # As Spectre Variant 4 can be mitigated by site isolation, opt-out SSBD on site

@@ -0,0 +1,80 @@ 

+ From 036d209a3f1a771de9aed31dfbe804aaf91d1c27 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 23:35:21 -0500

+ Subject: [PATCH] sandbox/linux: Implement partial support for ppc64 syscalls

+  and ucontext

+ 

+ Unlike other architectures, the ppc64 files currently rely on applicable

+ headers being provided by the system. It is sufficient for standard

+ GNU/Linux environments, but may require expansion elsewhere.

+ ---

+  sandbox/linux/BUILD.gn                              |  2 ++

+  sandbox/linux/system_headers/linux_syscalls.h       |  4 ++++

+  sandbox/linux/system_headers/linux_ucontext.h       |  2 ++

+  sandbox/linux/system_headers/ppc64_linux_syscalls.h | 12 ++++++++++++

+  sandbox/linux/system_headers/ppc64_linux_ucontext.h | 12 ++++++++++++

+  5 files changed, 32 insertions(+)

+  create mode 100644 sandbox/linux/system_headers/ppc64_linux_syscalls.h

+  create mode 100644 sandbox/linux/system_headers/ppc64_linux_ucontext.h

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/BUILD.gn

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/BUILD.gn

+ +++ chromium-110.0.5481.77/sandbox/linux/BUILD.gn

+ @@ -383,6 +383,8 @@ component("sandbox_services") {

+  

+  source_set("sandbox_services_headers") {

+    sources = [

+ +    "system_headers/ppc64_linux_syscalls.h",

+ +    "system_headers/ppc64_linux_ucontext.h",

+      "system_headers/arm64_linux_syscalls.h",

+      "system_headers/arm_linux_syscalls.h",

+      "system_headers/arm_linux_ucontext.h",

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/linux_syscalls.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/system_headers/linux_syscalls.h

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/linux_syscalls.h

+ @@ -35,5 +35,9 @@

+  #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"

+  #endif

+  

+ +#if defined(__powerpc64__)

+ +#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"

+ +#endif

+ +

+  #endif  // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_

+  

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/ppc64_linux_syscalls.h

+ ===================================================================

+ --- /dev/null

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/ppc64_linux_syscalls.h

+ @@ -0,0 +1,12 @@

+ +// Copyright 2014 The Chromium Authors. All rights reserved.

+ +// Use of this source code is governed by a BSD-style license that can be

+ +// found in the LICENSE file.

+ +

+ +#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_

+ +#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_

+ +

+ +#include <asm/unistd.h>

+ +

+ +//TODO: is it necessary to redefine syscall numbers for PPC64?

+ +

+ +#endif  // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/ppc64_linux_ucontext.h

+ ===================================================================

+ --- /dev/null

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/ppc64_linux_ucontext.h

+ @@ -0,0 +1,12 @@

+ +// Copyright 2014 The Chromium Authors. All rights reserved.

+ +// Use of this source code is governed by a BSD-style license that can be

+ +// found in the LICENSE file.

+ +

+ +#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_

+ +#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_

+ +

+ +#include <sys/ucontext.h>

+ +

+ +//TODO: is it necessary to redefine ucontext on PPC64?

+ +

+ +#endif  // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_

@@ -0,0 +1,22 @@ 

+ From c41cd6ac927f592b161abc04468d3c7a4be91995 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Tue, 23 Oct 2018 15:49:31 -0500

+ Subject: [PATCH] sandbox/linux: Update IsSyscallAllowed in broker_process.cc

+ 

+ ---

+  sandbox/linux/syscall_broker/broker_process.cc | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/syscall_broker/broker_process.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/syscall_broker/broker_process.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/syscall_broker/broker_process.cc

+ @@ -166,7 +166,7 @@ bool BrokerProcess::IsSyscallBrokerable(

+  #if defined(__NR_fstatat64)

+      case __NR_fstatat64:

+  #endif

+ -#if defined(__x86_64__) || defined(__aarch64__)

+ +#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_newfstatat:

+  #endif

+        return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT);

@@ -0,0 +1,638 @@ 

+ From da52663deec77f705d7d58b18484c3e28e563f10 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Tue, 18 Sep 2018 18:39:28 -0500

+ Subject: [PATCH] sandbox/linux: Update syscall helpers/lists for ppc64

+ 

+ ---

+  .../seccomp-bpf-helpers/baseline_policy.cc    |   8 +-

+  .../syscall_parameters_restrictions.cc        |   2 +-

+  .../syscall_parameters_restrictions.h         |   2 +-

+  .../linux/seccomp-bpf-helpers/syscall_sets.cc | 108 ++++++++++--------

+  .../linux/seccomp-bpf-helpers/syscall_sets.h  |   6 +-

+  sandbox/linux/services/syscall_wrappers.cc    |   2 +-

+  6 files changed, 73 insertions(+), 55 deletions(-)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc

+ @@ -91,7 +91,8 @@ bool IsBaselinePolicyWatched(int sysno)

+           SyscallSets::IsPrctl(sysno) ||

+           SyscallSets::IsProcessGroupOrSession(sysno) ||

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+           SyscallSets::IsSocketCall(sysno) ||

+  #endif

+  #if defined(__arm__)

+ @@ -256,7 +257,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de

+    }

+  

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+    if (sysno == __NR_mmap)

+      return RestrictMmapFlags();

+  #endif

+ @@ -277,7 +278,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de

+      return RestrictPrctl();

+  

+  #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+    if (sysno == __NR_socketpair) {

+      // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.

+      static_assert(AF_UNIX == PF_UNIX,

+ @@ -341,7 +342,8 @@ ResultExpr EvaluateSyscallImpl(int fs_de

+    }

+  

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+    if (SyscallSets::IsSocketCall(sysno))

+      return RestrictSocketcallCommand();

+  #endif

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc

+ @@ -36,7 +36,7 @@

+  #include "sandbox/linux/system_headers/linux_time.h"

+  

+  #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \

+ -    !defined(__arm__) && !defined(__aarch64__) &&             \

+ +    !defined(__arm__) && !defined(__aarch64__) && !defined(__powerpc64__) && \

+      !defined(PTRACE_GET_THREAD_AREA)

+  // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance

+  // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.

+ @@ -45,6 +45,11 @@

+  #include <asm/ptrace-abi.h>

+  #endif

+  

+ +// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h

+ +#ifdef __powerpc64__

+ +#include <termios.h>

+ +#endif

+ +

+  #if BUILDFLAG(IS_ANDROID)

+  

+  #if !defined(F_DUPFD_CLOEXEC)

+ @@ -102,6 +107,15 @@ inline bool IsArchitectureMips() {

+  #endif

+  }

+  

+ +inline bool IsArchitecturePPC64() {

+ +#if defined(__powerpc64__)

+ +  return true;

+ +#else

+ +  return false;

+ +#endif

+ +}

+ +

+ +

+  // Ubuntu's version of glibc has a race condition in sem_post that can cause

+  // it to call futex(2) with bogus op arguments. To workaround this, we need

+  // to allow those futex(2) calls to fail with EINVAL, instead of crashing the

+ @@ -253,9 +267,11 @@ ResultExpr RestrictFcntlCommands() {

+    // operator.

+    // Glibc overrides the kernel's O_LARGEFILE value. Account for this.

+    uint64_t kOLargeFileFlag = O_LARGEFILE;

+ -  if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())

+ +  if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips() \

+ +      || IsArchitecturePPC64())

+      kOLargeFileFlag = 0100000;

+  

+ +

+    const Arg<int> cmd(1);

+    const Arg<long> long_arg(2);

+  

+ @@ -278,8 +294,17 @@ ResultExpr RestrictFcntlCommands() {

+                F_SETLKW,

+                F_GETLK,

+                F_DUPFD,

+ -              F_DUPFD_CLOEXEC},

+ -             Allow())

+ +              F_DUPFD_CLOEXEC

+ +#if defined(__powerpc64__)

+ +// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants

+ +// but glibc will sometimes still use the 32-bit versions. Allow both.

+ +              ,

+ +              5, /* F_GETLK (32) */

+ +              6, /* F_SETLK (32) */

+ +              7  /* F_SETLKW (32) */

+ +#endif

+ +              },

+ +            Allow())

+        .Case(F_SETFL,

+              If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))

+        .Case(F_ADD_SEALS,

+ @@ -288,7 +313,7 @@ ResultExpr RestrictFcntlCommands() {

+    // clang-format on

+  }

+  

+ -#if defined(__i386__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)

+  ResultExpr RestrictSocketcallCommand() {

+    // Unfortunately, we are unable to restrict the first parameter to

+    // socketpair(2). Whilst initially sounding bad, it's noteworthy that very

+ @@ -443,7 +468,7 @@ ResultExpr RestrictPtrace() {

+  #endif

+    return Switch(request)

+        .Cases({

+ -#if !defined(__aarch64__)

+ +#if !defined(__aarch64__) && !defined(__powerpc64__)

+                   PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,

+                   PTRACE_GETREGSET,

+  #endif

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h

+ @@ -52,7 +52,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr Restr

+  // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.

+  SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();

+  

+ -#if defined(__i386__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)

+  // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),

+  // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).

+  SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

+ @@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int s

+    switch (sysno) {

+      case __NR_gettimeofday:

+  #if defined(__i386__) || defined(__x86_64__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_time:

+  #endif

+        return true;

+ @@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int s

+      case __NR_clock_nanosleep_time64:  // Parameters filtered by RestrictClockID().

+  #endif

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_ftime:  // Obsolete.

+  #endif

+      case __NR_settimeofday:  // Privileged.

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_stime:

+  #endif

+      default:

+ @@ -136,7 +139,7 @@ bool SyscallSets::IsFileSystem(int sysno

+      case __NR_faccessat2:

+      case __NR_fchmodat:

+      case __NR_fchownat:  // Should be called chownat ?

+ -#if defined(__x86_64__) || defined(__aarch64__)

+ +#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_newfstatat:  // fstatat(). EPERM not a valid errno.

+  #elif defined(__i386__) || defined(__arm__) || \

+      (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ @@ -155,7 +158,7 @@ bool SyscallSets::IsFileSystem(int sysno

+      case __NR_memfd_create:

+      case __NR_mkdirat:

+      case __NR_mknodat:

+ -#if defined(__i386__)

+ +#if defined(__i386__) || defined(__powerpc64__)

+      case __NR_oldlstat:

+      case __NR_oldstat:

+  #endif

+ @@ -169,7 +172,8 @@ bool SyscallSets::IsFileSystem(int sysno

+  #endif

+      case __NR_statfs:  // EPERM not a valid errno.

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_statfs64:

+  #endif

+      case __NR_statx:  // EPERM not a valid errno.

+ @@ -180,7 +184,8 @@ bool SyscallSets::IsFileSystem(int sysno

+      case __NR_truncate64:

+  #endif

+      case __NR_unlinkat:

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_utime:

+  #endif

+      case __NR_utimensat:  // New.

+ @@ -220,7 +225,8 @@ bool SyscallSets::IsAllowedFileSystemAcc

+  #endif

+        return true;

+  // TODO(jln): these should be denied gracefully as well (moved below).

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_fadvise64:  // EPERM not a valid errno.

+  #endif

+  #if defined(__i386__)

+ @@ -233,11 +239,12 @@ bool SyscallSets::IsAllowedFileSystemAcc

+      case __NR_flock:      // EPERM not a valid errno.

+      case __NR_fstatfs:    // Give information about the whole filesystem.

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_fstatfs64:

+  #endif

+      case __NR_fsync:  // EPERM not a valid errno.

+ -#if defined(__i386__)

+ +#if defined(__i386__) || defined(__powerpc64__)

+      case __NR_oldfstat:

+  #endif

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ @@ -245,6 +252,8 @@ bool SyscallSets::IsAllowedFileSystemAcc

+      case __NR_sync_file_range:  // EPERM not a valid errno.

+  #elif defined(__arm__)

+      case __NR_arm_sync_file_range:  // EPERM not a valid errno.

+ +#elif defined(__powerpc64__)

+ +    case __NR_sync_file_range2: // EPERM not a valid errno.

+  #endif

+      default:

+        return false;

+ @@ -265,7 +274,8 @@ bool SyscallSets::IsDeniedFileSystemAcce

+  #endif

+      case __NR_getdents64:  // EPERM not a valid errno.

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_readdir:

+  #endif

+        return true;

+ @@ -306,7 +316,7 @@ bool SyscallSets::IsGetSimpleId(int sysn

+  bool SyscallSets::IsProcessPrivilegeChange(int sysno) {

+    switch (sysno) {

+      case __NR_capset:

+ -#if defined(__i386__) || defined(__x86_64__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)

+      case __NR_ioperm:  // Intel privilege.

+      case __NR_iopl:    // Intel privilege.

+  #endif

+ @@ -362,7 +372,8 @@ bool SyscallSets::IsAllowedSignalHandlin

+      // overflow.

+      case __NR_sigaltstack:

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_rt_sigtimedwait_time64:

+      case __NR_sigaction:

+      case __NR_sigprocmask:

+ @@ -378,7 +389,8 @@ bool SyscallSets::IsAllowedSignalHandlin

+  #endif

+      case __NR_signalfd4:

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_sigpending:

+      case __NR_sigsuspend:

+  #endif

+ @@ -402,7 +414,7 @@ bool SyscallSets::IsAllowedOperationOnFd

+  #endif

+      case __NR_dup3:

+  #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_shutdown:

+  #endif

+        return true;

+ @@ -435,7 +447,7 @@ bool SyscallSets::IsAllowedProcessStartO

+      case __NR_exit_group:

+      case __NR_wait4:

+      case __NR_waitid:

+ -#if defined(__i386__)

+ +#if defined(__i386__) || defined(__powerpc64__)

+      case __NR_waitpid:

+  #endif

+        return true;

+ @@ -452,7 +464,7 @@ bool SyscallSets::IsAllowedProcessStartO

+  #endif

+      case __NR_set_tid_address:

+      case __NR_unshare:

+ -#if !defined(__mips__) && !defined(__aarch64__)

+ +#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_vfork:

+  #endif

+      default:

+ @@ -515,7 +527,7 @@ bool SyscallSets::IsAllowedGetOrModifySo

+  bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {

+    switch (sysno) {

+  #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_accept:

+      case __NR_accept4:

+      case __NR_bind:

+ @@ -530,7 +542,8 @@ bool SyscallSets::IsDeniedGetOrModifySoc

+  }

+  

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+  // Big multiplexing system call for sockets.

+  bool SyscallSets::IsSocketCall(int sysno) {

+    switch (sysno) {

+ @@ -544,7 +557,8 @@ bool SyscallSets::IsSocketCall(int sysno

+  }

+  #endif

+  

+ -#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)

+ +#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+  bool SyscallSets::IsNetworkSocketInformation(int sysno) {

+    switch (sysno) {

+      case __NR_getpeername:

+ @@ -569,7 +583,7 @@ bool SyscallSets::IsAllowedAddressSpaceA

+      case __NR_mincore:

+      case __NR_mlockall:

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_mmap:

+  #endif

+  #if defined(__i386__) || defined(__arm__) || \

+ @@ -599,7 +613,8 @@ bool SyscallSets::IsAllowedGeneralIo(int

+    switch (sysno) {

+      case __NR_lseek:

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR__llseek:

+  #endif

+  #if !defined(__aarch64__)

+ @@ -619,26 +634,28 @@ bool SyscallSets::IsAllowedGeneralIo(int

+      case __NR_readv:

+      case __NR_pread64:

+  #if defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_recv:

+  #endif

+  #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_recvfrom:  // Could specify source.

+      case __NR_recvmsg:   // Could specify source.

+  #endif

+ -#if defined(__i386__) || defined(__x86_64__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)

+      case __NR_select:

+  #endif

+ -#if defined(__i386__) || defined(__arm__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)

+      case __NR__newselect:

+  #endif

+  #if defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_send:

+  #endif

+  #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_sendmsg:  // Could specify destination.

+      case __NR_sendto:   // Could specify destination.

+  #endif

+ @@ -694,7 +711,8 @@ bool SyscallSets::IsAllowedBasicSchedule

+        return true;

+      case __NR_getpriority:

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_nice:

+  #endif

+      case __NR_setpriority:

+ @@ -706,7 +724,8 @@ bool SyscallSets::IsAllowedBasicSchedule

+  bool SyscallSets::IsAdminOperation(int sysno) {

+    switch (sysno) {

+  #if defined(__i386__) || defined(__arm__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_bdflush:

+  #endif

+      case __NR_kexec_load:

+ @@ -722,7 +741,8 @@ bool SyscallSets::IsAdminOperation(int s

+  

+  bool SyscallSets::IsKernelModule(int sysno) {

+    switch (sysno) {

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_create_module:

+      case __NR_get_kernel_syms:  // Should ENOSYS.

+      case __NR_query_module:

+ @@ -755,7 +775,8 @@ bool SyscallSets::IsFsControl(int sysno)

+      case __NR_swapoff:

+      case __NR_swapon:

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_umount:

+  #endif

+      case __NR_umount2:

+ @@ -771,7 +792,7 @@ bool SyscallSets::IsNuma(int sysno) {

+      case __NR_getcpu:

+      case __NR_mbind:

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_migrate_pages:

+  #endif

+      case __NR_move_pages:

+ @@ -806,14 +827,15 @@ bool SyscallSets::IsGlobalProcessEnviron

+    switch (sysno) {

+      case __NR_acct:  // Privileged.

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_getrlimit:

+  #endif

+ -#if defined(__i386__) || defined(__arm__)

+ +#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)

+      case __NR_ugetrlimit:

+  #endif

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_ulimit:

+  #endif

+      case __NR_getrusage:

+ @@ -847,7 +869,7 @@ bool SyscallSets::IsGlobalSystemStatus(i

+  #endif

+      case __NR_sysinfo:

+      case __NR_uname:

+ -#if defined(__i386__)

+ +#if defined(__i386__) || defined(__powerpc64__)

+      case __NR_olduname:

+      case __NR_oldolduname:

+  #endif

+ @@ -931,7 +953,8 @@ bool SyscallSets::IsSystemVSemaphores(in

+  

+  #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \

+      defined(__aarch64__) ||                                         \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \

+ +    defined(__powerpc64__)

+  // These give a lot of ambient authority and bypass the setuid sandbox.

+  bool SyscallSets::IsSystemVSharedMemory(int sysno) {

+    switch (sysno) {

+ @@ -962,7 +985,8 @@ bool SyscallSets::IsSystemVMessageQueue(

+  #endif

+  

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+  // Big system V multiplexing system call.

+  bool SyscallSets::IsSystemVIpc(int sysno) {

+    switch (sysno) {

+ @@ -982,7 +1006,8 @@ bool SyscallSets::IsAnySystemV(int sysno

+    return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||

+           IsSystemVSharedMemory(sysno);

+  #elif defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+    return IsSystemVIpc(sysno);

+  #endif

+  }

+ @@ -1039,7 +1064,8 @@ bool SyscallSets::IsFaNotify(int sysno)

+  bool SyscallSets::IsTimer(int sysno) {

+    switch (sysno) {

+      case __NR_getitimer:

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_alarm:

+  #endif

+      case __NR_setitimer:

+ @@ -1121,18 +1147,22 @@ bool SyscallSets::IsMisc(int sysno) {

+      case __NR_syncfs:

+      case __NR_vhangup:

+  // The system calls below are not implemented.

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_afs_syscall:

+  #endif

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_break:

+  #endif

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_getpmsg:

+  #endif

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_gtty:

+      case __NR_idle:

+      case __NR_lock:

+ @@ -1140,20 +1170,22 @@ bool SyscallSets::IsMisc(int sysno) {

+      case __NR_prof:

+      case __NR_profil:

+  #endif

+ -#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)

+ +#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ +    defined(__powerpc64__)

+      case __NR_putpmsg:

+  #endif

+  #if defined(__x86_64__)

+      case __NR_security:

+  #endif

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+      case __NR_stty:

+  #endif

+ -#if defined(__x86_64__)

+ +#if defined(__x86_64__) || defined(__powerpc64__)

+      case __NR_tuxcall:

+  #endif

+ -#if !defined(__aarch64__)

+ +#if !defined(__aarch64__) && !defined(__powerpc64__)

+      case __NR_vserver:

+  #endif

+        return true;

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h

+ @@ -47,13 +47,14 @@ class SANDBOX_EXPORT SyscallSets {

+    static bool IsDeniedGetOrModifySocket(int sysno);

+  

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+    // Big multiplexing system call for sockets.

+    static bool IsSocketCall(int sysno);

+  #endif

+  

+  #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+    static bool IsNetworkSocketInformation(int sysno);

+  #endif

+  

+ @@ -85,7 +86,8 @@ class SANDBOX_EXPORT SyscallSets {

+  #endif

+  #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \

+      defined(__aarch64__) ||                                         \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \

+ +    defined(__powerpc64__)

+    // These give a lot of ambient authority and bypass the setuid sandbox.

+    static bool IsSystemVSharedMemory(int sysno);

+  #endif

+ @@ -96,7 +98,8 @@ class SANDBOX_EXPORT SyscallSets {

+  #endif

+  

+  #if defined(__i386__) || \

+ -    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))

+ +    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+ +    defined(__powerpc64__)

+    // Big system V multiplexing system call.

+    static bool IsSystemVIpc(int sysno);

+  #endif

+ Index: chromium-110.0.5481.77/sandbox/linux/services/syscall_wrappers.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/services/syscall_wrappers.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/services/syscall_wrappers.cc

+ @@ -61,7 +61,7 @@ long sys_clone(unsigned long flags,

+  #if defined(ARCH_CPU_X86_64)

+    return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);

+  #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \

+ -    defined(ARCH_CPU_MIPS_FAMILY)

+ +    defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)

+    // CONFIG_CLONE_BACKWARDS defined.

+    return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);

+  #endif

@@ -0,0 +1,27 @@ 

+ From c9043a422fb4a5a6c72aaa1b907cea5f6a3061dd Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 19:10:24 -0500

+ Subject: [PATCH 1/4] sandbox/linux/bpf_dsl: Update syscall ranges for ppc64

+ 

+ ---

+  sandbox/linux/bpf_dsl/linux_syscall_ranges.h | 7 +++++++

+  1 file changed, 7 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/bpf_dsl/linux_syscall_ranges.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/bpf_dsl/linux_syscall_ranges.h

+ +++ chromium-110.0.5481.77/sandbox/linux/bpf_dsl/linux_syscall_ranges.h

+ @@ -56,6 +56,13 @@

+  #define MAX_PUBLIC_SYSCALL __NR_syscalls

+  #define MAX_SYSCALL MAX_PUBLIC_SYSCALL

+  

+ +#elif defined(__powerpc64__)

+ +

+ +#include <asm/unistd.h>

+ +#define MIN_SYSCALL 0u

+ +#define MAX_PUBLIC_SYSCALL 386u

+ +#define MAX_SYSCALL MAX_PUBLIC_SYSCALL

+ +

+  #else

+  #error "Unsupported architecture"

+  #endif

@@ -0,0 +1,26 @@ 

+ From 7468b266532bd607eb1f5292d758256d800b2eee Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Fri, 10 Aug 2018 00:23:50 -0500

+ Subject: [PATCH] services/service_manager/sandbox/linux: Fix TCGETS

+  declaration on PPC64

+ 

+ ---

+  .../sandbox/linux/bpf_renderer_policy_linux.cc               | 5 +++++

+  1 file changed, 5 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/sandbox/policy/linux/bpf_renderer_policy_linux.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/policy/linux/bpf_renderer_policy_linux.cc

+ +++ chromium-110.0.5481.77/sandbox/policy/linux/bpf_renderer_policy_linux.cc

+ @@ -15,6 +15,11 @@

+  #include "sandbox/linux/system_headers/linux_syscalls.h"

+  #include "sandbox/policy/linux/sandbox_linux.h"

+  

+ +// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h

+ +#ifdef __powerpc64__

+ +#include <termios.h>

+ +#endif

+ +

+  // TODO(vignatti): replace the local definitions below with #include

+  // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.

+  #include <linux/types.h>

@@ -0,0 +1,76 @@ 

+ From 3c4705bfdda45feb860a1f121631773e5fe8e53f Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 19:11:26 -0500

+ Subject: [PATCH 1/4] sandbox/linux/bpf_dsl: Modify seccomp_macros to add

+  support for ppc64

+ 

+ ---

+  sandbox/linux/bpf_dsl/seccomp_macros.h | 43 ++++++++++++++++++++++++++

+  1 file changed, 43 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/bpf_dsl/seccomp_macros.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/bpf_dsl/seccomp_macros.h

+ +++ chromium-110.0.5481.77/sandbox/linux/bpf_dsl/seccomp_macros.h

+ @@ -14,6 +14,9 @@

+  #if defined(__mips__)

+  // sys/user.h in eglibc misses size_t definition

+  #include <stddef.h>

+ +#elif defined(__powerpc64__)

+ +// Manually define greg_t on ppc64

+ +typedef unsigned long long greg_t;

+  #endif

+  #endif

+  

+ @@ -343,6 +346,51 @@ struct regs_struct {

+  #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]

+  #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]

+  #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]

+ +

+ +#elif defined(__powerpc64__)

+ +#include <asm/ptrace.h>

+ +

+ +typedef struct pt_regs regs_struct;

+ +

+ +#ifdef ARCH_CPU_LITTLE_ENDIAN

+ +#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE

+ +#else

+ +#define SECCOMP_ARCH AUDIT_ARCH_PPC64

+ +#endif

+ +

+ +#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])

+ +

+ +#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)

+ +#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)

+ +#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip

+ +#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)

+ +#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)

+ +#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)

+ +#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)

+ +#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)

+ +#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)

+ +

+ +#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))

+ +#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))

+ +#define SECCOMP_IP_MSB_IDX \

+ +  (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)

+ +#define SECCOMP_IP_LSB_IDX \

+ +  (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)

+ +#define SECCOMP_ARG_MSB_IDX(nr) \

+ +  (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)

+ +#define SECCOMP_ARG_LSB_IDX(nr) \

+ +  (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)

+ +

+ +#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]

+ +#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]

+ +#define SECCOMP_PT_IP(_regs) (_regs).nip

+ +#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]

+ +#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]

+ +#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]

+ +#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]

+ +#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]

+ +#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]

+ +

+  #else

+  #error Unsupported target platform

+  

@@ -0,0 +1,37 @@ 

+ From cca78240860abb63bbcfe94d1e5f04a1f23c527d Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 19:11:56 -0500

+ Subject: [PATCH 3/4] sandbox/linux/system_headers: Update linux seccomp header

+  for ppc64

+ 

+ ---

+  sandbox/linux/system_headers/linux_seccomp.h | 10 ++++++++++

+  1 file changed, 10 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/linux_seccomp.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/system_headers/linux_seccomp.h

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/linux_seccomp.h

+ @@ -38,6 +38,9 @@

+  #ifndef EM_AARCH64

+  #define EM_AARCH64 183

+  #endif

+ +#ifndef EM_PPC64

+ +#define EM_PPC64 21

+ +#endif

+  

+  #ifndef __AUDIT_ARCH_64BIT

+  #define __AUDIT_ARCH_64BIT 0x80000000

+ @@ -70,6 +73,12 @@

+  #ifndef AUDIT_ARCH_AARCH64

+  #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)

+  #endif

+ +#ifndef AUDIT_ARCH_PPC64

+ +#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)

+ +#endif

+ +#ifndef AUDIT_ARCH_PPC64LE

+ +#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)

+ +#endif

+  

+  // For prctl.h

+  #ifndef PR_SET_SECCOMP

@@ -0,0 +1,23 @@ 

+ From 298df3dc44f7121cd8cb9a06b29fa3b16c959b8d Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 19:13:25 -0500

+ Subject: [PATCH 4/4] sandbox/linux/system_headers: Update linux signal header

+  for ppc64

+ 

+ ---

+  sandbox/linux/system_headers/linux_signal.h | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/linux_signal.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/system_headers/linux_signal.h

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/linux_signal.h

+ @@ -13,7 +13,7 @@

+  // (not undefined, but defined different values and in different memory

+  // layouts). So, fill the gap here.

+  #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+  

+  #define LINUX_SIGHUP 1

+  #define LINUX_SIGINT 2

@@ -0,0 +1,107 @@ 

+ From 1d44643a7c7cf650efd1093d22cd5bf859fdcb51 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 9 Aug 2018 20:52:13 -0500

+ Subject: [PATCH] sandbox/linux/seccomp-bpf: Add ppc64 syscall stub

+ 

+ ---

+  sandbox/linux/seccomp-bpf/syscall.cc | 53 ++++++++++++++++++++++++++--

+  1 file changed, 51 insertions(+), 2 deletions(-)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf/syscall.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf/syscall.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf/syscall.cc

+ @@ -18,7 +18,7 @@ namespace sandbox {

+  namespace {

+  

+  #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \

+ -    defined(ARCH_CPU_MIPS_FAMILY)

+ +    defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)

+  // Number that's not currently used by any Linux kernel ABIs.

+  const int kInvalidSyscallNumber = 0x351d3;

+  #else

+ @@ -308,10 +308,54 @@ asm(// We need to be able to tell the ke

+      "2:ret\n"

+      ".cfi_endproc\n"

+      ".size SyscallAsm, .-SyscallAsm\n"

+ +#elif defined(__powerpc64__)

+ +    ".text\n"

+ +    ".align 4\n"

+ +    ".type SyscallAsm @function\n"

+ +    "SyscallAsm:\n"

+ +    ".cfi_startproc\n"

+ +

+ +    // Check if r3 is negative

+ +    "cmpdi 3, 0\n"

+ +    "bgt 2f\n"

+ +

+ +    // Load address of 3f into r3 and return

+ +    "mflr 10\n"

+ +    "bl 1f\n"

+ +    "1: mflr 3\n"

+ +    "mtlr 10\n"

+ +    "addi 3, 3, 4*13\n"

+ +    "blr\n"

+ +

+ +    // Load arguments from array into r3-8

+ +    // save param 3 in r10

+ +    "2:\n"

+ +    "mr 0, 3\n"

+ +    "ld 3, 0(4)\n"

+ +    "ld 5, 16(4)\n"

+ +    "ld 6, 24(4)\n"

+ +    "ld 7, 32(4)\n"

+ +    "ld 8, 40(4)\n"

+ +    "ld 4, 8(4)\n"

+ +    "li 9, 0\n"

+ +

+ +    // Enter kernel

+ +    "sc\n"

+ +

+ +    // Magic return address

+ +    "3:\n"

+ +    // Like MIPS, ppc64 return values are always positive.

+ +    // Check for error in cr0.SO and negate upon error

+ +    "bc 4, 3, 4f\n"

+ +    "neg 3, 3\n"

+ +    "4: blr\n"

+ +

+ +    ".cfi_endproc\n"

+ +    ".size SyscallAsm, .-SyscallAsm\n"

+  #endif

+      );  // asm

+  

+ -#if defined(__x86_64__)

+ +#if defined(__x86_64__) || defined(__powerpc64__)

+  extern "C" {

+  intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);

+  }

+ @@ -425,6 +469,8 @@ intptr_t Syscall::Call(int nr,

+      ret = inout;

+    }

+  

+ +#elif defined(__powerpc64__)

+ +  intptr_t ret = SyscallAsm(nr, args);

+  #else

+  #error "Unimplemented architecture"

+  #endif

+ @@ -441,8 +487,18 @@ void Syscall::PutValueInUcontext(intptr_

+      // needs to be changed back.

+      ret_val = -ret_val;

+      SECCOMP_PARM4(ctx) = 1;

+ -  } else

+ +  } else {

+      SECCOMP_PARM4(ctx) = 0;

+ +  }

+ +#endif

+ +#if defined(__powerpc64__)

+ +  // Same as MIPS, need to invert ret and set error register (cr0.SO)

+ +  if (ret_val <= -1 && ret_val >= -4095) {

+ +    ret_val = -ret_val;

+ +    ctx->uc_mcontext.regs->ccr |= (1 << 28);

+ +  } else {

+ +    ctx->uc_mcontext.regs->ccr &= ~(1 << 28);

+ +  }

+  #endif

+    SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);

+  }

@@ -0,0 +1,24 @@ 

+ From 6a852c4135864ba87b3cbdd0880d7cfecf7cd654 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Thu, 13 Sep 2018 15:12:22 -0500

+ Subject: [PATCH 5/6] sandbox/linux: update unit test for ppc64

+ 

+ ---

+  sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc

+ @@ -322,8 +322,10 @@ TEST_BASELINE_SIGSYS(__NR_timer_create)

+  

+  #if !defined(__aarch64__)

+  TEST_BASELINE_SIGSYS(__NR_inotify_init)

+ +#if !defined(__powerpc64__)

+  TEST_BASELINE_SIGSYS(__NR_vserver)

+  #endif

+ +#endif

+  

+  #if defined(LIBC_GLIBC) && !BUILDFLAG(IS_CHROMEOS_ASH)

+  BPF_TEST_C(BaselinePolicy, FutexEINVAL, BaselinePolicy) {

@@ -0,0 +1,14 @@ 

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

+ @@ -374,7 +374,9 @@ bool SyscallSets::IsAllowedSignalHandlin

+  #if defined(__i386__) || defined(__arm__) || \

+      (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \

+      defined(__powerpc64__)

+ +#if !defined(__powerpc64__)

+      case __NR_rt_sigtimedwait_time64:

+ +#endif

+      case __NR_sigaction:

+      case __NR_sigprocmask:

+      case __NR_sigreturn:

@@ -0,0 +1,33 @@ 

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/linux_stat.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/system_headers/linux_stat.h

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/linux_stat.h

+ @@ -173,6 +173,28 @@ struct kernel_stat {

+    unsigned int __unused4;

+    unsigned int __unused5;

+  };

+ +#elif defined(__powerpc64__)

+ +struct kernel_stat {

+ +   unsigned long   st_dev;

+ +   ino_t           st_ino;

+ +   unsigned long   st_nlink;

+ +   mode_t          st_mode;

+ +   uid_t           st_uid;

+ +   gid_t           st_gid;

+ +   unsigned long   st_rdev;

+ +   long            st_size;

+ +   unsigned long   st_blksize;

+ +   unsigned long   st_blocks;

+ +   // unsigned long   st_atime;

+ +   unsigned long   st_atime_nsec;

+ +   //unsigned long   st_mtime;

+ +   unsigned long   st_mtime_nsec;

+ +   //unsigned long   st_ctime;

+ +   unsigned long   st_ctime_nsec;

+ +   unsigned long   __unused4;

+ +   unsigned long   __unused5;

+ +   unsigned long   __unused6;

+ +};

+  #endif

+  

+  #if !defined(AT_EMPTY_PATH)

@@ -0,0 +1,91 @@ 

+ Index: chromium-110.0.5481.77/sandbox/policy/linux/bpf_utility_policy_linux.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/policy/linux/bpf_utility_policy_linux.cc

+ +++ chromium-110.0.5481.77/sandbox/policy/linux/bpf_utility_policy_linux.cc

+ @@ -34,7 +34,7 @@ ResultExpr UtilityProcessPolicy::Evaluat

+      case __NR_fdatasync:

+      case __NR_fsync:

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_getrlimit:

+  #endif

+  #if defined(__i386__) || defined(__arm__)

+ Index: chromium-110.0.5481.77/sandbox/policy/linux/bpf_renderer_policy_linux.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/policy/linux/bpf_renderer_policy_linux.cc

+ +++ chromium-110.0.5481.77/sandbox/policy/linux/bpf_renderer_policy_linux.cc

+ @@ -77,7 +77,7 @@ ResultExpr RendererProcessPolicy::Evalua

+      case __NR_ftruncate64:

+  #endif

+  #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \

+ -    defined(__aarch64__)

+ +    defined(__aarch64__) || defined(__powerpc64__)

+      case __NR_getrlimit:

+      case __NR_setrlimit:

+  // We allow setrlimit to dynamically adjust the address space limit as

+ Index: chromium-110.0.5481.77/sandbox/linux/bpf_dsl/linux_syscall_ranges.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/bpf_dsl/linux_syscall_ranges.h

+ +++ chromium-110.0.5481.77/sandbox/linux/bpf_dsl/linux_syscall_ranges.h

+ @@ -58,9 +58,9 @@

+  

+  #elif defined(__powerpc64__)

+  

+ -#include <asm/unistd.h>

+ +#include <asm-generic/unistd.h>

+  #define MIN_SYSCALL 0u

+ -#define MAX_PUBLIC_SYSCALL 386u

+ +#define MAX_PUBLIC_SYSCALL __NR_syscalls

+  #define MAX_SYSCALL MAX_PUBLIC_SYSCALL

+  

+  #else

+ Index: chromium-110.0.5481.77/sandbox/linux/services/credentials.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/services/credentials.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/services/credentials.cc

+ @@ -89,7 +89,9 @@ bool ChrootToSafeEmptyDir() {

+  

+    int clone_flags = CLONE_FS | LINUX_SIGCHLD;

+    void* tls = nullptr;

+ -#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \

+ +// RAJA this might be it...

+ +#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \

+ +    defined(ARCH_CPU_PPC64_FAMILY)) && \

+      !defined(MEMORY_SANITIZER)

+    // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.

+    // Since clone writes to the new child's TLS before returning, we must set a

+ @@ -97,6 +99,11 @@ bool ChrootToSafeEmptyDir() {

+    // glibc performs syscalls by calling a function pointer in TLS, so we do not

+    // attempt this optimization.

+    // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.

+ +  //

+ +  // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration

+ +  // in every thread.  Since the rendered threads are sandboxed without

+ +  // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font

+ +  // configuraiton loading failures and no fonts will be displayed!

+    clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;

+  

+    // PTHREAD_STACK_MIN can be dynamic in glibc2.34+, so it is not possible to

+ Index: chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc

+ @@ -357,7 +357,16 @@ intptr_t SIGSYSFstatatHandler(const stru

+    if (args.nr == __NR_fstatat_default) {

+      if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&

+          args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {

+ -      return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),

+ +          int fd = static_cast<int>(args.args[0]);

+ +#if defined(__powerpc64__)

+ +      // On ppc64+glibc, some syscalls seem to accidentally negate the first

+ +      // parameter which causes checks against it to fail. For now, manually

+ +      // negate them back.

+ +      // TODO: Investigate the root cause and fix in glibc

+ +      if (fd < 0)

+ +        fd = -fd;

+ +#endif

+ +      return syscall(__NR_fstat_default, fd,

+                       reinterpret_cast<default_stat_struct*>(args.args[2]));

+      }

+      return -reinterpret_cast<intptr_t>(fs_denied_errno);

@@ -0,0 +1,13 @@ 

+ Index: chromium-110.0.5481.77/sandbox/linux/services/credentials.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/services/credentials.cc

+ +++ chromium-110.0.5481.77/sandbox/linux/services/credentials.cc

+ @@ -80,7 +80,7 @@ bool ChrootToSafeEmptyDir() {

+    pid_t pid = -1;

+    alignas(16) char stack_buf[PTHREAD_STACK_MIN];

+  #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \

+ -    defined(ARCH_CPU_MIPS_FAMILY)

+ +    defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)

+    // The stack grows downward.

+    void* stack = stack_buf + sizeof(stack_buf);

+  #else

@@ -0,0 +1,23 @@ 

+ Index: chromium-110.0.5481.77/sandbox/linux/system_headers/ppc64_linux_syscalls.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/sandbox/linux/system_headers/ppc64_linux_syscalls.h

+ +++ chromium-110.0.5481.77/sandbox/linux/system_headers/ppc64_linux_syscalls.h

+ @@ -8,5 +8,18 @@

+  #include <asm/unistd.h>

+  

+  //TODO: is it necessary to redefine syscall numbers for PPC64?

+ +// Needed for Ubuntu/Debian/Centos/RHEL:

+ +#if !defined(__NR_shmget)

+ +#define __NR_shmget     395

+ +#endif

+ +#if !defined(__NR_shmdt)

+ +#define __NR_shmdt      398

+ +#endif

+ +#if !defined(__NR_shmctl)

+ +#define __NR_shmctl     396

+ +#endif

+ +#if !defined(__NR_shmat)

+ +#define __NR_shmat      397

+ +#endif

+  

+  #endif  // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_

@@ -0,0 +1,30 @@ 

+ From 61dcf0ff9603e8f5b0a859fb0837c51527ebae43 Mon Sep 17 00:00:00 2001

+ From: Colin Samples <colin.samples+git@gmail.com>

+ Date: Fri, 1 Nov 2019 11:50:52 -0400

+ Subject: [PATCH] Add PPC64 support for libdav1d

+ 

+ ---

+  third_party/dav1d/BUILD.gn            | 21 ++++++++++++++++++++

+  third_party/dav1d/generate_configs.py | 28 ++-------------------------

+  third_party/dav1d/generate_source.py  |  2 ++

+  3 files changed, 25 insertions(+), 26 deletions(-)

+ 

+ --- a/third_party/dav1d/generate_configs.py

+ +++ b/third_party/dav1d/generate_configs.py

+ @@ -21,7 +21,7 @@ CHROMIUM_ROOT_DIR = os.path.abspath(os.p

+  sys.path.append(os.path.join(CHROMIUM_ROOT_DIR, 'build'))

+  import gn_helpers

+  

+ -MESON = ['meson.py']

+ +MESON = ['meson']

+  

+  DEFAULT_BUILD_ARGS = [

+      '-Denable_tools=false', '-Denable_tests=false', '-Ddefault_library=static',

+ @@ -205,6 +205,7 @@ def main():

+      linux_env = os.environ

+      linux_env['CC'] = 'clang'

+  

+ +    GenerateConfig('config/linux/ppc64', linux_env)

+      GenerateConfig('config/linux/x64', linux_env)

+  

+      noasm_dir = 'config/linux-noasm/x64'

@@ -0,0 +1,12 @@ 

+ --- a/third_party/highway/BUILD.gn

+ +++ b/third_party/highway/BUILD.gn

+ @@ -13,6 +13,9 @@

+      # explicitly disabling AVX2 and AVX3 targets.

+      defines += [ "HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)" ]

+    }

+ +  if (target_cpu == "ppc64") {

+ +    defines += [ "TOOLCHAIN_MISS_ASM_HWCAP_H" ]

+ +  }

+  }

+  

+  source_set("libhwy") {

@@ -0,0 +1,33 @@ 

+ From e14024659e0fc2af3df6ec56ce39a8e93b75722d Mon Sep 17 00:00:00 2001

+ From: Colin Samples <colin.samples+git@gmail.com>

+ Date: Sun, 8 Dec 2019 19:25:02 -0500

+ Subject: [PATCH] Fix libdav1d compilation on clang ppc

+ 

+ ---

+  src/ppc/dav1d_types.h | 15 +++++++++++++++

+  1 file changed, 15 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h

+ +++ chromium-110.0.5481.77/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h

+ @@ -51,4 +51,19 @@

+  #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))

+  #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))

+  

+ +#if defined(__clang__)

+ +#undef vec_splats

+ +#define vec_splats(N)                     \

+ +    _Generic((N),                         \

+ +        unsigned char:      ((u8x16)(N)), \

+ +        signed char:        ((i8x16)(N)), \

+ +        unsigned short:     ((u16x8)(N)), \

+ +        signed short:       ((i16x8)(N)), \

+ +        unsigned int:       ((u32x4)(N)), \

+ +        signed int:         ((i32x4)(N)), \

+ +        unsigned long long: ((u64x2)(N)), \

+ +        signed long long:   ((i64x2)(N))  \

+ +    )

+ +#endif

+ +

+  #endif /* DAV1D_SRC_PPC_TYPES_H */

@@ -0,0 +1,27 @@ 

+ From ea104a841fca1ff4d5430915f1b7c52c6a642f13 Mon Sep 17 00:00:00 2001

+ From: Timothy Pearson <tpearson@raptorengineering.com>

+ Date: Fri, 21 Sep 2018 21:44:17 -0500

+ Subject: [PATCH] Force baseline POWER8 / AltiVec / VSX CPU features when on a

+  PPC64 platform in LE mode

+ 

+ ---

+  BUILD.gn | 6 ++++++

+  1 file changed, 6 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/v8/BUILD.gn

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/v8/BUILD.gn

+ +++ chromium-110.0.5481.77/v8/BUILD.gn

+ @@ -1202,6 +1202,12 @@ config("toolchain") {

+      }

+      if (host_byteorder == "little") {

+        defines += [ "V8_TARGET_ARCH_PPC_LE" ]

+ +        cflags += [

+ +        # Enable usage of AltiVec, VSX, and other POWER8 and higher features

+ +        "-mcpu=power8",

+ +        "-maltivec",

+ +        "-mvsx",

+ +      ]

+      } else if (host_byteorder == "big") {

+        defines += [ "V8_TARGET_ARCH_PPC_BE" ]

+        if (current_os == "aix") {

@@ -0,0 +1,10 @@ 

+ --- a/third_party/angle/src/libANGLE/Constants.h

+ +++ b/third_party/angle/src/libANGLE/Constants.h

+ @@ -9,6 +9,7 @@

+  #ifndef LIBANGLE_CONSTANTS_H_

+  #define LIBANGLE_CONSTANTS_H_

+  

+ +#include <cstddef>

+  #include "common/platform.h"

+  

+  #include <stddef.h>

@@ -0,0 +1,27 @@ 

+ From 4fcc19598eb97a47fe6612912ba1e4d895e14860 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawn@anastas.io>

+ Date: Sun, 17 Feb 2019 23:08:33 -0600

+ Subject: [PATCH] third_party/boringssl: Properly detect ppc64le in BUILD.gn

+ 

+ ---

+  third_party/boringssl/BUILD.gn | 7 +++++++

+  1 file changed, 7 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/third_party/boringssl/BUILD.gn

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/boringssl/BUILD.gn

+ +++ chromium-110.0.5481.77/third_party/boringssl/BUILD.gn

+ @@ -101,6 +101,13 @@ if (is_win && !is_msan && current_cpu !=

+        } else {

+          public_configs = [ ":no_asm_config" ]

+        }

+ +    } else if (current_cpu == "ppc64") {

+ +      if (is_linux) {

+ +        # TODO: ppc64 (be) check

+ +        sources += crypto_sources_linux_ppc64le

+ +      } else {

+ +        public_configs = [ ":no_asm_config" ]

+ +      }

+      } else {

+        public_configs = [ ":no_asm_config" ]

+      }

@@ -0,0 +1,23 @@ 

+ From cc613c2e3bac8d4d1ff153700b819f964435923a Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawnanastasio@yahoo.com>

+ Date: Tue, 4 Sep 2018 18:16:07 -0500

+ Subject: [PATCH] third_party/libvpx: Properly generate gni on ppc64

+ 

+ ---

+  third_party/libvpx/BUILD.gn        |  2 ++

+  third_party/libvpx/generate_gni.sh | 10 ++++++++++

+  2 files changed, 12 insertions(+)

+ 

+ Index: chromium-110.0.5481.77/third_party/libvpx/BUILD.gn

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/BUILD.gn

+ +++ chromium-110.0.5481.77/third_party/libvpx/BUILD.gn

+ @@ -245,6 +245,8 @@ if (current_cpu == "x86" || (current_cpu

+      } else if (current_cpu == "x64") {

+        deps = [ ":libvpx_x86_64_headers" ]

+        sources = libvpx_srcs_x86_64_avx512

+ +    } else if (current_cpu == "ppc64") {

+ +      sources = libvpx_srcs_ppc64

+      }

+    }

+  }

@@ -0,0 +1,22 @@ 

+ Index: chromium-110.0.5481.77/third_party/lss/linux_syscall_support.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/lss/linux_syscall_support.h

+ +++ chromium-110.0.5481.77/third_party/lss/linux_syscall_support.h

+ @@ -4638,7 +4638,7 @@ struct kernel_statx {

+        LSS_REG(2, buf);

+        LSS_BODY(void*, mmap2, "0"(__r2));

+      }

+ -#else

+ +#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */

+      #define __NR__mmap2 __NR_mmap2

+      LSS_INLINE _syscall6(void*, _mmap2,            void*, s,

+                           size_t,                   l, int,               p,

+ @@ -4749,7 +4749,7 @@ struct kernel_statx {

+    #if defined(__i386__) ||                                                    \

+        defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) ||                     \

+       (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) ||                   \

+ -      defined(__PPC__) ||                                                     \

+ +     (defined(__PPC__) && !defined(__powerpc64__)) ||                                                     \

+       (defined(__s390__) && !defined(__s390x__))

+      /* On these architectures, implement mmap() with mmap2(). */

+      LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,

@@ -0,0 +1,22 @@ 

+ From 63e63a70766f3059ce5f1d06a95988ecf909b298 Mon Sep 17 00:00:00 2001

+ From: Shawn Anastasio <shawn@anastas.io>

+ Date: Wed, 24 Apr 2019 21:17:23 -0500

+ Subject: [PATCH] third_party/pffft: Include altivec.h on ppc64 with SIMD

+  enabled

+ 

+ ---

+  third_party/pffft/src/pffft.c | 1 +

+  1 file changed, 1 insertion(+)

+ 

+ Index: chromium-110.0.5481.77/third_party/pffft/src/pffft.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/pffft/src/pffft.c

+ +++ chromium-110.0.5481.77/third_party/pffft/src/pffft.c

+ @@ -100,6 +100,7 @@

+     Altivec support macros 

+  */

+  #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))

+ +#include <altivec.h>

+  typedef vector float v4sf;

+  #  define SIMD_SZ 4

+  #  define VZERO() ((vector float) vec_splat_u8(0))

@@ -0,0 +1,99 @@ 

+ --- a/third_party/highway/src/hwy/ops/ppc_vsx-inl.h

+ +++ b/third_party/highway/src/hwy/ops/ppc_vsx-inl.h

+ @@ -36,6 +36,8 @@

+  

+  #include "hwy/ops/shared-inl.h"

+  

+ +#undef __SIZEOF_INT128__

+ +

+  HWY_BEFORE_NAMESPACE();

+  namespace hwy {

+  namespace HWY_NAMESPACE {

+ @@ -2844,7 +2846,6 @@

+  

+  namespace detail {

+  

+ -#if HWY_TARGET > HWY_PPC10 || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__

+  // fallback for missing vec_extractm

+  template <size_t N>

+  HWY_INLINE uint64_t ExtractSignBits(Vec128<uint8_t, N> sign_bits,

+ @@ -2857,22 +2858,16 @@

+    return extracted.raw[__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__];

+  }

+  

+ -#endif  // HWY_TARGET > HWY_PPC10

+ -

+  template <typename T, size_t N>

+  HWY_INLINE uint64_t BitsFromMask(hwy::SizeTag<1> /*tag*/,

+                                   Mask128<T, N> mask) {

+    const DFromM<decltype(mask)> d;

+    const Repartition<uint8_t, decltype(d)> du8;

+    const VFromD<decltype(du8)> sign_bits = BitCast(du8, VecFromMask(d, mask));

+ -#if HWY_TARGET <= HWY_PPC10 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+ -  return static_cast<uint64_t>(vec_extractm(sign_bits.raw));

+ -#else

+    const __vector unsigned char kBitShuffle = {

+      120, 112, 104, 96, 88, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0

+    };

+    return ExtractSignBits(sign_bits, kBitShuffle);

+ -#endif  // HWY_TARGET <= HWY_PPC10

+  }

+  

+  template <typename T, size_t N>

+ @@ -2882,10 +2877,6 @@

+    const Repartition<uint8_t, decltype(d)> du8;

+    const VFromD<decltype(du8)> sign_bits = BitCast(du8, VecFromMask(d, mask));

+  

+ -#if HWY_TARGET <= HWY_PPC10 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+ -  const RebindToUnsigned<decltype(d)> du;

+ -  return static_cast<uint64_t>(vec_extractm(BitCast(du, sign_bits).raw));

+ -#else

+  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+    const __vector unsigned char kBitShuffle = {

+      112, 96, 80, 64, 48, 32, 16, 0, 128, 128, 128, 128, 128, 128, 128, 128};

+ @@ -2894,7 +2885,6 @@

+      128, 128, 128, 128, 128, 128, 128, 128, 112, 96, 80, 64, 48, 32, 16, 0};

+  #endif

+    return ExtractSignBits(sign_bits, kBitShuffle);

+ -#endif  // HWY_TARGET <= HWY_PPC10

+  }

+  

+  template <typename T, size_t N>

+ @@ -2903,10 +2893,6 @@

+    const DFromM<decltype(mask)> d;

+    const Repartition<uint8_t, decltype(d)> du8;

+    const VFromD<decltype(du8)> sign_bits = BitCast(du8, VecFromMask(d, mask));

+ -#if HWY_TARGET <= HWY_PPC10 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+ -  const RebindToUnsigned<decltype(d)> du;

+ -  return static_cast<uint64_t>(vec_extractm(BitCast(du, sign_bits).raw));

+ -#else

+  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+    const __vector unsigned char kBitShuffle = {

+      96, 64, 32, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128};

+ @@ -2915,7 +2901,6 @@

+       128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 96, 64, 32, 0};

+  #endif

+    return ExtractSignBits(sign_bits, kBitShuffle);

+ -#endif  // HWY_TARGET <= HWY_PPC10

+  }

+  

+  template <typename T, size_t N>

+ @@ -2924,10 +2909,6 @@

+    const DFromM<decltype(mask)> d;

+    const Repartition<uint8_t, decltype(d)> du8;

+    const VFromD<decltype(du8)> sign_bits = BitCast(du8, VecFromMask(d, mask));

+ -#if HWY_TARGET <= HWY_PPC10 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+ -  const RebindToUnsigned<decltype(d)> du;

+ -  return static_cast<uint64_t>(vec_extractm(BitCast(du, sign_bits).raw));

+ -#else

+  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+    const __vector unsigned char kBitShuffle = {64,  0,   128, 128, 128, 128,

+                                                128, 128, 128, 128, 128, 128,

+ @@ -2938,7 +2919,6 @@

+                                                128, 128, 64,  0};

+  #endif

+    return ExtractSignBits(sign_bits, kBitShuffle);

+ -#endif  // HWY_TARGET <= HWY_PPC10

+  }

+  

+  // Returns the lowest N of the mask bits.

@@ -0,0 +1,168 @@ 

+ Index: chromium-110.0.5481.77/third_party/lss/linux_syscall_support.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/lss/linux_syscall_support.h

+ +++ chromium-110.0.5481.77/third_party/lss/linux_syscall_support.h

+ @@ -87,7 +87,7 @@

+   * Porting to other related platforms should not be difficult.

+   */

+  #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) ||   \

+ -     defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__) || \

+ +     defined(__mips__) || defined(__PPC__) || defined(__powerpc64__) || defined(__ARM_EABI__) || \

+       defined(__aarch64__) || defined(__s390__) || defined(__e2k__) ||  \

+       (defined(__riscv) && __riscv_xlen == 64) || defined(__loongarch_lp64))  \

+    && (defined(__linux) || defined(__ANDROID__))

+ @@ -399,7 +399,7 @@ struct kernel_stat64 {

+    unsigned           __pad2;

+    unsigned long long st_blocks;

+  };

+ -#elif defined __PPC__

+ +#elif defined __PPC__ && !defined(__powerpc64__)

+  struct kernel_stat64 {

+    unsigned long long st_dev;

+    unsigned long long st_ino;

+ @@ -421,6 +421,28 @@ struct kernel_stat64 {

+    unsigned long      __unused4;

+    unsigned long      __unused5;

+  };

+ +#elif defined(__powerpc64__)

+ +struct kernel_stat64 {

+ +  unsigned long int  st_dev;

+ +  unsigned long int  st_ino;

+ +  unsigned int       st_mode;

+ +  unsigned long int  st_nlink;

+ +  unsigned int       st_uid;

+ +  unsigned int       st_gid;

+ +  unsigned long int  st_rdev;

+ +  unsigned short int __pad2;

+ +  long int           st_size;

+ +  long int           st_blksize;

+ +  long int           st_blocks;

+ +  long int           st_atime_;

+ +  unsigned long int  st_atime_nsec_;

+ +  long int           st_mtime_;

+ +  unsigned long int  st_mtime_nsec_;

+ +  long int           st_ctime_;

+ +  unsigned long int  st_ctime_nsec_;

+ +  unsigned long int  __unused4;

+ +  unsigned long int  __unused5;

+ +};

+  #elif defined(__e2k__)

+  struct kernel_stat64 {

+    unsigned long long st_dev;

+ @@ -537,7 +559,7 @@ struct kernel_stat {

+    uint64_t           st_ctime_nsec_;

+    int64_t            __unused4[3];

+  };

+ -#elif defined(__PPC__)

+ +#elif defined(__PPC__) && !defined(__powerpc64__)

+  typedef unsigned long kernel_blkcnt_t;

+  typedef unsigned long kernel_blksize_t;

+  typedef unsigned kernel_dev_t;

+ @@ -568,6 +590,37 @@ struct kernel_stat {

+    unsigned long      __unused4;

+    unsigned long      __unused5;

+  };

+ +#elif defined(__powerpc64__)

+ +typedef long int kernel_blkcnt_t;

+ +typedef long int kernel_blksize_t;

+ +typedef unsigned long int kernel_dev_t;

+ +typedef unsigned int kernel_gid_t;

+ +typedef unsigned long int kernel_ino_t;

+ +typedef unsigned int kernel_mode_t;

+ +typedef unsigned long int kernel_nlink_t;

+ +typedef long int kernel_off_t;

+ +typedef long int kernel_time_t;

+ +typedef unsigned int kernel_uid_t;

+ +struct kernel_stat {

+ +  kernel_dev_t       st_dev;

+ +  kernel_ino_t       st_ino;

+ +  kernel_mode_t      st_mode;

+ +  kernel_nlink_t     st_nlink;

+ +  kernel_uid_t       st_uid;

+ +  kernel_gid_t       st_gid;

+ +  kernel_dev_t       st_rdev;

+ +  kernel_off_t       st_size;

+ +  kernel_blksize_t   st_blksize;

+ +  kernel_blkcnt_t    st_blocks;

+ +  kernel_time_t      st_atime_;

+ +  unsigned long int  st_atime_nsec_;

+ +  kernel_time_t      st_mtime_;

+ +  unsigned long int  st_mtime_nsec_;

+ +  kernel_time_t      st_ctime_;

+ +  unsigned long int  st_ctime_nsec_;

+ +  unsigned long int  __unused4;

+ +  unsigned long int  __unused5;

+ +};

+  #elif (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64)

+  typedef int kernel_blkcnt_t;

+  typedef int kernel_blksize_t;

+ @@ -1824,6 +1877,28 @@ struct kernel_statx {

+  #ifndef __NR_getcpu

+  #define __NR_getcpu             302

+  #endif

+ +

+ +/* Linux commit 86250b9d12caa1a3dee12a7cf638b7dd70eaadb6 (2010) adds

+ + * direct socket system calls to PPC */

+ +#ifndef __NR_socket

+ +#define __NR_socket             326

+ +#endif

+ +#ifndef __NR_socketpair

+ +#define __NR_socketpair         333

+ +#endif

+ +#ifndef __NR_sendto

+ +#define __NR_sendto             335

+ +#endif

+ +#ifndef __NR_shutdown

+ +#define __NR_shutdown           338

+ +#endif

+ +#ifndef __NR_sendmsg

+ +#define __NR_sendmsg            341

+ +#endif

+ +#ifndef __NR_recvmsg

+ +#define __NR_recvmsg            342

+ +#endif

+ +

+  /* End of powerpc defininitions                                              */

+  #elif defined(__s390__)

+  #ifndef __NR_quotactl

+ @@ -3363,6 +3438,11 @@ struct kernel_statx {

+      /* TODO(csilvers): consider wrapping some args up in a struct, like we

+       * do for i386's _syscall6, so we can compile successfully on gcc 2.95

+       */

+ +    #ifdef __powerpc64__

+ +    /* TODO: implement clone() for ppc64.

+ +     * until then, use system libc */

+ +    #define sys_clone clone

+ +    #else

+      LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack,

+                                     int flags, void *arg, int *parent_tidptr,

+                                     void *newtls, int *child_tidptr) {

+ @@ -3433,6 +3513,7 @@ struct kernel_statx {

+        }

+        LSS_RETURN(int, __ret, __err);

+      }

+ +    #endif

+    #elif defined(__s390__)

+      #undef  LSS_REG

+      #define LSS_REG(r, a) register unsigned long __r##r __asm__("r"#r) = (unsigned long) a

+ @@ -4783,7 +4864,7 @@ struct kernel_statx {

+      LSS_INLINE _syscall6(void*, mmap, void*, addr, size_t, length, int, prot,

+                           int, flags, int, fd, int64_t, offset)

+    #endif

+ -  #if defined(__PPC__)

+ +  #if defined(__PPC__) && !defined(__powerpc64__)

+      #undef LSS_SC_LOADARGS_0

+      #define LSS_SC_LOADARGS_0(dummy...)

+      #undef LSS_SC_LOADARGS_1

+ @@ -5173,7 +5254,11 @@ struct kernel_statx {

+  #endif

+  

+  #if !defined(__NR_pipe)

+ +#if defined(__powerpc64__)

+ +  LSS_INLINE pid_t LSS_NAME(pipe)(int *pipefd) {

+ +#else

+    LSS_INLINE int LSS_NAME(pipe)(int *pipefd) {

+ +#endif

+      return LSS_NAME(pipe2)(pipefd, 0);

+    }

+  #endif

@@ -0,0 +1,35 @@ 

+ --- a/third_party/libvpx/libvpx_srcs.gni

+ +++ b/third_party/libvpx/libvpx_srcs.gni

+ @@ -4302,6 +4302,7 @@

+    "//third_party/libvpx/source/libvpx/vp9/common/vp9_seg_common.c",

+    "//third_party/libvpx/source/libvpx/vp9/common/vp9_thread_common.c",

+    "//third_party/libvpx/source/libvpx/vp9/common/vp9_tile_common.c",

+ +  "//third_party/libvpx/source/libvpx/vp9/common/ppc/vp9_idct_vsx.c",

+    "//third_party/libvpx/source/libvpx/vp9/decoder/vp9_decodeframe.c",

+    "//third_party/libvpx/source/libvpx/vp9/decoder/vp9_decodemv.c",

+    "//third_party/libvpx/source/libvpx/vp9/decoder/vp9_decoder.c",

+ @@ -4340,6 +4341,7 @@

+    "//third_party/libvpx/source/libvpx/vp9/encoder/vp9_svc_layercontext.c",

+    "//third_party/libvpx/source/libvpx/vp9/encoder/vp9_tokenize.c",

+    "//third_party/libvpx/source/libvpx/vp9/encoder/vp9_treewriter.c",

+ +  "//third_party/libvpx/source/libvpx/vp9/encoder/ppc/vp9_quantize_vsx.c",

+    "//third_party/libvpx/source/libvpx/vp9/vp9_cx_iface.c",

+    "//third_party/libvpx/source/libvpx/vp9/vp9_dx_iface.c",

+    "//third_party/libvpx/source/libvpx/vp9/vp9_iface_common.c",

+ @@ -4368,6 +4370,16 @@

+    "//third_party/libvpx/source/libvpx/vpx_dsp/variance.c",

+    "//third_party/libvpx/source/libvpx/vpx_dsp/vpx_convolve.c",

+    "//third_party/libvpx/source/libvpx/vpx_dsp/vpx_dsp_rtcd.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/deblock_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/fdct32x32_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/hadamard_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/intrapred_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/inv_txfm_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/quantize_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/sad_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/subtract_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/variance_vsx.c",

+ +  "//third_party/libvpx/source/libvpx/vpx_dsp/ppc/vpx_convolve_vsx.c",

+    "//third_party/libvpx/source/libvpx/vpx_mem/vpx_mem.c",

+    "//third_party/libvpx/source/libvpx/vpx_ports/ppc_cpudetect.c",

+    "//third_party/libvpx/source/libvpx/vpx_scale/generic/gen_scalers.c",

@@ -0,0 +1,43 @@ 

+ Index: chromium-110.0.5481.77/third_party/dav1d/config/linux/ppc64/config.h

+ ===================================================================

+ --- /dev/null

+ +++ chromium-110.0.5481.77/third_party/dav1d/config/linux/ppc64/config.h

+ @@ -0,0 +1,38 @@

+ +/*

+ + * Autogenerated by the Meson build system.

+ + * Do not edit, your changes will be lost.

+ + */

+ +

+ +#pragma once

+ +

+ +#define ARCH_AARCH64 0

+ +

+ +#define ARCH_ARM 0

+ +

+ +#define ARCH_PPC64LE 1

+ +

+ +#define ARCH_X86 0

+ +

+ +#define ARCH_X86_32 0

+ +

+ +#define ARCH_X86_64 0

+ +

+ +#define CONFIG_16BPC 1

+ +

+ +#define CONFIG_8BPC 1

+ +

+ +// #define CONFIG_LOG 1 -- Logging is controlled by Chromium

+ +

+ +#define ENDIANNESS_BIG 0

+ +

+ +#define HAVE_ASM 1

+ +

+ +#define HAVE_CLOCK_GETTIME 1

+ +

+ +#define HAVE_DLSYM 1

+ +

+ +#define HAVE_GETAUXVAL 1

+ +

+ +#define HAVE_POSIX_MEMALIGN 1

+ +

+ +#define HAVE_UNISTD_H 1

@@ -0,0 +1,17 @@ 

+ Index: chromium-110.0.5481.77/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc

+ +++ chromium-110.0.5481.77/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc

+ @@ -237,6 +237,12 @@ std::string UserAgent() {

+  #elif defined(ARCH_CPU_BIG_ENDIAN)

+      static constexpr char arch[] = "aarch64_be";

+  #endif

+ +#elif defined(__powerpc64__)

+ +#if defined(ARCH_CPU_LITTLE_ENDIAN)

+ +    static constexpr char arch[] = "ppc64";

+ +#elif defined(ARCH_CPU_BIG_ENDIAN)

+ +    static constexpr char arch[] = "ppc64_be";

+ +#endif

+  #else

+  #error Port

+  #endif

@@ -0,0 +1,376 @@ 

+ Index: chromium-110.0.5481.77/third_party/libvpx/source/libvpx/vp9/encoder/ppc/vp9_quantize_vsx.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/source/libvpx/vp9/encoder/ppc/vp9_quantize_vsx.c

+ +++ chromium-110.0.5481.77/third_party/libvpx/source/libvpx/vp9/encoder/ppc/vp9_quantize_vsx.c

+ @@ -38,6 +38,28 @@ static INLINE int16x8_t vec_max_across(i

+    return vec_max(a, vec_perm(a, a, vec_perm16));

+  }

+  

+ +static INLINE void

+ +vec_u64_store(vector unsigned long long vecu64, unsigned long offset, void *ptr)

+ +{

+ +#ifndef WORDS_BIGENDIAN

+ +  __asm__ ("xxswapd %x0, %x1"

+ +	   : "=wa" (vecu64)

+ +	   : "wa" (vecu64));

+ +#endif

+ +#if __GNUC__ >= 4

+ +  if (__builtin_constant_p (offset) && offset == 0)

+ +    __asm__ ("stxvd2x %x0,0,%1\n\t"

+ +	     :

+ +	     : "wa" (vecu64), "r" ((uintptr_t)ptr)

+ +	     : "memory");

+ +  else

+ +#endif

+ +    __asm__ ("stxvd2x %x0,%1,%2\n\t"

+ +	     :

+ +	     : "wa" (vecu64), "r" (offset), "r" ((uintptr_t)ptr)

+ +	     : "memory", "r0");

+ +}

+ +

+  void vp9_quantize_fp_vsx(const tran_low_t *coeff_ptr, intptr_t n_coeffs,

+                           const int16_t *round_ptr, const int16_t *quant_ptr,

+                           tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,

+ @@ -60,10 +82,10 @@ void vp9_quantize_fp_vsx(const tran_low_

+    qcoeff0 = vec_mulhi(vec_vaddshs(vec_abs(coeff0), round), quant);

+    zero_coeff0 = vec_cmpeq(qcoeff0, vec_zeros_s16);

+    qcoeff0 = vec_sign(qcoeff0, coeff0);

+ -  vec_vsx_st(qcoeff0, 0, qcoeff_ptr);

+ +  vec_u64_store(qcoeff0, 0, qcoeff_ptr);

+  

+    dqcoeff0 = vec_mladd(qcoeff0, dequant, vec_zeros_s16);

+ -  vec_vsx_st(dqcoeff0, 0, dqcoeff_ptr);

+ +  vec_u64_store(dqcoeff0, 0, dqcoeff_ptr);

+  

+    // Remove DC value from round and quant

+    round = vec_splat(round, 1);

+ @@ -76,10 +98,10 @@ void vp9_quantize_fp_vsx(const tran_low_

+    qcoeff1 = vec_mulhi(vec_vaddshs(vec_abs(coeff1), round), quant);

+    zero_coeff1 = vec_cmpeq(qcoeff1, vec_zeros_s16);

+    qcoeff1 = vec_sign(qcoeff1, coeff1);

+ -  vec_vsx_st(qcoeff1, 16, qcoeff_ptr);

+ +  vec_u64_store(qcoeff1, 16, qcoeff_ptr);

+  

+    dqcoeff1 = vec_mladd(qcoeff1, dequant, vec_zeros_s16);

+ -  vec_vsx_st(dqcoeff1, 16, dqcoeff_ptr);

+ +  vec_u64_store(dqcoeff1, 16, dqcoeff_ptr);

+  

+    eob = vec_max(vec_or(scan0, zero_coeff0), vec_or(scan1, zero_coeff1));

+  

+ @@ -107,23 +129,23 @@ void vp9_quantize_fp_vsx(const tran_low_

+        qcoeff0 = vec_mulhi(vec_vaddshs(vec_abs(coeff0), round), quant);

+        zero_coeff0 = vec_cmpeq(qcoeff0, vec_zeros_s16);

+        qcoeff0 = vec_sign(qcoeff0, coeff0);

+ -      vec_vsx_st(qcoeff0, off0, qcoeff_ptr);

+ +      vec_u64_store(qcoeff0, off0, qcoeff_ptr);

+        dqcoeff0 = vec_mladd(qcoeff0, dequant, vec_zeros_s16);

+ -      vec_vsx_st(dqcoeff0, off0, dqcoeff_ptr);

+ +      vec_u64_store(dqcoeff0, off0, dqcoeff_ptr);

+  

+        qcoeff1 = vec_mulhi(vec_vaddshs(vec_abs(coeff1), round), quant);

+        zero_coeff1 = vec_cmpeq(qcoeff1, vec_zeros_s16);

+        qcoeff1 = vec_sign(qcoeff1, coeff1);

+ -      vec_vsx_st(qcoeff1, off1, qcoeff_ptr);

+ +      vec_u64_store(qcoeff1, off1, qcoeff_ptr);

+        dqcoeff1 = vec_mladd(qcoeff1, dequant, vec_zeros_s16);

+ -      vec_vsx_st(dqcoeff1, off1, dqcoeff_ptr);

+ +      vec_u64_store(dqcoeff1, off1, dqcoeff_ptr);

+  

+        qcoeff2 = vec_mulhi(vec_vaddshs(vec_abs(coeff2), round), quant);

+        zero_coeff2 = vec_cmpeq(qcoeff2, vec_zeros_s16);

+        qcoeff2 = vec_sign(qcoeff2, coeff2);

+ -      vec_vsx_st(qcoeff2, off2, qcoeff_ptr);

+ +      vec_u64_store(qcoeff2, off2, qcoeff_ptr);

+        dqcoeff2 = vec_mladd(qcoeff2, dequant, vec_zeros_s16);

+ -      vec_vsx_st(dqcoeff2, off2, dqcoeff_ptr);

+ +      vec_u64_store(dqcoeff2, off2, dqcoeff_ptr);

+  

+        eob = vec_max(eob, vec_or(scan0, zero_coeff0));

+        eob2 = vec_max(vec_or(scan1, zero_coeff1), vec_or(scan2, zero_coeff2));

+ @@ -200,10 +222,10 @@ void vp9_quantize_fp_32x32_vsx(const tra

+    qcoeff0 = vec_and(qcoeff0, mask0);

+    zero_coeff0 = vec_cmpeq(qcoeff0, vec_zeros_s16);

+    qcoeff0 = vec_sign(qcoeff0, coeff0);

+ -  vec_vsx_st(qcoeff0, 0, qcoeff_ptr);

+ +  vec_u64_store(qcoeff0, 0, qcoeff_ptr);

+  

+    dqcoeff0 = dequantize_coeff_32(qcoeff0, dequant);

+ -  vec_vsx_st(dqcoeff0, 0, dqcoeff_ptr);

+ +  vec_u64_store(dqcoeff0, 0, dqcoeff_ptr);

+  

+    // Remove DC value from thres, round, quant and dequant

+    thres = vec_splat(thres, 1);

+ @@ -219,10 +241,10 @@ void vp9_quantize_fp_32x32_vsx(const tra

+    qcoeff1 = vec_and(qcoeff1, mask1);

+    zero_coeff1 = vec_cmpeq(qcoeff1, vec_zeros_s16);

+    qcoeff1 = vec_sign(qcoeff1, coeff1);

+ -  vec_vsx_st(qcoeff1, 16, qcoeff_ptr);

+ +  vec_u64_store(qcoeff1, 16, qcoeff_ptr);

+  

+    dqcoeff1 = dequantize_coeff_32(qcoeff1, dequant);

+ -  vec_vsx_st(dqcoeff1, 16, dqcoeff_ptr);

+ +  vec_u64_store(dqcoeff1, 16, dqcoeff_ptr);

+  

+    eob = vec_max(vec_or(scan0, zero_coeff0), vec_or(scan1, zero_coeff1));

+  

+ @@ -260,17 +282,17 @@ void vp9_quantize_fp_32x32_vsx(const tra

+      qcoeff1 = vec_sign(qcoeff1, coeff1);

+      qcoeff2 = vec_sign(qcoeff2, coeff2);

+  

+ -    vec_vsx_st(qcoeff0, off0, qcoeff_ptr);

+ -    vec_vsx_st(qcoeff1, off1, qcoeff_ptr);

+ -    vec_vsx_st(qcoeff2, off2, qcoeff_ptr);

+ +    vec_u64_store(qcoeff0, off0, qcoeff_ptr);

+ +    vec_u64_store(qcoeff1, off1, qcoeff_ptr);

+ +    vec_u64_store(qcoeff2, off2, qcoeff_ptr);

+  

+      dqcoeff0 = dequantize_coeff_32(qcoeff0, dequant);

+      dqcoeff1 = dequantize_coeff_32(qcoeff1, dequant);

+      dqcoeff2 = dequantize_coeff_32(qcoeff2, dequant);

+  

+ -    vec_vsx_st(dqcoeff0, off0, dqcoeff_ptr);

+ -    vec_vsx_st(dqcoeff1, off1, dqcoeff_ptr);

+ -    vec_vsx_st(dqcoeff2, off2, dqcoeff_ptr);

+ +    vec_u64_store(dqcoeff0, off0, dqcoeff_ptr);

+ +    vec_u64_store(dqcoeff1, off1, dqcoeff_ptr);

+ +    vec_u64_store(dqcoeff2, off2, dqcoeff_ptr);

+  

+      eob = vec_max(eob, vec_or(scan0, zero_coeff0));

+      eob2 = vec_max(vec_or(scan1, zero_coeff1), vec_or(scan2, zero_coeff2));

+ Index: chromium-110.0.5481.77/third_party/libvpx/source/libvpx/vpx_dsp/ppc/fdct32x32_vsx.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/source/libvpx/vpx_dsp/ppc/fdct32x32_vsx.c

+ +++ chromium-110.0.5481.77/third_party/libvpx/source/libvpx/vpx_dsp/ppc/fdct32x32_vsx.c

+ @@ -15,6 +15,28 @@

+  #include "vpx_dsp/ppc/txfm_common_vsx.h"

+  #include "vpx_dsp/ppc/types_vsx.h"

+  

+ +static INLINE void

+ +vec_u64_store(vector unsigned long long vecu64, unsigned long offset, void *ptr)

+ +{

+ +#ifndef WORDS_BIGENDIAN

+ +  __asm__ ("xxswapd %x0, %x1"

+ +	   : "=wa" (vecu64)

+ +	   : "wa" (vecu64));

+ +#endif

+ +#if __GNUC__ >= 4

+ +  if (__builtin_constant_p (offset) && offset == 0)

+ +    __asm__ ("stxvd2x %x0,0,%1\n\t"

+ +	     :

+ +	     : "wa" (vecu64), "r" ((uintptr_t)ptr)

+ +	     : "memory");

+ +  else

+ +#endif

+ +    __asm__ ("stxvd2x %x0,%1,%2\n\t"

+ +	     :

+ +	     : "wa" (vecu64), "r" (offset), "r" ((uintptr_t)ptr)

+ +	     : "memory", "r0");

+ +}

+ +

+  // Returns ((a +/- b) * cospi16 + (2 << 13)) >> 14.

+  static INLINE void single_butterfly(int16x8_t a, int16x8_t b, int16x8_t *add,

+                                      int16x8_t *sub) {

+ @@ -164,45 +186,45 @@ static INLINE void load(const int16_t *a

+  }

+  

+  static INLINE void store(tran_low_t *a, const int16x8_t *b) {

+ -  vec_vsx_st(b[0], 0, a);

+ -  vec_vsx_st(b[8], 0, a + 8);

+ -  vec_vsx_st(b[16], 0, a + 16);

+ -  vec_vsx_st(b[24], 0, a + 24);

+ -

+ -  vec_vsx_st(b[1], 0, a + 32);

+ -  vec_vsx_st(b[9], 0, a + 40);

+ -  vec_vsx_st(b[17], 0, a + 48);

+ -  vec_vsx_st(b[25], 0, a + 56);

+ -

+ -  vec_vsx_st(b[2], 0, a + 64);

+ -  vec_vsx_st(b[10], 0, a + 72);

+ -  vec_vsx_st(b[18], 0, a + 80);

+ -  vec_vsx_st(b[26], 0, a + 88);

+ -

+ -  vec_vsx_st(b[3], 0, a + 96);

+ -  vec_vsx_st(b[11], 0, a + 104);

+ -  vec_vsx_st(b[19], 0, a + 112);

+ -  vec_vsx_st(b[27], 0, a + 120);

+ -

+ -  vec_vsx_st(b[4], 0, a + 128);

+ -  vec_vsx_st(b[12], 0, a + 136);

+ -  vec_vsx_st(b[20], 0, a + 144);

+ -  vec_vsx_st(b[28], 0, a + 152);

+ -

+ -  vec_vsx_st(b[5], 0, a + 160);

+ -  vec_vsx_st(b[13], 0, a + 168);

+ -  vec_vsx_st(b[21], 0, a + 176);

+ -  vec_vsx_st(b[29], 0, a + 184);

+ -

+ -  vec_vsx_st(b[6], 0, a + 192);

+ -  vec_vsx_st(b[14], 0, a + 200);

+ -  vec_vsx_st(b[22], 0, a + 208);

+ -  vec_vsx_st(b[30], 0, a + 216);

+ -

+ -  vec_vsx_st(b[7], 0, a + 224);

+ -  vec_vsx_st(b[15], 0, a + 232);

+ -  vec_vsx_st(b[23], 0, a + 240);

+ -  vec_vsx_st(b[31], 0, a + 248);

+ +  vec_u64_store(b[0], 0, a);

+ +  vec_u64_store(b[8], 0, a + 8);

+ +  vec_u64_store(b[16], 0, a + 16);

+ +  vec_u64_store(b[24], 0, a + 24);

+ +

+ +  vec_u64_store(b[1], 0, a + 32);

+ +  vec_u64_store(b[9], 0, a + 40);

+ +  vec_u64_store(b[17], 0, a + 48);

+ +  vec_u64_store(b[25], 0, a + 56);

+ +

+ +  vec_u64_store(b[2], 0, a + 64);

+ +  vec_u64_store(b[10], 0, a + 72);

+ +  vec_u64_store(b[18], 0, a + 80);

+ +  vec_u64_store(b[26], 0, a + 88);

+ +

+ +  vec_u64_store(b[3], 0, a + 96);

+ +  vec_u64_store(b[11], 0, a + 104);

+ +  vec_u64_store(b[19], 0, a + 112);

+ +  vec_u64_store(b[27], 0, a + 120);

+ +

+ +  vec_u64_store(b[4], 0, a + 128);

+ +  vec_u64_store(b[12], 0, a + 136);

+ +  vec_u64_store(b[20], 0, a + 144);

+ +  vec_u64_store(b[28], 0, a + 152);

+ +

+ +  vec_u64_store(b[5], 0, a + 160);

+ +  vec_u64_store(b[13], 0, a + 168);

+ +  vec_u64_store(b[21], 0, a + 176);

+ +  vec_u64_store(b[29], 0, a + 184);

+ +

+ +  vec_u64_store(b[6], 0, a + 192);

+ +  vec_u64_store(b[14], 0, a + 200);

+ +  vec_u64_store(b[22], 0, a + 208);

+ +  vec_u64_store(b[30], 0, a + 216);

+ +

+ +  vec_u64_store(b[7], 0, a + 224);

+ +  vec_u64_store(b[15], 0, a + 232);

+ +  vec_u64_store(b[23], 0, a + 240);

+ +  vec_u64_store(b[31], 0, a + 248);

+  }

+  

+  // Returns 1 if negative 0 if positive

+ Index: chromium-110.0.5481.77/third_party/libvpx/source/libvpx/vpx_dsp/ppc/quantize_vsx.c

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/source/libvpx/vpx_dsp/ppc/quantize_vsx.c

+ +++ chromium-110.0.5481.77/third_party/libvpx/source/libvpx/vpx_dsp/ppc/quantize_vsx.c

+ @@ -13,6 +13,28 @@

+  #include "./vpx_dsp_rtcd.h"

+  #include "vpx_dsp/ppc/types_vsx.h"

+  

+ +static INLINE void

+ +vec_u64_store(vector unsigned long long vecu64, unsigned long offset, void *ptr)

+ +{

+ +#ifndef WORDS_BIGENDIAN

+ +  __asm__ ("xxswapd %x0, %x1"

+ +	   : "=wa" (vecu64)

+ +	   : "wa" (vecu64));

+ +#endif

+ +#if __GNUC__ >= 4

+ +  if (__builtin_constant_p (offset) && offset == 0)

+ +    __asm__ ("stxvd2x %x0,0,%1\n\t"

+ +	     :

+ +	     : "wa" (vecu64), "r" ((uintptr_t)ptr)

+ +	     : "memory");

+ +  else

+ +#endif

+ +    __asm__ ("stxvd2x %x0,%1,%2\n\t"

+ +	     :

+ +	     : "wa" (vecu64), "r" (offset), "r" ((uintptr_t)ptr)

+ +	     : "memory", "r0");

+ +}

+ +

+  // Negate 16-bit integers in a when the corresponding signed 16-bit

+  // integer in b is negative.

+  static INLINE int16x8_t vec_sign(int16x8_t a, int16x8_t b) {

+ @@ -124,19 +146,19 @@ void vpx_quantize_b_vsx(const tran_low_t

+  

+    qcoeff0 =

+        quantize_coeff(coeff0, coeff0_abs, round, quant, quant_shift, zero_mask0);

+ -  vec_vsx_st(qcoeff0, 0, qcoeff_ptr);

+ +  vec_u64_store(qcoeff0, 0, qcoeff_ptr);

+    round = vec_splat(round, 1);

+    quant = vec_splat(quant, 1);

+    quant_shift = vec_splat(quant_shift, 1);

+    qcoeff1 =

+        quantize_coeff(coeff1, coeff1_abs, round, quant, quant_shift, zero_mask1);

+ -  vec_vsx_st(qcoeff1, 16, qcoeff_ptr);

+ +  vec_u64_store(qcoeff1, 16, qcoeff_ptr);

+  

+    dqcoeff0 = vec_mladd(qcoeff0, dequant, vec_zeros_s16);

+ -  vec_vsx_st(dqcoeff0, 0, dqcoeff_ptr);

+ +  vec_u64_store(dqcoeff0, 0, dqcoeff_ptr);

+    dequant = vec_splat(dequant, 1);

+    dqcoeff1 = vec_mladd(qcoeff1, dequant, vec_zeros_s16);

+ -  vec_vsx_st(dqcoeff1, 16, dqcoeff_ptr);

+ +  vec_u64_store(dqcoeff1, 16, dqcoeff_ptr);

+  

+    eob = vec_max(nonzero_scanindex(qcoeff0, iscan_ptr, 0),

+                  nonzero_scanindex(qcoeff1, iscan_ptr, 16));

+ @@ -164,17 +186,17 @@ void vpx_quantize_b_vsx(const tran_low_t

+                                 zero_mask1);

+        qcoeff2 = quantize_coeff(coeff2, coeff2_abs, round, quant, quant_shift,

+                                 zero_mask2);

+ -      vec_vsx_st(qcoeff0, off0, qcoeff_ptr);

+ -      vec_vsx_st(qcoeff1, off1, qcoeff_ptr);

+ -      vec_vsx_st(qcoeff2, off2, qcoeff_ptr);

+ +      vec_u64_store(qcoeff0, off0, qcoeff_ptr);

+ +      vec_u64_store(qcoeff1, off1, qcoeff_ptr);

+ +      vec_u64_store(qcoeff2, off2, qcoeff_ptr);

+  

+        dqcoeff0 = vec_mladd(qcoeff0, dequant, vec_zeros_s16);

+        dqcoeff1 = vec_mladd(qcoeff1, dequant, vec_zeros_s16);

+        dqcoeff2 = vec_mladd(qcoeff2, dequant, vec_zeros_s16);

+  

+ -      vec_vsx_st(dqcoeff0, off0, dqcoeff_ptr);

+ -      vec_vsx_st(dqcoeff1, off1, dqcoeff_ptr);

+ -      vec_vsx_st(dqcoeff2, off2, dqcoeff_ptr);

+ +      vec_u64_store(dqcoeff0, off0, dqcoeff_ptr);

+ +      vec_u64_store(dqcoeff1, off1, dqcoeff_ptr);

+ +      vec_u64_store(dqcoeff2, off2, dqcoeff_ptr);

+  

+        eob = vec_max(eob, nonzero_scanindex(qcoeff0, iscan_ptr, off0));

+        eob2 = vec_max(nonzero_scanindex(qcoeff1, iscan_ptr, off1),

+ @@ -243,12 +265,12 @@ void vpx_quantize_b_32x32_vsx(const tran

+    qcoeff1 = quantize_coeff_32(coeff1, coeff1_abs, round, quant, quant_shift,

+                                zero_mask1);

+  

+ -  vec_vsx_st(qcoeff0, 0, qcoeff_ptr);

+ -  vec_vsx_st(qcoeff1, 16, qcoeff_ptr);

+ +  vec_u64_store(qcoeff0, 0, qcoeff_ptr);

+ +  vec_u64_store(qcoeff1, 16, qcoeff_ptr);

+  

+ -  vec_vsx_st(dequantize_coeff_32(qcoeff0, dequant), 0, dqcoeff_ptr);

+ +  vec_u64_store(dequantize_coeff_32(qcoeff0, dequant), 0, dqcoeff_ptr);

+    dequant = vec_splat(dequant, 1);  // remove DC from dequant

+ -  vec_vsx_st(dequantize_coeff_32(qcoeff1, dequant), 16, dqcoeff_ptr);

+ +  vec_u64_store(dequantize_coeff_32(qcoeff1, dequant), 16, dqcoeff_ptr);

+  

+    eob = vec_max(nonzero_scanindex(qcoeff0, iscan_ptr, 0),

+                  nonzero_scanindex(qcoeff1, iscan_ptr, 16));

+ @@ -276,13 +298,13 @@ void vpx_quantize_b_32x32_vsx(const tran

+      qcoeff2 = quantize_coeff_32(coeff2, coeff2_abs, round, quant, quant_shift,

+                                  zero_mask2);

+  

+ -    vec_vsx_st(qcoeff0, off0, qcoeff_ptr);

+ -    vec_vsx_st(qcoeff1, off1, qcoeff_ptr);

+ -    vec_vsx_st(qcoeff2, off2, qcoeff_ptr);

+ -

+ -    vec_vsx_st(dequantize_coeff_32(qcoeff0, dequant), off0, dqcoeff_ptr);

+ -    vec_vsx_st(dequantize_coeff_32(qcoeff1, dequant), off1, dqcoeff_ptr);

+ -    vec_vsx_st(dequantize_coeff_32(qcoeff2, dequant), off2, dqcoeff_ptr);

+ +    vec_u64_store(qcoeff0, off0, qcoeff_ptr);

+ +    vec_u64_store(qcoeff1, off1, qcoeff_ptr);

+ +    vec_u64_store(qcoeff2, off2, qcoeff_ptr);

+ +

+ +    vec_u64_store(dequantize_coeff_32(qcoeff0, dequant), off0, dqcoeff_ptr);

+ +    vec_u64_store(dequantize_coeff_32(qcoeff1, dequant), off1, dqcoeff_ptr);

+ +    vec_u64_store(dequantize_coeff_32(qcoeff2, dequant), off2, dqcoeff_ptr);

+  

+      eob = vec_max(eob, nonzero_scanindex(qcoeff0, iscan_ptr, off0));

+      eob2 = vec_max(nonzero_scanindex(qcoeff1, iscan_ptr, off1),

@@ -0,0 +1,914 @@ 

+ --- /dev/null

+ +++ b/third_party/libpng/powerpc/filter_vsx_intrinsics.c

+ @@ -0,0 +1,768 @@

+ +/* filter_vsx_intrinsics.c - PowerPC optimised filter functions

+ + *

+ + * Copyright (c) 2018 Cosmin Truta

+ + * Copyright (c) 2017 Glenn Randers-Pehrson

+ + * Written by Vadim Barkov, 2017.

+ + *

+ + * This code is released under the libpng license.

+ + * For conditions of distribution and use, see the disclaimer

+ + * and license in png.h

+ + */

+ +

+ +#include <stdio.h>

+ +#include <stdint.h>

+ +#include "../pngpriv.h"

+ +

+ +#ifdef PNG_READ_SUPPORTED

+ +

+ +/* This code requires -maltivec and -mvsx on the command line: */

+ +#if PNG_POWERPC_VSX_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */

+ +

+ +#include <altivec.h>

+ +

+ +#if PNG_POWERPC_VSX_OPT > 0

+ +

+ +#ifndef __VSX__

+ +#  error "This code requires VSX support (POWER7 and later). Please provide -mvsx compiler flag."

+ +#endif

+ +

+ +#define vec_ld_unaligned(vec,data) vec = vec_vsx_ld(0,data)

+ +#define vec_st_unaligned(vec,data) vec_vsx_st(vec,0,data)

+ +

+ +

+ +/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d).

+ + * They're positioned like this:

+ + *    prev:  c b

+ + *    row:   a d

+ + * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be

+ + * whichever of a, b, or c is closest to p=a+b-c.

+ + * ( this is taken from ../intel/filter_sse2_intrinsics.c )

+ + */

+ +

+ +#define vsx_declare_common_vars(row_info,row,prev_row,offset) \

+ +   png_byte i;\

+ +   png_bytep rp = row + offset;\

+ +   png_const_bytep pp = prev_row;\

+ +   size_t unaligned_top = 16 - (((size_t)rp % 16));\

+ +   size_t istop;\

+ +   if(unaligned_top == 16)\

+ +      unaligned_top = 0;\

+ +   istop = row_info->rowbytes;\

+ +   if((unaligned_top < istop))\

+ +      istop -= unaligned_top;\

+ +   else{\

+ +      unaligned_top = istop;\

+ +      istop = 0;\

+ +   }

+ +

+ +void png_read_filter_row_up_vsx(png_row_infop row_info, png_bytep row,

+ +                                png_const_bytep prev_row)

+ +{

+ +   vector unsigned char rp_vec;

+ +   vector unsigned char pp_vec;

+ +   vsx_declare_common_vars(row_info,row,prev_row,0)

+ +

+ +   /* Altivec operations require 16-byte aligned data

+ +    * but input can be unaligned. So we calculate

+ +    * unaligned part as usual.

+ +    */

+ +   for (i = 0; i < unaligned_top; i++)

+ +   {

+ +      *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);

+ +      rp++;

+ +   }

+ +

+ +   /* Using SIMD while we can */

+ +   while( istop >= 16 )

+ +   {

+ +      rp_vec = vec_ld(0,rp);

+ +      vec_ld_unaligned(pp_vec,pp);

+ +

+ +      rp_vec = vec_add(rp_vec,pp_vec);

+ +

+ +      vec_st(rp_vec,0,rp);

+ +

+ +      pp += 16;

+ +      rp += 16;

+ +      istop -= 16;

+ +   }

+ +

+ +   if(istop > 0)

+ +   {

+ +      /* If byte count of row is not divisible by 16

+ +       * we will process remaining part as usual

+ +       */

+ +      for (i = 0; i < istop; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);

+ +         rp++;

+ +      }

+ +}

+ +

+ +}

+ +

+ +static const vector unsigned char VSX_LEFTSHIFTED1_4 = {16,16,16,16, 0, 1, 2, 3,16,16,16,16,16,16,16,16};

+ +static const vector unsigned char VSX_LEFTSHIFTED2_4 = {16,16,16,16,16,16,16,16, 4, 5, 6, 7,16,16,16,16};

+ +static const vector unsigned char VSX_LEFTSHIFTED3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 8, 9,10,11};

+ +

+ +static const vector unsigned char VSX_LEFTSHIFTED1_3 = {16,16,16, 0, 1, 2,16,16,16,16,16,16,16,16,16,16};

+ +static const vector unsigned char VSX_LEFTSHIFTED2_3 = {16,16,16,16,16,16, 3, 4, 5,16,16,16,16,16,16,16};

+ +static const vector unsigned char VSX_LEFTSHIFTED3_3 = {16,16,16,16,16,16,16,16,16, 6, 7, 8,16,16,16,16};

+ +static const vector unsigned char VSX_LEFTSHIFTED4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 9,10,11,16};

+ +

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +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};

+ +

+ +static const vector unsigned char VSX_CHAR_ZERO = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

+ +#ifdef __LITTLE_ENDIAN__

+ +

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +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};

+ +

+ +#elif defined(__BIG_ENDIAN__)

+ +

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +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};

+ +

+ +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};

+ +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};

+ +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};

+ +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};

+ +

+ +#endif

+ +

+ +#define vsx_char_to_short(vec,offset,bpp) (vector unsigned short)vec_perm((vec),VSX_CHAR_ZERO,VSX_CHAR_TO_SHORT##offset##_##bpp)

+ +#define vsx_short_to_char(vec,offset,bpp) vec_perm(((vector unsigned char)(vec)),VSX_CHAR_ZERO,VSX_SHORT_TO_CHAR##offset##_##bpp)

+ +

+ +#ifdef PNG_USE_ABS

+ +#  define vsx_abs(number) abs(number)

+ +#else

+ +#  define vsx_abs(number) (number > 0) ? (number) : -(number)

+ +#endif

+ +

+ +void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row,

+ +                                  png_const_bytep prev_row)

+ +{

+ +   png_byte bpp = 4;

+ +

+ +   vector unsigned char rp_vec;

+ +   vector unsigned char part_vec;

+ +

+ +   vsx_declare_common_vars(row_info,row,prev_row,bpp)

+ +

+ +   PNG_UNUSED(pp)

+ +

+ +   /* Altivec operations require 16-byte aligned data

+ +    * but input can be unaligned. So we calculate

+ +    * unaligned part as usual.

+ +    */

+ +   for (i = 0; i < unaligned_top; i++)

+ +   {

+ +      *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);

+ +      rp++;

+ +   }

+ +

+ +   /* Using SIMD while we can */

+ +   while( istop >= 16 )

+ +   {

+ +      for(i=0;i < bpp ; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);

+ +         rp++;

+ +      }

+ +      rp -= bpp;

+ +

+ +      rp_vec = vec_ld(0,rp);

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_4);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_4);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_4);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      vec_st(rp_vec,0,rp);

+ +

+ +      rp += 16;

+ +      istop -= 16;

+ +   }

+ +

+ +   if(istop > 0)

+ +      for (i = 0; i < istop % 16; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) + (int)(*(rp - bpp))) & 0xff);

+ +         rp++;

+ +      }

+ +

+ +}

+ +

+ +void png_read_filter_row_sub3_vsx(png_row_infop row_info, png_bytep row,

+ +                                  png_const_bytep prev_row)

+ +{

+ +   png_byte bpp = 3;

+ +

+ +   vector unsigned char rp_vec;

+ +   vector unsigned char part_vec;

+ +

+ +   vsx_declare_common_vars(row_info,row,prev_row,bpp)

+ +

+ +   PNG_UNUSED(pp)

+ +

+ +   /* Altivec operations require 16-byte aligned data

+ +    * but input can be unaligned. So we calculate

+ +    * unaligned part as usual.

+ +    */

+ +   for (i = 0; i < unaligned_top; i++)

+ +   {

+ +      *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);

+ +      rp++;

+ +   }

+ +

+ +   /* Using SIMD while we can */

+ +   while( istop >= 16 )

+ +   {

+ +      for(i=0;i < bpp ; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);

+ +         rp++;

+ +      }

+ +      rp -= bpp;

+ +

+ +      rp_vec = vec_ld(0,rp);

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_3);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_3);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_3);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED4_3);

+ +      rp_vec = vec_add(rp_vec,part_vec);

+ +

+ +      vec_st(rp_vec,0,rp);

+ +      rp += 15;

+ +      istop -= 16;

+ +

+ +      /* Since 16 % bpp = 16 % 3 = 1, last element of array must

+ +       * be proceeded manually

+ +       */

+ +      *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);

+ +      rp++;

+ +   }

+ +

+ +   if(istop > 0)

+ +      for (i = 0; i < istop % 16; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);

+ +         rp++;

+ +      }

+ +}

+ +

+ +void png_read_filter_row_avg4_vsx(png_row_infop row_info, png_bytep row,

+ +                                  png_const_bytep prev_row)

+ +{

+ +   png_byte bpp = 4;

+ +

+ +   vector unsigned char rp_vec;

+ +   vector unsigned char pp_vec;

+ +   vector unsigned char pp_part_vec;

+ +   vector unsigned char rp_part_vec;

+ +   vector unsigned char avg_vec;

+ +

+ +   vsx_declare_common_vars(row_info,row,prev_row,bpp)

+ +   rp -= bpp;

+ +   if(istop >= bpp)

+ +      istop -= bpp;

+ +

+ +   for (i = 0; i < bpp; i++)

+ +   {

+ +      *rp = (png_byte)(((int)(*rp) +

+ +         ((int)(*pp++) / 2 )) & 0xff);

+ +

+ +      rp++;

+ +   }

+ +

+ +   /* Altivec operations require 16-byte aligned data

+ +    * but input can be unaligned. So we calculate

+ +    * unaligned part as usual.

+ +    */

+ +   for (i = 0; i < unaligned_top; i++)

+ +   {

+ +      *rp = (png_byte)(((int)(*rp) +

+ +         (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +

+ +      rp++;

+ +   }

+ +

+ +   /* Using SIMD while we can */

+ +   while( istop >= 16 )

+ +   {

+ +      for(i=0;i < bpp ; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) +

+ +            (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +

+ +         rp++;

+ +      }

+ +      rp -= bpp;

+ +      pp -= bpp;

+ +

+ +      vec_ld_unaligned(pp_vec,pp);

+ +      rp_vec = vec_ld(0,rp);

+ +

+ +      rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_4);

+ +      pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED1_4);

+ +      avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +      avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +      rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +      rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_4);

+ +      pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED2_4);

+ +      avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +      avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +      rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +      rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_4);

+ +      pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED3_4);

+ +      avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +      avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +      rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +      vec_st(rp_vec,0,rp);

+ +

+ +      rp += 16;

+ +      pp += 16;

+ +      istop -= 16;

+ +   }

+ +

+ +   if(istop  > 0)

+ +      for (i = 0; i < istop % 16; i++)

+ +      {

+ +         *rp = (png_byte)(((int)(*rp) +

+ +            (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +

+ +         rp++;

+ +      }

+ +}

+ +

+ +void png_read_filter_row_avg3_vsx(png_row_infop row_info, png_bytep row,

+ +                                  png_const_bytep prev_row)

+ +{

+ +  png_byte bpp = 3;

+ +

+ +  vector unsigned char rp_vec;

+ +  vector unsigned char pp_vec;

+ +  vector unsigned char pp_part_vec;

+ +  vector unsigned char rp_part_vec;

+ +  vector unsigned char avg_vec;

+ +

+ +  vsx_declare_common_vars(row_info,row,prev_row,bpp)

+ +  rp -= bpp;

+ +  if(istop >= bpp)

+ +     istop -= bpp;

+ +

+ +  for (i = 0; i < bpp; i++)

+ +  {

+ +     *rp = (png_byte)(((int)(*rp) +

+ +        ((int)(*pp++) / 2 )) & 0xff);

+ +

+ +     rp++;

+ +  }

+ +

+ +  /* Altivec operations require 16-byte aligned data

+ +   * but input can be unaligned. So we calculate

+ +   * unaligned part as usual.

+ +   */

+ +  for (i = 0; i < unaligned_top; i++)

+ +  {

+ +     *rp = (png_byte)(((int)(*rp) +

+ +        (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +

+ +     rp++;

+ +  }

+ +

+ +  /* Using SIMD while we can */

+ +  while( istop >= 16 )

+ +  {

+ +     for(i=0;i < bpp ; i++)

+ +     {

+ +        *rp = (png_byte)(((int)(*rp) +

+ +           (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +

+ +        rp++;

+ +     }

+ +     rp -= bpp;

+ +     pp -= bpp;

+ +

+ +     vec_ld_unaligned(pp_vec,pp);

+ +     rp_vec = vec_ld(0,rp);

+ +

+ +     rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_3);

+ +     pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED1_3);

+ +     avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +     avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +     rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +     rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_3);

+ +     pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED2_3);

+ +     avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +     avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +     rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +     rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_3);

+ +     pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED3_3);

+ +     avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +     avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +     rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +     rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED4_3);

+ +     pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED4_3);

+ +     avg_vec = vec_avg(rp_part_vec,pp_part_vec);

+ +     avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1)));

+ +     rp_vec = vec_add(rp_vec,avg_vec);

+ +

+ +     vec_st(rp_vec,0,rp);

+ +

+ +     rp += 15;

+ +     pp += 15;

+ +     istop -= 16;

+ +

+ +     /* Since 16 % bpp = 16 % 3 = 1, last element of array must

+ +      * be proceeded manually

+ +      */

+ +     *rp = (png_byte)(((int)(*rp) +

+ +        (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +     rp++;

+ +  }

+ +

+ +  if(istop  > 0)

+ +     for (i = 0; i < istop % 16; i++)

+ +     {

+ +        *rp = (png_byte)(((int)(*rp) +

+ +           (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);

+ +

+ +        rp++;

+ +     }

+ +}

+ +

+ +/* Bytewise c ? t : e. */

+ +#define if_then_else(c,t,e) vec_sel(e,t,c)

+ +

+ +#define vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) {\

+ +      c = *(pp - bpp);\

+ +      a = *(rp - bpp);\

+ +      b = *pp++;\

+ +      p = b - c;\

+ +      pc = a - c;\

+ +      pa = vsx_abs(p);\

+ +      pb = vsx_abs(pc);\

+ +      pc = vsx_abs(p + pc);\

+ +      if (pb < pa) pa = pb, a = b;\

+ +      if (pc < pa) a = c;\

+ +      a += *rp;\

+ +      *rp++ = (png_byte)a;\

+ +      }

+ +

+ +void png_read_filter_row_paeth4_vsx(png_row_infop row_info, png_bytep row,

+ +   png_const_bytep prev_row)

+ +{

+ +   png_byte bpp = 4;

+ +

+ +   int a, b, c, pa, pb, pc, p;

+ +   vector unsigned char rp_vec;

+ +   vector unsigned char pp_vec;

+ +   vector unsigned short a_vec,b_vec,c_vec,nearest_vec;

+ +   vector signed short pa_vec,pb_vec,pc_vec,smallest_vec;

+ +

+ +   vsx_declare_common_vars(row_info,row,prev_row,bpp)

+ +   rp -= bpp;

+ +   if(istop >= bpp)

+ +      istop -= bpp;

+ +

+ +   /* Process the first pixel in the row completely (this is the same as 'up'

+ +    * because there is only one candidate predictor for the first row).

+ +    */

+ +   for(i = 0; i < bpp ; i++)

+ +   {

+ +      *rp = (png_byte)( *rp + *pp);

+ +      rp++;

+ +      pp++;

+ +   }

+ +

+ +   for(i = 0; i < unaligned_top ; i++)

+ +   {

+ +      vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +   }

+ +

+ +   while( istop >= 16)

+ +   {

+ +      for(i = 0; i < bpp ; i++)

+ +      {

+ +         vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +      }

+ +

+ +      rp -= bpp;

+ +      pp -= bpp;

+ +      rp_vec = vec_ld(0,rp);

+ +      vec_ld_unaligned(pp_vec,pp);

+ +

+ +      a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_4),1,4);

+ +      b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED1_4),1,4);

+ +      c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_4),1,4);

+ +      pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +      pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +      pc_vec = vec_add(pa_vec,pb_vec);

+ +      pa_vec = vec_abs(pa_vec);

+ +      pb_vec = vec_abs(pb_vec);

+ +      pc_vec = vec_abs(pc_vec);

+ +      smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +      nearest_vec =  if_then_else(

+ +            vec_cmpeq(pa_vec,smallest_vec),

+ +            a_vec,

+ +            if_then_else(

+ +              vec_cmpeq(pb_vec,smallest_vec),

+ +              b_vec,

+ +              c_vec

+ +              )

+ +            );

+ +      rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,1,4)));

+ +

+ +      a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_4),2,4);

+ +      b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED2_4),2,4);

+ +      c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_4),2,4);

+ +      pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +      pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +      pc_vec = vec_add(pa_vec,pb_vec);

+ +      pa_vec = vec_abs(pa_vec);

+ +      pb_vec = vec_abs(pb_vec);

+ +      pc_vec = vec_abs(pc_vec);

+ +      smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +      nearest_vec =  if_then_else(

+ +            vec_cmpeq(pa_vec,smallest_vec),

+ +            a_vec,

+ +            if_then_else(

+ +              vec_cmpeq(pb_vec,smallest_vec),

+ +              b_vec,

+ +              c_vec

+ +              )

+ +            );

+ +      rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,2,4)));

+ +

+ +      a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_4),3,4);

+ +      b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED3_4),3,4);

+ +      c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_4),3,4);

+ +      pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +      pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +      pc_vec = vec_add(pa_vec,pb_vec);

+ +      pa_vec = vec_abs(pa_vec);

+ +      pb_vec = vec_abs(pb_vec);

+ +      pc_vec = vec_abs(pc_vec);

+ +      smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +      nearest_vec =  if_then_else(

+ +            vec_cmpeq(pa_vec,smallest_vec),

+ +            a_vec,

+ +            if_then_else(

+ +              vec_cmpeq(pb_vec,smallest_vec),

+ +              b_vec,

+ +              c_vec

+ +              )

+ +            );

+ +      rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,3,4)));

+ +

+ +      vec_st(rp_vec,0,rp);

+ +

+ +      rp += 16;

+ +      pp += 16;

+ +      istop -= 16;

+ +   }

+ +

+ +   if(istop > 0)

+ +      for (i = 0; i < istop % 16; i++)

+ +      {

+ +         vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +      }

+ +}

+ +

+ +void png_read_filter_row_paeth3_vsx(png_row_infop row_info, png_bytep row,

+ +   png_const_bytep prev_row)

+ +{

+ +  png_byte bpp = 3;

+ +

+ +  int a, b, c, pa, pb, pc, p;

+ +  vector unsigned char rp_vec;

+ +  vector unsigned char pp_vec;

+ +  vector unsigned short a_vec,b_vec,c_vec,nearest_vec;

+ +  vector signed short pa_vec,pb_vec,pc_vec,smallest_vec;

+ +

+ +  vsx_declare_common_vars(row_info,row,prev_row,bpp)

+ +  rp -= bpp;

+ +  if(istop >= bpp)

+ +     istop -= bpp;

+ +

+ +  /* Process the first pixel in the row completely (this is the same as 'up'

+ +   * because there is only one candidate predictor for the first row).

+ +   */

+ +  for(i = 0; i < bpp ; i++)

+ +  {

+ +     *rp = (png_byte)( *rp + *pp);

+ +     rp++;

+ +     pp++;

+ +  }

+ +

+ +  for(i = 0; i < unaligned_top ; i++)

+ +  {

+ +     vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +  }

+ +

+ +  while( istop >= 16)

+ +  {

+ +     for(i = 0; i < bpp ; i++)

+ +     {

+ +        vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +     }

+ +

+ +     rp -= bpp;

+ +     pp -= bpp;

+ +     rp_vec = vec_ld(0,rp);

+ +     vec_ld_unaligned(pp_vec,pp);

+ +

+ +     a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_3),1,3);

+ +     b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED1_3),1,3);

+ +     c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_3),1,3);

+ +     pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +     pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +     pc_vec = vec_add(pa_vec,pb_vec);

+ +     pa_vec = vec_abs(pa_vec);

+ +     pb_vec = vec_abs(pb_vec);

+ +     pc_vec = vec_abs(pc_vec);

+ +     smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +     nearest_vec =  if_then_else(

+ +           vec_cmpeq(pa_vec,smallest_vec),

+ +           a_vec,

+ +           if_then_else(

+ +             vec_cmpeq(pb_vec,smallest_vec),

+ +             b_vec,

+ +             c_vec

+ +             )

+ +           );

+ +     rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,1,3)));

+ +

+ +     a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_3),2,3);

+ +     b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED2_3),2,3);

+ +     c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_3),2,3);

+ +     pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +     pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +     pc_vec = vec_add(pa_vec,pb_vec);

+ +     pa_vec = vec_abs(pa_vec);

+ +     pb_vec = vec_abs(pb_vec);

+ +     pc_vec = vec_abs(pc_vec);

+ +     smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +     nearest_vec =  if_then_else(

+ +           vec_cmpeq(pa_vec,smallest_vec),

+ +           a_vec,

+ +           if_then_else(

+ +             vec_cmpeq(pb_vec,smallest_vec),

+ +             b_vec,

+ +             c_vec

+ +             )

+ +           );

+ +     rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,2,3)));

+ +

+ +     a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_3),3,3);

+ +     b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED3_3),3,3);

+ +     c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_3),3,3);

+ +     pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +     pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +     pc_vec = vec_add(pa_vec,pb_vec);

+ +     pa_vec = vec_abs(pa_vec);

+ +     pb_vec = vec_abs(pb_vec);

+ +     pc_vec = vec_abs(pc_vec);

+ +     smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +     nearest_vec =  if_then_else(

+ +           vec_cmpeq(pa_vec,smallest_vec),

+ +           a_vec,

+ +           if_then_else(

+ +             vec_cmpeq(pb_vec,smallest_vec),

+ +             b_vec,

+ +             c_vec

+ +             )

+ +           );

+ +     rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,3,3)));

+ +

+ +     a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED4_3),4,3);

+ +     b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED4_3),4,3);

+ +     c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED4_3),4,3);

+ +     pa_vec = (vector signed short) vec_sub(b_vec,c_vec);

+ +     pb_vec = (vector signed short) vec_sub(a_vec , c_vec);

+ +     pc_vec = vec_add(pa_vec,pb_vec);

+ +     pa_vec = vec_abs(pa_vec);

+ +     pb_vec = vec_abs(pb_vec);

+ +     pc_vec = vec_abs(pc_vec);

+ +     smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec));

+ +     nearest_vec =  if_then_else(

+ +           vec_cmpeq(pa_vec,smallest_vec),

+ +           a_vec,

+ +           if_then_else(

+ +             vec_cmpeq(pb_vec,smallest_vec),

+ +             b_vec,

+ +             c_vec

+ +             )

+ +           );

+ +     rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,4,3)));

+ +

+ +     vec_st(rp_vec,0,rp);

+ +

+ +     rp += 15;

+ +     pp += 15;

+ +     istop -= 16;

+ +

+ +     /* Since 16 % bpp = 16 % 3 = 1, last element of array must

+ +      * be proceeded manually

+ +      */

+ +     vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +  }

+ +

+ +  if(istop > 0)

+ +     for (i = 0; i < istop % 16; i++)

+ +     {

+ +        vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)

+ +     }

+ +}

+ +

+ +#endif /* PNG_POWERPC_VSX_OPT > 0 */

+ +#endif /* PNG_POWERPC_VSX_IMPLEMENTATION == 1 (intrinsics) */

+ +#endif /* READ */

+ --- /dev/null

+ +++ b/third_party/libpng/powerpc/powerpc_init.c

+ @@ -0,0 +1,126 @@

+ +

+ +/* powerpc_init.c - POWERPC optimised filter functions

+ + *

+ + * Copyright (c) 2018 Cosmin Truta

+ + * Copyright (c) 2017 Glenn Randers-Pehrson

+ + * Written by Vadim Barkov, 2017.

+ + *

+ + * This code is released under the libpng license.

+ + * For conditions of distribution and use, see the disclaimer

+ + * and license in png.h

+ + */

+ +

+ +/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are

+ + * called.

+ + */

+ +#define _POSIX_SOURCE 1

+ +

+ +#include <stdio.h>

+ +#include "../pngpriv.h"

+ +

+ +#ifdef PNG_READ_SUPPORTED

+ +

+ +#if PNG_POWERPC_VSX_OPT > 0

+ +#ifdef PNG_POWERPC_VSX_CHECK_SUPPORTED /* Do run-time checks */

+ +/* WARNING: it is strongly recommended that you do not build libpng with

+ + * run-time checks for CPU features if at all possible.  In the case of the PowerPC

+ + * VSX instructions there is no processor-specific way of detecting the

+ + * presence of the required support, therefore run-time detection is extremely

+ + * OS specific.

+ + *

+ + * You may set the macro PNG_POWERPC_VSX_FILE to the file name of file containing

+ + * a fragment of C source code which defines the png_have_vsx function.  There

+ + * are a number of implementations in contrib/powerpc-vsx, but the only one that

+ + * has partial support is contrib/powerpc-vsx/linux.c - a generic Linux

+ + * implementation which reads /proc/cpufino.

+ + */

+ +#ifndef PNG_POWERPC_VSX_FILE

+ +#  ifdef __linux__

+ +#     define  PNG_POWERPC_VSX_FILE "contrib/powerpc-vsx/linux_aux.c"

+ +#  endif

+ +#endif

+ +

+ +#ifdef PNG_POWERPC_VSX_FILE

+ +

+ +#include <signal.h> /* for sig_atomic_t */

+ +static int png_have_vsx(png_structp png_ptr);

+ +#include PNG_POWERPC_VSX_FILE

+ +

+ +#else  /* PNG_POWERPC_VSX_FILE */

+ +#  error "PNG_POWERPC_VSX_FILE undefined: no support for run-time POWERPC VSX checks"

+ +#endif /* PNG_POWERPC_VSX_FILE */

+ +#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */

+ +

+ +void

+ +png_init_filter_functions_vsx(png_structp pp, unsigned int bpp)

+ +{

+ +   /* The switch statement is compiled in for POWERPC_VSX_API, the call to

+ +    * png_have_vsx is compiled in for POWERPC_VSX_CHECK. If both are defined

+ +    * the check is only performed if the API has not set the PowerPC option on

+ +    * or off explicitly. In this case the check controls what happens.

+ +    */

+ +

+ +#ifdef PNG_POWERPC_VSX_API_SUPPORTED

+ +   switch ((pp->options >> PNG_POWERPC_VSX) & 3)

+ +   {

+ +      case PNG_OPTION_UNSET:

+ +         /* Allow the run-time check to execute if it has been enabled -

+ +          * thus both API and CHECK can be turned on.  If it isn't supported

+ +          * this case will fall through to the 'default' below, which just

+ +          * returns.

+ +          */

+ +#endif /* PNG_POWERPC_VSX_API_SUPPORTED */

+ +#ifdef PNG_POWERPC_VSX_CHECK_SUPPORTED

+ +         {

+ +            static volatile sig_atomic_t no_vsx = -1; /* not checked */

+ +

+ +            if (no_vsx < 0)

+ +               no_vsx = !png_have_vsx(pp);

+ +

+ +            if (no_vsx)

+ +               return;

+ +         }

+ +#ifdef PNG_POWERPC_VSX_API_SUPPORTED

+ +         break;

+ +#endif

+ +#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */

+ +

+ +#ifdef PNG_POWERPC_VSX_API_SUPPORTED

+ +      default: /* OFF or INVALID */

+ +         return;

+ +

+ +      case PNG_OPTION_ON:

+ +         /* Option turned on */

+ +         break;

+ +   }

+ +#endif

+ +

+ +   /* IMPORTANT: any new internal functions used here must be declared using

+ +    * PNG_INTERNAL_FUNCTION in ../pngpriv.h.  This is required so that the

+ +    * 'prefix' option to configure works:

+ +    *

+ +    *    ./configure --with-libpng-prefix=foobar_

+ +    *

+ +    * Verify you have got this right by running the above command, doing a build

+ +    * and examining pngprefix.h; it must contain a #define for every external

+ +    * function you add.  (Notice that this happens automatically for the

+ +    * initialization function.)

+ +    */

+ +   pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_vsx;

+ +

+ +   if (bpp == 3)

+ +   {

+ +      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_vsx;

+ +      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_vsx;

+ +      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_vsx;

+ +   }

+ +

+ +   else if (bpp == 4)

+ +   {

+ +      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_vsx;

+ +      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_vsx;

+ +      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_vsx;

+ +   }

+ +}

+ +#endif /* PNG_POWERPC_VSX_OPT > 0 */

+ +#endif /* READ */

+ --- a/third_party/libpng/BUILD.gn

+ +++ b/third_party/libpng/BUILD.gn

+ @@ -89,6 +91,11 @@ source_set("libpng_sources") {

+        "mips/filter_msa_intrinsics.c",

+        "mips/mips_init.c",

+      ]

+ +  } else if (current_cpu == "ppc64") {

+ +    sources += [

+ +      "powerpc/filter_vsx_intrinsics.c",

+ +      "powerpc/powerpc_init.c",

+ +    ]

+    }

+  

+    configs -= [ "//build/config/compiler:chromium_code" ]

@@ -0,0 +1,13 @@ 

+ Index: chromium-98.0.4758.80/third_party/pdfium/BUILD.gn

+ ===================================================================

+ --- chromium-98.0.4758.80.orig/third_party/pdfium/BUILD.gn

+ +++ chromium-98.0.4758.80/third_party/pdfium/BUILD.gn

+ @@ -16,7 +16,7 @@

+  }

+  

+  config("pdfium_common_config") {

+ -  cflags = []

+ +  cflags = [ "-DPNG_POWERPC_VSX_OPT=0" ]

+    cflags_cc = []

+    ldflags = []

+    include_dirs = [ "." ]

@@ -0,0 +1,19 @@ 

+ Index: chromium-110.0.5481.77/third_party/dawn/src/dawn/common/Platform.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/dawn/src/dawn/common/Platform.h

+ +++ chromium-110.0.5481.77/third_party/dawn/src/dawn/common/Platform.h

+ @@ -140,10 +140,12 @@

+  #elif defined(__s390x__)

+  #define DAWN_PLATFORM_IS_S390X 1

+  

+ -#elif defined(__PPC__)

+ -#define DAWN_PLATFORM_IS_PPC 1

+ +// Order matters here

+ +// PPC64 also defines PPC, which can lead to detection failures on ppc64le systems

+  #elif defined(__PPC64__)

+  #define DAWN_PLATFORM_IS_PPC64 1

+ +#elif defined(__PPC__)

+ +#define DAWN_PLATFORM_IS_PPC 1

+  

+  #else

+  #error "Unsupported platform."

@@ -0,0 +1,32 @@ 

+ Index: chromium-110.0.5481.77/third_party/dawn/src/dawn/common/Platform.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/dawn/src/dawn/common/Platform.h

+ +++ chromium-110.0.5481.77/third_party/dawn/src/dawn/common/Platform.h

+ @@ -135,9 +135,9 @@

+  #define DAWN_PLATFORM_IS_MIPS64 1

+  #endif

+  

+ -#elif defiend(__s390__)

+ +#elif defined(__s390__)

+  #define DAWN_PLATFORM_IS_S390 1

+ -#elif defiend(__s390x__)

+ +#elif defined(__s390x__)

+  #define DAWN_PLATFORM_IS_S390X 1

+  

+  #elif defined(__PPC__)

+ Index: chromium-110.0.5481.77/third_party/dawn/src/dawn/common/Assert.cpp

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/dawn/src/dawn/common/Assert.cpp

+ +++ chromium-110.0.5481.77/third_party/dawn/src/dawn/common/Assert.cpp

+ @@ -33,9 +33,9 @@ void BreakPoint() {

+      __asm__ __volatile__("ebreak");

+  #elif DAWN_PLATFORM_IS(MIPS)

+      __asm__ __volatile__("break");

+ -#elif DAWN_PLATFORM_IS(S390) || DAWN_PLATFORM_IS_(S390X)

+ +#elif DAWN_PLATFORM_IS(S390) || DAWN_PLATFORM_IS(S390X)

+      __asm__ __volatile__(".word 0x0001");

+ -#elif DAWN_PLATFORM_IS(PPC) || DAWN_PLATFORM_IS_(PPC64)

+ +#elif DAWN_PLATFORM_IS(PPC) || DAWN_PLATFORM_IS(PPC64)

+      __asm__ __volatile__("twge 2,2");

+  #else

+  #error "Unsupported platform"

@@ -0,0 +1,645 @@ 

+ Index: chromium-116.0.5845.82/third_party/skia/BUILD.gn

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/BUILD.gn

+ +++ chromium-116.0.5845.82/third_party/skia/BUILD.gn

+ @@ -215,6 +215,12 @@ opts("skx") {

+    }

+  }

+  

+ +opts("vsx") {

+ +  enabled = current_cpu == "ppc64"

+ +  sources = skia_opts.vsx_sources

+ +  cflags = [ "-mcpu=power9", "-mtune=power9" ]

+ +}

+ +

+  # Any feature of Skia that requires third-party code should be optional and use this template.

+  template("optional") {

+    if (invoker.enabled) {

+ @@ -1436,6 +1442,7 @@ skia_component("skia") {

+      ":skvm_jit",

+      ":skx",

+      ":ssse3",

+ +    ":vsx",

+      ":vello",

+      ":webp_decode",

+      ":wuffs",

+ @@ -1627,6 +1634,7 @@ skia_static_library("pathkit") {

+      ":avx",

+      ":hsw",

+      ":ssse3",

+ +    ":vsx",

+    ]

+  

+    sources = []

+ Index: chromium-116.0.5845.82/third_party/skia/gn/shared_sources.gni

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/gn/shared_sources.gni

+ +++ chromium-116.0.5845.82/third_party/skia/gn/shared_sources.gni

+ @@ -22,4 +22,5 @@ skia_opts = {

+    avx_sources = avx

+    hsw_sources = hsw

+    skx_sources = skx

+ +  vsx_sources = ssse3

+  }

+ Index: chromium-116.0.5845.82/third_party/skia/gn/skia/BUILD.gn

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/gn/skia/BUILD.gn

+ +++ chromium-116.0.5845.82/third_party/skia/gn/skia/BUILD.gn

+ @@ -163,6 +163,8 @@ config("default") {

+        "-mfpmath=sse",

+      ]

+      ldflags += [ "-m32" ]

+ +  } else if (current_cpu == "ppc64") {

+ +    cflags += [ "-mcpu=power9", "-mtune=power9" ]

+    }

+  

+    if (malloc != "" && !is_win) {

+ Index: chromium-116.0.5845.82/third_party/skia/include/core/SkTypes.h

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/include/core/SkTypes.h

+ +++ chromium-116.0.5845.82/third_party/skia/include/core/SkTypes.h

+ @@ -195,5 +195,41 @@ static constexpr uint32_t SK_InvalidGenI

+  */

+  static constexpr uint32_t SK_InvalidUniqueID = 0;

+  

+ +//////////////////////////////////////////////////////////////////////

+ +// PPC defines

+ +

+ +#if defined(__powerpc64__) || defined(__PPC64__)

+ +    #define SK_CPU_PPC64

+ +#endif

+ +

+ +// Newer versions of clang and gcc for ppc64 ship with wrappers that translate

+ +// Intel vector intrinsics into PPC VSX instrinsics, so we can pretend to have

+ +// to be Intel. Currently, full API support for SSSE3 on POWER8 and later

+ +// processors.

+ +#if defined(__POWER8_VECTOR__) && defined(__has_include) && \

+ +  !defined(SK_CPU_SSE_LEVEL)

+ +

+ +    // Clang ships both Intel and PPC headers in its PPC version, storing the

+ +    // PPC compatibility in a subdirectory that the compiler will include before

+ +    // its standard library include directory.

+ +    #if (__has_include(<tmmintrin.h>) && !defined(__clang__)) || \

+ +         __has_include(<ppc_wrappers/tmmintrin.h>)

+ +        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSSE3

+ +    #elif (__has_include(<emmintrin.h>) && !defined(__clang__)) || \

+ +           __has_include(<ppc_wrappers/emmintrin.h>)

+ +        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE2

+ +    #endif

+ +

+ +    #ifdef SK_CPU_SSE_LEVEL

+ +        #define SK_PPC64_HAS_SSE_COMPAT

+ +        #ifndef NO_WARN_X86_INTRINSICS

+ +            #define NO_WARN_X86_INTRINSICS

+ +        #endif

+ +        #if defined(__clang__)

+ +            #define SK_PPC64_CLANG_MFPPR_BUG

+ +        #endif

+ +    #endif

+ +#endif

+ +

+  

+  #endif

+ Index: chromium-116.0.5845.82/third_party/skia/src/base/SkSpinlock.cpp

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/src/base/SkSpinlock.cpp

+ +++ chromium-116.0.5845.82/third_party/skia/src/base/SkSpinlock.cpp

+ @@ -33,7 +33,8 @@

+  #endif

+  

+  // Renamed from "pause" to avoid conflict with function defined in unistd.h

+ -#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2

+ +#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && \

+ +    !defined(SK_PPC64_CLANG_MFPPR_BUG)

+      #include <emmintrin.h>

+      static void do_pause() { _mm_pause(); }

+  #else

+ Index: chromium-116.0.5845.82/third_party/skia/src/opts/SkBitmapProcState_opts.h

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/src/opts/SkBitmapProcState_opts.h

+ +++ chromium-116.0.5845.82/third_party/skia/src/opts/SkBitmapProcState_opts.h

+ @@ -21,7 +21,13 @@

+  // The rest are scattershot at the moment but I want to get them

+  // all migrated to be normal code inside SkBitmapProcState.cpp.

+  

+ -#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2

+ +#if defined(SK_PPC64_HAS_SSE_COMPAT)

+ +    #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3

+ +        #include <tmmintrin.h>

+ +    #else

+ +        #include <emmintrin.h>

+ +    #endif

+ +#elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2

+      #include <immintrin.h>

+  #elif defined(SK_ARM_HAS_NEON)

+      #include <arm_neon.h>

+ Index: chromium-116.0.5845.82/third_party/skia/src/opts/SkBlitRow_opts.h

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/src/opts/SkBlitRow_opts.h

+ +++ chromium-116.0.5845.82/third_party/skia/src/opts/SkBlitRow_opts.h

+ @@ -69,7 +69,7 @@

+  #endif

+  

+  #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2

+ -    #include <immintrin.h>

+ +    #include <emmintrin.h>

+  

+      static inline __m128i SkPMSrcOver_SSE2(const __m128i& src, const __m128i& dst) {

+          __m128i scale = _mm_sub_epi32(_mm_set1_epi32(256),

+ Index: chromium-116.0.5845.82/third_party/skia/src/opts/SkRasterPipeline_opts.h

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/src/opts/SkRasterPipeline_opts.h

+ +++ chromium-116.0.5845.82/third_party/skia/src/opts/SkRasterPipeline_opts.h

+ @@ -1,5 +1,6 @@

+  /*

+   * Copyright 2018 Google Inc.

+ + * Copyright 2023 Raptor Engineering, LLC

+   *

+   * Use of this source code is governed by a BSD-style license that can be

+   * found in the LICENSE file.

+ @@ -52,6 +53,8 @@ using NoCtx = const void*;

+      #define JUMPER_IS_SCALAR

+  #elif defined(SK_ARM_HAS_NEON)

+      #define JUMPER_IS_NEON

+ +#elif defined(SK_PPC64_HAS_SSE_COMPAT)

+ +    #define JUMPER_IS_VSX

+  #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2

+      #define JUMPER_IS_HSW

+  #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX

+ @@ -82,6 +85,8 @@ using NoCtx = const void*;

+      #include <math.h>

+  #elif defined(JUMPER_IS_NEON)

+      #include <arm_neon.h>

+ +#elif defined(JUMPER_IS_VSX)

+ +    #include <emmintrin.h>

+  #else

+      #include <immintrin.h>

+  #endif

+ @@ -183,6 +188,257 @@ namespace SK_OPTS_NS {

+          ptr[3] = a;

+      }

+  

+ +#elif defined(JUMPER_IS_VSX)

+ +    // Since we know we're using Clang, we can use its vector extensions.

+ +    template <typename T> using V = T __attribute__((ext_vector_type(4)));

+ +    using F   = V<float   >;

+ +    using I32 = V< int32_t>;

+ +    using U64 = V<uint64_t>;

+ +    using U32 = V<uint32_t>;

+ +    using U16 = V<uint16_t>;

+ +    using U8  = V<uint8_t >;

+ +

+ +    // We polyfill a few routines that Clang doesn't build into ext_vector_types.

+ +    SI F   min(F a, F b)     { return vec_min(a,b); }

+ +    SI I32 min(I32 a, I32 b) { return vec_min(a,b); }

+ +    SI U32 min(U32 a, U32 b) { return vec_min(a,b); }

+ +    SI F   max(F a, F b)     { return vec_max(a,b); }

+ +    SI I32 max(I32 a, I32 b) { return vec_max(a,b); }

+ +    SI U32 max(U32 a, U32 b) { return vec_max(a,b); }

+ +

+ +    SI F   abs_  (F v)   { return vec_abs(v); }

+ +    SI I32 abs_  (I32 v) { return vec_abs(v); }

+ +    SI F   rcp_fast(F v) { return vec_re(v); }

+ +    SI F   rcp_precise (F v) { F e = rcp_fast(v); return e * (2.0f - v * e); }

+ +    SI F   rsqrt (F v)   { return vec_rsqrte(v); }

+ +

+ +    SI U16 pack(U32 v)       { return __builtin_convertvector(v, U16); }

+ +    SI U8  pack(U16 v)       { return __builtin_convertvector(v,  U8); }

+ +

+ +    SI F if_then_else(I32 c, F t, F e) {

+ +        return vec_or((vector float)vec_and((vector float)c, (vector float)t), (vector float)vec_andc((vector float)e, (vector float)c));

+ +    }

+ +

+ +    // In both AltiVec and SSE there is no horizontal element compare, unlike ARM.  Fall back to scalar operations here...

+ +    SI bool any(I32 c) {

+ +        if (vec_extract((U32)c, 0) != 0) return 1;

+ +        if (vec_extract((U32)c, 1) != 0) return 1;

+ +        if (vec_extract((U32)c, 2) != 0) return 1;

+ +        if (vec_extract((U32)c, 3) != 0) return 1;

+ +        return 0;

+ +    }

+ +    SI bool all(I32 c) {

+ +        if (vec_extract((U32)c, 0) == 0) return 0;

+ +        if (vec_extract((U32)c, 1) == 0) return 0;

+ +        if (vec_extract((U32)c, 2) == 0) return 0;

+ +        if (vec_extract((U32)c, 3) == 0) return 0;

+ +        return 1;

+ +    }

+ +

+ +    SI F     mad(F f, F m, F a) { return vec_madd(f,m,a); }

+ +    SI F  floor_(F v) { return vec_floor(v); }

+ +    SI F   ceil_(F v) { return vec_ceil(v); }

+ +    SI F   sqrt_(F v) { return vec_sqrt(v); }

+ +    SI U32 round(F v) { return vec_cts((vector float)vec_rint(v), 0); }

+ +    SI U32 round(F v, F scale) { return vec_cts((vector float)vec_rint(v*scale), 0); }

+ +

+ +    template <typename T>

+ +    SI V<T> gather(const T* p, U32 ix) {

+ +        return {p[ix[0]], p[ix[1]], p[ix[2]], p[ix[3]]};

+ +    }

+ +    template <typename V, typename S>

+ +    SI void scatter_masked(V src, S* dst, U32 ix, I32 mask) {

+ +        V before = gather(dst, ix);

+ +        V after = if_then_else(mask, src, before);

+ +        dst[ix[0]] = after[0];

+ +        dst[ix[1]] = after[1];

+ +        dst[ix[2]] = after[2];

+ +        dst[ix[3]] = after[3];

+ +    }

+ +

+ +    // TODO

+ +    // Finish converting these functions from the SSE translation layer to native AltiVec / VSX

+ +    SI void load2(const uint16_t* ptr, size_t tail, U16* r, U16* g) {

+ +        __m128i _01;

+ +        if (__builtin_expect(tail,0)) {

+ +            _01 = _mm_setzero_si128();

+ +            if (tail > 1) {

+ +                _01 = _mm_loadl_pd(_01, (const double*)ptr);            // r0 g0 r1 g1 00 00 00 00

+ +                if (tail > 2) {

+ +                  _01 = _mm_insert_epi16(_01, *(ptr+4), 4);             // r0 g0 r1 g1 r2 00 00 00

+ +                  _01 = _mm_insert_epi16(_01, *(ptr+5), 5);             // r0 g0 r1 g1 r2 g2 00 00

+ +                }

+ +            } else {

+ +                _01 = _mm_cvtsi32_si128(*(const uint32_t*)ptr);         // r0 g0 00 00 00 00 00 00

+ +            }

+ +        } else {

+ +            _01 = _mm_loadu_si128(((__m128i*)ptr) + 0);  // r0 g0 r1 g1 r2 g2 r3 g3

+ +        }

+ +        auto rg01_23 = _mm_shufflelo_epi16(_01, 0xD8);      // r0 r1 g0 g1 r2 g2 r3 g3

+ +        auto rg      = _mm_shufflehi_epi16(rg01_23, 0xD8);  // r0 r1 g0 g1 r2 r3 g2 g3

+ +

+ +        auto R = _mm_shuffle_epi32(rg, 0x88);  // r0 r1 r2 r3 r0 r1 r2 r3

+ +        auto G = _mm_shuffle_epi32(rg, 0xDD);  // g0 g1 g2 g3 g0 g1 g2 g3

+ +        *r = sk_unaligned_load<U16>(&R);

+ +        *g = sk_unaligned_load<U16>(&G);

+ +    }

+ +

+ +    SI void store2(uint16_t* ptr, size_t tail, U16 r, U16 g) {

+ +        U32 rg = _mm_unpacklo_epi16(widen_cast<__m128i>(r), widen_cast<__m128i>(g));

+ +        if (__builtin_expect(tail, 0)) {

+ +            if (tail > 1) {

+ +                _mm_storel_epi64((__m128i*)ptr, rg);

+ +                if (tail > 2) {

+ +                    int32_t rgpair = rg[2];

+ +                    memcpy(ptr + 4, &rgpair, sizeof(rgpair));

+ +                }

+ +            } else {

+ +                int32_t rgpair = rg[0];

+ +                memcpy(ptr, &rgpair, sizeof(rgpair));

+ +            }

+ +        } else {

+ +            _mm_storeu_si128((__m128i*)ptr + 0, rg);

+ +        }

+ +    }

+ +

+ +    SI void load3(const uint16_t* ptr, size_t tail, U16* r, U16* g, U16* b) {

+ +        __m128i _0, _1, _2, _3;

+ +        if (__builtin_expect(tail,0)) {

+ +            _1 = _2 = _3 = _mm_setzero_si128();

+ +            auto load_rgb = [](const uint16_t* src) {

+ +                auto v = _mm_cvtsi32_si128(*(const uint32_t*)src);

+ +                return _mm_insert_epi16(v, src[2], 2);

+ +            };

+ +            if (  true  ) { _0 = load_rgb(ptr + 0); }

+ +            if (tail > 1) { _1 = load_rgb(ptr + 3); }

+ +            if (tail > 2) { _2 = load_rgb(ptr + 6); }

+ +        } else {

+ +            // Load slightly weirdly to make sure we don't load past the end of 4x48 bits.

+ +            auto _01 =                _mm_loadu_si128((const __m128i*)(ptr + 0))    ,

+ +                 _23 = _mm_srli_si128(_mm_loadu_si128((const __m128i*)(ptr + 4)), 4);

+ +

+ +            // Each _N holds R,G,B for pixel N in its lower 3 lanes (upper 5 are ignored).

+ +            _0 = _01;

+ +            _1 = _mm_srli_si128(_01, 6);

+ +            _2 = _23;

+ +            _3 = _mm_srli_si128(_23, 6);

+ +        }

+ +

+ +        // De-interlace to R,G,B.

+ +        auto _02 = _mm_unpacklo_epi16(_0, _2),  // r0 r2 g0 g2 b0 b2 xx xx

+ +             _13 = _mm_unpacklo_epi16(_1, _3);  // r1 r3 g1 g3 b1 b3 xx xx

+ +

+ +        auto R = _mm_unpacklo_epi16(_02, _13),  // r0 r1 r2 r3 g0 g1 g2 g3

+ +             G = _mm_srli_si128(R, 8),

+ +             B = _mm_unpackhi_epi16(_02, _13);  // b0 b1 b2 b3 xx xx xx xx

+ +

+ +        *r = sk_unaligned_load<U16>(&R);

+ +        *g = sk_unaligned_load<U16>(&G);

+ +        *b = sk_unaligned_load<U16>(&B);

+ +    }

+ +

+ +    SI void load4(const uint16_t* ptr, size_t tail, U16* r, U16* g, U16* b, U16* a) {

+ +        __m128i _01, _23;

+ +        if (__builtin_expect(tail,0)) {

+ +            _01 = _23 = _mm_setzero_si128();

+ +            auto src = (const double*)ptr;

+ +            if (  true  ) { _01 = _mm_loadl_pd(_01, src + 0); } // r0 g0 b0 a0 00 00 00 00

+ +            if (tail > 1) { _01 = _mm_loadh_pd(_01, src + 1); } // r0 g0 b0 a0 r1 g1 b1 a1

+ +            if (tail > 2) { _23 = _mm_loadl_pd(_23, src + 2); } // r2 g2 b2 a2 00 00 00 00

+ +        } else {

+ +            _01 = _mm_loadu_si128(((__m128i*)ptr) + 0); // r0 g0 b0 a0 r1 g1 b1 a1

+ +            _23 = _mm_loadu_si128(((__m128i*)ptr) + 1); // r2 g2 b2 a2 r3 g3 b3 a3

+ +        }

+ +

+ +        auto _02 = _mm_unpacklo_epi16(_01, _23),  // r0 r2 g0 g2 b0 b2 a0 a2

+ +             _13 = _mm_unpackhi_epi16(_01, _23);  // r1 r3 g1 g3 b1 b3 a1 a3

+ +

+ +        auto rg = _mm_unpacklo_epi16(_02, _13),  // r0 r1 r2 r3 g0 g1 g2 g3

+ +             ba = _mm_unpackhi_epi16(_02, _13);  // b0 b1 b2 b3 a0 a1 a2 a3

+ +

+ +        *r = sk_unaligned_load<U16>((uint16_t*)&rg + 0);

+ +        *g = sk_unaligned_load<U16>((uint16_t*)&rg + 4);

+ +        *b = sk_unaligned_load<U16>((uint16_t*)&ba + 0);

+ +        *a = sk_unaligned_load<U16>((uint16_t*)&ba + 4);

+ +    }

+ +

+ +    SI void store4(uint16_t* ptr, size_t tail, U16 r, U16 g, U16 b, U16 a) {

+ +        auto rg = _mm_unpacklo_epi16(widen_cast<__m128i>(r), widen_cast<__m128i>(g)),

+ +             ba = _mm_unpacklo_epi16(widen_cast<__m128i>(b), widen_cast<__m128i>(a));

+ +

+ +        if (__builtin_expect(tail, 0)) {

+ +            auto dst = (double*)ptr;

+ +            if (  true  ) { _mm_storel_pd(dst + 0, _mm_unpacklo_epi32(rg, ba)); }

+ +            if (tail > 1) { _mm_storeh_pd(dst + 1, _mm_unpacklo_epi32(rg, ba)); }

+ +            if (tail > 2) { _mm_storel_pd(dst + 2, _mm_unpackhi_epi32(rg, ba)); }

+ +        } else {

+ +            _mm_storeu_si128((__m128i*)ptr + 0, _mm_unpacklo_epi32(rg, ba));

+ +            _mm_storeu_si128((__m128i*)ptr + 1, _mm_unpackhi_epi32(rg, ba));

+ +        }

+ +    }

+ +

+ +    SI void load2(const float* ptr, size_t tail, F* r, F* g) {

+ +        F _01, _23;

+ +        if (__builtin_expect(tail, 0)) {

+ +            _01 = _23 = _mm_setzero_si128();

+ +            if (  true  ) { _01 = _mm_loadl_pi(_01, (__m64 const*)(ptr + 0)); }

+ +            if (tail > 1) { _01 = _mm_loadh_pi(_01, (__m64 const*)(ptr + 2)); }

+ +            if (tail > 2) { _23 = _mm_loadl_pi(_23, (__m64 const*)(ptr + 4)); }

+ +        } else {

+ +            _01 = _mm_loadu_ps(ptr + 0);

+ +            _23 = _mm_loadu_ps(ptr + 4);

+ +        }

+ +        *r = _mm_shuffle_ps(_01, _23, 0x88);

+ +        *g = _mm_shuffle_ps(_01, _23, 0xDD);

+ +    }

+ +

+ +    SI void store2(float* ptr, size_t tail, F r, F g) {

+ +        F _01 = _mm_unpacklo_ps(r, g),

+ +          _23 = _mm_unpackhi_ps(r, g);

+ +        if (__builtin_expect(tail, 0)) {

+ +            if (  true  ) { _mm_storel_pi((__m64*)(ptr + 0), _01); }

+ +            if (tail > 1) { _mm_storeh_pi((__m64*)(ptr + 2), _01); }

+ +            if (tail > 2) { _mm_storel_pi((__m64*)(ptr + 4), _23); }

+ +        } else {

+ +            _mm_storeu_ps(ptr + 0, _01);

+ +            _mm_storeu_ps(ptr + 4, _23);

+ +        }

+ +    }

+ +

+ +    SI void load4(const float* ptr, size_t tail, F* r, F* g, F* b, F* a) {

+ +        F _0, _1, _2, _3;

+ +        if (__builtin_expect(tail, 0)) {

+ +            _1 = _2 = _3 = _mm_setzero_si128();

+ +            if (  true  ) { _0 = _mm_loadu_ps(ptr + 0); }

+ +            if (tail > 1) { _1 = _mm_loadu_ps(ptr + 4); }

+ +            if (tail > 2) { _2 = _mm_loadu_ps(ptr + 8); }

+ +        } else {

+ +            _0 = _mm_loadu_ps(ptr + 0);

+ +            _1 = _mm_loadu_ps(ptr + 4);

+ +            _2 = _mm_loadu_ps(ptr + 8);

+ +            _3 = _mm_loadu_ps(ptr +12);

+ +        }

+ +        _MM_TRANSPOSE4_PS(_0,_1,_2,_3);

+ +        *r = _0;

+ +        *g = _1;

+ +        *b = _2;

+ +        *a = _3;

+ +    }

+ +

+ +    SI void store4(float* ptr, size_t tail, F r, F g, F b, F a) {

+ +        _MM_TRANSPOSE4_PS(r,g,b,a);

+ +        if (__builtin_expect(tail, 0)) {

+ +            if (  true  ) { _mm_storeu_ps(ptr + 0, r); }

+ +            if (tail > 1) { _mm_storeu_ps(ptr + 4, g); }

+ +            if (tail > 2) { _mm_storeu_ps(ptr + 8, b); }

+ +        } else {

+ +            _mm_storeu_ps(ptr + 0, r);

+ +            _mm_storeu_ps(ptr + 4, g);

+ +            _mm_storeu_ps(ptr + 8, b);

+ +            _mm_storeu_ps(ptr +12, a);

+ +        }

+ +    }

+ +

+  #elif defined(JUMPER_IS_NEON)

+      // Since we know we're using Clang, we can use its vector extensions.

+      template <typename T> using V = T __attribute__((ext_vector_type(4)));

+ @@ -1032,7 +1288,7 @@ SI V if_then_else(I32 c, V t, V e) {

+  }

+  

+  SI U16 bswap(U16 x) {

+ -#if defined(JUMPER_IS_SSE2) || defined(JUMPER_IS_SSE41)

+ +#if defined(JUMPER_IS_SSE2) || defined(JUMPER_IS_SSE41) || defined(JUMPER_IS_VSX)

+      // Somewhat inexplicably Clang decides to do (x<<8) | (x>>8) in 32-bit lanes

+      // when generating code for SSE2 and SSE4.1.  We'll do it manually...

+      auto v = widen_cast<__m128i>(x);

+ @@ -1094,6 +1350,15 @@ SI F from_half(U16 h) {

+  #elif defined(JUMPER_IS_HSW)

+      return _mm256_cvtph_ps(h);

+  

+ +// Disabled for now as this is not a particularly hot function

+ +// and there is no good reason to lock Chromium to POWER9+ yet.

+ +#elif 0 && defined(JUMPER_IS_VSX) && __has_builtin(__builtin_vsx_xvcvhpsp)

+ +    #if defined(SK_CPU_LENDIAN)

+ +        return __builtin_vsx_xvcvhpsp({h[0], 0, h[1], 0, h[2], 0, h[3], 0});

+ +    #else

+ +        return __builtin_vsx_xvcvhpsp({0, h[0], 0, h[1], 0, h[2], 0, h[3]});

+ +    #endif

+ +

+  #else

+      // Remember, a half is 1-5-10 (sign-exponent-mantissa) with 15 exponent bias.

+      U32 sem = expand(h),

+ @@ -1115,6 +1380,16 @@ SI U16 to_half(F f) {

+  #elif defined(JUMPER_IS_HSW)

+      return _mm256_cvtps_ph(f, _MM_FROUND_CUR_DIRECTION);

+  

+ +// Disabled for now as this is not a particularly hot function

+ +// and there is no good reason to lock Chromium to POWER9+ yet.

+ +#elif 0 && defined(JUMPER_IS_VSX) && __has_builtin(__builtin_vsx_xvcvsphp)

+ +    __vector unsigned short v = __builtin_vsx_xvcvsphp(f);

+ +    #if defined(SK_CPU_LENDIAN)

+ +        return U16{v[0], v[2], v[4], v[6]};

+ +    #else

+ +        return U16{v[1], v[3], v[5], v[7]};

+ +    #endif

+ +

+  #else

+      // Remember, a float is 1-8-23 (sign-exponent-mantissa) with 127 exponent bias.

+      U32 sem = sk_bit_cast<U32>(f),

+ @@ -1148,7 +1423,7 @@ static constexpr size_t N = sizeof(F) /

+      // instead of {b,a} on the stack.  Narrow stages work best for __vectorcall.

+      #define ABI __vectorcall

+      #define JUMPER_NARROW_STAGES 1

+ -#elif defined(__x86_64__) || defined(SK_CPU_ARM64)

+ +#elif defined(__x86_64__) || defined(SK_CPU_ARM64) || defined(SK_CPU_PPC64)

+      // These platforms are ideal for wider stages, and their default ABI is ideal.

+      #define ABI

+      #define JUMPER_NARROW_STAGES 0

+ @@ -4822,6 +5097,10 @@ SI F sqrt_(F x) {

+      float32x4_t lo,hi;

+      split(x, &lo,&hi);

+      return join<F>(sqrt(lo), sqrt(hi));

+ +#elif defined(JUMPER_IS_VSX)

+ +    vector float lo,hi;

+ +    split(x, &lo,&hi);

+ +    return join<F>(vec_sqrt(lo), vec_sqrt(hi));

+  #else

+      return F{

+          sqrtf(x[0]), sqrtf(x[1]), sqrtf(x[2]), sqrtf(x[3]),

+ @@ -4843,6 +5122,10 @@ SI F floor_(F x) {

+      __m128 lo,hi;

+      split(x, &lo,&hi);

+      return join<F>(_mm_floor_ps(lo), _mm_floor_ps(hi));

+ +#elif defined(JUMPER_IS_VSX)

+ +    vector float lo,hi;

+ +    split(x, &lo,&hi);

+ +    return join<F>(vec_floor(lo), vec_floor(hi));

+  #else

+      F roundtrip = cast<F>(cast<I32>(x));

+      return roundtrip - if_then_else(roundtrip > x, F(1), F(0));

+ @@ -4854,6 +5137,7 @@ SI F floor_(F x) {

+  //     (2 * a * b + (1 << 15)) >> 16

+  // The result is a number on [-1, 1).

+  // Note: on neon this is a saturating multiply while the others are not.

+ +// Note: for POWER, the code below was borrowed from emmintrin.h

+  SI I16 scaled_mult(I16 a, I16 b) {

+  #if defined(JUMPER_IS_HSW)

+      return _mm256_mulhrs_epi16(a, b);

+ @@ -4863,6 +5147,22 @@ SI I16 scaled_mult(I16 a, I16 b) {

+      return vqrdmulhq_s16(a, b);

+  #elif defined(JUMPER_IS_NEON)

+      return vqrdmulhq_s16(a, b);

+ +#elif defined(JUMPER_IS_VSX)

+ +    const vector unsigned int shift = vec_splats((unsigned int)14);

+ +    const vector int ones = vec_splats((signed int)1);

+ +    vector int c = vec_unpackh((vector short)a);

+ +    vector int d = vec_unpackh((vector short)b);

+ +    vector int e = vec_unpackl((vector short)b);

+ +    c = vec_mul(c, d);

+ +    d = vec_unpackl((vector short)a);

+ +    d = vec_mul(d, e);

+ +    c = vec_sr(c, shift);

+ +    d = vec_sr(d, shift);

+ +    c = vec_add(c, ones);

+ +    c = vec_sr(c,(vector unsigned int)ones);

+ +    d = vec_add(d, ones);

+ +    d = vec_sr(d,(vector unsigned int)ones);

+ +    return vec_pack(c, d);

+  #else

+      const I32 roundingTerm = 1 << 14;

+      return cast<I16>((cast<I32>(a) * cast<I32>(b) + roundingTerm) >> 15);

+ @@ -4884,7 +5184,26 @@ SI U16 constrained_add(I16 a, U16 b) {

+              SkASSERT(-ib <= ia && ia <= 65535 - ib);

+          }

+      #endif

+ +

+ +    // Technically, trying to add a signed and unsigned vector invokes undefined behavior

+ +    // Just because it sort of seems to work on Intel/ARM on Clang doesn't mean it works everywhere...

+ +    // FIXME: For added fun, the existing Skia unit tests do NOT properly test for issues in the

+ +    // lowp bilerp path.  Investigate and write an appropriate test case...

+ +#if defined(JUMPER_IS_VSX)

+ +    // Most POWER compilers end up doing some kind of width promotion that causes memory corruption

+ +    // and/or incorrect results.  This shows up as snow and general graphics corruption, especially

+ +    // noticeable when trying to display a PNG at less than 50% size (resize the browser window down

+ +    // until the artifacts appear).

+ +    // Take the (likely invisible) loss of precision, convert b to a signed int immediately, and do

+ +    // a proper saturated add here.  This seems to fully resolve the issue for all test cases Raptor

+ +    // has seen so far...

+ +    // In half precision mode, this function expects both input arguments to have been divided by

+ +    // two prior to being called, and returns the output without being multiplied back up by two

+ +    return vec_adds(a, (I16)b);

+ +#else

+ +    // Hic Sunt Dragones!

+      return b + a;

+ +#endif

+  }

+  

+  SI F fract(F x) { return x - floor_(x); }

+ @@ -5791,8 +6110,14 @@ STAGE_GP(bilerp_clamp_8888, const SkRast

+      //         2^-8 * v = 2^-9 * (tx*(R - L) + (R + L))

+      //                v = 1/2 * (tx*(R - L) + (R + L))

+      auto lerpX = [&](U16 left, U16 right) -> U16 {

+ +#if defined(JUMPER_IS_VSX)

+ +	// constrained_add() on POWER is run in half precision mode to avoid undefined behavior

+ +        I16 width  = (I16)(right - left) << 6;

+ +        U16 middle = (right + left) << 6;

+ +#else

+          I16 width  = (I16)(right - left) << 7;

+          U16 middle = (right + left) << 7;

+ +#endif

+          // The constrained_add is the most subtle part of lerp. The first term is on the interval

+          // [-1, 1), and the second term is on the interval is on the interval [0, 1) because

+          // both terms are too high by a factor of 2 which will be handled below. (Both R and L are

+ @@ -5804,7 +6129,12 @@ STAGE_GP(bilerp_clamp_8888, const SkRast

+          U16 v2  = constrained_add(scaled_mult(tx, width), middle) + 1;

+          // Divide by 2 to calculate v and at the same time bring the intermediate value onto the

+          // interval [0, 1/2] to set up for the lerpY.

+ +#if defined(JUMPER_IS_VSX)

+ +	// constrained_add() on POWER is run in half precision mode to avoid undefined behavior

+ +        return v2;

+ +#else

+          return v2 >> 1;

+ +#endif

+      };

+  

+      const uint32_t* ptr;

+ @@ -5838,9 +6168,15 @@ STAGE_GP(bilerp_clamp_8888, const SkRast

+          I16 width  = (I16)bottom - top;

+          U16 middle = bottom + top;

+          // Add + 0x80 for rounding.

+ +#if defined(JUMPER_IS_VSX)

+ +	// constrained_add() on POWER is run in half precision mode to avoid undefined behavior

+ +        U16 blend  = constrained_add(scaled_mult(ty, width) / 2, middle / 2) + (0x80 / 2);

+ +        return blend >> 7;

+ +#else

+          U16 blend  = constrained_add(scaled_mult(ty, width), middle) + 0x80;

+ -

+          return blend >> 8;

+ +#endif

+ +

+      };

+  

+      r = lerpY(topR, bottomR);

+ Index: chromium-116.0.5845.82/third_party/skia/src/opts/SkSwizzler_opts.h

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/src/opts/SkSwizzler_opts.h

+ +++ chromium-116.0.5845.82/third_party/skia/src/opts/SkSwizzler_opts.h

+ @@ -12,7 +12,9 @@

+  #include "src/base/SkVx.h"

+  #include <utility>

+  

+ -#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3

+ +#if defined(SK_PPC64_HAS_SSE_COMPAT)

+ +    #include <emmintrin.h>

+ +#elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3

+      #include <immintrin.h>

+  #elif defined(SK_ARM_HAS_NEON)

+      #include <arm_neon.h>

+ Index: chromium-116.0.5845.82/third_party/skia/src/base/SkVx.h

+ ===================================================================

+ --- chromium-116.0.5845.82.orig/third_party/skia/src/base/SkVx.h

+ +++ chromium-116.0.5845.82/third_party/skia/src/base/SkVx.h

+ @@ -42,7 +42,13 @@

+  

+  #if SKVX_USE_SIMD

+      #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE1

+ -        #include <immintrin.h>

+ +        #if __PPC64__

+ +            #include <mmintrin.h>

+ +            #include <emmintrin.h>

+ +            #include <tmmintrin.h>

+ +        #else

+ +            #include <immintrin.h>

+ +        #endif

+      #elif defined(SK_ARM_HAS_NEON)

+          #include <arm_neon.h>

+      #elif defined(__wasm_simd128__)

@@ -0,0 +1,54 @@ 

+ --- a/base/allocator/partition_allocator/page_allocator_constants.h

+ +++ b/base/allocator/partition_allocator/page_allocator_constants.h

+ @@ -161,7 +161,11 @@ SystemPageBaseMask() {

+    return ~SystemPageOffsetMask();

+  }

+  

+ +#if defined(ARCH_CPU_PPC64)

+ +constexpr size_t kPageMetadataShift = 6;  // 64 bytes per partition page.

+ +#else

+  constexpr size_t kPageMetadataShift = 5;  // 32 bytes per partition page.

+ +#endif

+  constexpr size_t kPageMetadataSize = 1 << kPageMetadataShift;

+  

+  }  // namespace partition_alloc::internal

+ --- a/base/allocator/partition_allocator/partition_page.h

+ +++ b/base/allocator/partition_allocator/partition_page.h

+ @@ -87,7 +87,11 @@ struct SlotSpanMetadata {

+  

+    // CHECK()ed in AllocNewSlotSpan().

+    // The maximum number of bits needed to cover all currently supported OSes.

+ +#if defined(ARCH_CPU_PPC64)

+ +  static constexpr size_t kMaxSlotsPerSlotSpanBits = 15;

+ +#else

+    static constexpr size_t kMaxSlotsPerSlotSpanBits = 13;

+ +#endif

+    static_assert(kMaxSlotsPerSlotSpan < (1 << kMaxSlotsPerSlotSpanBits), "");

+  

+    // |marked_full| isn't equivalent to being full. Slot span is marked as full

+ @@ -101,7 +105,11 @@ struct SlotSpanMetadata {

+   private:

+    const uint32_t can_store_raw_size_ : 1;

+    uint32_t freelist_is_sorted_ : 1;

+ +#if defined(ARCH_CPU_PPC64)

+ +  uint32_t unused1_ : (64 - 1 - 2 * kMaxSlotsPerSlotSpanBits - 1 - 1);

+ +#else

+    uint32_t unused1_ : (32 - 1 - 2 * kMaxSlotsPerSlotSpanBits - 1 - 1);

+ +#endif

+    // If |in_empty_cache_|==1, |empty_cache_index| is undefined and mustn't be

+    // used.

+    uint16_t in_empty_cache_ : 1;

+ --- a/base/allocator/partition_allocator/partition_page_constants.h

+ +++ b/base/allocator/partition_allocator/partition_page_constants.h

+ @@ -21,6 +21,11 @@ static constexpr size_t kMaxSlotsPerSlot

+  // currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code,

+  // so we use the 16 kiB maximum (64 kiB will crash).

+  static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 14) / kSmallestBucket;

+ +#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_PPC64)

+ +// System page size is not a constant on OpenPOWER systems, but is either 4kiB

+ +// or 64kiB (1 << 12 or 1 << 16)

+ +// And PartitionPageSize() is 4 times the OS page size.

+ +static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 16) / kSmallestBucket;

+  #else

+  // A slot span can "span" multiple PartitionPages, but then its slot size is

+  // larger, so it doesn't have as many slots.

@@ -0,0 +1,18 @@ 

+ Index: chromium-110.0.5481.77/v8/src/base/immediate-crash.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/v8/src/base/immediate-crash.h

+ +++ chromium-110.0.5481.77/v8/src/base/immediate-crash.h

+ @@ -75,6 +75,13 @@

+  #define TRAP_SEQUENCE1_() asm volatile("brk #0")

+  #define TRAP_SEQUENCE2_() asm volatile("hlt #0")

+  

+ +#elif V8_HOST_ARCH_PPC64

+ +

+ +#define TRAP_SEQUENCE1_() asm volatile("trap")

+ +// Intentionally empty: __builtin_unreachable() is always part of the sequence

+ +// (see IMMEDIATE_CRASH below)

+ +#define TRAP_SEQUENCE2_() asm volatile("")

+ +

+  #else

+  

+  // Crash report accuracy will not be guaranteed on other architectures, but at

@@ -0,0 +1,23 @@ 

+ Index: chromium-110.0.5481.77/third_party/webrtc/rtc_base/system/arch.h

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/webrtc/rtc_base/system/arch.h

+ +++ chromium-110.0.5481.77/third_party/webrtc/rtc_base/system/arch.h

+ @@ -46,6 +46,18 @@

+  #endif

+  #if defined(__MIPSEL__)

+  #define WEBRTC_ARCH_LITTLE_ENDIAN

+ +#elif defined(__PPC__)

+ +#define WEBRTC_ARCH_PPC_FAMILY

+ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

+ +#define WEBRTC_ARCH_LITTLE_ENDIAN

+ +#else

+ +#define WEBRTC_ARCH_BIG_ENDIAN

+ +#endif

+ +#if defined(__LP64__)

+ +#define WEBRTC_ARCH_64_BITS

+ +#else

+ +#define WEBRTC_ARCH_32_BITS

+ +#endif

+  #else

+  #define WEBRTC_ARCH_BIG_ENDIAN

+  #endif

@@ -0,0 +1,11 @@ 

+ --- a/third_party/skia/src/core/SkRasterPipeline.h

+ +++ b/third_party/skia/src/core/SkRasterPipeline.h

+ @@ -24,7 +24,7 @@

+  struct SkImageInfo;

+  struct skcms_TransferFunction;

+  

+ -#if __has_cpp_attribute(clang::musttail) && !defined(__EMSCRIPTEN__) && !defined(SK_CPU_ARM32)

+ +#if __has_cpp_attribute(clang::musttail) && !defined(__EMSCRIPTEN__) && !defined(SK_CPU_ARM32) && !defined(__powerpc64__)

+      #define SK_HAS_MUSTTAIL 1

+  #else

+      #define SK_HAS_MUSTTAIL 0

@@ -0,0 +1,48 @@ 

+ Index: chromium-110.0.5481.77/third_party/libvpx/generate_gni.sh

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/generate_gni.sh

+ +++ chromium-110.0.5481.77/third_party/libvpx/generate_gni.sh

+ @@ -405,7 +405,7 @@ gen_config_files linux/mipsel "--target=

+  gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"

+  gen_config_files linux/loongarch \

+    "--target=loongarch64-linux-gcc ${all_platforms}"

+ -gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"

+ +gen_config_files linux/ppc64 "--target=generic-gnu $HIGHBD ${all_platforms}"

+  gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"

+  gen_config_files win/arm64 \

+    "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"

+ Index: chromium-110.0.5481.77/third_party/libvpx/source/libvpx/build/make/rtcd.pl

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/source/libvpx/build/make/rtcd.pl

+ +++ chromium-110.0.5481.77/third_party/libvpx/source/libvpx/build/make/rtcd.pl

+ @@ -492,8 +492,9 @@ if ($opts{arch} eq 'x86') {

+    &require(@REQUIRES);

+    arm;

+  } elsif ($opts{arch} =~ /^ppc/ ) {

+ -  @ALL_ARCHS = filter(qw/vsx/);

+ -  ppc;

+ +  #@ALL_ARCHS = filter(qw/vsx/);

+ +  #ppc;

+ +  unoptimized;

+  } elsif ($opts{arch} =~ /loongarch/ ) {

+    @ALL_ARCHS = filter(qw/lsx lasx/);

+    loongarch;

+ Index: chromium-110.0.5481.77/third_party/libvpx/BUILD.gn

+ ===================================================================

+ --- chromium-110.0.5481.77.orig/third_party/libvpx/BUILD.gn

+ +++ chromium-110.0.5481.77/third_party/libvpx/BUILD.gn

+ @@ -90,6 +90,14 @@ config("libvpx_config") {

+        "-Wno-sign-compare",

+      ]

+    }

+ +

+ +  if (current_cpu == "ppc64") {

+ +    cflags += [

+ +      "-mcpu=power8",

+ +      "-maltivec",

+ +      "-mvsx",

+ +    ]

+ +  }

+  }

+  

+  # This config is applied to targets that depend on libvpx.

file modified
+6 -2
@@ -1,3 +1,7 @@ 

- SHA512 (node-v19.8.1-linux-arm64.tar.xz) = 86ff19085669e92ce7afe2fd7d4df0c5441df2d88c00f29d5463b805f3cf5625626db8aebf98349c9a495b772da1ce6d68263730018207ea98815058a1c81397

- SHA512 (node-v19.8.1-linux-x64.tar.xz) = 925c0037c6b7074d0b0245bced20d0a0d9b1300f53b808106f16b5018d763f5f5b00bc321b33fa1033d736b1e1076608da9b7fcae66aed53d27b100b1186e2c6

+ SHA256 (node-v18.17.1-linux-arm64.tar.xz) = 3f933716a468524acb68c2514d819b532131eb50399ee946954d4a511303e1bb

+ SHA256 (node-v18.17.1-linux-x64.tar.xz) = 07e76408ddb0300a6f46fcc9abc61f841acde49b45020ec4e86bb9b25df4dced

+ SHA256 (node-v18.17.1-linux-ppc64le.tar.xz) = 8046fa0eb23c8bb57c52a62fc84315712f280d482b6f0358dcedc7d26bfb4065

+ SHA512 (linux-arm64-0.19.2.tgz) = 8a0d8fec6786fffcd6954d00820037a55d61e60762c74300df0801f8db27057562c221a063bedfb8df56af9ba80abb366336987e881782c5996e6f871abd3dc6

+ SHA512 (linux-x64-0.19.2.tgz) = a31cc74c4bfa54f9b75d735a1cfc944d3b5efb7c06bfba9542da9a642ae0b2d235ea00ae84d3ad0572c406405110fe7b61377af0fd15803806ef78d20fc6f05d

+ SHA512 (linux-ppc64-0.19.2.tgz) = 749d2413c293a9b887b40dc573fce7ee509dee9a95af825c4f426a3a76e3e0b2f3627a7eee1f108b8ca37eae366651df84e08ce36ac18741301d82cbe8b13373

  SHA512 (chromium-116.0.5845.179-clean.tar.xz) = 63598c6c8712f1c869ed8548a575d484ceb828eb358952bfdddd7804b33ca0ba098951d5d21d50a424ea9aee56f16bc466c34128564c1dc7087ad9350576036c

DO NOT MERGE! - THIS PULL REQUEST IS STILL IN TESTING!

Changelog

  • Enable support for ppc64le
  • Use Node LTS

Notes

I do not know how long it would take for the CI to build the ppc64le so my intention is to leave this PR open and iron out all rough edges. Once ready, I will let the core team know

I strongly encourage you to try to get this merged upstream first. I'm not very excited about carrying a giant patch tree for an architecture I don't own (and for which few people connect a monitor to), and upstream chromium moves incredibly quickly which means it's likely to break often unless upstream merged this.

@spot Great thanks for the comment

Firstly, PowerPC64 is not just being used as headless anymore. In fact many institutions/users are using them like a workstation not a remote access server. You might have heard of Raptor Computing System Talos II and Blackbird workstations. And even in the headless scenarios, by having a chromium-headless, that would be open to endless possibilities for end users.

In regards to upstreaming the patches, the OpenPOWER community has tried to persuade Google but all efforts were in vain. In conclusion, Google would not agree to support ppc64le so all distro that supports ppc64le (for example gentoo, debian, void) would have to support it as downstream.

I have been maintaining an unofficial RPM build in https://gitlab.com/chromium-ppc64le/chromium-ppc64le but it's just getting harder for a one-man team to continue that repo tree. Plus there has been strong support from the PowerPC community to add such support directly to Fedora package for years and having talked to some IBM / RedHat devs, they encouraged me to submit this Pull Request.

I acknowledge your concern but I do not have any options and I hope this Pull Request would get considered.

Kind regards

rebased onto 24a875b

8 months ago

rebased onto 43bb410

8 months ago

What about being a co-maintainer for the chromium package?

Also, you can't have patches in folders...

Pull-Request has been closed by than

2 months ago

the pppc64le support was added in the latest chromium build

Metadata
Changes Summary 62
+6 -9
file changed
.gitignore
+262 -41
file changed
chromium.spec
+728
file added
ppc64le/breakpad/0001-Implement-support-for-ppc64-on-Linux.patch
+33
file added
ppc64le/core/baseline-isa-3-0.patch
+1480
file added
ppc64le/crashpad/0001-Implement-support-for-PPC64-on-Linux.patch
+21
file added
ppc64le/crashpad/0002-Include-cstddef-to-fix-build.patch
+56
file added
ppc64le/database/0001-Properly-detect-little-endian-PPC64-systems.patch
+114
file added
ppc64le/ffmpeg/0001-Add-support-for-ppc64.patch
+29
file added
ppc64le/fixes/fix-breakpad-compile.patch
+16
file added
ppc64le/fixes/fix-partition-alloc-compile.patch
+26
file added
ppc64le/fixes/fix-swiftshader-compile.patch
+33
file added
ppc64le/fixes/fix-unknown-warning-option-messages.patch
+53
file added
ppc64le/libaom/0001-Add-ppc64-target-to-libaom.patch
+2447
file added
ppc64le/libaom/0001-Add-pregenerated-config-for-libaom-on-ppc64.patch
+37
file added
ppc64le/sandbox/0001-linux-seccomp-bpf-ppc64-glibc-workaround-in-SIGSYS-h.patch
+23
file added
ppc64le/sandbox/0001-sandbox-Enable-seccomp_bpf-for-ppc64.patch
+80
file added
ppc64le/sandbox/0001-sandbox-linux-Implement-partial-support-for-ppc64-sy.patch
+22
file added
ppc64le/sandbox/0001-sandbox-linux-Update-IsSyscallAllowed-in-broker_proc.patch
+638
file added
ppc64le/sandbox/0001-sandbox-linux-Update-syscall-helpers-lists-for-ppc64.patch
+27
file added
ppc64le/sandbox/0001-sandbox-linux-bpf_dsl-Update-syscall-ranges-for-ppc6.patch
+26
file added
ppc64le/sandbox/0001-services-service_manager-sandbox-linux-Fix-TCGETS-de.patch
+76
file added
ppc64le/sandbox/0002-sandbox-linux-bpf_dsl-Modify-seccomp_macros-to-add-s.patch
+37
file added
ppc64le/sandbox/0003-sandbox-linux-system_headers-Update-linux-seccomp-he.patch
+23
file added
ppc64le/sandbox/0004-sandbox-linux-system_headers-Update-linux-signal-hea.patch
+107
file added
ppc64le/sandbox/0005-sandbox-linux-seccomp-bpf-Add-ppc64-syscall-stub.patch
+24
file added
ppc64le/sandbox/0005-sandbox-linux-update-unit-test-for-ppc64.patch
+14
file added
ppc64le/sandbox/0006-sandbox-linux-disable-timedwait-time64-ppc64.patch
+33
file added
ppc64le/sandbox/0007-sandbox-linux-add-ppc64-stat.patch
+91
file added
ppc64le/sandbox/0008-sandbox-fix-ppc64le-glibc234.patch
+13
file added
ppc64le/sandbox/Sandbox-linux-services-credentials.cc-PPC.patch
+23
file added
ppc64le/sandbox/fix-ppc64-linux-syscalls-headers.patch
+8824
file added
ppc64le/third_party/0001-Add-PPC64-support-for-boringssl.patch
+30
file added
ppc64le/third_party/0001-Add-PPC64-support-for-libdav1d.patch
+12
file added
ppc64le/third_party/0001-Fix-highway-ppc-hwcap.patch
+33
file added
ppc64le/third_party/0001-Fix-libdav1d-compilation-on-clang-ppc.patch
+27
file added
ppc64le/third_party/0001-Force-baseline-POWER8-AltiVec-VSX-CPU-features-when-.patch
+10
file added
ppc64le/third_party/0001-third_party-angle-Include-missing-header-cstddef-in-.patch
+27
file added
ppc64le/third_party/0001-third_party-boringssl-Properly-detect-ppc64le-in-BUI.patch
+23
file added
ppc64le/third_party/0001-third_party-libvpx-Properly-generate-gni-on-ppc64.patch
+22
file added
ppc64le/third_party/0001-third_party-lss-Don-t-look-for-mmap2-on-ppc64.patch
+22
file added
ppc64le/third_party/0001-third_party-pffft-Include-altivec.h-on-ppc64-with-SI.patch
+99
file added
ppc64le/third_party/0002-Highway-disable-128-bit-vsx.patch
+5734
file added
ppc64le/third_party/0002-third-party-boringssl-add-generated-files.patch
+3047
file added
ppc64le/third_party/0002-third_party-libvpx-Remove-bad-ppc64-config.patch
+168
file added
ppc64le/third_party/0002-third_party-lss-kernel-structs.patch
+10194
file added
ppc64le/third_party/0003-third_party-ffmpeg-Add-ppc64-generated-config.patch
+5092
file added
ppc64le/third_party/0003-third_party-libvpx-Add-ppc64-generated-config.patch
+35
file added
ppc64le/third_party/0003-third_party-libvpx-Add-ppc64-vsx-files.patch
+43
file added
ppc64le/third_party/0003-thirdparty-fix-dav1d-gn.patch
+17
file added
ppc64le/third_party/0004-third_party-crashpad-port-curl-transport-ppc64.patch
+376
file added
ppc64le/third_party/0004-third_party-libvpx-work-around-ambiguous-vsx.patch
+914
file added
ppc64le/third_party/0005-chromium-ppc64-libpng.patch
+13
file added
ppc64le/third_party/0005-libpng-pdfium-compile-98.patch
+19
file added
ppc64le/third_party/dawn-fix-ppc64le-detection.patch
+32
file added
ppc64le/third_party/dawn-fix-typos.patch
+645
file added
ppc64le/third_party/skia-vsx-instructions.patch
+54
file added
ppc64le/third_party/use-sysconf-page-size-on-ppc64.patch
+18
file added
ppc64le/v8/0002-Add-ppc64-trap-instructions.patch
+23
file added
ppc64le/webrtc/Rtc_base-system-arch.h-PPC.patch
+11
file added
ppc64le/workarounds/HACK-debian-clang-disable-skia-musttail.patch
+48
file added
ppc64le/workarounds/HACK-third_party-libvpx-use-generic-gnu.patch
+6 -2
file changed
sources