Skip to content

cr_is_valid是否存在问题? #6

Description

@asueeer
// Check control registers are in a VMX-friendly state. (SDM Vol. 3C, Appendix A.7, A.8) /
        macro_rules! cr_is_valid {
            ($value: expr, $crx: ident) => {{
                use Msr::*;
                let value = $value;
                let fixed0 = concat_idents!(IA32_VMX_, $crx, _FIXED0).read();
                let fixed1 = concat_idents!(IA32_VMX_, $crx, _FIXED1).read();
                (!fixed0 | value != 0) && (fixed1 | !value != 0)
            }};
        }

函数最终返回 (!fixed0 | value != 0) && (fixed1 | !value != 0)
但是根据手册,FIXED0应该是所在位为1的,寄存器所在位也为1;
FIXED1应该是所在位为0的,寄存器所在位也为0,
判断结果应该写为(value & fixed0 == fixed0) && (value & !fixed1 == 0)才对吧。
不过这样就无法通过检查了。
我看其他开源项目是,先有一个调整寄存器值的操作。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions