From: xli24 Date: Tue, 28 Oct 2008 14:23:36 +0000 (+0000) Subject: Refine comments of X64 assembly files of MDE BaseLib. X-Git-Tag: edk2-stable201903~19952 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2faf4da5f757acc60e690c13e41d7c46ba6d8613;hp=405b567555b3e133ba9b49be3821c3b1b0e2a120 Refine comments of X64 assembly files of MDE BaseLib. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6277 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Library/BaseLib/X64/CpuIdEx.S b/MdePkg/Library/BaseLib/X64/CpuIdEx.S index 62d698a584..32abf114db 100644 --- a/MdePkg/Library/BaseLib/X64/CpuIdEx.S +++ b/MdePkg/Library/BaseLib/X64/CpuIdEx.S @@ -38,7 +38,7 @@ ASM_PFX(AsmCpuidEx): push %rbx movl %ecx,%eax movl %edx,%ecx - push %rax + push %rax # save Index on stack cpuid mov 0x38(%rsp), %r10 test %r10, %r10 @@ -57,6 +57,6 @@ L3: jrcxz L4 mov %edx, (%rcx) L4: - pop %rax + pop %rax # restore Index to rax as return value pop %rbx ret diff --git a/MdePkg/Library/BaseLib/X64/DisablePaging64.S b/MdePkg/Library/BaseLib/X64/DisablePaging64.S index 7a543febab..e4f77970ed 100644 --- a/MdePkg/Library/BaseLib/X64/DisablePaging64.S +++ b/MdePkg/Library/BaseLib/X64/DisablePaging64.S @@ -27,39 +27,39 @@ # VOID # EFIAPI # InternalX86DisablePaging64 ( -# IN UINT16 Cs, %rdi -# IN UINT64 EntryPoint, %rsi -# IN UINT64 Context1, OPTIONAL %rdx -# IN UINT32 Context2, OPTIONAL %rcx -# IN UINT64 NewStack %r8 +# IN UINT16 Cs, +# IN UINT64 EntryPoint, +# IN UINT64 Context1, OPTIONAL +# IN UINT32 Context2, OPTIONAL +# IN UINT64 NewStack # ); #------------------------------------------------------------------------------ .global ASM_PFX(InternalX86DisablePaging64) ASM_PFX(InternalX86DisablePaging64): cli - shl $0x20,%rcx + shl $0x20,%rcx # rcx[32..47] <- Cs lea L1, %eax mov %r8d, %esi - or %rax, %rcx + or %rax, %rcx # rcx[0..47] <- Cs:@F mov %r9d, %edi - mov 0x28(%rsp), %eax + mov 0x28(%rsp), %eax # eax <- New Stack push %rcx - ret + ret # switch to compatibility mode L1: - mov %eax,%esp + mov %eax,%esp # set up new stack mov %cr0,%rax btr $0x1f,%eax - mov %rax,%cr0 + mov %rax,%cr0 # disable paging mov $0xc0000080,%ecx rdmsr - and $0xfe,%ah + and $0xfe,%ah # clear LME wrmsr mov %cr4,%rax - and $0xdf,%al + and $0xdf,%al # clear PAE mov %rax,%cr4 - push %rdi - push %rsi - callq *%rdx - jmp . + push %rdi # push Context2 + push %rsi # push Context1 + callq *%rdx # transfer control to EntryPoint + jmp . # no one should get here diff --git a/MdePkg/Library/BaseLib/X64/EnablePaging64.S b/MdePkg/Library/BaseLib/X64/EnablePaging64.S index 452bd39acc..6a66aba3f7 100644 --- a/MdePkg/Library/BaseLib/X64/EnablePaging64.S +++ b/MdePkg/Library/BaseLib/X64/EnablePaging64.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -26,36 +26,36 @@ # VOID # EFIAPI # InternalX86EnablePaging64 ( -# IN UINT16 Cs, %rdi -# IN UINT64 EntryPoint, %rsi -# IN UINT64 Context1, OPTIONAL %rdx -# IN UINT64 Context2, OPTIONAL %rcx -# IN UINT64 NewStack %r8 +# IN UINT16 Cs, +# IN UINT64 EntryPoint, +# IN UINT64 Context1, OPTIONAL +# IN UINT64 Context2, OPTIONAL +# IN UINT64 NewStack # ); #------------------------------------------------------------------------------ .global ASM_PFX(InternalX86EnablePaging64) ASM_PFX(InternalX86EnablePaging64): cli - pop %rax + pop %rax # skip the return address callq Base Base: - addl $(L1-Base),(%rsp) + addl $(L1-Base),(%rsp) # offset for ret, seg is the 1st arg mov %cr4,%rax or $0x20,%al - mov %rax,%cr4 + mov %rax,%cr4 # enable PAE mov $0xc0000080,%ecx rdmsr - or $0x1,%ah + or $0x1,%ah # set LME wrmsr mov %cr0,%rax bts $0x1f,%eax - mov %rax,%cr0 + mov %rax,%cr0 # enable paging lret -L1: +L1: # long mode starts here addr32 mov (%esp),%rbx addr32 mov 0x8(%esp),%rcx addr32 mov 0x10(%esp),%rdx addr32 mov 0x18(%esp),%rsp add $-0x20,%rsp callq *%rbx - jmp . + jmp . # dead loop if EntryPoint() returned diff --git a/MdePkg/Library/BaseLib/X64/EnablePaging64.asm b/MdePkg/Library/BaseLib/X64/EnablePaging64.asm index c54843008a..bd5770d87c 100644 --- a/MdePkg/Library/BaseLib/X64/EnablePaging64.asm +++ b/MdePkg/Library/BaseLib/X64/EnablePaging64.asm @@ -1,6 +1,6 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation +; Copyright (c) 2006 - 2008, 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 @@ -40,14 +40,14 @@ InternalX86EnablePaging64 PROC call @Base @Base: add dword ptr [rsp], @F - @Base ; offset for far retf, seg is the 1st arg - mov rax, cr4 ; mov eax, cr4 + mov rax, cr4 or al, (1 SHL 5) mov cr4, rax ; enable PAE mov ecx, 0c0000080h rdmsr or ah, 1 ; set LME wrmsr - mov rax, cr0 ; mov eax, cr0 + mov rax, cr0 bts eax, 31 mov cr0, rax ; enable paging retf diff --git a/MdePkg/Library/BaseLib/X64/LongJump.S b/MdePkg/Library/BaseLib/X64/LongJump.S index 69229c2bf1..c135d3bd06 100644 --- a/MdePkg/Library/BaseLib/X64/LongJump.S +++ b/MdePkg/Library/BaseLib/X64/LongJump.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 -2008, 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 @@ -38,5 +38,5 @@ ASM_PFX(InternalLongJump): mov 0x30(%rcx), %r13 mov 0x38(%rcx), %r14 mov 0x40(%rcx), %r15 - mov %rdx, %rax + mov %rdx, %rax # set return value jmp *0x48(%rcx) diff --git a/MdePkg/Library/BaseLib/X64/ReadMm0.S b/MdePkg/Library/BaseLib/X64/ReadMm0.S index b14b061419..1a2de9f536 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm0.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm0.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm0) .align 16 ASM_PFX(AsmReadMm0): - #DB 48h, 0fh, 7eh, 0c0h movd %mm0, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm1.S b/MdePkg/Library/BaseLib/X64/ReadMm1.S index 6af2b17039..a50e0c319c 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm1.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm1.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm1) .align 16 ASM_PFX(AsmReadMm1): - #DB 48h, 0fh, 7eh, 0c8h movd %mm1, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm2.S b/MdePkg/Library/BaseLib/X64/ReadMm2.S index d80ad64eec..88d829e904 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm2.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm2.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm2) .align 16 ASM_PFX(AsmReadMm2): - #DB 48h, 0fh, 7eh, 0d0h movd %mm2, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm3.S b/MdePkg/Library/BaseLib/X64/ReadMm3.S index 7885952ed6..4565741d2e 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm3.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm3.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm3) .align 16 ASM_PFX(AsmReadMm3): - #DB 48h, 0fh, 7eh, 0d8h movd %mm3, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm4.S b/MdePkg/Library/BaseLib/X64/ReadMm4.S index 8c9830cc97..491a876b3f 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm4.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm4.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm4) .align 16 ASM_PFX(AsmReadMm4): - #DB 48h, 0fh, 7eh, 0e0h movd %mm4, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm5.S b/MdePkg/Library/BaseLib/X64/ReadMm5.S index 19f0fa4c5e..ac2119d649 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm5.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm5.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm5) .align 16 ASM_PFX(AsmReadMm5): - #DB 48h, 0fh, 7eh, 0e8h movd %mm5, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm6.S b/MdePkg/Library/BaseLib/X64/ReadMm6.S index 49cf4f3626..1816c93301 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm6.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm6.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm6) .align 16 ASM_PFX(AsmReadMm6): - #DB 48h, 0fh, 7eh, 0f0h movd %mm6, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/ReadMm7.S b/MdePkg/Library/BaseLib/X64/ReadMm7.S index 94abd776b4..c5465769c4 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm7.S +++ b/MdePkg/Library/BaseLib/X64/ReadMm7.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -32,6 +32,5 @@ .global ASM_PFX(AsmReadMm7) .align 16 ASM_PFX(AsmReadMm7): - #DB 48h, 0fh, 7eh, 0f8h movd %mm7, %rax ret diff --git a/MdePkg/Library/BaseLib/X64/WriteDr5.asm b/MdePkg/Library/BaseLib/X64/WriteDr5.asm index 86009c3287..e35f53e6dd 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr5.asm +++ b/MdePkg/Library/BaseLib/X64/WriteDr5.asm @@ -1,6 +1,6 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation +; Copyright (c) 2006 - 2008, 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 @@ -26,7 +26,7 @@ ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI -; AsmWriteDr6 ( +; AsmWriteDr5 ( ; IN UINTN Value ; ); ;------------------------------------------------------------------------------ diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.S b/MdePkg/Library/BaseLib/X64/WriteMsr64.S index 2b0a557128..4a06f85e8a 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMsr64.S +++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006, Intel Corporation +# Copyright (c) 2006 - 2008, 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 @@ -29,12 +29,11 @@ # IN UINT32 Index, # IN UINT64 Value # ); -# TODO: #------------------------------------------------------------------------------ .global ASM_PFX(AsmWriteMsr64) .align 16 ASM_PFX(AsmWriteMsr64): - mov %rdx, %rax - shr $0x20, %rdx + mov %rdx, %rax # meanwhile, rax <- return value + shr $0x20, %rdx # edx:eax contains the value to write wrmsr ret