-
Notifications
You must be signed in to change notification settings - Fork 108
Add support for Transmeta(TM) Crusoe(TM) CPU #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ enum { | |
| // ARCH_X86 | ||
| CPU_VENDOR_INTEL, | ||
| CPU_VENDOR_AMD, | ||
| CPU_VENDOR_TRANSMETA, | ||
| // ARCH_ARM | ||
| CPU_VENDOR_ARM, | ||
| CPU_VENDOR_APPLE, | ||
|
|
@@ -82,7 +83,7 @@ struct cache { | |
| }; | ||
|
|
||
| struct topology { | ||
| int32_t total_cores; | ||
Dr-Noob marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| int32_t total_cores; | ||
| struct cache* cach; | ||
| #if defined(ARCH_X86) || defined(ARCH_PPC) | ||
| int32_t physical_cores; | ||
|
|
@@ -98,7 +99,7 @@ struct topology { | |
| }; | ||
|
|
||
| struct features { | ||
| bool AES; // Must be the first field of features struct! | ||
Dr-Noob marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bool AES; // Must be the first field of features struct! | ||
| #ifdef ARCH_X86 | ||
| bool AVX; | ||
| bool AVX2; | ||
|
|
@@ -116,11 +117,11 @@ struct features { | |
| #elif ARCH_PPC | ||
| bool altivec; | ||
| #elif ARCH_ARM | ||
| bool NEON; | ||
Dr-Noob marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bool NEON; | ||
| bool SHA1; | ||
| bool SHA2; | ||
| bool CRC32; | ||
| #endif | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Remove space
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. about these 4 nit: remove space comments in
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes, that would be nice. I want to give this a format pass sometime soon. |
||
| #endif | ||
| }; | ||
|
|
||
| struct extensions { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,9 @@ | |
| #include "uarch.h" | ||
| #include "freq/freq.h" | ||
|
|
||
| #define CPU_VENDOR_INTEL_STRING "GenuineIntel" | ||
| #define CPU_VENDOR_AMD_STRING "AuthenticAMD" | ||
| #define CPU_VENDOR_INTEL_STRING "GenuineIntel" | ||
| #define CPU_VENDOR_AMD_STRING "AuthenticAMD" | ||
| #define CPU_VENDOR_TRANSMETA_STRING "GenuineTMx86" | ||
|
|
||
| static const char *hv_vendors_string[] = { | ||
| [HV_VENDOR_KVM] = "KVMKVMKVM", | ||
|
|
@@ -468,6 +469,8 @@ struct cpuInfo* get_cpu_info(void) { | |
| cpu->cpu_vendor = CPU_VENDOR_INTEL; | ||
| else if (strcmp(CPU_VENDOR_AMD_STRING,name) == 0) | ||
| cpu->cpu_vendor = CPU_VENDOR_AMD; | ||
| else if (strcmp(CPU_VENDOR_TRANSMETA_STRING,name) == 0) | ||
| cpu->cpu_vendor = CPU_VENDOR_TRANSMETA; | ||
| else { | ||
| cpu->cpu_vendor = CPU_VENDOR_INVALID; | ||
| printErr("Unknown CPU vendor: %s", name); | ||
|
|
@@ -692,6 +695,7 @@ struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, int | |
|
|
||
| switch(cpu->cpu_vendor) { | ||
| case CPU_VENDOR_INTEL: | ||
| case CPU_VENDOR_TRANSMETA: | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure of this. From what I recall,
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right. Any help with finding out how to retrieve topology is appreciated. I believe we could also assume cores=1 on this platform. |
||
| if (cpu->maxLevels >= 0x00000004) { | ||
| bool toporet = get_topology_from_apic(cpu, topo); | ||
| if(!toporet) { | ||
|
|
@@ -767,6 +771,32 @@ struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, int | |
| return topo; | ||
| } | ||
|
|
||
| struct cache* get_cache_info_transmeta(struct cache* cach) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't we use
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It failed to retrieve the cache size with that. I have eventually hardcoded the cache size to this CPU model. |
||
| uint32_t eax = 0x80000005; | ||
| uint32_t ebx = 0; | ||
| uint32_t ecx = 0; | ||
| uint32_t edx = 0; | ||
| cpuid(&eax, &ebx, &ecx, &edx); | ||
|
|
||
| cach->L1d->size = (ecx >> 24) * 1024; | ||
| cach->L1i->size = (edx >> 24) * 1024; | ||
|
|
||
| eax = 0x80000006; | ||
| cpuid(&eax, &ebx, &ecx, &edx); | ||
|
|
||
| cach->L2->size = (ecx >> 16) * 1024; | ||
| cach->L3->size = (edx >> 18) * 512 * 1024; | ||
|
|
||
| cach->L1i->exists = cach->L1i->size > 0; | ||
| cach->L1d->exists = cach->L1d->size > 0; | ||
| cach->L2->exists = cach->L2->size > 0; | ||
| cach->L3->exists = 0; | ||
|
|
||
| cach->max_cache_level = 3; | ||
|
|
||
| return cach; | ||
| } | ||
|
|
||
| struct cache* get_cache_info_amd_fallback(struct cache* cach) { | ||
| uint32_t eax = 0x80000005; | ||
| uint32_t ebx = 0; | ||
|
|
@@ -890,6 +920,10 @@ struct cache* get_cache_info(struct cpuInfo* cpu) { | |
| cach = get_cache_info_general(cach, level); | ||
| } | ||
| } | ||
| else if (cpu->cpu_vendor == CPU_VENDOR_TRANSMETA) { | ||
| level = 0x00000001; | ||
| cach = get_cache_info_transmeta(cach); | ||
| } | ||
| else { | ||
| level = 0x8000001D; | ||
| if(cpu->maxExtendedLevels < level || !cpu->topology_extensions) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.