Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
318 heavyiron 1
;Addresses for bits
2
 
3
FPU_FLAG equ 0001h    ;Floating-point unit on-Chip
4
VME_FLAG equ 0002h    ;Virtual Mode Extension
5
DE_FLAG equ 0004h     ;Debugging Extension
6
PSE_FLAG equ 0008h    ;Page Size Extension
7
TSC_FLAG equ 0010h    ;Time-Stamp Counter
8
MSR_FLAG equ 0020h    ;Model Specific Registers
9
PAE_FLAG equ 0040h    ;Physical Address Extension
10
MCE_FLAG equ 0080h    ;Machine Check Exception
11
CX8_FLAG equ 0100h    ;CMPXCHG8 Instruction Supported
12
APIC_FLAG equ 0200h   ;On-chip APIC Hardware Supported
13
;10_FLAG equ 0400h   ;Reserved
14
SEP_FLAG equ 0800h	 ;Fast System Call
15
MTRR_FLAG equ 1000h	 ;Memory Type Range Registers
16
PGE_FLAG equ 2000h	 ;Page Global Enable
17
MCA_FLAG equ 4000h	 ;Machine Check Architecture
18
CMOV_FLAG equ 8000h	 ;Conditional Move Instruction Supported
19
PAT_FLAG equ 10000h	 ;Page Attribute Table
20
PSE36_FLAG equ 20000h	 ;36-bit Page Size Extension
21
PSNUM_FLAG equ 40000h	 ;Processor serial number present and enabled
22
CLFLUSH_FLAG equ 80000h  ;CLFLUSH Instruction supported
23
;20_FLAG equ 100000h  ;Reserved
24
DTS_FLAG equ 200000h	 ;Debug Store
25
ACPI_FLAG equ 400000h	 ;Thermal Monitor and Software Controlled Clock Facilities supported
26
MMX_FLAG equ 800000h	 ;Intel Architecture MMX technology supported
27
FXSR_FLAG equ 1000000h	 ;Fast floating point save and restore
28
SSE_FLAG equ 2000000h	 ;Streaming SIMD Extensions supported
29
SSE2_FLAG equ 4000000h	 ;Streaming SIMD Extensions 2
30
SS_FLAG equ 8000000h	 ;Self-Snoop
31
;HTT_FLAG equ 10000000h   ;Hyper-Threading Technology
32
TM_FLAG equ 20000000h	 ;Thermal Monitor supported
33
IA64_FLAG equ 40000000h  ; IA-64
34
PBE_FLAG equ 80000000h	  ;Pending Break Enable
35
 
36
; ecx cpuid(1)
37
SSE3_FLAG equ 0001h	  ;SSE3 0
38
MON_FLAG equ 0008h	  ;MON -3
39
DS_CPL_FLAG equ 0010h	  ;DS-CPL -4
40
VMX_FLAG equ 0020h	  ;VMX -5
41
EST_FLAG equ 0080h	  ; EST-7
42
TM2_FLAG equ 0100h	  ; TM2-8
43
SSSE3_FLAG equ 0200h	  ;SSSE3 -9
44
CNXT_ID_FLAG equ 0400h	  ;CID -10
45
CX16_FLAG equ 2000h	  ;CX16 - 13
46
ETPRD_FLAG equ 4000h	  ;xTPR - 14
47
DCA_FLAG equ 40000h	  ;DCA - 18
48
 
49
 
50
; edx cpuid(8000_0001h)
51
 
52
SYS_FLAG equ 0800h	 ;11
53
 
54
MP_FLAG equ 80000h	 ;19
55
NX_FLAG equ 100000h	 ;20
56
MMXPi_FLAG equ 400000h	  ;22
57
MMXn_FLAG equ 800000h	  ;23
58
FXSRn_FLAG equ 1000000h   ;24   it is ллу+ for Cyrix
59
FFXSR_FLAG equ 2000000h  ;25
60
TSCP_FLAG equ 8000000h	 ;27
61
LM_FLAG equ 20000000h	 ;29  EM64T
62
DNo_FLAG equ 40000000h	;30
63
DN_FLAG equ 80000000h	;31
64
 
65
; ecx cpuid(8000_0001h)
66
LAHF_FLAG equ 0001h  ; LAHF   0
67
CMPL_FLAG equ 0002h    ; core multi-processing legacy mode 1
68
SVM_FLAG equ 0004h     ; secure virtual machine 2
69
MOVCR8_FLAG equ 0010h    ;AltMovCr8  4
70
 
532 diamond 71
;//////////////////////////////////////////////
72
decode_sse3:   ; is SS3 supported
73
        xor     eax, eax
74
        inc     eax
75
        cpuid
76
        test    ecx, 1
77
        setnz   [sse3sup]
