source: trunk/src/kernel32/cpuhlp.asm@ 2788

Last change on this file since 2788 was 2613, checked in by sandervl, 26 years ago

export cpu feature dword + functions

File size: 1.6 KB
Line 
1; $Id: cpuhlp.asm,v 1.2 2000-02-03 18:56:39 sandervl Exp $
2
3;/*
4; * Project Odin Software License can be found in LICENSE.TXT
5; * CPU detection functions
6; *
7; * Copyright 1999 Sander van Leeuwen
8; *
9; */
10.586
11 NAME cpuhlp
12
13DATA32 SEGMENT DWORD PUBLIC USE32 'DATA'
14 ASSUME DS:FLAT,SS:FLAT
15
16 PUBLIC CPUFeatures
17CPUFeatures dd 0
18
19DATA32 ENDS
20
21CODE32 SEGMENT DWORD PUBLIC USE32 'CODE'
22
23 public SupportsCPUID
24
25SupportsCPUID proc near
26 pushfd
27 push ecx
28
29 pushfd
30 pop eax
31 mov ecx, eax
32 xor eax, 200000h ;flip bit 21
33 push eax
34 popfd
35 pushfd
36 pop eax
37 cmp eax, ecx ;bit 21 changed -> has cpuid support
38 jnz @supportscpuid
39 xor eax, eax
40 jmp short @end
41
42@supportscpuid:
43 mov eax, 1
44@end:
45 pop ecx
46 popfd
47 ret
48SupportsCPUID endp
49
50 public GetCPUVendorString
51
52GetCPUVendorString proc near
53 push ebp
54 mov ebp, esp
55 push ebx
56 push ecx
57 push edx
58 push esi
59
60 mov esi, [ebp+8] ;ptr to string
61 mov eax, 0
62 cpuid
63
64 mov [esi], ebx
65 mov [esi+4], edx
66 mov [esi+8], ecx
67
68 pop esi
69 pop edx
70 pop ecx
71 pop ebx
72 pop ebp
73 ret
74GetCPUVendorString endp
75
76 public GetCPUFeatures
77GetCPUFeatures proc near
78 push ebx
79 push ecx
80 push edx
81
82 mov eax, 1
83 cpuid
84
85 mov eax, edx
86
87 mov [CPUFeatures], eax
88
89 pop edx
90 pop ecx
91 pop ebx
92 ret
93GetCPUFeatures endp
94
95 public GetCPUSignature
96GetCPUSignature proc near
97 push ebx
98 push ecx
99 push edx
100
101 mov eax, 1
102 cpuid
103
104 pop edx
105 pop ecx
106 pop ebx
107 ret
108GetCPUSignature endp
109
110
111CODE32 ENDS
112
113 END
Note: See TracBrowser for help on using the repository browser.