1 TITLE Cpu.asm: Assembly code for the x64 resources
3 ;------------------------------------------------------------------------------
5 ;* Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>
6 ;* This program and the accompanying materials
7 ;* are licensed and made available under the terms and conditions of the BSD License
8 ;* which accompanies this distribution. The full text of the license may be found at
9 ;* http://opensource.org/licenses/bsd-license.php
11 ;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 ;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 ;------------------------------------------------------------------------------
25 ;------------------------------------------------------------------------------
30 ;------------------------------------------------------------------------------
37 ;------------------------------------------------------------------------------
42 ;------------------------------------------------------------------------------
49 ;------------------------------------------------------------------------------
54 ;------------------------------------------------------------------------------
60 ;------------------------------------------------------------------------------
63 ; IN UINT32 RegisterInEax, // rcx
64 ; OUT EFI_CPUID_REGISTER *Reg OPTIONAL // rdx
66 ;------------------------------------------------------------------------------
70 mov r8, rdx ; r8 = *Reg
71 mov rax, rcx ; RegisterInEax
75 mov [r8 + 0], eax ; Reg->RegEax
76 mov [r8 + 4], ebx ; Reg->RegEbx
77 mov [r8 + 8], ecx ; Reg->RegEcx
78 mov [r8 + 12], edx ; Reg->RegEdx
85 ;------------------------------------------------------------------------------
88 ; IN UINT32 Index, // rcx
90 ;------------------------------------------------------------------------------
91 EfiReadMsr PROC PUBLIC
93 sal rdx, 32 ; edx:eax -> rax
94 or rax, rdx ; rax = edx:eax
98 ;------------------------------------------------------------------------------
101 ; IN UINT32 Index, // rcx
102 ; IN UINT64 Value // rdx
104 ;------------------------------------------------------------------------------
105 EfiWriteMsr PROC PUBLIC
106 mov rax, rdx ; rdx = Value
107 sar rdx, 32 ; convert rdx to edx upper 32-bits
108 wrmsr ; wrmsr[ecx] result = edx:eax
113 ;------------------------------------------------------------------------------
118 ;------------------------------------------------------------------------------
119 EfiReadTsc PROC PUBLIC
126 ;------------------------------------------------------------------------------
131 ;------------------------------------------------------------------------------
132 EfiDisableCache PROC PUBLIC
133 ; added a check to see if cache is already disabled. If it is, then skip.
146 ;------------------------------------------------------------------------------
151 ;------------------------------------------------------------------------------
152 EfiEnableCache PROC PUBLIC
160 ;------------------------------------------------------------------------------
165 ;------------------------------------------------------------------------------
166 EfiGetEflags PROC PUBLIC
172 ;------------------------------------------------------------------------------
174 ; EfiDisableInterrupts (
177 ;------------------------------------------------------------------------------
178 EfiDisableInterrupts PROC PUBLIC
181 EfiDisableInterrupts ENDP
183 ;------------------------------------------------------------------------------
185 ; EfiEnableInterrupts (
188 ;------------------------------------------------------------------------------
189 EfiEnableInterrupts PROC PUBLIC
192 EfiEnableInterrupts ENDP
193 ;------------------------------------------------------------------------------
196 ; IN UINT32 RegisterInEax,
197 ; IN UINT32 CacheLevel,
198 ; OUT EFI_CPUID_REGISTER *Regs
200 ;------------------------------------------------------------------------------
201 EfiCpuidExt PROC PUBLIC
203 mov rax, rcx ; rax = RegisterInEax
204 mov rcx, rdx ; rcx = CacheLevel
207 mov [r8 + 0 ], eax ; Reg->RegEax
208 mov [r8 + 4 ], ebx ; Reg->RegEbx
209 mov [r8 + 8 ], ecx ; Reg->RegEcx
210 mov [r8 + 12], edx ; Reg->RegEdx