78
        mov     eax, sse3+6
318 heavyiron 79
 
532 diamond 80
write_yes_no:
81
        mov     dword [eax], 'no'
82
        jz      @f
83
        mov     dword [eax], 'yes'
84
@@:
85
        ret
86
 
87
show_next_bit:
88
        shr     edx, 1
89
write_yes_no_cf:
90
        mov     dword [eax], 'no'
91
        jnc     @f
92
        mov     dword [eax], 'yes'
93
@@:
94
        ret
95
 
318 heavyiron 96
;decoding standard features
97
 
98
decode_standard_features:
99
 
100
 xor eax,eax
101
 inc eax
102
 cpuid
103
 
532 diamond 104
        mov     eax, FPU+6
105
        call    show_next_bit
318 heavyiron 106
 
532 diamond 107
        mov     eax, VME+7
108
        call    show_next_bit
318 heavyiron 109
 
532 diamond 110
        mov     eax, DE+7
111
        call    show_next_bit
318 heavyiron 112
 
532 diamond 113
        mov     eax, PSE+8
114
        call    show_next_bit
318 heavyiron 115
 
532 diamond 116
        mov     eax, TSC+6
117
        call    show_next_bit
318 heavyiron 118
 
532 diamond 119
        mov     eax, MSR+7
120
        call    show_next_bit
318 heavyiron 121
 
532 diamond 122
        mov     eax, PAE+7
123
        call    show_next_bit
318 heavyiron 124
 
532 diamond 125
        mov     eax, MCE+8
126
        call    show_next_bit
318 heavyiron 127
 
532 diamond 128
        mov     eax, CX8+6
129
        call    show_next_bit
318 heavyiron 130
 
532 diamond 131
        mov     eax, APIC+7
132
        call    show_next_bit
318 heavyiron 133
 
532 diamond 134
        shr     edx, 1          ; skip reserved bit
318 heavyiron 135
 
532 diamond 136
        mov     eax, SEP+8
137
        call    show_next_bit
318 heavyiron 138
 
532 diamond 139
        mov     eax, MTRR+6
140
        call    show_next_bit
318 heavyiron 141
 
532 diamond 142
        mov     eax, PGE+7
143
        call    show_next_bit
318 heavyiron 144
 
532 diamond 145
        mov     eax, MCA+7
146
        call    show_next_bit
318 heavyiron 147
 
532 diamond 148
        mov     eax, CMOV+8
149
        call    show_next_bit
318 heavyiron 150
 
532 diamond 151
        mov     eax, PAT+6
152
        call    show_next_bit
318 heavyiron 153
 
532 diamond 154
        mov     eax, PSE36+7
155
        call    show_next_bit
318 heavyiron 156
 
532 diamond 157
        mov     eax, PSNUM+7
158
        call    show_next_bit
318 heavyiron 159
 
532 diamond 160
        mov     eax, CLFLUSHn+8
161
        call    show_next_bit
318 heavyiron 162
 
532 diamond 163
        shr     edx, 1          ; skip reserved bit
318 heavyiron 164
 
532 diamond 165
        mov     eax, DTS+7
166
        call    show_next_bit
318 heavyiron 167
 
532 diamond 168
        mov     eax, ACPI+7
169
        call    show_next_bit
318 heavyiron 170
 
532 diamond 171
        mov     eax, MMX+8
172
        call    show_next_bit
173
        mov     eax, [eax]
174
        mov     [MMXs+7], eax
318 heavyiron 175
 
532 diamond 176
        mov     eax, FXSR+6
177
        call    show_next_bit
318 heavyiron 178
 
532 diamond 179
        mov     eax, SSE+7
180
        call    show_next_bit
318 heavyiron 181
 
532 diamond 182
        mov     eax, SSE2+7
183
        call    show_next_bit
318 heavyiron 184
 
532 diamond 185
        mov     eax, SSn+8
186
        call    show_next_bit
318 heavyiron 187
 
532 diamond 188
        shr     edx, 1
189
;       mov     eax, HTT+8
190
;       test    edx, HTT_FLAG
191
;       call    write_yes_no
318 heavyiron 192
 
532 diamond 193
        mov     eax, TM+7
194
        call    show_next_bit
318 heavyiron 195
 
532 diamond 196
        mov     eax, IA64+7
197
        call    show_next_bit
318 heavyiron 198
 
532 diamond 199
        mov     eax, PBE+8
200
        call    show_next_bit
318 heavyiron 201
 
532 diamond 202
        ret
318 heavyiron 203
 
204
;//////////////////////////////////////////////
205
decode_extended_features:
532 diamond 206
; is called immediately after decode_standard_features
207
;        xor     eax, eax
208
;        inc     eax
209
;        cpuid
318 heavyiron 210
 
