summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-01-19 11:40:59 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-01-19 11:40:59 +0200
commit240b2d3441ce0711b0eacdc5345b3a4d9b77a716 (patch)
treeeb1f9467ddc240ce20de61ef297c68815ca673b3 /lib
parent735c83ad5291858cc981f739c3db5165d50598d5 (diff)
downloadrpm-240b2d3441ce0711b0eacdc5345b3a4d9b77a716.tar.gz
rpm-240b2d3441ce0711b0eacdc5345b3a4d9b77a716.tar.bz2
rpm-240b2d3441ce0711b0eacdc5345b3a4d9b77a716.zip
Add support for Geode CPU (rhbz#428979)
Patch from Dennis Gilmore
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmrc.c28
-rw-r--r--lib/rpmts.c2
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 11ca6e488..c1acb28f5 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -975,6 +975,32 @@ static int is_pentium4()
return 0;
}
+static int is_geode()
+{
+ unsigned int eax, ebx, ecx, edx, family, model;
+ char vendor[16];
+ /* If you care about space, you can just check ebx, ecx and edx directly
+ instead of forming a string first and then doing a strcmp */
+ memset(vendor, 0, sizeof(vendor));
+
+ cpuid(0, &eax, &ebx, &ecx, &edx);
+ memset(vendor, 0, sizeof(vendor));
+ *((unsigned int *)&vendor[0]) = ebx;
+ *((unsigned int *)&vendor[4]) = edx;
+ *((unsigned int *)&vendor[8]) = ecx;
+ if (strncmp(vendor, "AuthenticAMD", 12) != 0)
+ return 0;
+ cpuid(1, &eax, &ebx, &ecx, &edx);
+ family = (eax >> 8) & 0x0f;
+ model = (eax >> 4) & 0x0f;
+ if (family == 5)
+ switch (model)
+ {
+ case 10: // Geode
+ return 1;
+ }
+ return 0;
+}
#endif
#if defined(__linux__) && defined(__powerpc__)
@@ -1216,6 +1242,8 @@ static void defaultMachine(const char ** arch,
strcpy(un.machine, "pentium4");
else if (is_pentium3())
strcpy(un.machine, "pentium3");
+ else if (is_geode())
+ strcpy(un.machine, "geode");
else if (strchr("3456", un.machine[1]) && un.machine[1] != class)
un.machine[1] = class;
}
diff --git a/lib/rpmts.c b/lib/rpmts.c
index 876522dd2..80f96c20c 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -153,7 +153,7 @@ static int isArch(const char * arch)
{
const char ** av;
static const char *arches[] = {
- "i386", "i486", "i586", "i686", "athlon", "pentium3", "pentium4", "x86_64", "amd64", "ia32e",
+ "i386", "i486", "i586", "i686", "athlon", "pentium3", "pentium4", "x86_64", "amd64", "ia32e", "geode",
"alpha", "alphaev5", "alphaev56", "alphapca56", "alphaev6", "alphaev67",
"sparc", "sun4", "sun4m", "sun4c", "sun4d", "sparcv8", "sparcv9", "sparcv9v",
"sparc64", "sparc64v", "sun4u",