Rev 1 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 65 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | # |
- | |
30 | # CPU identification functions. |
- | |
31 | # The code below just interfaces the CPUID instruction. |
29 | # The code below just interfaces the CPUID instruction. |
32 | # CPU recognition logic is contained in higher-level functions. |
30 | # CPU recognition logic is contained in higher-level functions. |
33 | 31 | ||
34 | .text |
32 | .text |
35 | 33 | ||
36 | .global has_cpuid |
34 | .global has_cpuid |
37 | .global cpuid |
35 | .global cpuid |
38 | .global rdtsc |
36 | .global rdtsc |
39 | 37 | ||
- | 38 | ||
- | 39 | ## Determine CPUID support |
|
- | 40 | # |
|
- | 41 | # Return 0 in EAX if CPUID is not support, 1 if supported. |
|
- | 42 | # |
|
40 | has_cpuid: |
43 | has_cpuid: |
41 | push %ebx |
44 | push %ebx |
42 | 45 | ||
43 | pushf # store flags |
46 | pushf # store flags |
44 | popl %eax # read flags |
47 | popl %eax # read flags |
Line 53... | Line 56... | ||
53 | xorl %ebx,%eax # 0 if not supported, 1 if supported |
56 | xorl %ebx,%eax # 0 if not supported, 1 if supported |
54 | 57 | ||
55 | pop %ebx |
58 | pop %ebx |
56 | ret |
59 | ret |
57 | 60 | ||
- | 61 | ||
- | 62 | ## Get CPUID data |
|
- | 63 | # |
|
- | 64 | # This code is just an interfaces the CPUID instruction, CPU recognition |
|
- | 65 | # logic is contained in higher-level functions. |
|
- | 66 | # |
|
- | 67 | # The C prototype is: |
|
58 | # cpuid(__u32 cmd, struct cpu_info *info) |
68 | # void cpuid(__u32 cmd, struct cpu_info *info) |
- | 69 | # |
|
- | 70 | # @param cmd CPUID command. |
|
- | 71 | # @param info Buffer to store CPUID output. |
|
- | 72 | # |
|
59 | cpuid: |
73 | cpuid: |
60 | pushl %ebp |
74 | pushl %ebp |
61 | movl %esp,%ebp |
75 | movl %esp,%ebp |
62 | pusha |
76 | pusha |
63 | 77 |