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
This commit is contained in:
xli24 2008-10-28 14:23:36 +00:00
parent 405b567555
commit 2faf4da5f7
15 changed files with 50 additions and 59 deletions

View 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

View File

@ -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

View 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
@ -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

View 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
@ -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

View 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
@ -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)

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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
@ -26,7 +26,7 @@
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr6 (
; AsmWriteDr5 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------

View 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
@ -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