2006-12-19 00:17:44 +01:00
|
|
|
Patch machine detection code: always use "ppc", restore SIGILL
|
|
|
|
handler, detect transmeta. [#52713]
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2006-12-19 00:17:44 +01:00
|
|
|
--- ./lib/rpmrc.c.orig 2005-01-17 18:46:23.000000000 +0000
|
|
|
|
+++ ./lib/rpmrc.c 2005-12-16 18:30:29.000000000 +0000
|
|
|
|
@@ -2,9 +2,6 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
#include "system.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
-#if defined(__linux__) && defined(__powerpc__)
|
|
|
|
-#include <setjmp.h>
|
|
|
|
-#endif
|
|
|
|
|
2006-12-19 00:17:44 +01:00
|
|
|
#include <ctype.h> /* XXX for /etc/rpm/platform contents */
|
|
|
|
|
|
|
|
@@ -953,20 +950,38 @@ static inline int RPMClass(void)
|
|
|
|
{
|
|
|
|
int cpu;
|
|
|
|
unsigned int tfms, junk, cap, capamd;
|
|
|
|
+ struct sigaction oldsa;
|
|
|
|
|
|
|
|
+ sigaction(SIGILL, NULL, &oldsa);
|
|
|
|
signal(SIGILL, model3);
|
|
|
|
|
|
|
|
- if (sigsetjmp(jenv, 1))
|
|
|
|
+ if (sigsetjmp(jenv, 1)) {
|
|
|
|
+ sigaction(SIGILL, &oldsa, NULL);
|
|
|
|
return 3;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (cpuid_eax(0x000000000)==0)
|
|
|
|
+ if (cpuid_eax(0x000000000)==0) {
|
|
|
|
+ sigaction(SIGILL, &oldsa, NULL);
|
|
|
|
return 4;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
cpuid(0x00000001, &tfms, &junk, &junk, &cap);
|
|
|
|
cpuid(0x80000001, &junk, &junk, &junk, &capamd);
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
cpu = (tfms>>8)&15;
|
|
|
|
|
2006-12-19 00:17:44 +01:00
|
|
|
+ /* Check if we have a Transmeta i686-compatible CPU
|
|
|
|
+ that reports as being i586 */
|
|
|
|
+ if(cpu == 5
|
2006-12-19 00:17:44 +01:00
|
|
|
+ && cpuid_ecx(0)=='68xM'
|
|
|
|
+ && cpuid_edx(0)=='Teni'
|
|
|
|
+ && (cpuid_edx(1) & ((1<<8)|(1<<15))) == ((1<<8)|(1<<15))) {
|
|
|
|
+ sigaction(SIGILL, &oldsa, NULL);
|
|
|
|
+ return 6; /* has CX8 and CMOV */
|
|
|
|
+ }
|
|
|
|
+
|
2006-12-19 00:17:44 +01:00
|
|
|
+ sigaction(SIGILL, &oldsa, NULL);
|
|
|
|
+
|
2008-09-12 20:37:28 +02:00
|
|
|
if (cpu < 6)
|
2006-12-19 00:17:44 +01:00
|
|
|
return cpu;
|
|
|
|
|
|
|
|
@@ -1076,15 +1091,6 @@ static int is_pentium4()
|
|
|
|
|
2006-12-19 00:17:44 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
-#if defined(__linux__) && defined(__powerpc__)
|
|
|
|
-static jmp_buf mfspr_jmpbuf;
|
|
|
|
-
|
|
|
|
-static void mfspr_ill(int notused)
|
|
|
|
-{
|
|
|
|
- longjmp(mfspr_jmpbuf, -1);
|
|
|
|
-}
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
/**
|
|
|
|
*/
|
2006-12-19 00:17:44 +01:00
|
|
|
static void defaultMachine(/*@out@*/ const char ** arch,
|
|
|
|
@@ -1219,6 +1225,11 @@ static void defaultMachine(/*@out@*/ con
|
2006-12-19 00:17:44 +01:00
|
|
|
/* big endian */
|
|
|
|
strcpy(un.machine, "mips");
|
|
|
|
# endif
|
|
|
|
+ /* in linux, lets rename parisc to hppa */
|
|
|
|
+#if defined(__linux__)
|
|
|
|
+ if (!strcmp(un.machine,"parisc"))
|
|
|
|
+ strcpy(un.machine,"hppa");
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
# if defined(__hpux) && defined(_SC_CPU_VERSION)
|
|
|
|
{
|
2006-12-19 00:17:44 +01:00
|
|
|
@@ -1326,27 +1337,6 @@ static void defaultMachine(/*@out@*/ con
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
-# if defined(__linux__) && defined(__powerpc__)
|
|
|
|
- {
|
|
|
|
- unsigned pvr = 0;
|
|
|
|
- __sighandler_t oldh = signal(SIGILL, mfspr_ill);
|
|
|
|
- if (setjmp(mfspr_jmpbuf) == 0) {
|
|
|
|
- __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
|
|
|
|
- }
|
|
|
|
- signal(SIGILL, oldh);
|
|
|
|
-
|
|
|
|
- if ( pvr ) {
|
|
|
|
- pvr >>= 16;
|
|
|
|
- if ( pvr >= 0x40)
|
|
|
|
- strcpy(un.machine, "ppcpseries");
|
|
|
|
- else if ( (pvr == 0x36) || (pvr == 0x37) )
|
|
|
|
- strcpy(un.machine, "ppciseries");
|
|
|
|
- else
|
|
|
|
- strcpy(un.machine, "ppc");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-# endif
|
|
|
|
-
|
|
|
|
/* the uname() result goes through the arch_canon table */
|
|
|
|
canon = lookupInCanonTable(un.machine,
|
|
|
|
tables[RPM_MACHTABLE_INSTARCH].canons,
|