MdePkg: Remove X86 ASM and S files

NASM has replaced ASM and S files.
1. Remove ASM from all modules.
2. Remove S files from the drivers only.
3. https://bugzilla.tianocore.org/show_bug.cgi?id=881
After NASM is updated, S files can be removed from Library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Liming Gao
2018-06-04 13:26:22 +08:00
parent b20085454e
commit 13688930ae
308 changed files with 8 additions and 15375 deletions

View File

@@ -1,37 +0,0 @@
;------------------------------------------------------------------------------ ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; CpuBreakpoint.Asm
;
; Abstract:
;
; CpuBreakpoint function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuBreakpoint (
; VOID
; );
;------------------------------------------------------------------------------
CpuBreakpoint PROC
int 3
ret
CpuBreakpoint ENDP
END

View File

@@ -1,62 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; CpuId.Asm
;
; Abstract:
;
; AsmCpuid function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmCpuid (
; IN UINT32 RegisterInEax,
; OUT UINT32 *RegisterOutEax OPTIONAL,
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
; )
;------------------------------------------------------------------------------
AsmCpuid PROC USES rbx
mov eax, ecx
push rax ; save Index on stack
push rdx
cpuid
test r9, r9
jz @F
mov [r9], ecx
@@:
pop rcx
jrcxz @F
mov [rcx], eax
@@:
mov rcx, r8
jrcxz @F
mov [rcx], ebx
@@:
mov rcx, [rsp + 38h]
jrcxz @F
mov [rcx], edx
@@:
pop rax ; restore Index to rax as return value
ret
AsmCpuid ENDP
END

View File

@@ -1,64 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; CpuIdEx.Asm
;
; Abstract:
;
; AsmCpuidEx function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; AsmCpuidEx (
; IN UINT32 RegisterInEax,
; IN UINT32 RegisterInEcx,
; OUT UINT32 *RegisterOutEax OPTIONAL,
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
; )
;------------------------------------------------------------------------------
AsmCpuidEx PROC USES rbx
mov eax, ecx
mov ecx, edx
push rax ; save Index on stack
cpuid
mov r10, [rsp + 38h]
test r10, r10
jz @F
mov [r10], ecx
@@:
mov rcx, r8
jrcxz @F
mov [rcx], eax
@@:
mov rcx, r9
jrcxz @F
mov [rcx], ebx
@@:
mov rcx, [rsp + 40h]
jrcxz @F
mov [rcx], edx
@@:
pop rax ; restore Index to rax as return value
ret
AsmCpuidEx ENDP
END

View File

@@ -1,37 +0,0 @@
;------------------------------------------------------------------------------ ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; CpuPause.Asm
;
; Abstract:
;
; CpuPause function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuPause (
; VOID
; );
;------------------------------------------------------------------------------
CpuPause PROC
pause
ret
CpuPause ENDP
END

View File

@@ -1,43 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; DisableCache.Asm
;
; Abstract:
;
; Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a
; WBINVD instruction.
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmDisableCache (
; VOID
; );
;------------------------------------------------------------------------------
AsmDisableCache PROC
mov rax, cr0
bts rax, 30
btr rax, 29
mov cr0, rax
wbinvd
ret
AsmDisableCache ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; DisableInterrupts.Asm
;
; Abstract:
;
; DisableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; DisableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
DisableInterrupts PROC
cli
ret
DisableInterrupts ENDP
END

View File

@@ -1,84 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; DisablePaging64.Asm
;
; Abstract:
;
; AsmDisablePaging64 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86DisablePaging64 (
; IN UINT16 Cs,
; IN UINT32 EntryPoint,
; IN UINT32 Context1, OPTIONAL
; IN UINT32 Context2, OPTIONAL
; IN UINT32 NewStack
; );
;------------------------------------------------------------------------------
InternalX86DisablePaging64 PROC
cli
lea rsi, @F ; rsi <- The start address of transition code
mov edi, [rsp + 28h] ; rdi <- New stack
lea rax, mTransitionEnd ; rax <- end of transition code
sub rax, rsi ; rax <- The size of transition piece code
add rax, 4 ; Round RAX up to the next 4 byte boundary
and al, 0fch
sub rdi, rax ; rdi <- Use stack to hold transition code
mov r10d, edi ; r10 <- The start address of transicition code below 4G
push rcx ; save rcx to stack
mov rcx, rax ; rcx <- The size of transition piece code
rep movsb ; copy transition code to top of new stack which must be below 4GB
pop rcx ; restore rcx
mov esi, r8d
mov edi, r9d
mov eax, r10d ; eax <- start of the transition code on the stack
sub eax, 4 ; eax <- One slot below transition code on the stack
push rcx ; push Cs to stack
push r10 ; push address of tansition code on stack
DB 48h ; prefix to composite "retq" with next "retf"
retf ; Use far return to load CS register from stack
; Start of transition code
@@:
mov esp, eax ; set up new stack
mov rax, cr0
btr eax, 31 ; Clear CR0.PG
mov cr0, rax ; disable paging and caches
mov ebx, edx ; save EntryPoint to rbx, for rdmsr will overwrite rdx
mov ecx, 0c0000080h
rdmsr
and ah, NOT 1 ; clear LME
wrmsr
mov rax, cr4
and al, NOT (1 SHL 5) ; clear PAE
mov cr4, rax
push rdi ; push Context2
push rsi ; push Context1
call rbx ; transfer control to EntryPoint
hlt ; no one should get here
InternalX86DisablePaging64 ENDP
mTransitionEnd LABEL BYTE
END

View File

@@ -1,43 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; EnableCache.Asm
;
; Abstract:
;
; Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear
; the NW bit of CR0 to 0
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmEnableCache (
; VOID
; );
;------------------------------------------------------------------------------
AsmEnableCache PROC
wbinvd
mov rax, cr0
btr rax, 29
btr rax, 30
mov cr0, rax
ret
AsmEnableCache ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; EnableDisableInterrupts.Asm
;
; Abstract:
;
; EnableDisableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; EnableDisableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
EnableDisableInterrupts PROC
sti
cli
ret
EnableDisableInterrupts ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; EnableInterrupts.Asm
;
; Abstract:
;
; EnableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; EnableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
EnableInterrupts PROC
sti
ret
EnableInterrupts ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; FlushCacheLine.Asm
;
; Abstract:
;
; AsmFlushCacheLine function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID *
; EFIAPI
; AsmFlushCacheLine (
; IN VOID *LinearAddress
; );
;------------------------------------------------------------------------------
AsmFlushCacheLine PROC
clflush [rcx]
mov rax, rcx
ret
AsmFlushCacheLine ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; FxRestore.Asm
;
; Abstract:
;
; AsmFxRestore function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86FxRestore (
; IN CONST IA32_FX_BUFFER *Buffer
; );
;------------------------------------------------------------------------------
InternalX86FxRestore PROC
fxrstor [rcx]
ret
InternalX86FxRestore ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; FxSave.Asm
;
; Abstract:
;
; AsmFxSave function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86FxSave (
; OUT IA32_FX_BUFFER *Buffer
; );
;------------------------------------------------------------------------------
InternalX86FxSave PROC
fxsave [rcx]
ret
InternalX86FxSave ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; Invd.Asm
;
; Abstract:
;
; AsmInvd function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmInvd (
; VOID
; );
;------------------------------------------------------------------------------
AsmInvd PROC
invd
ret
AsmInvd ENDP
END

View File

@@ -1,58 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; LongJump.Asm
;
; Abstract:
;
; Implementation of _LongJump() on x64.
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalLongJump (
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
; IN UINTN Value
; );
;------------------------------------------------------------------------------
InternalLongJump PROC
mov rbx, [rcx]
mov rsp, [rcx + 8]
mov rbp, [rcx + 10h]
mov rdi, [rcx + 18h]
mov rsi, [rcx + 20h]
mov r12, [rcx + 28h]
mov r13, [rcx + 30h]
mov r14, [rcx + 38h]
mov r15, [rcx + 40h]
; load non-volatile fp registers
ldmxcsr [rcx + 50h]
movdqu xmm6, [rcx + 58h]
movdqu xmm7, [rcx + 68h]
movdqu xmm8, [rcx + 78h]
movdqu xmm9, [rcx + 88h]
movdqu xmm10, [rcx + 98h]
movdqu xmm11, [rcx + 0A8h]
movdqu xmm12, [rcx + 0B8h]
movdqu xmm13, [rcx + 0C8h]
movdqu xmm14, [rcx + 0D8h]
movdqu xmm15, [rcx + 0E8h]
mov rax, rdx ; set return value
jmp qword ptr [rcx + 48h]
InternalLongJump ENDP
END

View File

