From: Jan Kiszka Date: Wed, 13 Feb 2013 11:43:10 +0000 (+0100) Subject: vmxcap: Open MSR file in unbuffered mode X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~900^2~59^2~320^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f505a4d74aae6fc8bb5502a6038b5f671aa97713;p=sdk%2Femulator%2Fqemu.git vmxcap: Open MSR file in unbuffered mode Python may otherwise decide to to read larger chunks, applying the seek only on the software buffer. This will return results from the wrong MSRs. Signed-off-by: Jan Kiszka Signed-off-by: Gleb Natapov --- diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 0b23f7795a..6363e7368f 100755 --- a/scripts/kvm/vmxcap +++ b/scripts/kvm/vmxcap @@ -27,9 +27,9 @@ MSR_IA32_VMX_VMFUNC = 0x491 class msr(object): def __init__(self): try: - self.f = file('/dev/cpu/0/msr') + self.f = open('/dev/cpu/0/msr', 'r', 0) except: - self.f = file('/dev/msr0') + self.f = open('/dev/msr0', 'r', 0) def read(self, index, default = None): import struct self.f.seek(index)