532 diamond 211
        mov     eax, SS3+8
212
        test    ecx, SSE3_FLAG
213
        call    write_yes_no
318 heavyiron 214
 
532 diamond 215
        mov     eax, MON+8
216
        test    ecx, MON_FLAG
217
        call    write_yes_no
318 heavyiron 218
 
532 diamond 219
        mov     eax, DS_CPL+8
220
        test    ecx, DS_CPL_FLAG
221
        call    write_yes_no
318 heavyiron 222
 
532 diamond 223
        mov     eax, EST+8
224
        test    ecx, EST_FLAG
225
        call    write_yes_no
318 heavyiron 226
 
532 diamond 227
        mov     eax, TM2+8
228
        test    ecx, TM2_FLAG
229
        call    write_yes_no
318 heavyiron 230
 
532 diamond 231
        mov     eax, CNXT_ID+12
232
        test    ecx, CNXT_ID_FLAG
233
        call    write_yes_no
318 heavyiron 234
 
532 diamond 235
        mov     eax, CX16+12
236
        test    ecx, CX16_FLAG
237
        call    write_yes_no
318 heavyiron 238
 
532 diamond 239
        mov     eax, ETPRD+12
240
        test    ecx, ETPRD_FLAG
241
        call    write_yes_no
318 heavyiron 242
 
532 diamond 243
        mov     eax, VMX+8
244
        test    ecx, VMX_FLAG
245
        call    write_yes_no
318 heavyiron 246
 
532 diamond 247
        mov     eax, SSSE3+12
248
        test    ecx, SSSE3_FLAG
249
        call    write_yes_no
318 heavyiron 250
 
532 diamond 251
        mov     eax, DCA+8
252
        test    ecx, DCA_FLAG
253
        call    write_yes_no
254
@@:
255
        ret
318 heavyiron 256
 
257
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
258
decode_extended:
532 diamond 259
        mov     eax, $80000000
260
        cpuid
261
        mov     [extc], eax     ; max number of calls
262
        test    eax, eax
263
        jns     @b
318 heavyiron 264
 
532 diamond 265
        mov     eax, $80000001 ;// Setup extended function 8000_0001h
266
        cpuid
318 heavyiron 267
 
532 diamond 268
        mov     eax, MP+8
269
        test    edx, MP_FLAG
270
        call    write_yes_no
318 heavyiron 271
 
532 diamond 272
        mov     eax, NX+8
273
        test    edx, NX_FLAG
274
        call    write_yes_no
318 heavyiron 275
 
276
;jmp Tez3 we do detection in another place, because of Cyrix specific MMX+ detection
532 diamond 277
;       mov     eax, MMXPi+8
278
;       test    edx, MMXPi_FLAG
279
;       call    write_yes_no
318 heavyiron 280
 
532 diamond 281
        mov     eax, MMXn+8
282
        test    edx, MMXn_FLAG
283
        call    write_yes_no
318 heavyiron 284
 
532 diamond 285
        mov     eax, FXSRn+8
286
        test    edx, FXSRn_FLAG
287
        call    write_yes_no
318 heavyiron 288
 
532 diamond 289
        mov     eax, FFXSR+12
290
        test    edx, FFXSR_FLAG
291
        call    write_yes_no
318 heavyiron 292
 
532 diamond 293
        mov     eax, TSCP+12
294
        test    edx, TSCP_FLAG
295
        call    write_yes_no
318 heavyiron 296
 
532 diamond 297
        mov     eax, LM+12
298
        test    edx, LM_FLAG
299
        call    write_yes_no
318 heavyiron 300
 
532 diamond 301
        mov     eax, DNo+12
302
        test    edx, DNo_FLAG
303
        call    write_yes_no
318 heavyiron 304
 
532 diamond 305
        mov     eax, DN+12
306
        test    edx, DN_FLAG
307
        call    write_yes_no
318 heavyiron 308
 
309
;Intel
532 diamond 310
        mov     eax, SYS+12
311
        test    edx, SYS_FLAG
312
        call    write_yes_no
318 heavyiron 313
 
532 diamond 314
        mov     eax, LAF+12
315
        test    ecx, LAHF_FLAG
316
        call    write_yes_no
318 heavyiron 317
 
532 diamond 318
        mov     eax, CMPL+12
319
        test    ecx, CMPL_FLAG
320
        call    write_yes_no
318 heavyiron 321
 
532 diamond 322
        mov     eax, SVM+8
323
        test    ecx, SVM_FLAG
324
        call    write_yes_no
318 heavyiron 325
 
532 diamond 326
        mov     eax, MCR8+12
327
        test    ecx, MOVCR8_FLAG
328
        call    write_yes_no
318 heavyiron 329
 
532 diamond 330
        ret