]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine comments of X64 assembly files of MDE BaseLib.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Oct 2008 14:23:36 +0000 (14:23 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Oct 2008 14:23:36 +0000 (14:23 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6277 6f19259b-4bc3-4df7-8a09-765794883524

15 files changed:
MdePkg/Library/BaseLib/X64/CpuIdEx.S
MdePkg/Library/BaseLib/X64/DisablePaging64.S
MdePkg/Library/BaseLib/X64/EnablePaging64.S
MdePkg/Library/BaseLib/X64/EnablePaging64.asm
MdePkg/Library/BaseLib/X64/LongJump.S
MdePkg/Library/BaseLib/X64/ReadMm0.S
MdePkg/Library/BaseLib/X64/ReadMm1.S
MdePkg/Library/BaseLib/X64/ReadMm2.S
MdePkg/Library/BaseLib/X64/ReadMm3.S
MdePkg/Library/BaseLib/X64/ReadMm4.S
MdePkg/Library/BaseLib/X64/ReadMm5.S
MdePkg/Library/BaseLib/X64/ReadMm6.S
MdePkg/Library/BaseLib/X64/ReadMm7.S
MdePkg/Library/BaseLib/X64/WriteDr5.asm
MdePkg/Library/BaseLib/X64/WriteMsr64.S

index 62d698a58444f4c29efec11fbd2fee0fe02a4ca5..32abf114dbb00bd99927a075c88fb5dfddb450d5 100644 (file)
@@ -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
index 7a543febabc3e2a1656213fd9a77254e2d855e09..e4f77970ed600f2fa568e96b1c527ccaff47a373 100644 (file)
 # 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 \r
-    or     %rax, %rcx\r
+    or     %rax, %rcx                     # rcx[0..47] <- Cs:@F\r
     mov    %r9d, %edi \r
-    mov    0x28(%rsp), %eax\r
+    mov    0x28(%rsp), %eax               # eax <- New Stack\r
     push   %rcx\r
-    ret\r
+    ret                                   # switch to compatibility mode\r
 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
 
index 452bd39acc83472141dd27ada213d1dd70ef35cc..6a66aba3f7bd8f4f6a3203d743d19d3aaddea029 100644 (file)
@@ -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
 # 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
index c54843008a4554b19f770861afe28b9a3520cdae..bd5770d87cf16980ac61ed3e70189524ced628b2 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2006, Intel Corporation\r
+; Copyright (c) 2006 - 2008, Intel Corporation\r
 ; All rights reserved. This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -40,14 +40,14 @@ InternalX86EnablePaging64 PROC
     call    @Base\r
 @Base:\r
     add     dword ptr [rsp], @F - @Base ; offset for far retf, seg is the 1st arg\r
-    mov     rax, cr4                    ; mov eax, cr4\r
+    mov     rax, cr4\r
     or      al, (1 SHL 5)\r
     mov     cr4, rax                    ; enable PAE\r
     mov     ecx, 0c0000080h\r
     rdmsr\r
     or      ah, 1                       ; set LME\r
     wrmsr\r
-    mov     rax, cr0                    ; mov eax, cr0\r
+    mov     rax, cr0\r
     bts     eax, 31\r
     mov     cr0, rax                    ; enable paging\r
     retf\r
index 69229c2bf18aaf219926c0c96d27f1e4759831a6..c135d3bd0654d1fb09ff13f122519538d37b6ee8 100644 (file)
@@ -1,6 +1,6 @@
 #------------------------------------------------------------------------------\r
 #\r
-# Copyright (c) 2006, Intel Corporation\r
+# Copyright (c) 2006 -2008, Intel Corporation\r
 # All rights reserved. This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -38,5 +38,5 @@ ASM_PFX(InternalLongJump):
     mov     0x30(%rcx), %r13\r
     mov     0x38(%rcx), %r14\r
     mov     0x40(%rcx), %r15\r
-    mov     %rdx, %rax\r
+    mov     %rdx, %rax          # set return value\r
     jmp     *0x48(%rcx)\r
index b14b06141922222fb322ccd7c3d3497e141648c5..1a2de9f5367742532b683a9e52ecd06ffd2f9ef6 100644 (file)
@@ -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
index 6af2b17039e5e5fe754f967c122f6390ac98596b..a50e0c319c771d6341bed79f93a9c4ede31c1ecc 100644 (file)
@@ -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
index d80ad64eecf15633ba3920f376fc15cd5e1409b2..88d829e90436eabc441387e93173a1fe597682e8 100644 (file)
@@ -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
index 7885952ed692975c7a21ffd6ea599f0e73730f37..4565741d2ecd89bc11014c5dcfd6dc9119203ca6 100644 (file)
@@ -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
index 8c9830cc973e6c1d8c358169b86b9a56c06393b2..491a876b3f6a6ab102557c9da21c4657560ce2c2 100644 (file)
@@ -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
index 19f0fa4c5e87af3799389e9cff3720cb40384102..ac2119d649baa8619c98168c46d14ce7d19f6742 100644 (file)
@@ -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
index 49cf4f3626dcd700b8dd0e577bd545e912945d74..1816c93301ea0f463dbfdd40874a2b1259349106 100644 (file)
@@ -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
index 94abd776b458426ed288f3ca9fec30023bfc01dc..c5465769c481fcb46b63b2fbe00927d82b73a0dc 100644 (file)
@@ -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
index 86009c32871d343cb61e728b7065c3e769d1e8ec..e35f53e6dd022e1327f005abb61c65c911684a36 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2006, Intel Corporation\r
+; Copyright (c) 2006 - 2008, Intel Corporation\r
 ; All rights reserved. This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -26,7 +26,7 @@
 ;------------------------------------------------------------------------------\r
 ; UINTN\r
 ; EFIAPI\r
-; AsmWriteDr6 (\r
+; AsmWriteDr5 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
index 2b0a557128810bfb0c88d476f92040941fcd267d..4a06f85e8acf01cf4b6607df23956a149bfaedcc 100644 (file)
@@ -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
 #   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