this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide more complete info in host_info()

+37 -1
+37 -1
lkm/servers/mach_host.c
··· 112 112 113 113 if (*host_info_outCnt < HOST_BASIC_INFO_OLD_COUNT) 114 114 return KERN_FAILURE; 115 + 116 + memset(host_info_out, 0, *host_info_outCnt * sizeof(int)); 115 117 116 118 si_meminfo(&i); 117 119 hinfo->memory_size = i.totalram; ··· 135 137 hinfo->cpu_type = 0; 136 138 hinfo->cpu_subtype = 0; 137 139 #endif 140 + hinfo->cpu_threadtype = 0; 138 141 139 142 if (*host_info_outCnt <= HOST_BASIC_INFO_COUNT) 140 143 { 141 - // TODO 144 + int pos = 0, last_phys_id = -1; 145 + 142 146 *host_info_outCnt = HOST_BASIC_INFO_COUNT; 147 + hinfo->max_mem = i.totalram; 148 + hinfo->logical_cpu = 0; 149 + hinfo->physical_cpu = 0; 150 + 151 + while (1) 152 + { 153 + pos = cpumask_next(pos - 1, cpu_online_mask); 154 + if (pos >= nr_cpu_ids) 155 + break; 156 + 157 + #if defined(__i386__) || defined(__x86_64__) 158 + { 159 + struct cpuinfo_x86* cpu; 160 + cpu = &cpu_data(pos); 161 + 162 + hinfo->logical_cpu++; 163 + 164 + if (cpu->phys_proc_id == last_phys_id) 165 + { 166 + pos++; 167 + continue; 168 + } 169 + 170 + last_phys_id = cpu->phys_proc_id; 171 + hinfo->physical_cpu += cpu->booted_cores; 172 + } 173 + #endif 174 + pos++; 175 + } 176 + 177 + hinfo->logical_cpu_max = hinfo->logical_cpu; 178 + hinfo->physical_cpu_max = hinfo->physical_cpu; 143 179 } 144 180 else 145 181 *host_info_outCnt = HOST_BASIC_INFO_OLD_COUNT;