Subversion Repositories HelenOS

Rev

Rev 332 | Rev 472 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 332 Rev 348
Line 73... Line 73...
73
## Determine CPUID support
73
## Determine CPUID support
74
#
74
#
75
# Return 0 in EAX if CPUID is not support, 1 if supported.
75
# Return 0 in EAX if CPUID is not support, 1 if supported.
76
#
76
#
77
has_cpuid:
77
has_cpuid:
78
	pushq %rbx
-
 
79
	
-
 
80
	pushfq			# store flags
78
	pushfq			# store flags
81
	popq %rax		# read flags
79
	popq %rax		# read flags
82
	movq %rax,%rbx		# copy flags
80
	movq %rax,%rdx		# copy flags
83
	btcl $21,%ebx		# swap the ID bit
81
	btcl $21,%edx		# swap the ID bit
84
	pushq %rbx
82
	pushq %rdx
85
	popfq			# propagate the change into flags
83
	popfq			# propagate the change into flags
86
	pushfq
84
	pushfq
87
	popq %rbx		# read flags	
85
	popq %rdx		# read flags	
88
	andl $(1<<21),%eax	# interested only in ID bit
86
	andl $(1<<21),%eax	# interested only in ID bit
89
	andl $(1<<21),%ebx
87
	andl $(1<<21),%edx
90
	xorl %ebx,%eax		# 0 if not supported, 1 if supported
88
	xorl %edx,%eax		# 0 if not supported, 1 if supported
91
	
-
 
92
	popq %rbx
-
 
93
	ret
89
	ret
94
 
90
 
95
cpuid:
91
cpuid:
96
	movq %rbx, %r10  # we have to preserve rbx across function calls
92
	movq %rbx, %r10  # we have to preserve rbx across function calls
97
 
93