Re: Geeky Linux Question... a little left of topic

aj wells wrote:

>We are running a bunch of Linux servers... 64 Bit, have a few that are
>32 bit... Red Hat 3
>
>If you look at cpuinfo... there is a flag... "lm"
>
>Red Hat site is less than helpful from what I have found.
>Google is also less than helpful... there are LMs in docs that have
>cupinfo... but not what the flag signifies or means.
>
>Anyone have any ideas?
>--
>http://www.freelists.org/webpage/oracle-l
>
>.
>
>  
>

You were looking at the wrong place :)

(I wish I could do the following with Oracle...)


fs/proc/proc_misc.c:

void __init proc_misc_init(void)
{
       struct proc_dir_entry *entry;
       ....
      create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);    
<--------------------------

and then:

extern struct seq_operations cpuinfo_op;
static int cpuinfo_open(struct inode *inode, struct file *file)          
<--------------------------
{
        return seq_open(file, 
&cpuinfo_op);                                           
<--------------------------
}
static struct file_operations proc_cpuinfo_operations = {
        .open           = 
cpuinfo_open,                                                             
<--------------------------
        .read           = seq_read,
        .llseek         = seq_lseek,
        .release        = seq_release,
};


arch/i386/kernel/cpu/proc.c:
 
struct seq_operations cpuinfo_op = {
        .start =c_start,
        .next = c_next,
        .stop = c_stop,
        .show = show_cpuinfo,                      <---------------
};


and above that:

static int show_cpuinfo(struct seq_file *m, void *v)
{
    /*
     * These flag bits must match the definitions in <asm/cpufeature.h>.
     * NULL means this bit is undefined or reserved; either way it doesn't
     * have meaning as far as Linux is concerned.  Note that it's important
     * to realize there is a difference between this table and CPUID -- if
     * applications want to get the raw CPUID data, they should access
     * /dev/cpu/<cpu_nr>/cpuid instead.
     */
    static char *x86_cap_flags[] = {
        /* Intel-defined */
            "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
            "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
            "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
            "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",

        /* AMD-defined */
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, "mp", NULL, NULL, "mmxext", NULL,
        NULL, NULL, NULL, NULL, NULL, "lm", "3dnowext", "3dnow",
                                                                          
^^^
                                                                          
^^^
.....

include/asm-i386/cpufeature.h:
...
/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
/* Don't duplicate feature flags which are redundant with Intel! */
#define X86_FEATURE_SYSCALL    (1*32+11) /* SYSCALL/SYSRET */
#define X86_FEATURE_MP        (1*32+19) /* MP Capable. */
#define X86_FEATURE_MMXEXT    (1*32+22) /* AMD MMX extensions */
#define X86_FEATURE_LM        (1*32+29) /* Long Mode (x86-64) 
*/                          <---------------------
#define X86_FEATURE_3DNOWEXT    (1*32+30) /* AMD 3DNow! extensions */
#define X86_FEATURE_3DNOW    (1*32+31) /* 3DNow! */
..



Due to the fact that the Athlon 64 can run two different types of code, 
x86 and AMD64, the CPU operates in two different modes dubbed "legacy 
mode" and "long mode".  In legacy mode, the Athlon 64 natively runs all 
16-bit or 32-bit x86 applications.  In long mode, which requires a 
64-bit AMD64 compliant operating system, the Athlon 64 will enjoy all of 
the benefits of 64-bit computing.  Long mode also has a compatibility 
sub-mode that allows the running of 32-bit applications with a 64-bit 
operating system.  The Athlon 64's ability to run all these different 
types of code make it a very versatile processor.
(http://www.hothardware.com/viewarticle.cfm?articleid=202&catid=1)


It is good to learn something new every day!


Regards,
Lyubomir Petrov

--
http://www.freelists.org/webpage/oracle-l

Other related posts: