Leaked source code of windows server 2003
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.

70 lines
1.5 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. NESTED_ENTRY KiCpuId, _TEXT$00
  50. push_reg rbx ; save nonvolatile register
  51. END_PROLOGUE
  52. mov eax, ecx ; set cpuid function
  53. mov r9, rdx ; save information structure address
  54. cpuid ; get cpu information
  55. mov CpuEax[r9], eax ; save cpu information in structure
  56. mov CpuEbx[r9], ebx ;
  57. mov CpuEcx[r9], ecx ;
  58. mov CpuEdx[r9], edx ;
  59. pop rbx ; restore nonvolatile registeer
  60. ret ; return
  61. NESTED_END KiCpuId, _TEXT$00
  62. end