Subversion Repositories Kolibri OS

Rev

Rev 318 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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.  
  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
  79.  
  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.  
  96. ;decoding standard features
  97.  
  98. decode_standard_features:
  99.  
  100.  xor eax,eax
  101.  inc eax
  102.  cpuid
  103.  
  104.         mov     eax, FPU+6
  105.         call    show_next_bit
  106.  
  107.         mov     eax, VME+7
  108.         call    show_next_bit
  109.  
  110.         mov     eax, DE+7
  111.         call    show_next_bit
  112.  
  113.         mov     eax, PSE+8
  114.         call    show_next_bit
  115.  
  116.         mov     eax, TSC+6
  117.         call    show_next_bit
  118.  
  119.         mov     eax, MSR+7
  120.         call    show_next_bit
  121.  
  122.         mov     eax, PAE+7
  123.         call    show_next_bit
  124.  
  125.         mov     eax, MCE+8
  126.         call    show_next_bit
  127.  
  128.         mov     eax, CX8+6
  129.         call    show_next_bit
  130.  
  131.         mov     eax, APIC+7
  132.         call    show_next_bit
  133.  
  134.         shr     edx, 1          ; skip reserved bit
  135.  
  136.         mov     eax, SEP+8
  137.         call    show_next_bit
  138.  
  139.         mov     eax, MTRR+6
  140.         call    show_next_bit
  141.  
  142.         mov     eax, PGE+7
  143.         call    show_next_bit
  144.  
  145.         mov     eax, MCA+7
  146.         call    show_next_bit
  147.  
  148.         mov     eax, CMOV+8
  149.         call    show_next_bit
  150.  
  151.         mov     eax, PAT+6
  152.         call    show_next_bit
  153.  
  154.         mov     eax, PSE36+7
  155.         call    show_next_bit
  156.  
  157.         mov     eax, PSNUM+7
  158.         call    show_next_bit
  159.  
  160.         mov     eax, CLFLUSHn+8
  161.         call    show_next_bit
  162.  
  163.         shr     edx, 1          ; skip reserved bit
  164.  
  165.         mov     eax, DTS+7
  166.         call    show_next_bit
  167.  
  168.         mov     eax, ACPI+7
  169.         call    show_next_bit
  170.  
  171.         mov     eax, MMX+8
  172.         call    show_next_bit
  173.         mov     eax, [eax]
  174.         mov     [MMXs+7], eax
  175.  
  176.         mov     eax, FXSR+6
  177.         call    show_next_bit
  178.  
  179.         mov     eax, SSE+7
  180.         call    show_next_bit
  181.  
  182.         mov     eax, SSE2+7
  183.         call    show_next_bit
  184.  
  185.         mov     eax, SSn+8
  186.         call    show_next_bit
  187.  
  188.         shr     edx, 1
  189. ;       mov     eax, HTT+8
  190. ;       test    edx, HTT_FLAG
  191. ;       call    write_yes_no
  192.  
  193.         mov     eax, TM+7
  194.         call    show_next_bit
  195.  
  196.         mov     eax, IA64+7
  197.         call    show_next_bit
  198.  
  199.         mov     eax, PBE+8
  200.         call    show_next_bit
  201.  
  202.         ret
  203.  
  204. ;//////////////////////////////////////////////
  205. decode_extended_features:
  206. ; is called immediately after decode_standard_features
  207. ;        xor     eax, eax
  208. ;        inc     eax
  209. ;        cpuid
  210.  
  211.         mov     eax, SS3+8
  212.         test    ecx, SSE3_FLAG
  213.         call    write_yes_no
  214.  
  215.         mov     eax, MON+8
  216.         test    ecx, MON_FLAG
  217.         call    write_yes_no
  218.  
  219.         mov     eax, DS_CPL+8
  220.         test    ecx, DS_CPL_FLAG
  221.         call    write_yes_no
  222.  
  223.         mov     eax, EST+8
  224.         test    ecx, EST_FLAG
  225.         call    write_yes_no
  226.  
  227.         mov     eax, TM2+8
  228.         test    ecx, TM2_FLAG
  229.         call    write_yes_no
  230.  
  231.         mov     eax, CNXT_ID+12
  232.         test    ecx, CNXT_ID_FLAG
  233.         call    write_yes_no
  234.  
  235.         mov     eax, CX16+12
  236.         test    ecx, CX16_FLAG
  237.         call    write_yes_no
  238.  
  239.         mov     eax, ETPRD+12
  240.         test    ecx, ETPRD_FLAG
  241.         call    write_yes_no
  242.  
  243.         mov     eax, VMX+8
  244.         test    ecx, VMX_FLAG
  245.         call    write_yes_no
  246.  
  247.         mov     eax, SSSE3+12
  248.         test    ecx, SSSE3_FLAG
  249.         call    write_yes_no
  250.  
  251.         mov     eax, DCA+8
  252.         test    ecx, DCA_FLAG
  253.         call    write_yes_no
  254. @@:
  255.         ret
  256.  
  257. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  258. decode_extended:
  259.         mov     eax, $80000000
  260.         cpuid
  261.         mov     [extc], eax     ; max number of calls
  262.         test    eax, eax
  263.         jns     @b
  264.  
  265.         mov     eax, $80000001 ;// Setup extended function 8000_0001h
  266.         cpuid
  267.  
  268.         mov     eax, MP+8
  269.         test    edx, MP_FLAG
  270.         call    write_yes_no
  271.  
  272.         mov     eax, NX+8
  273.         test    edx, NX_FLAG
  274.         call    write_yes_no
  275.  
  276. ;jmp Tez3 we do detection in another place, because of Cyrix specific MMX+ detection
  277. ;       mov     eax, MMXPi+8
  278. ;       test    edx, MMXPi_FLAG
  279. ;       call    write_yes_no
  280.  
  281.         mov     eax, MMXn+8
  282.         test    edx, MMXn_FLAG
  283.         call    write_yes_no
  284.  
  285.         mov     eax, FXSRn+8
  286.         test    edx, FXSRn_FLAG
  287.         call    write_yes_no
  288.  
  289.         mov     eax, FFXSR+12
  290.         test    edx, FFXSR_FLAG
  291.         call    write_yes_no
  292.  
  293.         mov     eax, TSCP+12
  294.         test    edx, TSCP_FLAG
  295.         call    write_yes_no
  296.  
  297.         mov     eax, LM+12
  298.         test    edx, LM_FLAG
  299.         call    write_yes_no
  300.  
  301.         mov     eax, DNo+12
  302.         test    edx, DNo_FLAG
  303.         call    write_yes_no
  304.  
  305.         mov     eax, DN+12
  306.         test    edx, DN_FLAG
  307.         call    write_yes_no
  308.  
  309. ;Intel
  310.         mov     eax, SYS+12
  311.         test    edx, SYS_FLAG
  312.         call    write_yes_no
  313.  
  314.         mov     eax, LAF+12
  315.         test    ecx, LAHF_FLAG
  316.         call    write_yes_no
  317.  
  318.         mov     eax, CMPL+12
  319.         test    ecx, CMPL_FLAG
  320.         call    write_yes_no
  321.  
  322.         mov     eax, SVM+8
  323.         test    ecx, SVM_FLAG
  324.         call    write_yes_no
  325.  
  326.         mov     eax, MCR8+12
  327.         test    ecx, MOVCR8_FLAG
  328.         call    write_yes_no
  329.  
  330.         ret
  331.