Doug Scoular
2006-Aug-28 22:19 UTC
[syslinux] Extending dmitest to check for Long Mode (aka 64 versus 32 bit)
Hi Erwan, First off, many thanks for your wonderful addition to syslinux: dmitest.c32 and another thankyou to hpa for it's inclusion. I need to ask if you are missing a couple of definitions in dmi_processor.h, specifically, the "long mode" flag. I need to use this flag to determine whether a machine is 64-bit capable or not. There is a great web page explaining the "long mode" flag at: http://www.mega-tokyo.com/osfaq/Tell%20me%20about%20x86%2064%20bits%20CPU%20...>From the web site I see the following:"How do I detect if the CPU is 64 bits ? You can find that out by checking CPUID. All AMD64 compliant processors have the longmode-capable-bit turned on in the extended feature flags (bit 29) in EDX, after calling CPUID with EAX=0x80000001. " Unfortunately, my understanding of what EDX and EAX means is zero... but looking through your code I suspect that this may be the missing entry from the cpu_flags_strings table in dmi_processor.h: NULL, /* 30 */ In the Linux kernel I see that /proc/cpuinfo is determined through the /usr/include/asm/cpufeature.h include as: #define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ Would I simply need to Change the NULL entry to a string in cpu_flags_strings table, add a bool in s_cpu_flags and then dmi.c would automagically set the boolean correctly ? I could then modify dmitest to check for Long Mode and achieve my goal. Any help hugely appreciated! Cheers, Doug -- The big print giveth and the small print taketh away.
Erwan Velu
2006-Aug-29 07:30 UTC
[syslinux] Extending dmitest to check for Long Mode (aka 64 versus 32 bit)
Doug Scoular wrote:> Hi Erwan, > > First off, many thanks for your wonderful addition to syslinux: > dmitest.c32 and another thankyou to hpa for it's inclusion.You're welcome ;)> > I need to ask if you are missing a couple of definitions in > dmi_processor.h, specifically, the "long mode" flag. I > need to use this flag to determine whether a machine is > 64-bit capable or not.Yes, this code is based on the implementation that comes from dmidecode. DMI doesn't handle the processor information but dmidecode did it, and this is nice because it give us some nice feature. So, as you noticed, this is not complete.> Unfortunately, my understanding of what EDX and EAX means is zero...EDX & EAX are some registers of the processor.> but looking through your code I suspect that this may be the missing > entry from > the cpu_flags_strings table in dmi_processor.h: > > NULL, /* 30 */ > > In the Linux kernel I see that /proc/cpuinfo is determined through the > /usr/include/asm/cpufeature.h include as: > > #define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ > > Would I simply need to Change the NULL entry to a string in > cpu_flags_strings table, add a bool in s_cpu_flags and then > dmi.c would automagically set the boolean correctly ?I don't think so ;) I didn't look precisely but you must "mask" some parts of the register of the processor to check it the LM is set or not. I'm adding this to my todo list.
Erwan Velu
2006-Aug-29 07:34 UTC
[syslinux] Extending dmitest to check for Long Mode (aka 64 versus 32 bit)
Doug Scoular wrote:> Hi Erwan, > > First off, many thanks for your wonderful addition to syslinux: > dmitest.c32 and another thankyou to hpa for it's inclusion.You're welcome ;)> > I need to ask if you are missing a couple of definitions in > dmi_processor.h, specifically, the "long mode" flag. I > need to use this flag to determine whether a machine is > 64-bit capable or not.Yes, this code is based on the implementation that comes from dmidecode. DMI doesn't handle the processor information but dmidecode did it, and this is nice because it give us some nice feature. So, as you noticed, this is not complete.> Unfortunately, my understanding of what EDX and EAX means is zero...EDX & EAX are some registers of the processor.> but looking through your code I suspect that this may be the missing > entry from > the cpu_flags_strings table in dmi_processor.h: > > NULL, /* 30 */ > > In the Linux kernel I see that /proc/cpuinfo is determined through the > /usr/include/asm/cpufeature.h include as: > > #define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ > > Would I simply need to Change the NULL entry to a string in > cpu_flags_strings table, add a bool in s_cpu_flags and then > dmi.c would automagically set the boolean correctly ?I don't think so ;) I didn't look precisely but you must "mask" some parts of the register of the processor to check it the LM is set or not. I'm adding this to my todo list.