2 TITLE Cpu.asm: Assembly code for the x64 resources
5 ; This file contains an 'Intel Sample Driver' and is
6 ; licensed for Intel CPUs and chipsets under the terms of your
7 ; license agreement with Intel or your vendor. This file may
8 ; be modified by the user, subject to additional terms of the
12 ; Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
14 ; This program and the accompanying materials are licensed and made available under
15 ; the terms and conditions of the BSD License that accompanies this distribution.
16 ; The full text of the license may be found at
17 ; http://opensource.org/licenses/bsd-license.php.
19 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
20 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
32 ;------------------------------------------------------------------------------
37 ;------------------------------------------------------------------------------
42 ;------------------------------------------------------------------------------
49 ;------------------------------------------------------------------------------
54 ;------------------------------------------------------------------------------
61 ;------------------------------------------------------------------------------
66 ;------------------------------------------------------------------------------
72 ;------------------------------------------------------------------------------
75 ; IN UINT32 RegisterInEax, // rcx
76 ; OUT EFI_CPUID_REGISTER *Reg OPTIONAL // rdx
78 ;------------------------------------------------------------------------------
82 mov r8, rdx ; r8 = *Reg
83 mov rax, rcx ; RegisterInEax
87 mov [r8 + 0], eax ; Reg->RegEax
88 mov [r8 + 4], ebx ; Reg->RegEbx
89 mov [r8 + 8], ecx ; Reg->RegEcx
90 mov [r8 + 12], edx ; Reg->RegEdx
97 ;------------------------------------------------------------------------------
100 ; IN UINT32 Index, // rcx
102 ;------------------------------------------------------------------------------
103 EfiReadMsr PROC PUBLIC
105 sal rdx, 32 ; edx:eax -> rax
106 or rax, rdx ; rax = edx:eax
110 ;------------------------------------------------------------------------------
113 ; IN UINT32 Index, // rcx
114 ; IN UINT64 Value // rdx
116 ;------------------------------------------------------------------------------
117 EfiWriteMsr PROC PUBLIC
118 mov rax, rdx ; rdx = Value
119 sar rdx, 32 ; convert rdx to edx upper 32-bits
120 wrmsr ; wrmsr[ecx] result = edx:eax
125 ;------------------------------------------------------------------------------
130 ;------------------------------------------------------------------------------
131 EfiReadTsc PROC PUBLIC
138 ;------------------------------------------------------------------------------
143 ;------------------------------------------------------------------------------
144 EfiDisableCache PROC PUBLIC
145 ; added a check to see if cache is already disabled. If it is, then skip.
158 ;------------------------------------------------------------------------------
163 ;------------------------------------------------------------------------------
164 EfiEnableCache PROC PUBLIC
172 ;------------------------------------------------------------------------------
177 ;------------------------------------------------------------------------------
178 EfiGetEflags PROC PUBLIC
184 ;------------------------------------------------------------------------------
186 ; EfiDisableInterrupts (
189 ;------------------------------------------------------------------------------
190 EfiDisableInterrupts PROC PUBLIC
193 EfiDisableInterrupts ENDP
195 ;------------------------------------------------------------------------------
197 ; EfiEnableInterrupts (
200 ;------------------------------------------------------------------------------
201 EfiEnableInterrupts PROC PUBLIC
204 EfiEnableInterrupts ENDP
205 ;------------------------------------------------------------------------------
208 ; IN UINT32 RegisterInEax,
209 ; IN UINT32 CacheLevel,
210 ; OUT EFI_CPUID_REGISTER *Regs
212 ;------------------------------------------------------------------------------
213 EfiCpuidExt PROC PUBLIC
215 mov rax, rcx ; rax = RegisterInEax
216 mov rcx, rdx ; rcx = CacheLevel
219 mov [r8 + 0 ], eax ; Reg->RegEax
220 mov [r8 + 4 ], ebx ; Reg->RegEbx
221 mov [r8 + 8 ], ecx ; Reg->RegEcx
222 mov [r8 + 12], edx ; Reg->RegEdx