Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cr_is_valid是否存在问题? #6

Open
asueeer opened this issue Jul 22, 2023 · 1 comment
Open

cr_is_valid是否存在问题? #6

asueeer opened this issue Jul 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@asueeer
Copy link

asueeer commented Jul 22, 2023

// 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)才对吧。
不过这样就无法通过检查了。
我看其他开源项目是,先有一个调整寄存器值的操作。

@equation314 equation314 added the bug Something isn't working label Sep 10, 2023
@equation314
Copy link
Owner

You are right, fixed by the following expression in 907afda:

(!fixed0 | value == !0) && (fixed1 | !value == !0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants