Changeset 287de3be5708ee186a1b1f9fffbdeab66b261383

Show
Ignore:
Timestamp:
01/07/12 16:08:02 (5 months ago)
Author:
Erwan Velu <erwanaliasr1@…>
Children:
442c60166a9165e4253fd091aba92c04c699017d
Parents:
8f44f565ce1ff017d8e1b071fcd73d8ac409ff57
git-committer:
Erwan Velu <erwanaliasr1@gmail.com> / 2012-01-07T17:08:02Z+0100
Message:

ifcpu: Adding hypervisor support

This simple hack add the ability to detect the hypervisor presence.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • com32/modules/ifcpu.c

    r88e09d r287de3  
    5050 "\n" 
    5151 "cpu_features could be:\n" 
    52  "   64        : Processor is x86_64 compatible (lm cpu flag)\n" 
    53  "   hvm       : Processor features hardware virtualization (hvm or svm cpu flag)\n" 
    54  "   multicore : Processor must be multi-core \n" 
    55  "   smp       : System must be multi-processor \n" 
    56  "   pae       : Processor features Physical Address Extension (PAE)\n" 
     52 "   64         : Processor is x86_64 compatible (lm cpu flag)\n" 
     53 "   hvm        : Processor features hardware virtualization (hvm or svm cpu flag)\n" 
     54 "   multicore  : Processor must be multi-core \n" 
     55 "   smp        : System must be multi-processor \n" 
     56 "   pae        : Processor features Physical Address Extension (PAE)\n" 
     57 "   hypervisor : Processor is running under an hypervisor\n" 
    5758 "\n" 
    5859 "if you want to match many cpu features, just separate them with a single space.\n"); 
     
    115116        } else if (!strcmp(argv[i], "64")) { 
    116117            if (debug) 
    117                 printf(" 64bit     : %s on this system\n", 
     118                printf(" 64bit      : %s on this system\n", 
    118119                       show_bool(cpu.flags.lm)); 
    119120            hardware_matches = cpu.flags.lm && hardware_matches; 
    120121        } else if (!strcmp(argv[i], "pae")) { 
    121122            if (debug) 
    122                 printf(" pae       : %s on this system\n", 
     123                printf(" pae        : %s on this system\n", 
    123124                       show_bool(cpu.flags.pae)); 
    124125            hardware_matches = cpu.flags.pae && hardware_matches; 
    125126        } else if (!strcmp(argv[i], "hvm")) { 
    126127            if (debug) 
    127                 printf(" hvm       : %s on this system\n", 
     128                printf(" hvm        : %s on this system\n", 
    128129                       show_bool((cpu.flags.vmx || cpu.flags.svm))); 
    129130            hardware_matches = (cpu.flags.vmx || cpu.flags.svm) 
     
    131132        } else if (!strcmp(argv[i], "multicore")) { 
    132133            if (debug) 
    133                 printf(" multicore : %d cores on this system\n", cpu.num_cores); 
     134                printf(" multicore  : %d cores on this system\n", cpu.num_cores); 
    134135            if (cpu.num_cores > 1) 
    135136                multicore = true; 
     
    137138        } else if (!strcmp(argv[i], "smp")) { 
    138139            if (debug) 
    139                 printf(" smp       : %s on this system\n", show_bool(cpu.flags.smp)); 
     140                printf(" smp        : %s on this system\n", show_bool(cpu.flags.smp)); 
    140141            hardware_matches = cpu.flags.smp && hardware_matches; 
     142        } else if (!strcmp(argv[i], "hypervisor")) { 
     143            if (debug) 
     144                printf(" hypervisor : %s on this system\n", show_bool(cpu.flags.hypervisor)); 
     145            hardware_matches = cpu.flags.hypervisor && hardware_matches; 
    141146        } else if (!strcmp(argv[i], "dry-run")) { 
    142147            dryrun = true;