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

Missing clobber declaration in kernel/cpuid.c #8

Open
wierton opened this issue Oct 3, 2019 · 0 comments
Open

Missing clobber declaration in kernel/cpuid.c #8

wierton opened this issue Oct 3, 2019 · 0 comments

Comments

@wierton
Copy link

wierton commented Oct 3, 2019

From the specification of x86_64, Vol. 2A 3-191, the cpuid instruction will override register EDX in most cases. A more general solution, declaring this register in clobber list would be better. Furthermore, x86_64 specification only marks EDX as reserved when EAX is 07h, such claim may be violated in the future, to maximize the compatibility, I think declaring the register EDX in clobber list is worth considering.

The source of xv6: kernel/cpuid.c: 140:
asm("cpuid" : "=a"(maxsubleaf), "=b"(sef_flags) : "a" (7), "c" (0) :);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant