mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 05:34:31 +02:00
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:
parent
405b567555
commit
2faf4da5f7
@ -38,7 +38,7 @@ ASM_PFX(AsmCpuidEx):
|
|||||||
push %rbx
|
push %rbx
|
||||||
movl %ecx,%eax
|
movl %ecx,%eax
|
||||||
movl %edx,%ecx
|
movl %edx,%ecx
|
||||||
push %rax
|
push %rax # save Index on stack
|
||||||
cpuid
|
cpuid
|
||||||
mov 0x38(%rsp), %r10
|
mov 0x38(%rsp), %r10
|
||||||
test %r10, %r10
|
test %r10, %r10
|
||||||
@ -57,6 +57,6 @@ L3:
|
|||||||
jrcxz L4
|
jrcxz L4
|
||||||
mov %edx, (%rcx)
|
mov %edx, (%rcx)
|
||||||
L4:
|
L4:
|
||||||
pop %rax
|
pop %rax # restore Index to rax as return value
|
||||||
pop %rbx
|
pop %rbx
|
||||||
ret
|
ret
|
||||||
|
@ -27,39 +27,39 @@
|
|||||||
# VOID
|
# VOID
|
||||||
# EFIAPI
|
# EFIAPI
|
||||||
# InternalX86DisablePaging64 (
|
# InternalX86DisablePaging64 (
|
||||||
# IN UINT16 Cs, %rdi
|
# IN UINT16 Cs,
|
||||||
# IN UINT64 EntryPoint, %rsi
|
# IN UINT64 EntryPoint,
|
||||||
# IN UINT64 Context1, OPTIONAL %rdx
|
# IN UINT64 Context1, OPTIONAL
|
||||||
# IN UINT32 Context2, OPTIONAL %rcx
|
# IN UINT32 Context2, OPTIONAL
|
||||||
# IN UINT64 NewStack %r8
|
# IN UINT64 NewStack
|
||||||
# );
|
# );
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.global ASM_PFX(InternalX86DisablePaging64)
|
.global ASM_PFX(InternalX86DisablePaging64)
|
||||||
ASM_PFX(InternalX86DisablePaging64):
|
ASM_PFX(InternalX86DisablePaging64):
|
||||||
cli
|
cli
|
||||||
shl $0x20,%rcx
|
shl $0x20,%rcx # rcx[32..47] <- Cs
|
||||||
lea L1, %eax
|
lea L1, %eax
|
||||||
mov %r8d, %esi
|
mov %r8d, %esi
|
||||||
or %rax, %rcx
|
or %rax, %rcx # rcx[0..47] <- Cs:@F
|
||||||
mov %r9d, %edi
|
mov %r9d, %edi
|
||||||
mov 0x28(%rsp), %eax
|
mov 0x28(%rsp), %eax # eax <- New Stack
|
||||||
push %rcx
|
push %rcx
|
||||||
ret
|
ret # switch to compatibility mode
|
||||||
L1:
|
L1:
|
||||||
mov %eax,%esp
|
mov %eax,%esp # set up new stack
|
||||||
mov %cr0,%rax
|
mov %cr0,%rax
|
||||||
btr $0x1f,%eax
|
btr $0x1f,%eax
|
||||||
mov %rax,%cr0
|
mov %rax,%cr0 # disable paging
|
||||||
mov $0xc0000080,%ecx
|
mov $0xc0000080,%ecx
|
||||||
rdmsr
|
rdmsr
|
||||||
and $0xfe,%ah
|
and $0xfe,%ah # clear LME
|
||||||
wrmsr
|
wrmsr
|
||||||
mov %cr4,%rax
|
mov %cr4,%rax
|
||||||
and $0xdf,%al
|
and $0xdf,%al # clear PAE
|
||||||
mov %rax,%cr4
|
mov %rax,%cr4
|
||||||
push %rdi
|
push %rdi # push Context2
|
||||||
push %rsi
|
push %rsi # push Context1
|
||||||
callq *%rdx
|
callq *%rdx # transfer control to EntryPoint
|
||||||
jmp .
|
jmp . # no one should get here
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -26,36 +26,36 @@
|
|||||||
# VOID
|
# VOID
|
||||||
# EFIAPI
|
# EFIAPI
|
||||||
# InternalX86EnablePaging64 (
|
# InternalX86EnablePaging64 (
|
||||||
# IN UINT16 Cs, %rdi
|
# IN UINT16 Cs,
|
||||||
# IN UINT64 EntryPoint, %rsi
|
# IN UINT64 EntryPoint,
|
||||||
# IN UINT64 Context1, OPTIONAL %rdx
|
# IN UINT64 Context1, OPTIONAL
|
||||||
# IN UINT64 Context2, OPTIONAL %rcx
|
# IN UINT64 Context2, OPTIONAL
|
||||||
# IN UINT64 NewStack %r8
|
# IN UINT64 NewStack
|
||||||
# );
|
# );
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
.global ASM_PFX(InternalX86EnablePaging64)
|
.global ASM_PFX(InternalX86EnablePaging64)
|
||||||
ASM_PFX(InternalX86EnablePaging64):
|
ASM_PFX(InternalX86EnablePaging64):
|
||||||
cli
|
cli
|
||||||
pop %rax
|
pop %rax # skip the return address
|
||||||
callq Base
|
callq Base
|
||||||
Base:
|
Base:
|
||||||
addl $(L1-Base),(%rsp)
|
addl $(L1-Base),(%rsp) # offset for ret, seg is the 1st arg
|
||||||
mov %cr4,%rax
|
mov %cr4,%rax
|
||||||
or $0x20,%al
|
or $0x20,%al
|
||||||
mov %rax,%cr4
|
mov %rax,%cr4 # enable PAE
|
||||||
mov $0xc0000080,%ecx
|
mov $0xc0000080,%ecx
|
||||||
rdmsr
|
rdmsr
|
||||||
or $0x1,%ah
|
or $0x1,%ah # set LME
|
||||||
wrmsr
|
wrmsr
|
||||||
mov %cr0,%rax
|
mov %cr0,%rax
|
||||||
bts $0x1f,%eax
|
bts $0x1f,%eax
|
||||||
mov %rax,%cr0
|
mov %rax,%cr0 # enable paging
|
||||||
lret
|
lret
|
||||||
L1:
|
L1: # long mode starts here
|
||||||
addr32 mov (%esp),%rbx
|
addr32 mov (%esp),%rbx
|
||||||
addr32 mov 0x8(%esp),%rcx
|
addr32 mov 0x8(%esp),%rcx
|
||||||
addr32 mov 0x10(%esp),%rdx
|
addr32 mov 0x10(%esp),%rdx
|
||||||
addr32 mov 0x18(%esp),%rsp
|
addr32 mov 0x18(%esp),%rsp
|
||||||
add $-0x20,%rsp
|
add $-0x20,%rsp
|
||||||
callq *%rbx
|
callq *%rbx
|
||||||
jmp .
|
jmp . # dead loop if EntryPoint() returned
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006, Intel Corporation
|
; Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -40,14 +40,14 @@ InternalX86EnablePaging64 PROC
|
|||||||
call @Base
|
call @Base
|
||||||
@Base:
|
@Base:
|
||||||
add dword ptr [rsp], @F - @Base ; offset for far retf, seg is the 1st arg
|
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)
|
or al, (1 SHL 5)
|
||||||
mov cr4, rax ; enable PAE
|
mov cr4, rax ; enable PAE
|
||||||
mov ecx, 0c0000080h
|
mov ecx, 0c0000080h
|
||||||
rdmsr
|
rdmsr
|
||||||
or ah, 1 ; set LME
|
or ah, 1 ; set LME
|
||||||
wrmsr
|
wrmsr
|
||||||
mov rax, cr0 ; mov eax, cr0
|
mov rax, cr0
|
||||||
bts eax, 31
|
bts eax, 31
|
||||||
mov cr0, rax ; enable paging
|
mov cr0, rax ; enable paging
|
||||||
retf
|
retf
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 -2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# 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 0x30(%rcx), %r13
|
||||||
mov 0x38(%rcx), %r14
|
mov 0x38(%rcx), %r14
|
||||||
mov 0x40(%rcx), %r15
|
mov 0x40(%rcx), %r15
|
||||||
mov %rdx, %rax
|
mov %rdx, %rax # set return value
|
||||||
jmp *0x48(%rcx)
|
jmp *0x48(%rcx)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm0)
|
.global ASM_PFX(AsmReadMm0)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm0):
|
ASM_PFX(AsmReadMm0):
|
||||||
#DB 48h, 0fh, 7eh, 0c0h
|
|
||||||
movd %mm0, %rax
|
movd %mm0, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm1)
|
.global ASM_PFX(AsmReadMm1)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm1):
|
ASM_PFX(AsmReadMm1):
|
||||||
#DB 48h, 0fh, 7eh, 0c8h
|
|
||||||
movd %mm1, %rax
|
movd %mm1, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm2)
|
.global ASM_PFX(AsmReadMm2)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm2):
|
ASM_PFX(AsmReadMm2):
|
||||||
#DB 48h, 0fh, 7eh, 0d0h
|
|
||||||
movd %mm2, %rax
|
movd %mm2, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm3)
|
.global ASM_PFX(AsmReadMm3)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm3):
|
ASM_PFX(AsmReadMm3):
|
||||||
#DB 48h, 0fh, 7eh, 0d8h
|
|
||||||
movd %mm3, %rax
|
movd %mm3, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm4)
|
.global ASM_PFX(AsmReadMm4)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm4):
|
ASM_PFX(AsmReadMm4):
|
||||||
#DB 48h, 0fh, 7eh, 0e0h
|
|
||||||
movd %mm4, %rax
|
movd %mm4, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm5)
|
.global ASM_PFX(AsmReadMm5)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm5):
|
ASM_PFX(AsmReadMm5):
|
||||||
#DB 48h, 0fh, 7eh, 0e8h
|
|
||||||
movd %mm5, %rax
|
movd %mm5, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm6)
|
.global ASM_PFX(AsmReadMm6)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm6):
|
ASM_PFX(AsmReadMm6):
|
||||||
#DB 48h, 0fh, 7eh, 0f0h
|
|
||||||
movd %mm6, %rax
|
movd %mm6, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -32,6 +32,5 @@
|
|||||||
.global ASM_PFX(AsmReadMm7)
|
.global ASM_PFX(AsmReadMm7)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmReadMm7):
|
ASM_PFX(AsmReadMm7):
|
||||||
#DB 48h, 0fh, 7eh, 0f8h
|
|
||||||
movd %mm7, %rax
|
movd %mm7, %rax
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006, Intel Corporation
|
; Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -26,7 +26,7 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; UINTN
|
; UINTN
|
||||||
; EFIAPI
|
; EFIAPI
|
||||||
; AsmWriteDr6 (
|
; AsmWriteDr5 (
|
||||||
; IN UINTN Value
|
; IN UINTN Value
|
||||||
; );
|
; );
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -29,12 +29,11 @@
|
|||||||
# IN UINT32 Index,
|
# IN UINT32 Index,
|
||||||
# IN UINT64 Value
|
# IN UINT64 Value
|
||||||
# );
|
# );
|
||||||
# TODO:
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
.global ASM_PFX(AsmWriteMsr64)
|
.global ASM_PFX(AsmWriteMsr64)
|
||||||
.align 16
|
.align 16
|
||||||
ASM_PFX(AsmWriteMsr64):
|
ASM_PFX(AsmWriteMsr64):
|
||||||
mov %rdx, %rax
|
mov %rdx, %rax # meanwhile, rax <- return value
|
||||||
shr $0x20, %rdx
|
shr $0x20, %rdx # edx:eax contains the value to write
|
||||||
wrmsr
|
wrmsr
|
||||||
ret
|
ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user