@@ -1,43 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; Monitor.Asm
;
; Abstract:
;
; AsmMonitor function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmMonitor (
; IN UINTN Eax,
; IN UINTN Ecx,
; IN UINTN Edx
; );
;------------------------------------------------------------------------------
AsmMonitor PROC
mov eax, ecx
mov ecx, edx
mov edx, r8d
DB 0fh, 1, 0c8h ; monitor
ret
AsmMonitor ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; Mwait.Asm
;
; Abstract:
;
; AsmMwait function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmMwait (
; IN UINTN Eax,
; IN UINTN Ecx
; );
;------------------------------------------------------------------------------
AsmMwait PROC
mov eax, ecx
mov ecx, edx
DB 0fh, 1, 0c9h ; mwait
ret
AsmMwait ENDP
END

View File

@@ -1,83 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
; 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:
;
; RdRand.asm
;
; Abstract:
;
; Generates random number through CPU RdRand instruction under 64-bit platform.
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; Generates a 16 bit random number through RDRAND instruction.
; Return TRUE if Rand generated successfully, or FALSE if not.
;
; BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand);
;------------------------------------------------------------------------------
InternalX86RdRand16 PROC
; rdrand ax ; generate a 16 bit RN into eax,
; CF=1 if RN generated ok, otherwise CF=0
db 0fh, 0c7h, 0f0h ; rdrand r16: "0f c7 /6 ModRM:r/m(w)"
jc rn16_ok ; jmp if CF=1
xor rax, rax ; reg=0 if CF=0
ret ; return with failure status
rn16_ok:
mov [rcx], ax
mov rax, 1
ret
InternalX86RdRand16 ENDP
;------------------------------------------------------------------------------
; Generates a 32 bit random number through RDRAND instruction.
; Return TRUE if Rand generated successfully, or FALSE if not.
;
; BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand);
;------------------------------------------------------------------------------
InternalX86RdRand32 PROC
; rdrand eax ; generate a 32 bit RN into eax,
; CF=1 if RN generated ok, otherwise CF=0
db 0fh, 0c7h, 0f0h ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"
jc rn32_ok ; jmp if CF=1
xor rax, rax ; reg=0 if CF=0
ret ; return with failure status
rn32_ok:
mov [rcx], eax
mov rax, 1
ret
InternalX86RdRand32 ENDP
;------------------------------------------------------------------------------
; Generates a 64 bit random number through one RDRAND instruction.
; Return TRUE if Rand generated successfully, or FALSE if not.
;
; BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Random);
;------------------------------------------------------------------------------
InternalX86RdRand64 PROC
; rdrand rax ; generate a 64 bit RN into rax,
; CF=1 if RN generated ok, otherwise CF=0
db 048h, 0fh, 0c7h, 0f0h ; rdrand r64: "REX.W + 0f c7 /6 ModRM:r/m(w)"
jc rn64_ok ; jmp if CF=1
xor rax, rax ; reg=0 if CF=0
ret ; return with failure status
rn64_ok:
mov [rcx], rax
mov rax, 1
ret
InternalX86RdRand64 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadCr0.Asm
;
; Abstract:
;
; AsmReadCr0 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadCr0 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadCr0 PROC
mov rax, cr0
ret
AsmReadCr0 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadCr2.Asm
;
; Abstract:
;
; AsmReadCr2 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadCr2 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadCr2 PROC
mov rax, cr2
ret
AsmReadCr2 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadCr3.Asm
;
; Abstract:
;
; AsmReadCr3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadCr3 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadCr3 PROC
mov rax, cr3
ret
AsmReadCr3 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadCr4.Asm
;
; Abstract:
;
; AsmReadCr4 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadCr4 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadCr4 PROC
mov rax, cr4
ret
AsmReadCr4 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadCs.Asm
;
; Abstract:
;
; AsmReadCs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadCs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadCs PROC
mov eax, cs
ret
AsmReadCs ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr0.Asm
;
; Abstract:
;
; AsmReadDr0 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr0 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr0 PROC
mov rax, dr0
ret
AsmReadDr0 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr1.Asm
;
; Abstract:
;
; AsmReadDr1 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr1 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr1 PROC
mov rax, dr1
ret
AsmReadDr1 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr2.Asm
;
; Abstract:
;
; AsmReadDr2 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr2 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr2 PROC
mov rax, dr2
ret
AsmReadDr2 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr3.Asm
;
; Abstract:
;
; AsmReadDr3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr3 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr3 PROC
mov rax, dr3
ret
AsmReadDr3 ENDP
END

View File

@@ -1,42 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr4.Asm
;
; Abstract:
;
; AsmReadDr4 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr4 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr4 PROC
;
; There's no obvious reason to access this register, since it's aliased to
; DR7 when DE=0 or an exception generated when DE=1
;
DB 0fh, 21h, 0e0h
ret
AsmReadDr4 ENDP
END

