You'll also have to #define BUF_SIZ to something, perhaps 128 or 256, higher up in the code (pref. /proc/cpuinfo is one of the few places where you get information about what hardware implements these threads of execution: physical id : 0 siblings : 4 core id : 0 cpu cores : 2 means that cpu0 is one of 4 threads inside physical component (processor) number 0, and that's in core 0 among 2 in this processor. You can find cpu cores: 1 in the output after you run cat /proc/cpuinfo, which denotes that in your ubuntu virtual machine, you only have one cpu core. Try doing a "line=malloc(BUF_SIZ) ", then using BUF_SIZ on the fgets line. And storing those 4 bytes in a random memory location, which is why it's surprising you didn't get a segfault. So you were passing 4 into fgets, and it was reading 3 characters and making the fourth one a '\0' (string terminator). Because any pointer's size is 4 - 4 bytes for the address the pointer contains.
When you say sizeof(char *), which is what you were effectively saying, you get 4. You could try just printing the size of it. I don't know what sizeof() does with something like char line, because I've never tried using sizeof with a char array. Nothing in C keeps track of how much memory you allocate with malloc()!
That's the job of strlen(), but even strlen() is dependent on having a string in there already. This means the addresses the processes see, are virtual memory addresses which are unique to that process. address sizes: 38 bits physical, 48 bits virtual An affected AMD CPU will. In your case, malloc would work, or you could change the declaration to something like "char line " or something.Īlso, sizeof() doesn't report the number of characters in a char *. To verify whether the the CPU is affected, run the following command from the. You HAVE to allocate space for that string somehow. One of the cpu flags shows me that I support vmx but not the other.OK, you can't just declare a string by saying "char *variable ". I'm unable to load the kvm_intel module and I have no other clue why this is so. Using the latter information I would have thought that the system uses the least significant 12 bits of an address as offset and the rest for address translation virtual to physical via TLB and page table.
includeaddress sizes : 36 bits physical, 48 bits virtual the page size determined with. 64 address sizes : 40 bits physical, 48 bits virtual power management. cat /proc/cpuinfo on a cpu flagged -lm gives.
CAT PROC CPUINFO VIRTUAL ADDRESS HOW TO
I noticed this problem when trying to configure my system for KVM. This document will demonstrate how to hot add CPU to a live running Linux VM. Model name : Intel(R) Core(TM)2 CPU E8400 3.00GHzįlags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni monitor tm2 ssse3 lahf_lm dtsĪddress sizes : 36 bits physical, 48 bits virtualįlags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority Can someone explains to me why? I'm running Ubuntu 10.10 kernel 2.6.35-24-generic.
Cat /proc/cpuinfo on my system gives me different flags for my 2 cores. cat /proc/ cpuinfo processor : 0 vendorid : GenuineIntel cpu family : 6 model : 60 model name : Intel(R) Core(TM) i5-4210M CPU 2.60GHz stepping : 3 microcode : 28 cpu MHz : 800.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpuexception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic.