diff options
-rw-r--r-- | system/easy-kernel/APKBUILD | 8 | ||||
-rw-r--r-- | system/easy-kernel/config-pmmx | 10 | ||||
-rw-r--r-- | system/easy-kernel/config-ppc | 24 | ||||
-rw-r--r-- | system/easy-kernel/config-ppc64 | 18 | ||||
-rw-r--r-- | system/musl/APKBUILD | 4 | ||||
-rw-r--r-- | system/musl/ppc-hwcap.patch | 36 | ||||
-rw-r--r-- | user/mailcap/APKBUILD | 9 | ||||
-rw-r--r-- | user/node/APKBUILD | 4 | ||||
-rw-r--r-- | user/node/ppc-fixes-for-older-models-18.patch | 918 |
9 files changed, 990 insertions, 41 deletions
diff --git a/system/easy-kernel/APKBUILD b/system/easy-kernel/APKBUILD index a23937679..f0aec189d 100644 --- a/system/easy-kernel/APKBUILD +++ b/system/easy-kernel/APKBUILD @@ -5,7 +5,7 @@ _kflavour="" _patchver=2 # must match 1000-version.patch _pkgname=easy-kernel$_kflavour pkgver=6.6.58 -pkgrel=0 +pkgrel=1 pkgname=$_pkgname-$pkgver-mc$_patchver pkgdesc="The Linux kernel, packaged for your convenience" url="https://kernel.org/" @@ -167,9 +167,9 @@ sha512sums="458b2c34d46206f9b4ccbac54cc57aeca1eaecaf831bc441e59701bac6eadffc17f6 c16e726450602b271802b74bcfced1e2373c21b7cea8108bb722f9b4abcad44ae6e135a26296d76ad869c554360d1e043d163934592e5899e4c9514f179ac094 config-aarch64 237b7eff4ecab68600497761eb3716c158f1f3fc6e55f70559189cd15ecc381017cb0017a44c766eb016b50d091410e590312d5eaebebb2e6e13495f5602281b config-armv7 af1495f11e7252ee65af2ce00b551b4715a9d663e1bf8cff1a1235ba922e7d0b9e90dcdacd469db1d7831d8580071f0f7fef24c89362afccde63058393d115f5 config-m68k -9b3ca7e6f8b18374da0c58ff7fc9211a41a717e68eb87dc8f78af3fe8387fc03500cd5f4f66d2b8292b117d0067edfc89adf9370b323c5fd0ed7ec6d5616b1ff config-pmmx -a4a2e4579a33d2720fb141d83f5a6f1b1b8be701cfee12a479a9b63021974159df7d5984a730dfa8da2e8e761d506ab6f5cce1d72b99ee577582bac7d2348cb0 config-ppc -60116d4f5c454539d3c86538611bbcd683e46352419bcea1bb0c3f4e08e0915dff3053f80f600b54656eb12fa1f6ca818424ef91f59f0301ce71a0dc4b49a86f config-ppc64 +52d65ad133b66550e651b9165f647b094730e42d9d2e7036879f32b7c6f4f9c2320cddb0506efa832e7365156b70ed09cc66ed213bfbc67e94d60a916291e1aa config-pmmx +fd1c8b0fa7bf0122fe670e54fa592ebb792415fba528011c83bdbfbbf16bd442339c9e1338214cb8e7522ac3ab51f45c1360dd3ce40607da902eb99ec03bc62d config-ppc +95796cf8c2416d12fa61d72ffe1403b33f0b35dead111c94cc6835d74586761ec47b562ad1516a917a5411de043164daf13a35b5d86ee03266db2a0b146d507b config-ppc64 17a07b7563acba1f5b99b9055198f5f93e7c65432ec46c35fa6c2b5307107ad9d4e8ffea9800f50cf8a8445b69561b9a95ba1ac8cd5bb2b6814dab540edb17d4 config-sparc64 137b549a61a241c21f956c9f13f476858bbffd4b393a3630e39d7c810f25d71cdcfd5307788c5c40fb3a92552ee1081f06ccb2379a9c0868ce25cb36f31cbda2 config-x86_64 1ca1bc094a8106b33176ab6cfb55c9514e7d69f1ed30c580eee419a3c422a2e6625d71c4581702e911f36c4bbac175010f46b7123bb81fda3303d4decdc57287 kernel.h diff --git a/system/easy-kernel/config-pmmx b/system/easy-kernel/config-pmmx index 7597f52a0..db5fe789c 100644 --- a/system/easy-kernel/config-pmmx +++ b/system/easy-kernel/config-pmmx @@ -3510,12 +3510,12 @@ CONFIG_MOUSE_PS2_SYNAPTICS=y CONFIG_MOUSE_PS2_CYPRESS=y CONFIG_MOUSE_PS2_LIFEBOOK=y CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -# CONFIG_MOUSE_PS2_OLPC is not set +CONFIG_MOUSE_PS2_ELANTECH=y +CONFIG_MOUSE_PS2_SENTELIC=y +CONFIG_MOUSE_PS2_TOUCHKIT=y +CONFIG_MOUSE_PS2_OLPC=y CONFIG_MOUSE_PS2_FOCALTECH=y -# CONFIG_MOUSE_PS2_VMMOUSE is not set +CONFIG_MOUSE_PS2_VMMOUSE=y CONFIG_MOUSE_SERIAL=y CONFIG_MOUSE_APPLETOUCH=m CONFIG_MOUSE_BCM5974=m diff --git a/system/easy-kernel/config-ppc b/system/easy-kernel/config-ppc index 86965b861..717fc60c3 100644 --- a/system/easy-kernel/config-ppc +++ b/system/easy-kernel/config-ppc @@ -7,9 +7,9 @@ CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=130300 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y -CONFIG_AS_VERSION=24200 +CONFIG_AS_VERSION=24301 CONFIG_LD_IS_BFD=y -CONFIG_LD_VERSION=24200 +CONFIG_LD_VERSION=24301 CONFIG_LLD_VERSION=0 CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y @@ -595,7 +595,7 @@ CONFIG_OLD_SIGSUSPEND=y CONFIG_OLD_SIGACTION=y CONFIG_COMPAT_32BIT_TIME=y CONFIG_HAVE_ARCH_VMAP_STACK=y -CONFIG_VMAP_STACK=y +# CONFIG_VMAP_STACK is not set CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y CONFIG_RANDOMIZE_KSTACK_OFFSET=y # CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set @@ -4832,11 +4832,11 @@ CONFIG_DRM_ARCPGU=m CONFIG_DRM_BOCHS=m CONFIG_DRM_CIRRUS_QEMU=m # CONFIG_DRM_GM12U320 is not set -CONFIG_DRM_OFDRM=m +# CONFIG_DRM_OFDRM is not set CONFIG_DRM_SIMPLEDRM=m # CONFIG_DRM_GUD is not set # CONFIG_DRM_SSD130X is not set -CONFIG_DRM_LEGACY=y +# CONFIG_DRM_LEGACY is not set CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=m # @@ -4848,7 +4848,7 @@ CONFIG_FB_MACMODES=y CONFIG_FB_CIRRUS=m # CONFIG_FB_PM2 is not set # CONFIG_FB_CYBER2000 is not set -CONFIG_FB_OF=m +CONFIG_FB_OF=y CONFIG_FB_CONTROL=y CONFIG_FB_PLATINUM=y CONFIG_FB_VALKYRIE=y @@ -4859,10 +4859,7 @@ CONFIG_FB_IMSTT=y CONFIG_FB_UVESA=m # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set -CONFIG_FB_NVIDIA=m -CONFIG_FB_NVIDIA_I2C=y -# CONFIG_FB_NVIDIA_DEBUG is not set -CONFIG_FB_NVIDIA_BACKLIGHT=y +# CONFIG_FB_NVIDIA is not set CONFIG_FB_RIVA=m # CONFIG_FB_RIVA_I2C is not set # CONFIG_FB_RIVA_DEBUG is not set @@ -4873,10 +4870,7 @@ CONFIG_FB_MATROX_MILLENIUM=y CONFIG_FB_MATROX_MYSTIQUE=y CONFIG_FB_MATROX_G=y # CONFIG_FB_MATROX_I2C is not set -CONFIG_FB_RADEON=m -CONFIG_FB_RADEON_I2C=y -CONFIG_FB_RADEON_BACKLIGHT=y -# CONFIG_FB_RADEON_DEBUG is not set +# CONFIG_FB_RADEON is not set CONFIG_FB_ATY128=m CONFIG_FB_ATY128_BACKLIGHT=y CONFIG_FB_ATY=m @@ -4967,7 +4961,7 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set +CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y # CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set diff --git a/system/easy-kernel/config-ppc64 b/system/easy-kernel/config-ppc64 index aa02a42fc..4b51a8c09 100644 --- a/system/easy-kernel/config-ppc64 +++ b/system/easy-kernel/config-ppc64 @@ -7,9 +7,9 @@ CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=130300 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y -CONFIG_AS_VERSION=24200 +CONFIG_AS_VERSION=24301 CONFIG_LD_IS_BFD=y -CONFIG_LD_VERSION=24200 +CONFIG_LD_VERSION=24301 CONFIG_LLD_VERSION=0 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y @@ -2151,7 +2151,7 @@ CONFIG_SCSI_SNIC=m # CONFIG_SCSI_SNIC_DEBUG_FS is not set CONFIG_SCSI_DMX3191D=m # CONFIG_SCSI_FDOMAIN_PCI is not set -CONFIG_SCSI_IPS=y +CONFIG_SCSI_IPS=m CONFIG_SCSI_IBMVSCSI=y CONFIG_SCSI_INITIO=m CONFIG_SCSI_INIA100=m @@ -4630,7 +4630,7 @@ CONFIG_DRM_PANEL_BRIDGE=y CONFIG_DRM_BOCHS=m CONFIG_DRM_CIRRUS_QEMU=m # CONFIG_DRM_GM12U320 is not set -CONFIG_DRM_OFDRM=m +# CONFIG_DRM_OFDRM is not set CONFIG_DRM_SIMPLEDRM=m # CONFIG_DRM_GUD is not set # CONFIG_DRM_SSD130X is not set @@ -4641,11 +4641,11 @@ CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=m # Frame buffer Devices # CONFIG_FB=y -CONFIG_FB_MACMODES=m +CONFIG_FB_MACMODES=y # CONFIG_FB_CIRRUS is not set # CONFIG_FB_PM2 is not set # CONFIG_FB_CYBER2000 is not set -CONFIG_FB_OF=m +CONFIG_FB_OF=y # CONFIG_FB_ASILIANT is not set # CONFIG_FB_IMSTT is not set # CONFIG_FB_VGA16 is not set @@ -4656,10 +4656,7 @@ CONFIG_FB_OF=m # CONFIG_FB_RIVA is not set # CONFIG_FB_I740 is not set # CONFIG_FB_MATROX is not set -CONFIG_FB_RADEON=m -CONFIG_FB_RADEON_I2C=y -CONFIG_FB_RADEON_BACKLIGHT=y -# CONFIG_FB_RADEON_DEBUG is not set +# CONFIG_FB_RADEON is not set CONFIG_FB_ATY128=m CONFIG_FB_ATY128_BACKLIGHT=y # CONFIG_FB_ATY is not set @@ -4689,7 +4686,6 @@ CONFIG_FB_CORE=y CONFIG_FB_NOTIFY=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_DEVICE=y -CONFIG_FB_DDC=m CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y diff --git a/system/musl/APKBUILD b/system/musl/APKBUILD index 9816d009e..a8e6c7daa 100644 --- a/system/musl/APKBUILD +++ b/system/musl/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=musl pkgver=1.2.3 -pkgrel=1 +pkgrel=2 pkgdesc="System library (libc) implementation" url="https://www.musl-libc.org/" arch="all" @@ -26,6 +26,7 @@ source="https://musl.libc.org/releases/musl-${pkgver}.tar.gz 3001-make-real-lastlog-h.patch handle-aux-at_base.patch fgetspent_r.patch + ppc-hwcap.patch realpath.patch signed-wchar_t-fixes.patch @@ -125,6 +126,7 @@ f7b05d8c5f804ba3ad6998b3de5fa4d9dfceac4aca63dd67298c2d5f27cdd28a91eba74f6e428c25 88ae443dbb8e0a4368235bdc3a1c5c7b718495afa75e06deb8e01becc76cb1f0d6964589e2204fc749c9c1b3190b8b9ac1ae2c0099cab8e2ce3ec877103d4332 3001-make-real-lastlog-h.patch 1f4e9aea5a546015c75f77aa0dec10d56fc14831ccc15cf71ff27fc15ac5230ffeadb382ebe1c87c1ea07a462620e16ed01cd36252d997d1a9c2af11cb5c9ff3 handle-aux-at_base.patch ded41235148930f8cf781538f7d63ecb0c65ea4e8ce792565f3649ee2523592a76b2a166785f0b145fc79f5852fd1fb1729a7a09110b3b8f85cba3912e790807 fgetspent_r.patch +96d88bb9c03f6eddcfc22cbd04efa73535f4ab78409954a042a2e08294cc8df1fb2cb0475eadb92a7fa281229abaa600f034d3ef08e918c6016dbf9be1db28d9 ppc-hwcap.patch d5ec3f1a86f2194e0af83c2391508811b939d0f8f2fd2ac5ac7f03774f8a250ce42399110d2ae04d32b864ee292863fed683a029b64598dbbcb21d9811a825d0 realpath.patch 3770af3bc961e5d5b8c152c428cd20dc54e026b23b31d764fbc2e71ee38140d160db2267755f23800bc8586fd4b51554b1caebb2415bef82fd0f4a6dd8bf640d signed-wchar_t-fixes.patch cb71d29a87f334c75ecbc911becde7be825ab30d8f39fa6d64cb53812a7c9abaf91d9804c72540e5be3ddd3c84cfe7fd9632274309005cb8bcdf9a9b09b4b923 ldconfig diff --git a/system/musl/ppc-hwcap.patch b/system/musl/ppc-hwcap.patch new file mode 100644 index 000000000..3ebd5c42b --- /dev/null +++ b/system/musl/ppc-hwcap.patch @@ -0,0 +1,36 @@ +From 2c788798c1f625c42e844311f5a5d2e19707d581 Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> +Date: Fri, 3 Jan 2025 13:36:33 -0600 +Subject: [PATCH] powerpc: Update HWCAP bits for Power10 + +Linux kernel commit ee988c11acf6f9464b7b44e9a091bf6afb3b3a49 added two +new HWCAP bits: one for ARCH_3_1, which is the Power10 ISA revision, and +one for MMA, which is the optional Matrix Multiply Assist extension. +--- + arch/powerpc/bits/hwcap.h | 2 ++ + arch/powerpc64/bits/hwcap.h | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/arch/powerpc/bits/hwcap.h b/arch/powerpc/bits/hwcap.h +index 803de9b5..12981623 100644 +--- a/arch/powerpc/bits/hwcap.h ++++ b/arch/powerpc/bits/hwcap.h +@@ -41,3 +41,5 @@ + #define PPC_FEATURE2_DARN 0x00200000 + #define PPC_FEATURE2_SCV 0x00100000 + #define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 ++#define PPC_FEATURE2_ARCH_3_1 0x00040000 ++#define PPC_FEATURE2_MMA 0x00020000 +diff --git a/arch/powerpc64/bits/hwcap.h b/arch/powerpc64/bits/hwcap.h +index 803de9b5..12981623 100644 +--- a/arch/powerpc64/bits/hwcap.h ++++ b/arch/powerpc64/bits/hwcap.h +@@ -41,3 +41,5 @@ + #define PPC_FEATURE2_DARN 0x00200000 + #define PPC_FEATURE2_SCV 0x00100000 + #define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 ++#define PPC_FEATURE2_ARCH_3_1 0x00040000 ++#define PPC_FEATURE2_MMA 0x00020000 +-- +2.40.0 + diff --git a/user/mailcap/APKBUILD b/user/mailcap/APKBUILD index deada77a7..91cc3598c 100644 --- a/user/mailcap/APKBUILD +++ b/user/mailcap/APKBUILD @@ -6,16 +6,17 @@ pkgrel=0 pkgdesc="Helper application and MIME type associations for file types" url="https://pagure.io/mailcap" arch="noarch" -license="Public Domain" -options="!check" # no testsuite +license="Public-Domain" +options="!check" # No test suite. subpackages="$pkgname-doc" source="https://releases.pagure.org/mailcap/mailcap-$pkgver.tar.xz" package() { - make install DESTDIR="$pkgdir" - rm -Rf "$pkgdir"/etc/nginx + make install DESTDIR="$pkgdir" + rm -Rf "$pkgdir"/etc/nginx } sha512sums=" a80caba013b644111f163d8ef74fe801d7266cf4edd38ca723f98fb12a103a24e84a8fca0c569beb05ca0f407437ed1282306b30303c38327b744194c6fe80b2 mailcap-2.1.54.tar.xz " +sha512sums="a80caba013b644111f163d8ef74fe801d7266cf4edd38ca723f98fb12a103a24e84a8fca0c569beb05ca0f407437ed1282306b30303c38327b744194c6fe80b2 mailcap-2.1.54.tar.xz" diff --git a/user/node/APKBUILD b/user/node/APKBUILD index eb3e08ad5..1c0cbe5a8 100644 --- a/user/node/APKBUILD +++ b/user/node/APKBUILD @@ -16,6 +16,7 @@ source="https://nodejs.org/download/release/v$pkgver/node-v$pkgver.tar.xz pmmx-test.patch pmmx-time64.patch zlib-version-regex.patch + ppc-fixes-for-older-models-18.patch " builddir="$srcdir/$pkgname-v$pkgver" @@ -68,4 +69,5 @@ package() { sha512sums="e41fcda469809186fd724ef4691e25f4a5bd81357ee99acf3d7faa1190a69c19cb62bd14aea199ca6f8b5cf9687af7d898cdf605ea2414d2c04db87ddb3b4dc8 node-v18.15.0.tar.xz 277e226f3906f791bae6aedd0b74b0e2c52b6154eb2dc0c568417ad94a0722078e4fbbbe15c59d4ba0b59cdb4ad45b5e9620f14d75694a15531857cd29aa044a pmmx-test.patch bf78e52c60b4567854eaa9d9433ade8a318a356cb326dded99e800df35a9f475390a0cf8b0c8e595bbdb3702838eafe91801cd646576aa7fa7966b37d794e380 pmmx-time64.patch -45d899bd62e39762fde7e9743efcc6dc032161ae087099da8eecebc84f3eaab87eecf00cbc5861f686a45332224025af172ab00ce966771dccf2e925ca48bc6a zlib-version-regex.patch" +45d899bd62e39762fde7e9743efcc6dc032161ae087099da8eecebc84f3eaab87eecf00cbc5861f686a45332224025af172ab00ce966771dccf2e925ca48bc6a zlib-version-regex.patch +64cffa3cfdced1152a41d77c344370d0077d046ccf20fb618cad7396bcb37290c14a8180b713a7e554e3b09042e481d6aa4a5f97a0a93ceb4090d0f2a510b052 ppc-fixes-for-older-models-18.patch" diff --git a/user/node/ppc-fixes-for-older-models-18.patch b/user/node/ppc-fixes-for-older-models-18.patch new file mode 100644 index 000000000..88d5bd1a0 --- /dev/null +++ b/user/node/ppc-fixes-for-older-models-18.patch @@ -0,0 +1,918 @@ +Fix PowerPC CPU detection and codegen to work with more processors. + +This patch defines the correct optional Power ISA features that the +PPC code generator needs in order to run without crashing on v2.01 +and older CPUs such as PPC 970 (G5) or NXP e6500, and to run more +efficiently on CPUs with features that weren't being used before. + +PowerPC ISA v2.01 and older CPUs don't have FP round to int instructions, +and PowerPC ISA v2.06 and older are missing support for unsigned 64-bit +to/from double, as well as integer to/from single-precision float. + +Use the current PPC_5_PLUS CPU feature to determine whether to generate +FP round to int, and use the PPC_7_PLUS feature to determine whether +to use the v2.06 ISA instructions or whether to generate an alternate +generic PPC sequence to handle the cases of 64-bit unsigned integer +to/from floating point, integers to single-precision floating point, +and loading and storing 64-bit integers with byte reversal. + +Add a new PPC_7_PLUS_NXP feature for the popcnt and ldbrx/stdbrx +opcodes added in Power ISA v2.06, which are also present in the NXP +e5500 and e6500 cores, which are otherwise missing many of the +features added since v2.01. This enables NXP cores to use a few +more features. Additionally, bring back the ISELECT feature flag, +which is also supported by NXP cores, including older ones, and +has its own AT_HWCAP2 feature flag in Linux. + +By defining a new ICACHE_SNOOP feature bit to replace the use of +PPC_6_PLUS, the meaning of the instruction cache flushing fast path, +and the CPUs that can use it, is more clearly defined. In addition, +for the other PowerPC chips, the loop to flush the data and instruction +cache blocks has been split into two loops, with a single "sync" and +"isync" after each loop, which should be more efficient, and also handles +the few CPUs with differing data and instruction cache line sizes. + +In the macro assembler methods, in addition to providing an alternate +path for FP conversion opcodes added in POWER7 (ISA v2.06), unnecessary +instructions to move sp down and then immediately back up were replaced +with negative offsets from the current sp. This should be faster, and also +sp is supposed to point to a back chain at all times (V8 may not do this). + +--- a/deps/v8/src/base/cpu.cc 2022-02-08 04:37:48.000000000 -0800 ++++ b/deps/v8/src/base/cpu.cc 2022-02-19 14:38:37.997161835 -0800 +@@ -14,15 +14,16 @@ + #if V8_OS_LINUX + #include <linux/auxvec.h> // AT_HWCAP + #endif +-#if V8_GLIBC_PREREQ(2, 16) ++#if V8_GLIBC_PREREQ(2, 16) || \ ++ (V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64)) + #include <sys/auxv.h> // getauxval() ++#if defined(PPC_FEATURE2_HAS_ISEL) && !defined(PPC_FEATURE2_ISEL) ++#define PPC_FEATURE2_ISEL PPC_FEATURE2_HAS_ISEL ++#endif + #endif + #if V8_OS_QNX + #include <sys/syspage.h> // cpuinfo + #endif +-#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64) +-#include <elf.h> +-#endif + #if V8_OS_AIX + #include <sys/systemcfg.h> // _system_configuration + #ifndef POWER_8 +@@ -772,56 +773,55 @@ + + #ifndef USE_SIMULATOR + #if V8_OS_LINUX +- // Read processor info from /proc/self/auxv. +- char* auxv_cpu_type = nullptr; +- FILE* fp = base::Fopen("/proc/self/auxv", "r"); +- if (fp != nullptr) { +-#if V8_TARGET_ARCH_PPC64 +- Elf64_auxv_t entry; +-#else +- Elf32_auxv_t entry; +-#endif +- for (;;) { +- size_t n = fread(&entry, sizeof(entry), 1, fp); +- if (n == 0 || entry.a_type == AT_NULL) { +- break; +- } +- switch (entry.a_type) { +- case AT_PLATFORM: +- auxv_cpu_type = reinterpret_cast<char*>(entry.a_un.a_val); +- break; +- case AT_ICACHEBSIZE: +- icache_line_size_ = entry.a_un.a_val; +- break; +- case AT_DCACHEBSIZE: +- dcache_line_size_ = entry.a_un.a_val; +- break; +- } +- } +- base::Fclose(fp); +- } +- +- part_ = -1; +- if (auxv_cpu_type) { +- if (strcmp(auxv_cpu_type, "power10") == 0) { +- part_ = kPPCPower10; +- } else if (strcmp(auxv_cpu_type, "power9") == 0) { +- part_ = kPPCPower9; +- } else if (strcmp(auxv_cpu_type, "power8") == 0) { +- part_ = kPPCPower8; +- } else if (strcmp(auxv_cpu_type, "power7") == 0) { +- part_ = kPPCPower7; +- } else if (strcmp(auxv_cpu_type, "power6") == 0) { +- part_ = kPPCPower6; +- } else if (strcmp(auxv_cpu_type, "power5") == 0) { +- part_ = kPPCPower5; +- } else if (strcmp(auxv_cpu_type, "ppc970") == 0) { +- part_ = kPPCG5; +- } else if (strcmp(auxv_cpu_type, "ppc7450") == 0) { +- part_ = kPPCG4; +- } else if (strcmp(auxv_cpu_type, "pa6t") == 0) { +- part_ = kPPCPA6T; +- } ++ // Read processor info from getauxval() (needs at least glibc 2.18 or musl). ++ icache_line_size_ = static_cast<int>(getauxval(AT_ICACHEBSIZE)); ++ dcache_line_size_ = static_cast<int>(getauxval(AT_DCACHEBSIZE)); ++ const unsigned long hwcap = getauxval(AT_HWCAP); ++ const unsigned long hwcap2 = getauxval(AT_HWCAP2); ++ const char* platform = reinterpret_cast<const char*>(getauxval(AT_PLATFORM)); ++ ++ // NOTE: AT_HWCAP ISA version bits aren't cumulative, so it's necessary ++ // to compare against a mask of all supported versions and CPUs, up to ++ // ISA v2.06, which *is* set for later CPUs. In contrast, the AT_HWCAP2 ++ // ISA version bits from v2.07 onward are set cumulatively, so POWER10 ++ // will set the ISA version bits from v2.06 (in AT_HWCAP) through v3.1. ++ ++ // i-cache coherency requires Power ISA v2.02 or later; has its own flag. ++ has_icache_snoop_ = (hwcap & PPC_FEATURE_ICACHE_SNOOP); ++ ++ // requires Power ISA v2.03 or later, or the ISEL bit (e.g. e6500). ++ has_isel_ = (hwcap & (PPC_FEATURE_POWER5_PLUS | PPC_FEATURE_ARCH_2_05 | ++ PPC_FEATURE_PA6T | PPC_FEATURE_POWER6_EXT | PPC_FEATURE_ARCH_2_06)) || ++ (hwcap2 & PPC_FEATURE2_ISEL); ++ ++ // hwcap mask for older 64-bit PPC CPUs with Altivec, e.g. G5, Cell. ++ static const unsigned long kHwcapMaskPPCG5 = ++ (PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC); ++ ++ if (hwcap2 & PPC_FEATURE2_ARCH_3_1) { ++ part_ = kPPCPower10; ++ } else if (hwcap2 & PPC_FEATURE2_ARCH_3_00) { ++ part_ = kPPCPower9; ++ } else if (hwcap2 & PPC_FEATURE2_ARCH_2_07) { ++ part_ = kPPCPower8; ++ } else if (hwcap & PPC_FEATURE_ARCH_2_06) { ++ part_ = kPPCPower7; ++ } else if (hwcap & PPC_FEATURE_ARCH_2_05) { ++ part_ = kPPCPower6; ++ } else if (hwcap & (PPC_FEATURE_POWER5 | PPC_FEATURE_POWER5_PLUS)) { ++ part_ = kPPCPower5; ++ } else if (hwcap & PPC_FEATURE_PA6T) { ++ part_ = kPPCPA6T; ++ } else if (strcmp(platform, "ppce6500") == 0) { ++ part_ = kPPCE6500; ++ } else if (strcmp(platform, "ppce5500") == 0) { ++ part_ = kPPCE5500; ++ } else if ((hwcap & kHwcapMaskPPCG5) == kHwcapMaskPPCG5) { ++ part_ = kPPCG5; ++ } else if (hwcap & PPC_FEATURE_HAS_ALTIVEC) { ++ part_ = kPPCG4; ++ } else { ++ part_ = kPPCG3; + } + + #elif V8_OS_AIX +@@ -842,9 +842,13 @@ + part_ = kPPCPower6; + break; + case POWER_5: ++ default: + part_ = kPPCPower5; + break; + } ++ ++ has_icache_snoop_ = true; ++ has_isel_ = (part_ != kPPCPower5); // isel was added in POWER5+ (v2.03) + #endif // V8_OS_AIX + #endif // !USE_SIMULATOR + #endif // V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64 +--- a/deps/v8/src/base/cpu.h 2023-03-05 09:42:53.000000000 +0300 ++++ b/deps/v8/src/base/cpu.h 2024-12-30 04:02:27.901400946 +0300 +@@ -71,9 +71,12 @@ + kPPCPower8, + kPPCPower9, + kPPCPower10, ++ kPPCG3, + kPPCG4, + kPPCG5, +- kPPCPA6T ++ kPPCPA6T, ++ kPPCE5500, ++ kPPCE6500 + }; + + // General features +@@ -127,6 +130,10 @@ + // mips features + bool is_fp64_mode() const { return is_fp64_mode_; } + bool has_msa() const { return has_msa_; } ++ ++ // PowerPC features ++ bool has_icache_snoop() const { return has_icache_snoop_; } ++ bool has_isel() const { return has_isel_; } + + // riscv features + bool has_rvv() const { return has_rvv_; } +@@ -180,6 +187,8 @@ + bool has_non_stop_time_stamp_counter_; + bool is_running_in_vm_; + bool has_msa_; ++ bool has_icache_snoop_; ++ bool has_isel_; + bool has_rvv_; + }; + +--- a/deps/v8/src/builtins/ppc/builtins-ppc.cc 2022-02-08 04:37:48.000000000 -0800 ++++ b/deps/v8/src/builtins/ppc/builtins-ppc.cc 2022-02-19 15:18:36.373031457 -0800 +@@ -2823,7 +2823,7 @@ + __ lbz(scratch, MemOperand(scratch, 0)); + __ cmpi(scratch, Operand::Zero()); + +- if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ if (CpuFeatures::IsSupported(ISELECT)) { + __ Move(scratch, thunk_ref); + __ isel(eq, scratch, function_address, scratch); + } else { +--- a/deps/v8/src/codegen/ppc/macro-assembler-ppc.cc 2023-03-05 09:42:53.000000000 +0300 ++++ b/deps/v8/src/codegen/ppc/macro-assembler-ppc.cc 2025-01-02 18:47:19.405199075 +0300 +@@ -906,13 +906,25 @@ + + void TurboAssembler::ConvertIntToFloat(Register src, DoubleRegister dst) { + MovIntToDouble(dst, src, r0); +- fcfids(dst, dst); ++ ++ if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ fcfids(dst, dst); ++ } else { ++ fcfid(dst, dst); ++ frsp(dst, dst); ++ } + } + + void TurboAssembler::ConvertUnsignedIntToFloat(Register src, + DoubleRegister dst) { + MovUnsignedIntToDouble(dst, src, r0); +- fcfids(dst, dst); ++ ++ if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ fcfids(dst, dst); ++ } else { ++ fcfid(dst, dst); ++ frsp(dst, dst); ++ } + } + + #if V8_TARGET_ARCH_PPC64 +@@ -924,20 +936,52 @@ + + void TurboAssembler::ConvertUnsignedInt64ToFloat(Register src, + DoubleRegister double_dst) { +- MovInt64ToDouble(double_dst, src); +- fcfidus(double_dst, double_dst); ++ if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ MovInt64ToDouble(double_dst, src); ++ fcfidus(double_dst, double_dst); ++ } else { ++ ConvertUnsignedInt64ToDouble(src, double_dst); ++ frsp(double_dst, double_dst); ++ } + } + + void TurboAssembler::ConvertUnsignedInt64ToDouble(Register src, + DoubleRegister double_dst) { +- MovInt64ToDouble(double_dst, src); +- fcfidu(double_dst, double_dst); ++ if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ MovInt64ToDouble(double_dst, src); ++ fcfidu(double_dst, double_dst); ++ } else { ++ Label negative; ++ Label done; ++ cmpi(src, Operand::Zero()); ++ blt(&negative); ++ std(src, MemOperand(sp, -kDoubleSize)); ++ nop(GROUP_ENDING_NOP); // LHS/RAW optimization ++ lfd(double_dst, MemOperand(sp, -kDoubleSize)); ++ fcfid(double_dst, double_dst); ++ b(&done); ++ bind(&negative); ++ // Note: GCC saves the lowest bit, then ORs it after shifting right 1 bit, ++ // presumably for better rounding. This version only shifts right 1 bit. ++ srdi(r0, src, Operand(1)); ++ std(r0, MemOperand(sp, -kDoubleSize)); ++ nop(GROUP_ENDING_NOP); // LHS/RAW optimization ++ lfd(double_dst, MemOperand(sp, -kDoubleSize)); ++ fcfid(double_dst, double_dst); ++ fadd(double_dst, double_dst, double_dst); ++ bind(&done); ++ } + } + + void TurboAssembler::ConvertInt64ToFloat(Register src, + DoubleRegister double_dst) { + MovInt64ToDouble(double_dst, src); +- fcfids(double_dst, double_dst); ++ if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ fcfids(double_dst, double_dst); ++ } else { ++ fcfid(double_dst, double_dst); ++ frsp(double_dst, double_dst); ++ } + } + #endif + +@@ -967,15 +1011,56 @@ + void TurboAssembler::ConvertDoubleToUnsignedInt64( + const DoubleRegister double_input, const Register dst, + const DoubleRegister double_dst, FPRoundingMode rounding_mode) { +- if (rounding_mode == kRoundToZero) { +- fctiduz(double_dst, double_input); ++ if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ if (rounding_mode == kRoundToZero) { ++ fctiduz(double_dst, double_input); ++ } else { ++ SetRoundingMode(rounding_mode); ++ fctidu(double_dst, double_input); ++ ResetRoundingMode(); ++ } ++ ++ MovDoubleToInt64(dst, double_dst); + } else { +- SetRoundingMode(rounding_mode); +- fctidu(double_dst, double_input); +- ResetRoundingMode(); ++ Label safe_size; ++ Label done; ++ mov(dst, Operand(1593835520)); // bit pattern for 2^63 as a float ++ stw(dst, MemOperand(sp, -kFloatSize)); ++ nop(GROUP_ENDING_NOP); // LHS/RAW optimization ++ lfs(double_dst, MemOperand(sp, -kFloatSize)); ++ fcmpu(double_input, double_dst); ++ blt(&safe_size); ++ // Subtract 2^63, then OR the top bit of the uint64 to add back ++ fsub(double_dst, double_input, double_dst); ++ if (rounding_mode == kRoundToZero) { ++ fctidz(double_dst, double_dst); ++ } else { ++ SetRoundingMode(rounding_mode); ++ fctid(double_dst, double_dst); ++ ResetRoundingMode(); ++ } ++ // set r0 to -1, then clear all but the MSB. ++ mov(r0, Operand(-1)); ++ rldicr(r0, r0, 0, 0); ++ stfd(double_dst, MemOperand(sp, -kDoubleSize)); ++ nop(GROUP_ENDING_NOP); // LHS/RAW optimization ++ ld(dst, MemOperand(sp, -kDoubleSize)); ++ orx(dst, dst, r0); ++ b(&done); ++ // Handling for values smaller than 2^63. ++ bind(&safe_size); ++ if (rounding_mode == kRoundToZero) { ++ fctidz(double_dst, double_input); ++ } else { ++ SetRoundingMode(rounding_mode); ++ fctid(double_dst, double_input); ++ ResetRoundingMode(); ++ } ++ stfd(double_dst, MemOperand(sp, -kDoubleSize)); ++ nop(GROUP_ENDING_NOP); // LHS/RAW optimization ++ ld(dst, MemOperand(sp, -kDoubleSize)); ++ bind(&done); + } +- +- MovDoubleToInt64(dst, double_dst); + } + #endif + +@@ -2466,19 +2551,17 @@ + } + #endif + +- addi(sp, sp, Operand(-kDoubleSize)); + #if V8_TARGET_ARCH_PPC64 + mov(scratch, Operand(litVal.ival)); +- std(scratch, MemOperand(sp)); ++ std(scratch, MemOperand(sp, -kDoubleSize)); + #else + LoadIntLiteral(scratch, litVal.ival[0]); +- stw(scratch, MemOperand(sp, 0)); ++ stw(scratch, MemOperand(sp, -kDoubleSize)); + LoadIntLiteral(scratch, litVal.ival[1]); +- stw(scratch, MemOperand(sp, 4)); ++ stw(scratch, MemOperand(sp, -kDoubleSize + 4)); + #endif + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(result, MemOperand(sp, 0)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(result, MemOperand(sp, -kDoubleSize)); + } + + void TurboAssembler::MovIntToDouble(DoubleRegister dst, Register src, +@@ -2492,18 +2575,16 @@ + #endif + + DCHECK(src != scratch); +- subi(sp, sp, Operand(kDoubleSize)); + #if V8_TARGET_ARCH_PPC64 + extsw(scratch, src); +- std(scratch, MemOperand(sp, 0)); ++ std(scratch, MemOperand(sp, -kDoubleSize)); + #else + srawi(scratch, src, 31); +- stw(scratch, MemOperand(sp, Register::kExponentOffset)); +- stw(src, MemOperand(sp, Register::kMantissaOffset)); ++ stw(scratch, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); ++ stw(src, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + #endif + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(dst, MemOperand(sp, 0)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(dst, MemOperand(sp, -kDoubleSize)); + } + + void TurboAssembler::MovUnsignedIntToDouble(DoubleRegister dst, Register src, +@@ -2517,18 +2598,16 @@ + #endif + + DCHECK(src != scratch); +- subi(sp, sp, Operand(kDoubleSize)); + #if V8_TARGET_ARCH_PPC64 + clrldi(scratch, src, Operand(32)); +- std(scratch, MemOperand(sp, 0)); ++ std(scratch, MemOperand(sp, -kDoubleSize)); + #else + li(scratch, Operand::Zero()); +- stw(scratch, MemOperand(sp, Register::kExponentOffset)); +- stw(src, MemOperand(sp, Register::kMantissaOffset)); ++ stw(scratch, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); ++ stw(src, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + #endif + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(dst, MemOperand(sp, 0)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(dst, MemOperand(sp, -kDoubleSize)); + } + + void TurboAssembler::MovInt64ToDouble(DoubleRegister dst, +@@ -2543,16 +2622,14 @@ + } + #endif + +- subi(sp, sp, Operand(kDoubleSize)); + #if V8_TARGET_ARCH_PPC64 +- std(src, MemOperand(sp, 0)); ++ std(src, MemOperand(sp, -kDoubleSize)); + #else +- stw(src_hi, MemOperand(sp, Register::kExponentOffset)); +- stw(src, MemOperand(sp, Register::kMantissaOffset)); ++ stw(src_hi, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); ++ stw(src, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + #endif + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(dst, MemOperand(sp, 0)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(dst, MemOperand(sp, -kDoubleSize)); + } + + #if V8_TARGET_ARCH_PPC64 +@@ -2567,12 +2644,10 @@ + return; + } + +- subi(sp, sp, Operand(kDoubleSize)); +- stw(src_hi, MemOperand(sp, Register::kExponentOffset)); +- stw(src_lo, MemOperand(sp, Register::kMantissaOffset)); ++ stw(src_hi, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); ++ stw(src_lo, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(dst, MemOperand(sp)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(dst, MemOperand(sp, -kDoubleSize)); + } + #endif + +@@ -2587,12 +2662,10 @@ + } + #endif + +- subi(sp, sp, Operand(kDoubleSize)); +- stfd(dst, MemOperand(sp)); +- stw(src, MemOperand(sp, Register::kMantissaOffset)); ++ stfd(dst, MemOperand(sp, -kDoubleSize)); ++ stw(src, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(dst, MemOperand(sp)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(dst, MemOperand(sp, -kDoubleSize)); + } + + void TurboAssembler::InsertDoubleHigh(DoubleRegister dst, Register src, +@@ -2606,12 +2679,10 @@ + } + #endif + +- subi(sp, sp, Operand(kDoubleSize)); +- stfd(dst, MemOperand(sp)); +- stw(src, MemOperand(sp, Register::kExponentOffset)); ++ stfd(dst, MemOperand(sp, -kDoubleSize)); ++ stw(src, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lfd(dst, MemOperand(sp)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lfd(dst, MemOperand(sp, -kDoubleSize)); + } + + void TurboAssembler::MovDoubleLowToInt(Register dst, DoubleRegister src) { +@@ -2622,11 +2693,9 @@ + } + #endif + +- subi(sp, sp, Operand(kDoubleSize)); +- stfd(src, MemOperand(sp)); ++ stfd(src, MemOperand(sp, -kDoubleSize)); + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lwz(dst, MemOperand(sp, Register::kMantissaOffset)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lwz(dst, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + } + + void TurboAssembler::MovDoubleHighToInt(Register dst, DoubleRegister src) { +@@ -2638,13 +2707,10 @@ + } + #endif + +- subi(sp, sp, Operand(kDoubleSize)); +- stfd(src, MemOperand(sp)); ++ stfd(src, MemOperand(sp, -kDoubleSize)); + nop(GROUP_ENDING_NOP); // LHS/RAW optimization +- lwz(dst, MemOperand(sp, Register::kExponentOffset)); +- addi(sp, sp, Operand(kDoubleSize)); ++ lwz(dst, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); + } +- + void TurboAssembler::MovDoubleToInt64( + #if !V8_TARGET_ARCH_PPC64 + Register dst_hi, +@@ -2657,16 +2723,14 @@ + } + #endif + +- subi(sp, sp, Operand(kDoubleSize)); +- stfd(src, MemOperand(sp)); ++ stfd(src, MemOperand(sp, -kDoubleSize)); + nop(GROUP_ENDING_NOP); // LHS/RAW optimization + #if V8_TARGET_ARCH_PPC64 +- ld(dst, MemOperand(sp, 0)); ++ ld(dst, MemOperand(sp, -kDoubleSize)); + #else +- lwz(dst_hi, MemOperand(sp, Register::kExponentOffset)); +- lwz(dst, MemOperand(sp, Register::kMantissaOffset)); ++ lwz(dst_hi, MemOperand(sp, -kDoubleSize + Register::kExponentOffset)); ++ lwz(dst, MemOperand(sp, -kDoubleSize + Register::kMantissaOffset)); + #endif +- addi(sp, sp, Operand(kDoubleSize)); + } + + void TurboAssembler::MovIntToFloat(DoubleRegister dst, Register src, +@@ -3291,10 +3355,8 @@ + } + + #define MEM_LE_OP_LIST(V) \ +- V(LoadU64, ldbrx) \ + V(LoadU32, lwbrx) \ + V(LoadU16, lhbrx) \ +- V(StoreU64, stdbrx) \ + V(StoreU32, stwbrx) \ + V(StoreU16, sthbrx) + +@@ -3316,6 +3378,37 @@ + #undef MEM_LE_OP_FUNCTION + #undef MEM_LE_OP_LIST + ++void TurboAssembler::LoadU64LE(Register dst, const MemOperand& mem, ++ Register scratch) { ++#ifdef V8_TARGET_BIG_ENDIAN ++ if (CpuFeatures::IsSupported(PPC_7_PLUS_NXP)) { ++ GenerateMemoryLEOperation(dst, mem, ldbrx); ++ } else { ++ lwbrx(dst, mem); ++ lwbrx(scratch, MemOperand(mem.ra(), mem.rb(), mem.offset() + 4)); ++ rldicr(scratch, scratch, 32, 31); ++ orx(dst, dst, scratch); ++ } ++#else ++ LoadU64(dst, mem, scratch); ++#endif ++} ++ ++void TurboAssembler::StoreU64LE(Register src, const MemOperand& mem, ++ Register scratch) { ++#ifdef V8_TARGET_BIG_ENDIAN ++ if (CpuFeatures::IsSupported(PPC_7_PLUS_NXP)) { ++ GenerateMemoryLEOperation(src, mem, stdbrx); ++ } else { ++ stwbrx(src, mem); ++ rldicl(scratch, src, 32, 32); ++ stwbrx(scratch, MemOperand(mem.ra(), mem.rb(), mem.offset() + 4)); ++ } ++#else ++ StoreU64(src, mem, scratch); ++#endif ++} ++ + void TurboAssembler::LoadS32LE(Register dst, const MemOperand& mem, + Register scratch) { + #ifdef V8_TARGET_BIG_ENDIAN +--- a/deps/v8/src/codegen/cpu-features.h 2022-02-19 21:19:15.982288690 -0800 ++++ b/deps/v8/src/codegen/cpu-features.h 2022-02-19 21:22:43.071487369 -0800 +@@ -52,11 +52,15 @@ + MIPS_SIMD, // MSA instructions + + #elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 ++ PPC_5_PLUS, + PPC_6_PLUS, + PPC_7_PLUS, + PPC_8_PLUS, + PPC_9_PLUS, + PPC_10_PLUS, ++ ICACHE_SNOOP, // ISA v2.02 (POWER5) ++ ISELECT, // ISA v2.03 (POWER5+ and some NXP cores) ++ PPC_7_PLUS_NXP, // ISA v2.06 (POWER7 and NXP e5500/e6500) + + #elif V8_TARGET_ARCH_S390X + FPU, +--- a/deps/v8/src/compiler/backend/ppc/instruction-selector-ppc.cc 2022-02-20 23:35:21.212337639 -0800 ++++ b/deps/v8/src/compiler/backend/ppc/instruction-selector-ppc.cc 2022-02-20 23:36:20.925858840 -0800 +@@ -2702,16 +2702,26 @@ + // static + MachineOperatorBuilder::Flags + InstructionSelector::SupportedMachineOperatorFlags() { +- return MachineOperatorBuilder::kFloat32RoundDown | +- MachineOperatorBuilder::kFloat64RoundDown | +- MachineOperatorBuilder::kFloat32RoundUp | +- MachineOperatorBuilder::kFloat64RoundUp | +- MachineOperatorBuilder::kFloat32RoundTruncate | +- MachineOperatorBuilder::kFloat64RoundTruncate | +- MachineOperatorBuilder::kFloat64RoundTiesAway | +- MachineOperatorBuilder::kWord32Popcnt | +- MachineOperatorBuilder::kWord64Popcnt; ++ MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::Flag::kNoFlags; ++ // FP rounding to integer instructions require Power ISA v2.02 or later. ++ if (CpuFeatures::IsSupported(PPC_5_PLUS)) { ++ flags |= MachineOperatorBuilder::kFloat32RoundDown | ++ MachineOperatorBuilder::kFloat64RoundDown | ++ MachineOperatorBuilder::kFloat32RoundUp | ++ MachineOperatorBuilder::kFloat64RoundUp | ++ MachineOperatorBuilder::kFloat32RoundTruncate | ++ MachineOperatorBuilder::kFloat64RoundTruncate | ++ MachineOperatorBuilder::kFloat64RoundTiesAway; ++ } ++ // Population count requires Power ISA v2.06, or NXP e5500/e6500. ++ if (CpuFeatures::IsSupported(PPC_7_PLUS_NXP)) { ++ flags |= MachineOperatorBuilder::kWord32Popcnt; ++#if V8_TARGET_ARCH_PPC64 ++ flags |= MachineOperatorBuilder::kWord64Popcnt; ++#endif ++ } + // We omit kWord32ShiftIsSafe as s[rl]w use 0x3F as a mask rather than 0x1F. ++ return flags; + } + + // static +--- a/deps/v8/src/compiler/backend/ppc/code-generator-ppc.cc 2023-03-05 09:42:53.000000000 +0300 ++++ b/deps/v8/src/compiler/backend/ppc/code-generator-ppc.cc 2025-01-02 22:32:18.475188958 +0300 +@@ -1859,7 +1859,7 @@ + cr, static_cast<CRBit>(VXCVI % CRWIDTH)); + __ mcrfs(cr, VXCVI); // extract FPSCR field containing VXCVI into cr7 + // Handle conversion failures (such as overflow). +- if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ if (CpuFeatures::IsSupported(ISELECT)) { + if (check_conversion) { + __ li(i.OutputRegister(1), Operand(1)); + __ isel(i.OutputRegister(1), r0, i.OutputRegister(1), crbit); +@@ -1896,7 +1896,7 @@ + int crbit = v8::internal::Assembler::encode_crbit( + cr, static_cast<CRBit>(VXCVI % CRWIDTH)); + __ mcrfs(cr, VXCVI); // extract FPSCR field containing VXCVI into cr7 +- if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ if (CpuFeatures::IsSupported(ISELECT)) { + __ li(i.OutputRegister(1), Operand(1)); + __ isel(i.OutputRegister(1), r0, i.OutputRegister(1), crbit); + } else { +@@ -2173,11 +2173,66 @@ + break; + } + case kPPC_LoadByteRev64: { +- ASSEMBLE_LOAD_INTEGER_RR(ldbrx); ++ // inlined version of ASSEMBLE_LOAD_INTEGER_RR() ++ Register result = i.OutputRegister(); ++ AddressingMode mode = kMode_None; ++ MemOperand operand = i.MemoryOperand(&mode); ++ DCHECK_EQ(mode, kMode_MRR); ++ bool is_atomic = i.InputInt32(2); ++ if (CpuFeatures::IsSupported(PPC_7_PLUS_NXP)) { ++ __ ldbrx(result, operand); ++ } else { ++#ifdef V8_TARGET_BIG_ENDIAN ++ // low and high words from reversed perspective ++ MemOperand op_low = operand; ++ MemOperand op_high = MemOperand(operand.ra(), operand.rb(), ++ operand.offset() + 4); ++#else ++ // low and high words from reversed perspective ++ MemOperand op_high = operand; ++ MemOperand op_low = MemOperand(operand.ra(), operand.rb(), ++ operand.offset() + 4); ++#endif ++ Register temp1 = r0; ++ __ lwbrx(result, op_low); ++ __ lwbrx(temp1, op_high); ++ __ rldicr(temp1, temp1, 32, 31); ++ __ orx(result, result, temp1); ++ } ++ if (is_atomic) __ lwsync(); ++ DCHECK_EQ(LeaveRC, i.OutputRCBit()); + break; + } + case kPPC_StoreByteRev64: { +- ASSEMBLE_STORE_INTEGER_RR(stdbrx); ++ // inlined version of ASSEMBLE_STORE_INTEGER_RR() ++ size_t index = 0; ++ AddressingMode mode = kMode_None; ++ MemOperand operand = i.MemoryOperand(&mode, &index); ++ DCHECK_EQ(mode, kMode_MRR); ++ Register value = i.InputRegister(index); ++ bool is_atomic = i.InputInt32(3); ++ if (is_atomic) __ lwsync(); ++ if (CpuFeatures::IsSupported(PPC_7_PLUS_NXP)) { ++ __ stdbrx(value, operand); ++ } else { ++#ifdef V8_TARGET_BIG_ENDIAN ++ // low and high words from reversed perspective ++ MemOperand op_low = operand; ++ MemOperand op_high = MemOperand(operand.ra(), operand.rb(), ++ operand.offset() + 4); ++#else ++ // low and high words from reversed perspective ++ MemOperand op_high = operand; ++ MemOperand op_low = MemOperand(operand.ra(), operand.rb(), ++ operand.offset() + 4); ++#endif ++ Register temp1 = r0; ++ __ stwbrx(value, op_low); ++ __ rldicl(temp1, value, 32, 32); ++ __ stwbrx(temp1, op_high); ++ } ++ if (is_atomic) __ sync(); ++ DCHECK_EQ(LeaveRC, i.OutputRCBit()); + break; + } + case kPPC_F64x2Splat: { +@@ -3936,7 +3991,7 @@ + // Unnecessary for eq/lt & ne/ge since only FU bit will be set. + } + +- if (CpuFeatures::IsSupported(PPC_7_PLUS)) { ++ if (CpuFeatures::IsSupported(ISELECT)) { + switch (cond) { + case eq: + case lt: +@@ -3954,6 +4009,7 @@ + break; + default: + UNREACHABLE(); ++ break; + } + } else { + if (reg_value != 0) __ li(reg, Operand::Zero()); +--- a/deps/v8/src/codegen/ppc/cpu-ppc.cc 2022-02-08 04:37:48.000000000 -0800 ++++ b/deps/v8/src/codegen/ppc/cpu-ppc.cc 2022-02-20 17:02:17.900000785 -0800 +@@ -8,14 +8,12 @@ + + #include "src/codegen/cpu-features.h" + +-#define INSTR_AND_DATA_CACHE_COHERENCY PPC_6_PLUS +- + namespace v8 { + namespace internal { + + void CpuFeatures::FlushICache(void* buffer, size_t size) { + #if !defined(USE_SIMULATOR) +- if (CpuFeatures::IsSupported(INSTR_AND_DATA_CACHE_COHERENCY)) { ++ if (CpuFeatures::IsSupported(ICACHE_SNOOP)) { + __asm__ __volatile__( + "sync \n" + "icbi 0, %0 \n" +@@ -26,25 +24,33 @@ + return; + } + +- const int kCacheLineSize = CpuFeatures::icache_line_size(); +- intptr_t mask = kCacheLineSize - 1; ++ const int kInstrCacheLineSize = CpuFeatures::icache_line_size(); ++ const int kDataCacheLineSize = CpuFeatures::dcache_line_size(); ++ intptr_t ic_mask = kInstrCacheLineSize - 1; ++ intptr_t dc_mask = kDataCacheLineSize - 1; + byte* start = +- reinterpret_cast<byte*>(reinterpret_cast<intptr_t>(buffer) & ~mask); ++ reinterpret_cast<byte*>(reinterpret_cast<intptr_t>(buffer) & ~dc_mask); + byte* end = static_cast<byte*>(buffer) + size; +- for (byte* pointer = start; pointer < end; pointer += kCacheLineSize) { +- __asm__( ++ for (byte* pointer = start; pointer < end; pointer += kDataCacheLineSize) { ++ __asm__ __volatile__( + "dcbf 0, %0 \n" +- "sync \n" +- "icbi 0, %0 \n" +- "isync \n" + : /* no output */ + : "r"(pointer)); + } ++ __asm__ __volatile__("sync"); + ++ start = ++ reinterpret_cast<byte*>(reinterpret_cast<intptr_t>(buffer) & ~ic_mask); ++ for (byte* pointer = start; pointer < end; pointer += kInstrCacheLineSize) { ++ __asm__ __volatile__( ++ "icbi 0, %0 \n" ++ : /* no output */ ++ : "r"(pointer)); ++ } ++ __asm__ __volatile__("isync"); + #endif // !USE_SIMULATOR + } + } // namespace internal + } // namespace v8 + +-#undef INSTR_AND_DATA_CACHE_COHERENCY + #endif // V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 +--- ./deps/v8/src/codegen/ppc/assembler-ppc.cc.orig 2022-02-08 04:37:48.000000000 -0800 ++++ ./deps/v8/src/codegen/ppc/assembler-ppc.cc 2022-02-20 17:20:25.019591225 -0800 +@@ -65,6 +65,7 @@ + void CpuFeatures::ProbeImpl(bool cross_compile) { + supported_ |= CpuFeaturesImpliedByCompiler(); + icache_line_size_ = 128; ++ dcache_line_size_ = 128; + + // Only use statically determined features for cross compile (snapshot). + if (cross_compile) return; +@@ -73,6 +74,8 @@ + #ifdef USE_SIMULATOR + // Simulator + supported_ |= (1u << PPC_10_PLUS); ++ supported_ |= (1u << ICACHE_SNOOP); ++ supported_ |= (1u << ISELECT); + #else + base::CPU cpu; + if (cpu.part() == base::CPU::kPPCPower10) { +@@ -85,17 +88,37 @@ + supported_ |= (1u << PPC_7_PLUS); + } else if (cpu.part() == base::CPU::kPPCPower6) { + supported_ |= (1u << PPC_6_PLUS); ++ } else if (cpu.part() == base::CPU::kPPCPower5 || ++ cpu.part() == base::CPU::kPPCPA6T) { ++ supported_ |= (1u << PPC_5_PLUS); ++ } else if (cpu.part() == base::CPU::kPPCE6500 || ++ cpu.part() == base::CPU::kPPCE5500) { ++ supported_ |= (1u << PPC_7_PLUS_NXP); // NXP-supported v2.06 features ++ } ++ ++ if (cpu.has_icache_snoop()) { ++ supported_ |= (1u << ICACHE_SNOOP); ++ } ++ if (cpu.has_isel()) { ++ supported_ |= (1u << ISELECT); + } + #if V8_OS_LINUX + if (cpu.icache_line_size() != base::CPU::kUnknownCacheLineSize) { + icache_line_size_ = cpu.icache_line_size(); + } ++ if (cpu.dcache_line_size() != base::CPU::kUnknownCacheLineSize) { ++ dcache_line_size_ = cpu.dcache_line_size(); ++ } + #endif + #endif + if (supported_ & (1u << PPC_10_PLUS)) supported_ |= (1u << PPC_9_PLUS); + if (supported_ & (1u << PPC_9_PLUS)) supported_ |= (1u << PPC_8_PLUS); + if (supported_ & (1u << PPC_8_PLUS)) supported_ |= (1u << PPC_7_PLUS); +- if (supported_ & (1u << PPC_7_PLUS)) supported_ |= (1u << PPC_6_PLUS); ++ if (supported_ & (1u << PPC_7_PLUS)) { ++ supported_ |= (1u << PPC_7_PLUS_NXP); // NXP-supported v2.06 features ++ supported_ |= (1u << PPC_6_PLUS); ++ } ++ if (supported_ & (1u << PPC_6_PLUS)) supported_ |= (1u << PPC_5_PLUS); + + // Set a static value on whether Simd is supported. + // This variable is only used for certain archs to query SupportWasmSimd128() +@@ -117,11 +140,15 @@ + } + + void CpuFeatures::PrintFeatures() { ++ printf("PPC_5_PLUS=%d\n", CpuFeatures::IsSupported(PPC_5_PLUS)); + printf("PPC_6_PLUS=%d\n", CpuFeatures::IsSupported(PPC_6_PLUS)); + printf("PPC_7_PLUS=%d\n", CpuFeatures::IsSupported(PPC_7_PLUS)); + printf("PPC_8_PLUS=%d\n", CpuFeatures::IsSupported(PPC_8_PLUS)); + printf("PPC_9_PLUS=%d\n", CpuFeatures::IsSupported(PPC_9_PLUS)); + printf("PPC_10_PLUS=%d\n", CpuFeatures::IsSupported(PPC_10_PLUS)); ++ printf("ICACHE_SNOOP=%d\n", CpuFeatures::IsSupported(ICACHE_SNOOP)); ++ printf("ISELECT=%d\n", CpuFeatures::IsSupported(ISELECT)); ++ printf("PPC_7_PLUS_NXP=%d\n", CpuFeatures::IsSupported(PPC_7_PLUS_NXP)); + } + + Register ToRegister(int num) { |