jserv / xv6-x86_64

re-implementation of UNIX v6 in ANSI C for x86_64 SMP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing clobber declaration in kernel/cpuid.c

wierton opened this issue · comments

commented

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) :);