From 0f840f1de0ef43b56289d259489015fb8eb0c230 Mon Sep 17 00:00:00 2001 From: Laxman824 Date: Sun, 11 Sep 2022 22:40:25 +0530 Subject: [PATCH] readme for cpuid.rs --- src/vm-vcpu-ref/src/x86_64/cpuid.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/vm-vcpu-ref/src/x86_64/cpuid.md diff --git a/src/vm-vcpu-ref/src/x86_64/cpuid.md b/src/vm-vcpu-ref/src/x86_64/cpuid.md new file mode 100644 index 0000000..8f2eb15 --- /dev/null +++ b/src/vm-vcpu-ref/src/x86_64/cpuid.md @@ -0,0 +1,12 @@ +Firstly in this code they strongly suggest that the 'cpuid' be derived from the supported CPUID of the host machine that is currently operating. + +They have defined cpuid and used it with kvm_bindings and kvm_iocontrols .we are defining some variables with the cpuid bits in ebx,ecx and edx registers .all most every varibale is unsigned int of 32 bit ex: EBX_CLFLUSH_CACHELINE: u32,EBX_CPU_COUNT_SHIFT: u32 ,ECX_TSC_DEADLINE_TIMER_SHIFT: u32 etc + +They have written a funciton for filter_cpuid which takes input of vcpu_id and cpu_count,cpuid and for each entry in cpuid we are checking/matching the address(0x06) of x86 hypervisor feature . +here we are using the temporary registers for data storing and memory access like edx,ebx,ecx etc. +if address matches then it will execute the clear the x86 EPB feature and no frequency selection in the hypervisor is done.In other case if address is (0x0B) then edx 32 bit contains the X2APIC ID of current logical processor as vcpu_id. + +In other case of address(0x01) then as we will check the index ,if it is equal to 0,then shift the ECX_HYPERVISOR_SHIFT and in the same address if check_extension is TscDeadlineTimer accordingly as we have declared above the function is performing TSC deadline mode of APIC timer. +IF ebx register is equals to ,we are flusing the byte which are stored in CACHELINE +In the other case of address (0x01) if cpu_count is greater than one then we are shifting the EBX_CPU_COUNT_SHIFT to the ebx register and EDX_HTT_SHIFT is shifted to edx register accordingly. +