From 3f566587aea64bb986866c7f69a6b82891bf59db Mon Sep 17 00:00:00 2001 From: bxing Date: Fri, 21 Jul 2006 08:47:38 +0000 Subject: 1. Updated function headers in all assembly files. 2. Split x86LowLevel.c into a bunch of C files to make images linked with BaseLib smaller. 3. Fixed a few minor bugs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1066 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseLib/X64/DisablePaging64.asm | 11 +++++++ MdePkg/Library/BaseLib/X64/FxRestore.asm | 7 +++++ MdePkg/Library/BaseLib/X64/FxSave.asm | 7 +++++ MdePkg/Library/BaseLib/X64/LongJump.asm | 8 +++++ MdePkg/Library/BaseLib/X64/ReadCs.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadDs.asm | 3 +- MdePkg/Library/BaseLib/X64/ReadEs.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadFs.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadGdtr.asm | 7 +++++ MdePkg/Library/BaseLib/X64/ReadGs.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadIdtr.asm | 7 +++++ MdePkg/Library/BaseLib/X64/ReadMm0.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm1.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm2.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm3.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm4.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm5.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm6.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMm7.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadMsr32.asm | 38 ------------------------ MdePkg/Library/BaseLib/X64/ReadMsr64.asm | 6 ++-- MdePkg/Library/BaseLib/X64/ReadPmc.asm | 7 ++--- MdePkg/Library/BaseLib/X64/ReadSs.asm | 2 +- MdePkg/Library/BaseLib/X64/ReadTsc.asm | 4 +-- MdePkg/Library/BaseLib/X64/SetJump.asm | 7 +++++ MdePkg/Library/BaseLib/X64/Thunk16.asm | 21 +++++++++---- MdePkg/Library/BaseLib/X64/WriteCr0.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteCr2.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteCr3.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteCr4.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr0.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr1.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr2.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr3.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr4.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr5.asm | 5 ++-- MdePkg/Library/BaseLib/X64/WriteDr6.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteDr7.asm | 3 +- MdePkg/Library/BaseLib/X64/WriteGdtr.asm | 7 +++++ MdePkg/Library/BaseLib/X64/WriteIdtr.asm | 7 +++++ MdePkg/Library/BaseLib/X64/WriteMm0.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm1.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm2.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm3.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm4.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm5.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm6.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMm7.asm | 4 +-- MdePkg/Library/BaseLib/X64/WriteMsr32.asm | 41 -------------------------- MdePkg/Library/BaseLib/X64/WriteMsr64.asm | 4 +-- 50 files changed, 147 insertions(+), 141 deletions(-) delete mode 100644 MdePkg/Library/BaseLib/X64/ReadMsr32.asm delete mode 100644 MdePkg/Library/BaseLib/X64/WriteMsr32.asm (limited to 'MdePkg/Library/BaseLib/X64') diff --git a/MdePkg/Library/BaseLib/X64/DisablePaging64.asm b/MdePkg/Library/BaseLib/X64/DisablePaging64.asm index 7b1e1b8bd2..2609c941aa 100644 --- a/MdePkg/Library/BaseLib/X64/DisablePaging64.asm +++ b/MdePkg/Library/BaseLib/X64/DisablePaging64.asm @@ -23,6 +23,17 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86DisablePaging64 ( +; IN UINT16 Cs, +; IN UINT32 EntryPoint, +; IN UINT32 Context1, OPTIONAL +; IN UINT32 Context2, OPTIONAL +; IN UINT32 NewStack +; ); +;------------------------------------------------------------------------------ InternalX86DisablePaging64 PROC cli shl rcx, 32 diff --git a/MdePkg/Library/BaseLib/X64/FxRestore.asm b/MdePkg/Library/BaseLib/X64/FxRestore.asm index 8acfc2f00f..7e7037e9e6 100644 --- a/MdePkg/Library/BaseLib/X64/FxRestore.asm +++ b/MdePkg/Library/BaseLib/X64/FxRestore.asm @@ -23,6 +23,13 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86FxRestore ( +; IN CONST IA32_FX_BUFFER *Buffer +; ); +;------------------------------------------------------------------------------ InternalX86FxRestore PROC fxrstor [rcx] ret diff --git a/MdePkg/Library/BaseLib/X64/FxSave.asm b/MdePkg/Library/BaseLib/X64/FxSave.asm index cacb1f5283..ea19cd1648 100644 --- a/MdePkg/Library/BaseLib/X64/FxSave.asm +++ b/MdePkg/Library/BaseLib/X64/FxSave.asm @@ -23,6 +23,13 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86FxSave ( +; OUT IA32_FX_BUFFER *Buffer +; ); +;------------------------------------------------------------------------------ InternalX86FxSave PROC fxsave [rcx] ret diff --git a/MdePkg/Library/BaseLib/X64/LongJump.asm b/MdePkg/Library/BaseLib/X64/LongJump.asm index fb6378d030..6ef5f964e0 100644 --- a/MdePkg/Library/BaseLib/X64/LongJump.asm +++ b/MdePkg/Library/BaseLib/X64/LongJump.asm @@ -21,6 +21,14 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalLongJump ( +; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, +; IN UINTN Value +; ); +;------------------------------------------------------------------------------ InternalLongJump PROC mov rbx, [rcx] mov rsp, [rcx + 8] diff --git a/MdePkg/Library/BaseLib/X64/ReadCs.asm b/MdePkg/Library/BaseLib/X64/ReadCs.asm index 126149a47c..642ce5b169 100644 --- a/MdePkg/Library/BaseLib/X64/ReadCs.asm +++ b/MdePkg/Library/BaseLib/X64/ReadCs.asm @@ -31,7 +31,7 @@ ; ); ;------------------------------------------------------------------------------ AsmReadCs PROC - mov ax, cs + mov eax, cs ret AsmReadCs ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadDs.asm b/MdePkg/Library/BaseLib/X64/ReadDs.asm index bdcddb65d8..6f2629872b 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDs.asm +++ b/MdePkg/Library/BaseLib/X64/ReadDs.asm @@ -31,9 +31,8 @@ ; ); ;------------------------------------------------------------------------------ AsmReadDs PROC - mov ax, ds + mov eax, ds ret AsmReadDs ENDP END - diff --git a/MdePkg/Library/BaseLib/X64/ReadEs.asm b/MdePkg/Library/BaseLib/X64/ReadEs.asm index 40384bcd71..d5fe84d73f 100644 --- a/MdePkg/Library/BaseLib/X64/ReadEs.asm +++ b/MdePkg/Library/BaseLib/X64/ReadEs.asm @@ -31,7 +31,7 @@ ; ); ;------------------------------------------------------------------------------ AsmReadEs PROC - mov ax, es + mov eax, es ret AsmReadEs ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadFs.asm b/MdePkg/Library/BaseLib/X64/ReadFs.asm index b63e474023..d44ee545af 100644 --- a/MdePkg/Library/BaseLib/X64/ReadFs.asm +++ b/MdePkg/Library/BaseLib/X64/ReadFs.asm @@ -31,7 +31,7 @@ ; ); ;------------------------------------------------------------------------------ AsmReadFs PROC - mov ax, fs + mov eax, fs ret AsmReadFs ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadGdtr.asm b/MdePkg/Library/BaseLib/X64/ReadGdtr.asm index 2d40599a8b..0bc2949b54 100644 --- a/MdePkg/Library/BaseLib/X64/ReadGdtr.asm +++ b/MdePkg/Library/BaseLib/X64/ReadGdtr.asm @@ -23,6 +23,13 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86ReadGdtr ( +; OUT IA32_DESCRIPTOR *Gdtr +; ); +;------------------------------------------------------------------------------ InternalX86ReadGdtr PROC sgdt fword ptr [rcx] ret diff --git a/MdePkg/Library/BaseLib/X64/ReadGs.asm b/MdePkg/Library/BaseLib/X64/ReadGs.asm index 02d140e670..bc5de7691b 100644 --- a/MdePkg/Library/BaseLib/X64/ReadGs.asm +++ b/MdePkg/Library/BaseLib/X64/ReadGs.asm @@ -31,7 +31,7 @@ ; ); ;------------------------------------------------------------------------------ AsmReadGs PROC - mov ax, gs + mov eax, gs ret AsmReadGs ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadIdtr.asm b/MdePkg/Library/BaseLib/X64/ReadIdtr.asm index 260f697178..db684f3671 100644 --- a/MdePkg/Library/BaseLib/X64/ReadIdtr.asm +++ b/MdePkg/Library/BaseLib/X64/ReadIdtr.asm @@ -23,6 +23,13 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86ReadIdtr ( +; OUT IA32_DESCRIPTOR *Idtr +; ); +;------------------------------------------------------------------------------ InternalX86ReadIdtr PROC sidt fword ptr [rcx] ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm0.asm b/MdePkg/Library/BaseLib/X64/ReadMm0.asm index 1239bcacd6..a81d208298 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm0.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm0.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm0 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm1.asm b/MdePkg/Library/BaseLib/X64/ReadMm1.asm index b42bd7f63f..5da8c4f9e5 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm1.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm1.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm1 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm2.asm b/MdePkg/Library/BaseLib/X64/ReadMm2.asm index b10782e403..3b2b1e3af3 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm2.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm2.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm2 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm3.asm b/MdePkg/Library/BaseLib/X64/ReadMm3.asm index 15a96475bd..6283c30285 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm3.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm3.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm3 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm4.asm b/MdePkg/Library/BaseLib/X64/ReadMm4.asm index 73f528342e..a65f130283 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm4.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm4.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm4 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm5.asm b/MdePkg/Library/BaseLib/X64/ReadMm5.asm index a487889480..5295c38ae0 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm5.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm5.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm5 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm6.asm b/MdePkg/Library/BaseLib/X64/ReadMm6.asm index 56f81bf7b1..acdc99b888 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm6.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm6.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm6 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMm7.asm b/MdePkg/Library/BaseLib/X64/ReadMm7.asm index e3ad6bb658..7a1b4e6111 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm7.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMm7.asm @@ -24,7 +24,7 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; UINT64 ; EFIAPI ; AsmReadMm7 ( ; VOID diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr32.asm b/MdePkg/Library/BaseLib/X64/ReadMsr32.asm deleted file mode 100644 index 271eabbeae..0000000000 --- a/MdePkg/Library/BaseLib/X64/ReadMsr32.asm +++ /dev/null @@ -1,38 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; ReadMsr32.Asm -; -; Abstract: -; -; AsmReadMsr32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; AsmReadMsr32 ( -; IN UINT32 Index -; ); -;------------------------------------------------------------------------------ -AsmReadMsr32 PROC - rdmsr - ret -AsmReadMsr32 ENDP - - END diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.asm b/MdePkg/Library/BaseLib/X64/ReadMsr64.asm index 4444c18676..580c0761a4 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMsr64.asm +++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.asm @@ -31,9 +31,9 @@ ; ); ;------------------------------------------------------------------------------ AsmReadMsr64 PROC - rdmsr - shl rax, 20h - shrd rax, rdx, 20h + rdmsr ; edx & eax are zero extended + shl rdx, 20h + or rax, rdx ret AsmReadMsr64 ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadPmc.asm b/MdePkg/Library/BaseLib/X64/ReadPmc.asm index b5004d6f34..5ca60fa85f 100644 --- a/MdePkg/Library/BaseLib/X64/ReadPmc.asm +++ b/MdePkg/Library/BaseLib/X64/ReadPmc.asm @@ -32,11 +32,8 @@ ;------------------------------------------------------------------------------ AsmReadPmc PROC rdpmc - shl ecx, 1 - jnc @F - shl rax, 20h - shrd rax, rdx, 20h -@@: + shl rdx, 20h + or rax, rdx ret AsmReadPmc ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadSs.asm b/MdePkg/Library/BaseLib/X64/ReadSs.asm index 4aa480d71b..2c2be564ac 100644 --- a/MdePkg/Library/BaseLib/X64/ReadSs.asm +++ b/MdePkg/Library/BaseLib/X64/ReadSs.asm @@ -31,7 +31,7 @@ ; ); ;------------------------------------------------------------------------------ AsmReadSs PROC - mov ax, ss + mov eax, ss ret AsmReadSs ENDP diff --git a/MdePkg/Library/BaseLib/X64/ReadTsc.asm b/MdePkg/Library/BaseLib/X64/ReadTsc.asm index 25fa2cc5d8..7c45eebd54 100644 --- a/MdePkg/Library/BaseLib/X64/ReadTsc.asm +++ b/MdePkg/Library/BaseLib/X64/ReadTsc.asm @@ -32,8 +32,8 @@ ;------------------------------------------------------------------------------ AsmReadTsc PROC rdtsc - shl rax, 20h - shrd rax, rdx, 20h + shl rdx, 20h + or rax, rdx ret AsmReadTsc ENDP diff --git a/MdePkg/Library/BaseLib/X64/SetJump.asm b/MdePkg/Library/BaseLib/X64/SetJump.asm index 148b0cb65e..2ed581ea9d 100644 --- a/MdePkg/Library/BaseLib/X64/SetJump.asm +++ b/MdePkg/Library/BaseLib/X64/SetJump.asm @@ -23,6 +23,13 @@ EXTERNDEF InternalAssertJumpBuffer:PROC +;------------------------------------------------------------------------------ +; UINTN +; EFIAPI +; SetJump ( +; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer +; ); +;------------------------------------------------------------------------------ SetJump PROC push rcx add rsp, -20h diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.asm b/MdePkg/Library/BaseLib/X64/Thunk16.asm index b120434efb..2c35c72a57 100644 --- a/MdePkg/Library/BaseLib/X64/Thunk16.asm +++ b/MdePkg/Library/BaseLib/X64/Thunk16.asm @@ -61,6 +61,10 @@ SavedGdt LABEL FWORD DW ? DQ ? +;------------------------------------------------------------------------------ +; _BackFromUserCode() takes control in real mode after 'retf' has been executed +; by user code. It will be shadowed to somewhere in memory below 1MB. +;------------------------------------------------------------------------------ _BackFromUserCode PROC DB 16h ; push ss DB 0eh ; push cs @@ -125,6 +129,10 @@ _16Gdtr LABEL FWORD _16GdtrBase DQ _NullSegDesc _16Idtr FWORD (1 SHL 10) - 1 +;------------------------------------------------------------------------------ +; _ToUserCode() takes control in real mode before passing control to user code. +; It will be shadowed to somewhere in memory below 1MB. +;------------------------------------------------------------------------------ _ToUserCode PROC mov edi, ss mov ss, edx ; set new segment selectors @@ -184,11 +192,14 @@ _16DsDesc LABEL QWORD DB 0 GdtEnd LABEL QWORD -; -; @param RegSet Pointer to a IA32_DWORD_REGS structure -; @param Transition Pointer to the transition code -; @return The address of the 16-bit stack after returning from user code -; +;------------------------------------------------------------------------------ +; IA32_REGISTER_SET * +; EFIAPI +; InternalAsmThunk16 ( +; IN IA32_REGISTER_SET *RegisterSet, +; IN OUT VOID *Transition +; ); +;------------------------------------------------------------------------------ InternalAsmThunk16 PROC USES rbp rbx rsi rdi mov r10d, ds mov r11d, es diff --git a/MdePkg/Library/BaseLib/X64/WriteCr0.asm b/MdePkg/Library/BaseLib/X64/WriteCr0.asm index defc7e7c96..caf1904d2e 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr0.asm +++ b/MdePkg/Library/BaseLib/X64/WriteCr0.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteCr0 ( -; VOID +; UINTN Cr0 ; ); ;------------------------------------------------------------------------------ AsmWriteCr0 PROC mov cr0, rcx + mov rax, rcx ret AsmWriteCr0 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteCr2.asm b/MdePkg/Library/BaseLib/X64/WriteCr2.asm index ebe6f89d62..ee5b546262 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr2.asm +++ b/MdePkg/Library/BaseLib/X64/WriteCr2.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteCr2 ( -; VOID +; UINTN Cr2 ; ); ;------------------------------------------------------------------------------ AsmWriteCr2 PROC mov cr2, rcx + mov rax, rcx ret AsmWriteCr2 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteCr3.asm b/MdePkg/Library/BaseLib/X64/WriteCr3.asm index 5715dea9b7..e63229820e 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr3.asm +++ b/MdePkg/Library/BaseLib/X64/WriteCr3.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteCr3 ( -; VOID +; UINTN Cr3 ; ); ;------------------------------------------------------------------------------ AsmWriteCr3 PROC mov cr3, rcx + mov rax, rcx ret AsmWriteCr3 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteCr4.asm b/MdePkg/Library/BaseLib/X64/WriteCr4.asm index 210744e16f..3e79fe23e4 100644 --- a/MdePkg/Library/BaseLib/X64/WriteCr4.asm +++ b/MdePkg/Library/BaseLib/X64/WriteCr4.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteCr4 ( -; VOID +; UINTN Cr4 ; ); ;------------------------------------------------------------------------------ AsmWriteCr4 PROC mov cr4, rcx + mov rax, rcx ret AsmWriteCr4 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr0.asm b/MdePkg/Library/BaseLib/X64/WriteDr0.asm index 2515a20404..a1131fead9 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr0.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr0.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr0 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr0 PROC mov dr0, rcx + mov rax, rcx ret AsmWriteDr0 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr1.asm b/MdePkg/Library/BaseLib/X64/WriteDr1.asm index 89f36ac3f9..366edb6ef8 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr1.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr1.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr1 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr1 PROC mov dr1, rcx + mov rax, rcx ret AsmWriteDr1 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr2.asm b/MdePkg/Library/BaseLib/X64/WriteDr2.asm index 820977c2e4..bde8e3d929 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr2.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr2.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr2 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr2 PROC mov dr2, rcx + mov rax, rcx ret AsmWriteDr2 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr3.asm b/MdePkg/Library/BaseLib/X64/WriteDr3.asm index 51c1407277..65180a27d5 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr3.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr3.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr3 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr3 PROC mov dr3, rcx + mov rax, rcx ret AsmWriteDr3 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr4.asm b/MdePkg/Library/BaseLib/X64/WriteDr4.asm index 12b643825b..ad618f1089 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr4.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr4.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr4 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr4 PROC DB 0fh, 23h, 0e1h + mov rax, rcx ret AsmWriteDr4 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr5.asm b/MdePkg/Library/BaseLib/X64/WriteDr5.asm index 6d454d5267..91eeef20e3 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr5.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr5.asm @@ -26,12 +26,13 @@ ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI -; AsmWriteDr5 ( -; VOID +; AsmWriteDr6 ( +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr5 PROC DB 0fh, 23h, 0e9h + mov rax, rcx ret AsmWriteDr5 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr6.asm b/MdePkg/Library/BaseLib/X64/WriteDr6.asm index b7b9f2509d..f1ddae8bfc 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr6.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr6.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr6 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr6 PROC mov dr6, rcx + mov rax, rcx ret AsmWriteDr6 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteDr7.asm b/MdePkg/Library/BaseLib/X64/WriteDr7.asm index de2237b6e4..6a0cbfa6ff 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr7.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr7.asm @@ -27,11 +27,12 @@ ; UINTN ; EFIAPI ; AsmWriteDr7 ( -; VOID +; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr7 PROC mov dr7, rcx + mov rax, rcx ret AsmWriteDr7 ENDP diff --git a/MdePkg/Library/BaseLib/X64/WriteGdtr.asm b/MdePkg/Library/BaseLib/X64/WriteGdtr.asm index 1757e3dea4..fa99a499e7 100644 --- a/MdePkg/Library/BaseLib/X64/WriteGdtr.asm +++ b/MdePkg/Library/BaseLib/X64/WriteGdtr.asm @@ -23,6 +23,13 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86WriteGdtr ( +; IN CONST IA32_DESCRIPTOR *Idtr +; ); +;------------------------------------------------------------------------------ InternalX86WriteGdtr PROC lgdt fword ptr [rcx] ret diff --git a/MdePkg/Library/BaseLib/X64/WriteIdtr.asm b/MdePkg/Library/BaseLib/X64/WriteIdtr.asm index 09fcb9e457..2f6c081ab6 100644 --- a/MdePkg/Library/BaseLib/X64/WriteIdtr.asm +++ b/MdePkg/Library/BaseLib/X64/WriteIdtr.asm @@ -23,6 +23,13 @@ .code +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; InternalX86WriteIdtr ( +; IN CONST IA32_DESCRIPTOR *Idtr +; ); +;------------------------------------------------------------------------------ InternalX86WriteIdtr PROC lidt fword ptr [rcx] ret diff --git a/MdePkg/Library/BaseLib/X64/WriteMm0.asm b/MdePkg/Library/BaseLib/X64/WriteMm0.asm index bb9a576125..0ad65e366d 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm0.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm0.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm0 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm0 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm1.asm b/MdePkg/Library/BaseLib/X64/WriteMm1.asm index 1bab3bcd8e..66425a43c2 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm1.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm1.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm1 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm1 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm2.asm b/MdePkg/Library/BaseLib/X64/WriteMm2.asm index 97e8a6a676..bd0f0a0e1a 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm2.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm2.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm2 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm2 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm3.asm b/MdePkg/Library/BaseLib/X64/WriteMm3.asm index d55e19a406..fa36ea64bb 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm3.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm3.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm3 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm3 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm4.asm b/MdePkg/Library/BaseLib/X64/WriteMm4.asm index 2a69b93bcc..d9bc46e16c 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm4.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm4.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm4 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm4 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm5.asm b/MdePkg/Library/BaseLib/X64/WriteMm5.asm index c4d798bcbd..f268bea8ec 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm5.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm5.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm5 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm5 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm6.asm b/MdePkg/Library/BaseLib/X64/WriteMm6.asm index c0164f66da..cb32ea6dc3 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm6.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm6.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm6 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm6 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMm7.asm b/MdePkg/Library/BaseLib/X64/WriteMm7.asm index 20768e2b78..f5713823bb 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm7.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMm7.asm @@ -24,10 +24,10 @@ .code ;------------------------------------------------------------------------------ -; UINTN +; VOID ; EFIAPI ; AsmWriteMm7 ( -; VOID +; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm7 PROC diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr32.asm b/MdePkg/Library/BaseLib/X64/WriteMsr32.asm deleted file mode 100644 index 0a74403624..0000000000 --- a/MdePkg/Library/BaseLib/X64/WriteMsr32.asm +++ /dev/null @@ -1,41 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. This program and the accompanying materials -; are licensed and made available under the terms and conditions of the BSD License -; which accompanies this distribution. The full text of the license may be found at -; http://opensource.org/licenses/bsd-license.php -; -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -; -; Module Name: -; -; WriteMsr32.Asm -; -; Abstract: -; -; AsmWriteMsr32 function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; UINT32 -; EFIAPI -; AsmWriteMsr32 ( -; IN UINT32 Index, -; IN UINT32 Value -; ); -;------------------------------------------------------------------------------ -AsmWriteMsr32 PROC - mov eax, edx - xor edx, edx - wrmsr - ret -AsmWriteMsr32 ENDP - - END diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.asm b/MdePkg/Library/BaseLib/X64/WriteMsr64.asm index 3337f45891..6b8066f922 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMsr64.asm +++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.asm @@ -32,11 +32,9 @@ ; ); ;------------------------------------------------------------------------------ AsmWriteMsr64 PROC - push rdx - mov eax, edx + mov rax, rdx shr rdx, 20h wrmsr - pop rax ret AsmWriteMsr64 ENDP -- cgit v1.2.3