View File

@@ -1,42 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr5.Asm
;
; Abstract:
;
; AsmReadDr5 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr5 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr5 PROC
;
; There's no obvious reason to access this register, since it's aliased to
; DR7 when DE=0 or an exception generated when DE=1
;
DB 0fh, 21h, 0e8h
ret
AsmReadDr5 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr6.Asm
;
; Abstract:
;
; AsmReadDr6 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr6 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr6 PROC
mov rax, dr6
ret
AsmReadDr6 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDr7.Asm
;
; Abstract:
;
; AsmReadDr7 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadDr7 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDr7 PROC
mov rax, dr7
ret
AsmReadDr7 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadDs.Asm
;
; Abstract:
;
; AsmReadDs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadDs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadDs PROC
mov eax, ds
ret
AsmReadDs ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadEflags.Asm
;
; Abstract:
;
; AsmReadEflags function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmReadEflags (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadEflags PROC
pushfq
pop rax
ret
AsmReadEflags ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadEs.Asm
;
; Abstract:
;
; AsmReadEs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadEs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadEs PROC
mov eax, es
ret
AsmReadEs ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadFs.Asm
;
; Abstract:
;
; AsmReadFs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadFs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadFs PROC
mov eax, fs
ret
AsmReadFs ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadGdtr.Asm
;
; Abstract:
;
; AsmReadGdtr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86ReadGdtr (
; OUT IA32_DESCRIPTOR *Gdtr
; );
;------------------------------------------------------------------------------
InternalX86ReadGdtr PROC
sgdt fword ptr [rcx]
ret
InternalX86ReadGdtr ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadGs.Asm
;
; Abstract:
;
; AsmReadGs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadGs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadGs PROC
mov eax, gs
ret
AsmReadGs ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadIdtr.Asm
;
; Abstract:
;
; AsmReadIdtr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86ReadIdtr (
; OUT IA32_DESCRIPTOR *Idtr
; );
;------------------------------------------------------------------------------
InternalX86ReadIdtr PROC
sidt fword ptr [rcx]
ret
InternalX86ReadIdtr ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadLdtr.Asm
;
; Abstract:
;
; AsmReadLdtr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadLdtr (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadLdtr PROC
sldt eax
ret
AsmReadLdtr ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm0.Asm
;
; Abstract:
;
; AsmReadMm0 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm0 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm0 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0c0h
ret
AsmReadMm0 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm1.Asm
;
; Abstract:
;
; AsmReadMm1 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm1 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm1 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0c8h
ret
AsmReadMm1 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm2.Asm
;
; Abstract:
;
; AsmReadMm2 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm2 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm2 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0d0h
ret
AsmReadMm2 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm3.Asm
;
; Abstract:
;
; AsmReadMm3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm3 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm3 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0d8h
ret
AsmReadMm3 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm4.Asm
;
; Abstract:
;
; AsmReadMm4 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm4 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm4 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0e0h
ret
AsmReadMm4 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm5.Asm
;
; Abstract:
;
; AsmReadMm5 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm5 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm5 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0e8h
ret
AsmReadMm5 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm6.Asm
;
; Abstract:
;
; AsmReadMm6 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm6 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm6 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0f0h
ret
AsmReadMm6 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMm7.Asm
;
; Abstract:
;
; AsmReadMm7 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm7 (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadMm7 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 7eh, 0f8h
ret
AsmReadMm7 ENDP
END

View File

@@ -1,40 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadMsr64.Asm
;
; Abstract:
;
; AsmReadMsr64 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMsr64 (
; IN UINT32 Index
; );
;------------------------------------------------------------------------------
AsmReadMsr64 PROC
rdmsr ; edx & eax are zero extended
shl rdx, 20h
or rax, rdx
ret
AsmReadMsr64 ENDP
END

View File

@@ -1,40 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadPmc.Asm
;
; Abstract:
;
; AsmReadPmc function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadPmc (
; IN UINT32 PmcIndex
; );
;------------------------------------------------------------------------------
AsmReadPmc PROC
rdpmc
shl rdx, 20h
or rax, rdx
ret
AsmReadPmc ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadSs.Asm
;
; Abstract:
;
; AsmReadSs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadSs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadSs PROC
mov eax, ss
ret
AsmReadSs ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadTr.Asm
;
; Abstract:
;
; AsmReadTr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadTr (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadTr PROC
str eax
ret
AsmReadTr ENDP
END

View File

@@ -1,40 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; ReadTsc.Asm
;
; Abstract:
;
; AsmReadTsc function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadTsc (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadTsc PROC
rdtsc
shl rdx, 20h
or rax, rdx
ret
AsmReadTsc ENDP
END

View File

@@ -1,66 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; SetJump.Asm
;
; Abstract:
;
; Implementation of SetJump() on x64.
;
;------------------------------------------------------------------------------
.code
EXTERN InternalAssertJumpBuffer:PROC
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; SetJump (
; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
; );
;------------------------------------------------------------------------------
SetJump PROC
push rcx
add rsp, -20h
call InternalAssertJumpBuffer
add rsp, 20h
pop rcx
pop rdx
mov [rcx], rbx
mov [rcx + 8], rsp
mov [rcx + 10h], rbp
mov [rcx + 18h], rdi
mov [rcx + 20h], rsi
mov [rcx + 28h], r12
mov [rcx + 30h], r13
mov [rcx + 38h], r14
mov [rcx + 40h], r15
mov [rcx + 48h], rdx
; save non-volatile fp registers
stmxcsr [rcx + 50h]
movdqu [rcx + 58h], xmm6
movdqu [rcx + 68h], xmm7
movdqu [rcx + 78h], xmm8
movdqu [rcx + 88h], xmm9
movdqu [rcx + 98h], xmm10
movdqu [rcx + 0A8h], xmm11
movdqu [rcx + 0B8h], xmm12
movdqu [rcx + 0C8h], xmm13
movdqu [rcx + 0D8h], xmm14
movdqu [rcx + 0E8h], xmm15
xor rax, rax
jmp rdx
SetJump ENDP
END

View File

@@ -1,51 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; SwitchStack.Asm
;
; Abstract:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; Routine Description:
;
; Routine for switching stacks with 2 parameters
;
; Arguments:
;
; (rcx) EntryPoint - Entry point with new stack.
; (rdx) Context1 - Parameter1 for entry point.
; (r8) Context2 - Parameter2 for entry point.
; (r9) NewStack - The pointer to new stack.
;
; Returns:
;
; None
;
;------------------------------------------------------------------------------
InternalSwitchStack PROC
mov rax, rcx
mov rcx, rdx
mov rdx, r8
;
; Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
; in case the callee wishes to spill them.
;
lea rsp, [r9 - 20h]
call rax
InternalSwitchStack ENDP
END

View File

@@ -1,315 +0,0 @@
#include "BaseLibInternals.h"
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
; 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:
;
; Thunk.asm
;
; Abstract:
;
; Real mode thunk
;
;------------------------------------------------------------------------------
EXTERNDEF m16Start:BYTE
EXTERNDEF m16Size:WORD
EXTERNDEF mThunk16Attr:WORD
EXTERNDEF m16Gdt:WORD
EXTERNDEF m16GdtrBase:WORD
EXTERNDEF mTransition:WORD
IA32_REGS STRUC 4t
_EDI DD ?
_ESI DD ?
_EBP DD ?
_ESP DD ?
_EBX DD ?
_EDX DD ?
_ECX DD ?
_EAX DD ?
_DS DW ?
_ES DW ?
_FS DW ?
_GS DW ?
_EFLAGS DQ ?
_EIP DD ?
_CS DW ?
_SS DW ?
IA32_REGS ENDS
.const
m16Size DW InternalAsmThunk16 - m16Start
mThunk16Attr DW _ThunkAttr - m16Start
m16Gdt DW _NullSeg - m16Start
m16GdtrBase DW _16GdtrBase - m16Start
mTransition DW _EntryPoint - m16Start
.code
m16Start LABEL BYTE
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
;
; The order of saved registers on the stack matches the order they appears
; in IA32_REGS structure. This facilitates wrapper function to extract them
; into that structure.
;
; Some instructions for manipulation of segment registers have to be written
; in opcode since 64-bit MASM prevents accesses to those registers.
;
DB 16h ; push ss
DB 0eh ; push cs
DB 66h
call @Base ; push eip
@Base:
DB 66h
push 0 ; reserved high order 32 bits of EFlags
pushf ; pushfd actually
cli ; disable interrupts
push gs
push fs
DB 6 ; push es
DB 1eh ; push ds
DB 66h, 60h ; pushad
DB 66h, 0bah ; mov edx, imm32
_ThunkAttr DD ?
test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15
jz @1
mov eax, 15cd2401h ; mov ax, 2401h & int 15h
cli ; disable interrupts
jnc @2
@1:
test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL
jz @2
in al, 92h
or al, 2
out 92h, al ; deactivate A20M#
@2:
xor ax, ax ; xor eax, eax
mov eax, ss ; mov ax, ss
lea bp, [esp + sizeof (IA32_REGS)]
;
; rsi in the following 2 instructions is indeed bp in 16-bit code
;
mov word ptr (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._ESP, bp
DB 66h
mov ebx, (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._EIP
shl ax, 4 ; shl eax, 4
add bp, ax ; add ebp, eax
mov ax, cs
shl ax, 4
lea ax, [eax + ebx + (@64BitCode - @Base)]
DB 66h, 2eh, 89h, 87h ; mov cs:[bx + (@64Eip - @Base)], eax
DW @64Eip - @Base
DB 66h, 0b8h ; mov eax, imm32
SavedCr4 DD ?
mov cr4, rax
;
; rdi in the instruction below is indeed bx in 16-bit code
;
DB 66h, 2eh ; 2eh is "cs:" segment override
lgdt fword ptr [rdi + (SavedGdt - @Base)]
DB 66h
mov ecx, 0c0000080h
rdmsr
or ah, 1
wrmsr
DB 66h, 0b8h ; mov eax, imm32
SavedCr0 DD ?
mov cr0, rax
DB 66h, 0eah ; jmp far cs:@64Bit
@64Eip DD ?
SavedCs DW ?
@64BitCode:
db 090h
db 048h, 0bch ; mov rsp, imm64
SavedSp DQ ? ; restore stack
nop
ret
_BackFromUserCode ENDP
_EntryPoint DD _ToUserCode - m16Start
DW CODE16
_16Gdtr LABEL FWORD
DW GDT_SIZE - 1
_16GdtrBase DQ _NullSeg
_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 ss, edx ; set new segment selectors
mov ds, edx
mov es, edx
mov fs, edx
mov gs, edx
DB 66h
mov ecx, 0c0000080h
mov cr0, rax ; real mode starts at next instruction
rdmsr
and ah, NOT 1
wrmsr
mov cr4, rbp
mov ss, esi ; set up 16-bit stack segment
mov sp, bx ; set up 16-bit stack pointer
DB 66h ; make the following call 32-bit
call @Base ; push eip
@Base:
pop bp ; ebp <- address of @Base
push [esp + sizeof (IA32_REGS) + 2]
lea eax, [rsi + (@RealMode - @Base)] ; rsi is "bp" in 16-bit code
push rax
retf ; execution begins at next instruction
@RealMode:
DB 66h, 2eh ; CS and operand size override
lidt fword ptr [rsi + (_16Idtr - @Base)]
DB 66h, 61h ; popad
DB 1fh ; pop ds
DB 07h ; pop es
pop fs
pop gs
popf ; popfd
lea sp, [esp + 4] ; skip high order 32 bits of EFlags
DB 66h ; make the following retf 32-bit
retf ; transfer control to user code
_ToUserCode ENDP
CODE16 = _16Code - $
DATA16 = _16Data - $
DATA32 = _32Data - $
_NullSeg DQ 0
_16Code LABEL QWORD
DW -1
DW 0
DB 0
DB 9bh
DB 8fh ; 16-bit segment, 4GB limit
DB 0
_16Data LABEL QWORD
DW -1
DW 0
DB 0
DB 93h
DB 8fh ; 16-bit segment, 4GB limit
DB 0
_32Data LABEL QWORD
DW -1
DW 0
DB 0
DB 93h
DB 0cfh ; 16-bit segment, 4GB limit
DB 0
GDT_SIZE = $ - _NullSeg
;------------------------------------------------------------------------------
; IA32_REGISTER_SET *
; EFIAPI
; InternalAsmThunk16 (
; IN IA32_REGISTER_SET *RegisterSet,
; IN OUT VOID *Transition
; );
;------------------------------------------------------------------------------
InternalAsmThunk16 PROC USES rbp rbx rsi rdi
mov rbx, ds
push rbx ; Save ds segment register on the stack
mov rbx, es
push rbx ; Save es segment register on the stack
mov rbx, ss
push rbx ; Save ss segment register on the stack
push fs
push gs
mov rsi, rcx
movzx r8d, (IA32_REGS ptr [rsi])._SS
mov edi, (IA32_REGS ptr [rsi])._ESP
lea rdi, [edi - (sizeof (IA32_REGS) + 4)]
imul eax, r8d, 16 ; eax <- r8d(stack segment) * 16
mov ebx, edi ; ebx <- stack for 16-bit code
push sizeof (IA32_REGS) / 4
add edi, eax ; edi <- linear address of 16-bit stack
pop rcx
rep movsd ; copy RegSet
lea ecx, [rdx + (SavedCr4 - m16Start)]
mov eax, edx ; eax <- transition code address
and edx, 0fh
shl eax, 12 ; segment address in high order 16 bits
lea ax, [rdx + (_BackFromUserCode - m16Start)] ; offset address
stosd ; [edi] <- return address of user code
sgdt fword ptr [rsp + 60h] ; save GDT stack in argument space
movzx r10, word ptr [rsp + 60h] ; r10 <- GDT limit
lea r11, [rcx + (InternalAsmThunk16 - SavedCr4) + 0xf]
and r11, 0xfffffff0 ; r11 <- 16-byte aligned shadowed GDT table in real mode buffer
mov word ptr [rcx + (SavedGdt - SavedCr4)], r10w ; save the limit of shadowed GDT table
mov qword ptr [rcx + (SavedGdt - SavedCr4) + 2], r11 ; save the base address of shadowed GDT table
mov rsi, qword ptr [rsp + 62h] ; rsi <- the original GDT base address
xchg rcx, r10 ; save rcx to r10 and initialize rcx to be the limit of GDT table
inc rcx ; rcx <- the size of memory to copy
xchg rdi, r11 ; save rdi to r11 and initialize rdi to the base address of shadowed GDT table
rep movsb ; perform memory copy to shadow GDT table
mov rcx, r10 ; restore the orignal rcx before memory copy
mov rdi, r11 ; restore the original rdi before memory copy
sidt fword ptr [rsp + 50h] ; save IDT stack in argument space
mov rax, cr0
mov [rcx + (SavedCr0 - SavedCr4)], eax
and eax, 7ffffffeh ; clear PE, PG bits
mov rbp, cr4
mov [rcx], ebp ; save CR4 in SavedCr4
and ebp, NOT 30h ; clear PAE, PSE bits
mov esi, r8d ; esi <- 16-bit stack segment
DB 6ah, DATA32 ; push DATA32
pop rdx ; rdx <- 32-bit data segment selector
lgdt fword ptr [rcx + (_16Gdtr - SavedCr4)]
mov ss, edx
pushfq
lea edx, [rdx + DATA16 - DATA32]
lea r8, @RetFromRealMode
push r8
mov r8d, cs
mov [rcx + (SavedCs - SavedCr4)], r8w
mov [rcx + (SavedSp - SavedCr4)], rsp
jmp fword ptr [rcx + (_EntryPoint - SavedCr4)]
@RetFromRealMode:
popfq
lgdt fword ptr [rsp + 60h] ; restore protected mode GDTR
lidt fword ptr [rsp + 50h] ; restore protected mode IDTR
lea eax, [rbp - sizeof (IA32_REGS)]
pop gs
pop fs
pop rbx
mov ss, rbx
pop rbx
mov es, rbx
pop rbx
mov ds, rbx
ret
InternalAsmThunk16 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; Wbinvd.Asm
;
; Abstract:
;
; AsmWbinvd function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWbinvd (
; VOID
; );
;------------------------------------------------------------------------------
AsmWbinvd PROC
wbinvd
ret
AsmWbinvd ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteCr0.Asm
;
; Abstract:
;
; AsmWriteCr0 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr0 (
; UINTN Cr0
; );
;------------------------------------------------------------------------------
AsmWriteCr0 PROC
mov cr0, rcx
mov rax, rcx
ret
AsmWriteCr0 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteCr2.Asm
;
; Abstract:
;
; AsmWriteCr2 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr2 (
; UINTN Cr2
; );
;------------------------------------------------------------------------------
AsmWriteCr2 PROC
mov cr2, rcx
mov rax, rcx
ret
AsmWriteCr2 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteCr3.Asm
;
; Abstract:
;
; AsmWriteCr3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr3 (
; UINTN Cr3
; );
;------------------------------------------------------------------------------
AsmWriteCr3 PROC
mov cr3, rcx
mov rax, rcx
ret
AsmWriteCr3 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteCr4.Asm
;
; Abstract:
;
; AsmWriteCr4 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr4 (
; UINTN Cr4
; );
;------------------------------------------------------------------------------
AsmWriteCr4 PROC
mov cr4, rcx
mov rax, rcx
ret
AsmWriteCr4 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr0.Asm
;
; Abstract:
;
; AsmWriteDr0 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr0 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr0 PROC
mov dr0, rcx
mov rax, rcx
ret
AsmWriteDr0 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr1.Asm
;
; Abstract:
;
; AsmWriteDr1 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr1 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr1 PROC
mov dr1, rcx
mov rax, rcx
ret
AsmWriteDr1 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr2.Asm
;
; Abstract:
;
; AsmWriteDr2 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr2 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr2 PROC
mov dr2, rcx
mov rax, rcx
ret
AsmWriteDr2 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr3.Asm
;
; Abstract:
;
; AsmWriteDr3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr3 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr3 PROC
mov dr3, rcx
mov rax, rcx
ret
AsmWriteDr3 ENDP
END

View File

@@ -1,43 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr4.Asm
;
; Abstract:
;
; AsmWriteDr4 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr4 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr4 PROC
;
; There's no obvious reason to access this register, since it's aliased to
; DR6 when DE=0 or an exception generated when DE=1
;
DB 0fh, 23h, 0e1h
mov rax, rcx
ret
AsmWriteDr4 ENDP
END

View File

@@ -1,43 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr5.Asm
;
; Abstract:
;
; AsmWriteDr5 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr5 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr5 PROC
;
; There's no obvious reason to access this register, since it's aliased to
; DR7 when DE=0 or an exception generated when DE=1
;
DB 0fh, 23h, 0e9h
mov rax, rcx
ret
AsmWriteDr5 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr6.Asm
;
; Abstract:
;
; AsmWriteDr6 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr6 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr6 PROC
mov dr6, rcx
mov rax, rcx
ret
AsmWriteDr6 ENDP
END

View File

@@ -1,39 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteDr7.Asm
;
; Abstract:
;
; AsmWriteDr7 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr7 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr7 PROC
mov dr7, rcx
mov rax, rcx
ret
AsmWriteDr7 ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteGdtr.Asm
;
; Abstract:
;
; AsmWriteGdtr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86WriteGdtr (
; IN CONST IA32_DESCRIPTOR *Idtr
; );
;------------------------------------------------------------------------------
InternalX86WriteGdtr PROC
lgdt fword ptr [rcx]
ret
InternalX86WriteGdtr ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteIdtr.Asm
;
; Abstract:
;
; AsmWriteIdtr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86WriteIdtr (
; IN CONST IA32_DESCRIPTOR *Idtr
; );
;------------------------------------------------------------------------------
InternalX86WriteIdtr PROC
pushfq
cli
lidt fword ptr [rcx]
popfq
ret
InternalX86WriteIdtr ENDP
END

View File

@@ -1,38 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteLdtr.Asm
;
; Abstract:
;
; AsmWriteLdtr function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteLdtr (
; IN UINT16 Ldtr
; );
;------------------------------------------------------------------------------
AsmWriteLdtr PROC
lldt cx
ret
AsmWriteLdtr ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm0.Asm
;
; Abstract:
;
; AsmWriteMm0 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm0 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm0 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0c1h
ret
AsmWriteMm0 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm1.Asm
;
; Abstract:
;
; AsmWriteMm1 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm1 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm1 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0c9h
ret
AsmWriteMm1 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm2.Asm
;
; Abstract:
;
; AsmWriteMm2 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm2 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm2 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0d1h
ret
AsmWriteMm2 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm3.Asm
;
; Abstract:
;
; AsmWriteMm3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm3 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm3 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0d9h
ret
AsmWriteMm3 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm4.Asm
;
; Abstract:
;
; AsmWriteMm4 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm4 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm4 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0e1h
ret
AsmWriteMm4 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm5.Asm
;
; Abstract:
;
; AsmWriteMm5 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm5 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm5 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0e9h
ret
AsmWriteMm5 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm6.Asm
;
; Abstract:
;
; AsmWriteMm6 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm6 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm6 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0f1h
ret
AsmWriteMm6 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMm7.Asm
;
; Abstract:
;
; AsmWriteMm7 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm7 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm7 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0f9h
ret
AsmWriteMm7 ENDP
END

View File

@@ -1,41 +0,0 @@
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; 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:
;
; WriteMsr64.Asm
;
; Abstract:
;
; AsmWriteMsr64 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmWriteMsr64 (
; IN UINT32 Index,
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMsr64 PROC
mov rax, rdx ; meanwhile, rax <- return value
shr rdx, 20h ; edx:eax contains the value to write
wrmsr
ret
AsmWriteMsr64 ENDP
END