Subversion Repositories Kolibri OS

Rev

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

Rev 4390 Rev 4593
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 4390 $
8
$Revision: 4593 $
9
 
9
 
10
 
10
 
Line 343... Line 343...
343
 
343
 
344
align 4
344
align 4
345
proc test_cpu
345
proc test_cpu
346
           locals
346
           locals
347
              cpu_type   dd ?
-
 
348
              cpu_id     dd ?
-
 
349
              cpu_Intel  dd ?
-
 
350
              cpu_AMD    dd ?
347
              cpu_type   dd ?
Line 351... Line 348...
351
           endl
348
           endl
352
 
349
 
353
        xor     eax, eax
350
        xor     eax, eax
354
        mov     [cpu_type], eax
351
        mov     [cpu_type], eax
-
 
352
        mov     [cpu_caps-OS_BASE], eax
Line 355... Line 353...
355
        mov     [cpu_caps-OS_BASE], eax
353
        mov     [cpu_caps+4-OS_BASE], eax
356
        mov     [cpu_caps+4-OS_BASE], eax
354
        mov     [cpu_phys_addr_width-OS_BASE], 32
357
 
355
 
358
        pushfd
356
        pushfd
Line 376... Line 374...
376
        popfd
374
        popfd
377
        pushfd
375
        pushfd
378
        pop     eax
376
        pop     eax
379
        xor     eax, ecx
377
        xor     eax, ecx
380
        je      .end_cpuid
378
        je      .end_cpuid
381
        mov     [cpu_id], 1
-
 
Line 382... Line 379...
382
 
379
 
383
        xor     eax, eax
380
        xor     eax, eax
Line 384... Line 381...
384
        cpuid
381
        cpuid
385
 
382
 
386
        mov     [cpu_vendor-OS_BASE], ebx
383
        mov     [cpu_vendor-OS_BASE], ebx
387
        mov     [cpu_vendor+4-OS_BASE], edx
-
 
388
        mov     [cpu_vendor+8-OS_BASE], ecx
-
 
389
        cmp     ebx, dword [intel_str-OS_BASE]
-
 
390
        jne     .check_AMD
-
 
391
        cmp     edx, dword [intel_str+4-OS_BASE]
-
 
392
        jne     .check_AMD
-
 
393
        cmp     ecx, dword [intel_str+8-OS_BASE]
-
 
-
 
384
        mov     [cpu_vendor+4-OS_BASE], edx
394
        jne     .check_AMD
385
        mov     [cpu_vendor+8-OS_BASE], ecx
395
        mov     [cpu_Intel], 1
386
 
396
        cmp     eax, 1
387
        cmp     eax, 1
397
        jl      .end_cpuid
388
        jl      .end_cpuid
398
        mov     eax, 1
389
        mov     eax, 1
399
        cpuid
390
        cpuid
400
        mov     [cpu_sign-OS_BASE], eax
391
        mov     [cpu_sign-OS_BASE], eax
401
        mov     [cpu_info-OS_BASE], ebx
392
        mov     [cpu_info-OS_BASE], ebx
Line -... Line 393...
-
 
393
        mov     [cpu_caps-OS_BASE], edx
-
 
394
        mov     [cpu_caps+4-OS_BASE], ecx
-
 
395
 
-
 
396
        bt      edx, CAPS_PAE
-
 
397
        jnc     @f
-
 
398
        mov     [cpu_phys_addr_width-OS_BASE], 36
-
 
399
@@:
-
 
400
        mov     eax, 0x80000000
-
 
401
        cpuid
-
 
402
        cmp     eax, 0x80000008
-
 
403
        jb      @f
-
 
404
        mov     eax, 0x80000008
-
 
405
        cpuid
-
 
406
        mov     [cpu_phys_addr_width-OS_BASE], al
402
        mov     [cpu_caps-OS_BASE], edx
407
@@:
403
        mov     [cpu_caps+4-OS_BASE], ecx
408
 
404
 
409
        mov     eax, [cpu_sign-OS_BASE]
405
        shr     eax, 8
410
        shr     eax, 8
406
        and     eax, 0x0f
411
        and     eax, 0x0f
407
        ret
412
        ret
408
.end_cpuid:
-
 
409
        mov     eax, [cpu_type]
-
 
410
        ret
-
 
411
 
-
 
412
.check_AMD:
-
 
413
        cmp     ebx, dword [AMD_str-OS_BASE]
-
 
414
        jne     .unknown
-
 
415
        cmp     edx, dword [AMD_str+4-OS_BASE]
-
 
416
        jne     .unknown
-
 
417
        cmp     ecx, dword [AMD_str+8-OS_BASE]
-
 
418
        jne     .unknown
-
 
419
        mov     [cpu_AMD], 1
-
 
420
        cmp     eax, 1
-
 
421
        jl      .unknown
-
 
422
        mov     eax, 1
-
 
423
        cpuid
-
 
424
        mov     [cpu_sign-OS_BASE], eax
-
 
425
        mov     [cpu_info-OS_BASE], ebx
-
 
426
        mov     [cpu_caps-OS_BASE], edx
-
 
427
        mov     [cpu_caps+4-OS_BASE], ecx
-
 
428
        shr     eax, 8
-
 
429
        and     eax, 0x0f
-
 
430
        ret
-
 
431
.unknown:
-
 
432
        mov     eax, 1
-
 
433
        cpuid
-
 
434
        mov     [cpu_sign-OS_BASE], eax
-
 
435
        mov     [cpu_info-OS_BASE], ebx
-
 
436
        mov     [cpu_caps-OS_BASE], edx
-
 
437
        mov     [cpu_caps+4-OS_BASE], ecx
-
 
438
        shr     eax, 8
413
.end_cpuid:
Line 439... Line 414...
439
        and     eax, 0x0f
414
        mov     eax, [cpu_type]
440
        ret
415
        ret
441
endp
416
endp