From 9f822cabe7af7c4b0cc7cdcfbac21bd8a5b3b9c1 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 26 May 2021 12:43:56 +0200 Subject: core/pacman: add patch for different sse2 detection - this should now also work on via processors --- core/pacman/PKGBUILD | 2 +- ...686-by-pentium4-when-architecture-is-auto.patch | 46 +++++++++++++++------- 2 files changed, 33 insertions(+), 15 deletions(-) (limited to 'core') diff --git a/core/pacman/PKGBUILD b/core/pacman/PKGBUILD index 7429bd4b..7706a130 100644 --- a/core/pacman/PKGBUILD +++ b/core/pacman/PKGBUILD @@ -24,7 +24,7 @@ if [ ! "${CARCH}" = "i686" ]; then fi source+=('replace-i686-by-pentium4-when-architecture-is-auto.patch') -sha256sums+=('e8d5f8979c4dfab49e7ac058846f2454b865c1da451e086c23e61034fd820c19') +sha256sums+=('e5d371dd890ba7916a7f363eea46da363a6b5b8794640f387945458d15323136') eval "$( { diff --git a/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch b/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch index 32030586..6c073a4a 100644 --- a/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch +++ b/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch @@ -1,24 +1,41 @@ diff --git a/src/pacman/conf.c b/src/pacman/conf.c -index 2d8518c4..2e7fac88 100644 +index 0f0c2cfb..87873891 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c -@@ -308,6 +308,11 @@ int config_set_arch(const char *arch) - struct utsname un; +@@ -18,6 +18,7 @@ + * along with this program. If not, see . + */ + ++#include + #include + #include + #include /* setlocale */ +@@ -401,6 +402,12 @@ int config_add_architecture(char *arch) + char *newarch; uname(&un); - config->arch = strdup(un.machine); -+ if(strcmp(config->arch, "i686") == 0) { -+ __builtin_cpu_init(); -+ if (__builtin_cpu_supports("sse2")) -+ config->arch = strdup("pentium4"); + newarch = strdup(un.machine); ++ if(strcmp(newarch, "i686") == 0) { ++ unsigned int eax, ebx, ecx, edx; ++ __get_cpuid(0, &eax, &ebx, &ecx, &edx); ++ if (ecx & bit_SSE2) ++ newarch = strdup("pentium4"); + } - } else { - config->arch = strdup(arch); + free(arch); + arch = newarch; } diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c -index 3bb622e6..34aace6c 100644 +index 7e810127..255c6269 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c -@@ -274,8 +274,18 @@ static void setuseragent(void) +@@ -26,6 +26,7 @@ + + #include /* atoi */ + #include ++#include + #include /* isspace */ + #include + #include +@@ -274,8 +275,19 @@ static void setuseragent(void) int len; uname(&un); @@ -26,8 +43,9 @@ index 3bb622e6..34aace6c 100644 + strncpy(machine, un.machine, sizeof machine); + machine[sizeof machine-1] = '\0'; + if(strcmp(machine, "i686") == 0) { -+ __builtin_cpu_init(); -+ if (__builtin_cpu_supports("sse2")) { ++ int eax, ebx, ecx, edx; ++ __cpuid(0, &eax, &ebx, &ecx, %edx); ++ if (ecx & bit_SSE2) { + strncpy(machine, "pentium4", sizeof machine); + machine[sizeof machine-1] = '\0'; + } -- cgit v1.2.3-70-g09d2