Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.6 KiB

  1. title "Processor Type and Stepping Detection"
  2. ;++
  3. ;
  4. ; Copyright (c) 2000 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; cpu.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This module implements the code necessary to determine cpu information.
  13. ;
  14. ; Author:
  15. ;
  16. ; David N. Cutler (davec) 10-Jun-2000
  17. ;
  18. ; Environment:
  19. ;
  20. ; Kernel mode only.
  21. ;
  22. ;--
  23. include ksamd64.inc
  24. ;++
  25. ;
  26. ; VOID
  27. ; KiCpuId (
  28. ; ULONG Function,
  29. ; PCPU_INFO CpuInfo
  30. ; );
  31. ;
  32. ; Routine Description:
  33. ;
  34. ; Executes the cpuid instruction and returns the resultant register
  35. ; values.
  36. ;
  37. ; Arguments:
  38. ;
  39. ; ecx - Supplies the cpuid function value.
  40. ;
  41. ; rdx - Supplies the address a cpu information structure.
  42. ;
  43. ; Return Value:
  44. ;
  45. ; The return values from the cpuid instruction are stored in the specified
  46. ; cpu infomation structure.
  47. ;
  48. ;--
  49. CiFrame struct
  50. SavedRbx dq ? ; saved register RBX
  51. CiFrame ends
  52. NESTED_ENTRY KiCpuId, _TEXT$00
  53. push_reg rbx ; save nonvolatile register
  54. END_PROLOGUE
  55. mov eax, ecx ; set cpuid function
  56. mov r9, rdx ; save information structure address
  57. cpuid ; get cpu information
  58. mov CpuEax[r9], eax ; save cpu information in structure
  59. mov CpuEbx[r9], ebx ;
  60. mov CpuEcx[r9], ecx ;
  61. mov CpuEdx[r9], edx ;
  62. pop rbx ; restore nonvolatile registeer
  63. ret ; return
  64. NESTED_END KiCpuId, _TEXT$00
  65. end