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 ; SPDX-License-Identifier: BSD-2-Clause-Patent
27 ;------------------------------------------------------------------------------
32 ;------------------------------------------------------------------------------
37 ;------------------------------------------------------------------------------
44 ;------------------------------------------------------------------------------
49 ;------------------------------------------------------------------------------
56 ;------------------------------------------------------------------------------
61 ;------------------------------------------------------------------------------
67 ;------------------------------------------------------------------------------
70 ; IN UINT32 RegisterInEax, // rcx
71 ; OUT EFI_CPUID_REGISTER *Reg OPTIONAL // rdx
73 ;------------------------------------------------------------------------------
77 mov r8, rdx ; r8 = *Reg
78 mov rax, rcx ; RegisterInEax
82 mov [r8 + 0], eax ; Reg->RegEax
83 mov [r8 + 4], ebx ; Reg->RegEbx
84 mov [r8 + 8], ecx ; Reg->RegEcx
85 mov [r8 + 12], edx ; Reg->RegEdx
92 ;------------------------------------------------------------------------------
95 ; IN UINT32 Index, // rcx
97 ;------------------------------------------------------------------------------
98 EfiReadMsr PROC PUBLIC
100 sal rdx, 32 ; edx:eax -> rax
101 or rax, rdx ; rax = edx:eax
105 ;------------------------------------------------------------------------------
108 ; IN UINT32 Index, // rcx
109 ; IN UINT64 Value // rdx
111 ;------------------------------------------------------------------------------
112 EfiWriteMsr PROC PUBLIC
113 mov rax, rdx ; rdx = Value
114 sar rdx, 32 ; convert rdx to edx upper 32-bits
115 wrmsr ; wrmsr[ecx] result = edx:eax
120 ;------------------------------------------------------------------------------
125 ;------------------------------------------------------------------------------
126 EfiReadTsc PROC PUBLIC
133 ;------------------------------------------------------------------------------
138 ;------------------------------------------------------------------------------
139 EfiDisableCache PROC PUBLIC
140 ; added a check to see if cache is already disabled. If it is, then skip.
153 ;------------------------------------------------------------------------------
158 ;------------------------------------------------------------------------------
159 EfiEnableCache PROC PUBLIC
167 ;------------------------------------------------------------------------------
172 ;------------------------------------------------------------------------------
173 EfiGetEflags PROC PUBLIC
179 ;------------------------------------------------------------------------------
181 ; EfiDisableInterrupts (
184 ;------------------------------------------------------------------------------
185 EfiDisableInterrupts PROC PUBLIC
188 EfiDisableInterrupts ENDP
190 ;------------------------------------------------------------------------------
192 ; EfiEnableInterrupts (
195 ;------------------------------------------------------------------------------
196 EfiEnableInterrupts PROC PUBLIC
199 EfiEnableInterrupts ENDP
200 ;------------------------------------------------------------------------------
203 ; IN UINT32 RegisterInEax,
204 ; IN UINT32 CacheLevel,
205 ; OUT EFI_CPUID_REGISTER *Regs
207 ;------------------------------------------------------------------------------
208 EfiCpuidExt PROC PUBLIC
210 mov rax, rcx ; rax = RegisterInEax
211 mov rcx, rdx ; rcx = CacheLevel
214 mov [r8 + 0 ], eax ; Reg->RegEax
215 mov [r8 + 4 ], ebx ; Reg->RegEbx
216 mov [r8 + 8 ], ecx ; Reg->RegEcx
217 mov [r8 + 12], edx ; Reg->RegEdx