Update to make end-of-line consistent for all source files in MdePkg. There are no other updates besides that change.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9160 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2009-08-20 08:19:39 +00:00
parent ec25b43fbd
commit b341712e31
133 changed files with 7253 additions and 7253 deletions

View File

@@ -1,54 +1,54 @@
#*****************************************************************************
#*
#* Copyright (c) 2006, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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:
#*
#* Fx.asm
#*
#* Abstract:
#*
#* AsmFxRestore and AsmFxSave function
#*
#include <EfiBind.h>
#------------------------------------------------------------------------------
.586P:
#.MODEL flat,C
.xmm:
.code:
#------------------------------------------------------------------------------
.globl ASM_PFX(AsmFxSave)
.globl ASM_PFX(AsmFxRestore)
#------------------------------------------------------------------------------
# VOID
# AsmFxSave (
# OUT IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxSave):
movl 4(%esp), %eax
fxsave (%eax)
ret
#AsmFxSave ENDP
#------------------------------------------------------------------------------
# VOID
# AsmFxRestore (
# IN CONST IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxRestore):
movl 4(%esp), %eax
fxrstor (%eax)
ret
#AsmFxRestore ENDP
#*****************************************************************************
#*
#* Copyright (c) 2006, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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:
#*
#* Fx.asm
#*
#* Abstract:
#*
#* AsmFxRestore and AsmFxSave function
#*
#include <EfiBind.h>
#------------------------------------------------------------------------------
.586P:
#.MODEL flat,C
.xmm:
.code:
#------------------------------------------------------------------------------
.globl ASM_PFX(AsmFxSave)
.globl ASM_PFX(AsmFxRestore)
#------------------------------------------------------------------------------
# VOID
# AsmFxSave (
# OUT IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxSave):
movl 4(%esp), %eax
fxsave (%eax)
ret
#AsmFxSave ENDP
#------------------------------------------------------------------------------
# VOID
# AsmFxRestore (
# IN CONST IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxRestore):
movl 4(%esp), %eax
fxrstor (%eax)
ret
#AsmFxRestore ENDP

View File

@@ -1,183 +1,183 @@
#*****************************************************************************
#*
#* Copyright (c) 2006 - 2007, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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
#*
#*****************************************************************************
#include <EfiBind.h>
.686p:
.globl ASM_PFX(mCode16Size)
.data
mCode16Size: .long _TEXT16SIZE
.data
NullSegSel: .quad 0
_16BitCsSel:
.word -1
.word 0
.byte 0
.byte 0x9b
.byte 0x8f # 16-bit segment
.byte 0
_16BitSsSel:
.word -1
.word 0
.byte 0
.byte 0x93
.byte 0x8f # 16-bit segment
.byte 0
_16Gdtr:
.word _16Gdtr - NullSegSel - 1
.long NullSegSel
.text
.align 16
ASM_PFX(Thunk16):
push %ebp
push %ebx
push %esi
push %edi
push %ds
push %es
push %fs
push %gs
mov 0x24(%esp),%esi
movzwl 0x32(%esi),%edx
mov 0xc(%esi),%edi
add $0xffffffb0,%edi
push %edi #; save stack offset
imul $0x10,%edx,%eax #; eax <- edx*16
add %eax,%edi #; edi <- linear address of 16-bit stack
push $0xd
pop %ecx
rep movsl %ds:(%esi),%es:(%edi) #; copy context to 16-bit stack
pop %ebx #; ebx <- 16-bit stack offset
mov $L_Label1,%eax
stos %eax,%es:(%edi)
movl %cs,%eax
stos %ax,%es:(%edi)
mov 0x28(%esp),%eax
stos %ax,%es:(%edi)
mov %esp,%eax
stos %eax,%es:(%edi)
movl %ss,%eax
stos %ax,%es:(%edi)
sgdtl (%edi)
sidtl 0x24(%esp)
mov %cr0,%esi
mov %esi,0x6(%edi) #; save CR0
and $0x7ffffffe,%esi #; esi <- CR0 to set
mov %cr4,%eax
mov %eax,0xa(%edi) #; save CR4
and $0xcf,%al #; clear PAE & PSE
mov %edx,%edi #; edi <- 16-bit stack segment
mov 0x2c(%esp),%edx
shl $0x10,%edx
push %edx
pop %edx
mov $(_16BitSsSel - NullSegSel),%dx
lgdtl _16Gdtr #bugbug mismatch.
.byte 0xea
.long L_16Bit #bugbug mismatch.
.word _16BitCsSel - NullSegSel
L_16Bit:
.byte 0x66
movw %dx,%ss
mov %esi,%cr0
mov %eax,%cr4
.byte 0x67
.byte 0xff
.byte 0x6c
.byte 0x24
.byte 0xfc
L_Lable1:
movl %ss,%eax
shl $0x4,%eax
add %esp,%eax
lss 0x3c(%esp),%esp
lidtl 0x24(%esp)
pop %gs
pop %fs
pop %es
pop %ds
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.code16
_Code16Addr:
ASM_PFX(RealMode):
movw %di, %ss # set up stack
movl %ebx, %esp
lidt %cs:_16Idtr - _Code16Addr #lidt fword ptr cs:[_16Idtr - _Code16Addr]
.byte 0x66
popaw
popw %ds
popw %es
popw %fs
popw %gs
addw $4, %sp # skip EFlags
testw $1, 14(%esp) #(_STK16 ptr [esp + 8]).ThunkFlags, 1
jz 1f
pushf
1:
pushw %cs
# push @FarCallRet - _Code16Addr
.byte 0x68 # push /iw
.word FarCallRet - _Code16Addr
jz 2f
ljmp *6(%esp) #bugbug
2:
ljmp *4(%esp) #bugbug
FarCallRet:
pushfl
pushw %gs
pushw %fs
pushw %es
pushw %ds
pushal
cli
.byte 0x66 # sizeof (IA32_REGS) = 13 * 4 = 52
lgdt 66(%esp) #lgdt (_STK16 ptr [esp + sizeof (IA32_REGS)]).SavedGdtr
mov 76(%esp), %eax
movl %eax, %cr4
mov 72(%esp), %eax
movl %eax, %cr0 # restore CR0
ljmpl *52(%esp)
#RealMode ENDP
.text
_16Idtr:
.word 0x3ff #_16Idtr FWORD (1 SHL 10) - 1
.byte 0x00
_TEXT16END:
_TEXT16SIZE = _TEXT16END - _Code16Addr
#*****************************************************************************
#*
#* Copyright (c) 2006 - 2007, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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
#*
#*****************************************************************************
#include <EfiBind.h>
.686p:
.globl ASM_PFX(mCode16Size)
.data
mCode16Size: .long _TEXT16SIZE
.data
NullSegSel: .quad 0
_16BitCsSel:
.word -1
.word 0
.byte 0
.byte 0x9b
.byte 0x8f # 16-bit segment
.byte 0
_16BitSsSel:
.word -1
.word 0
.byte 0
.byte 0x93
.byte 0x8f # 16-bit segment
.byte 0
_16Gdtr:
.word _16Gdtr - NullSegSel - 1
.long NullSegSel
.text
.align 16
ASM_PFX(Thunk16):
push %ebp
push %ebx
push %esi
push %edi
push %ds
push %es
push %fs
push %gs
mov 0x24(%esp),%esi
movzwl 0x32(%esi),%edx
mov 0xc(%esi),%edi
add $0xffffffb0,%edi
push %edi #; save stack offset
imul $0x10,%edx,%eax #; eax <- edx*16
add %eax,%edi #; edi <- linear address of 16-bit stack
push $0xd
pop %ecx
rep movsl %ds:(%esi),%es:(%edi) #; copy context to 16-bit stack
pop %ebx #; ebx <- 16-bit stack offset
mov $L_Label1,%eax
stos %eax,%es:(%edi)
movl %cs,%eax
stos %ax,%es:(%edi)
mov 0x28(%esp),%eax
stos %ax,%es:(%edi)
mov %esp,%eax
stos %eax,%es:(%edi)
movl %ss,%eax
stos %ax,%es:(%edi)
sgdtl (%edi)
sidtl 0x24(%esp)
mov %cr0,%esi
mov %esi,0x6(%edi) #; save CR0
and $0x7ffffffe,%esi #; esi <- CR0 to set
mov %cr4,%eax
mov %eax,0xa(%edi) #; save CR4
and $0xcf,%al #; clear PAE & PSE
mov %edx,%edi #; edi <- 16-bit stack segment
mov 0x2c(%esp),%edx
shl $0x10,%edx
push %edx
pop %edx
mov $(_16BitSsSel - NullSegSel),%dx
lgdtl _16Gdtr #bugbug mismatch.
.byte 0xea
.long L_16Bit #bugbug mismatch.
.word _16BitCsSel - NullSegSel
L_16Bit:
.byte 0x66
movw %dx,%ss
mov %esi,%cr0
mov %eax,%cr4
.byte 0x67
.byte 0xff
.byte 0x6c
.byte 0x24
.byte 0xfc
L_Lable1:
movl %ss,%eax
shl $0x4,%eax
add %esp,%eax
lss 0x3c(%esp),%esp
lidtl 0x24(%esp)
pop %gs
pop %fs
pop %es
pop %ds
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.code16
_Code16Addr:
ASM_PFX(RealMode):
movw %di, %ss # set up stack
movl %ebx, %esp
lidt %cs:_16Idtr - _Code16Addr #lidt fword ptr cs:[_16Idtr - _Code16Addr]
.byte 0x66
popaw
popw %ds
popw %es
popw %fs
popw %gs
addw $4, %sp # skip EFlags
testw $1, 14(%esp) #(_STK16 ptr [esp + 8]).ThunkFlags, 1
jz 1f
pushf
1:
pushw %cs
# push @FarCallRet - _Code16Addr
.byte 0x68 # push /iw
.word FarCallRet - _Code16Addr
jz 2f
ljmp *6(%esp) #bugbug
2:
ljmp *4(%esp) #bugbug
FarCallRet:
pushfl
pushw %gs
pushw %fs
pushw %es
pushw %ds
pushal
cli
.byte 0x66 # sizeof (IA32_REGS) = 13 * 4 = 52
lgdt 66(%esp) #lgdt (_STK16 ptr [esp + sizeof (IA32_REGS)]).SavedGdtr
mov 76(%esp), %eax
movl %eax, %cr4
mov 72(%esp), %eax
movl %eax, %cr0 # restore CR0
ljmpl *52(%esp)
#RealMode ENDP
.text
_16Idtr:
.word 0x3ff #_16Idtr FWORD (1 SHL 10) - 1
.byte 0x00
_TEXT16END:
_TEXT16SIZE = _TEXT16END - _Code16Addr

View File

@@ -1,48 +1,48 @@
#*****************************************************************************
#*
#* Copyright (c) 2008, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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:
#*
#* Fx.S
#*
#* Abstract:
#*
#* AsmFxRestore and AsmFxSave function
#*
#*****************************************************************************
#include <EfiBind.h>
.global ASM_PFX(AsmFxSave)
.global ASM_PFX(AsmFxRestore)
.text
#------------------------------------------------------------------------------
# VOID
# AsmFxSave (
# OUT IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxSave):
fxsave (%rcx)
retq
#------------------------------------------------------------------------------
# VOID
# AsmFxRestore (
# IN CONST IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxRestore):
fxrstor (%rcx)
retq
#*****************************************************************************
#*
#* Copyright (c) 2008, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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:
#*
#* Fx.S
#*
#* Abstract:
#*
#* AsmFxRestore and AsmFxSave function
#*
#*****************************************************************************
#include <EfiBind.h>
.global ASM_PFX(AsmFxSave)
.global ASM_PFX(AsmFxRestore)
.text
#------------------------------------------------------------------------------
# VOID
# AsmFxSave (
# OUT IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxSave):
fxsave (%rcx)
retq
#------------------------------------------------------------------------------
# VOID
# AsmFxRestore (
# IN CONST IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
ASM_PFX(AsmFxRestore):
fxrstor (%rcx)
retq

View File

@@ -1,56 +1,56 @@
#*****************************************************************************
#*
#* Copyright (c) 2008, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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.S
#*
#* Abstract:
#*
#* Real mode thunk
#*
#*****************************************************************************
#include <EfiBind.h>
.data
.globl ASM_PFX(mCode16Size)
.data
mCode16Size: .long _Code16End - _Code16Addr
NullSegSel: .quad 0
_16CsSegSel:
.word -1
.word 0
.byte 0
.byte 0x9b
.byte 0x8f #16-bit segment
.byte 0
_16DsSegSel:
.word -1
.word 0
.byte 0
.byte 0x93
.byte 0x8f #16-bit segment
.byte 0
_16Gdtr:
.word _16Gdtr - NullSegSel - 1
.long NullSegSel
.code:
#*****************************************************************************
#*
#* Copyright (c) 2008, Intel Corporation
#* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License
#* which accompanies this distribution. The full text of the license may be found at
#* 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.S
#*
#* Abstract:
#*
#* Real mode thunk
#*
#*****************************************************************************
#include <EfiBind.h>
.data
.globl ASM_PFX(mCode16Size)
.data
mCode16Size: .long _Code16End - _Code16Addr
NullSegSel: .quad 0
_16CsSegSel:
.word -1
.word 0
.byte 0
.byte 0x9b
.byte 0x8f #16-bit segment
.byte 0
_16DsSegSel:
.word -1
.word 0
.byte 0
.byte 0x93
.byte 0x8f #16-bit segment
.byte 0
_16Gdtr:
.word _16Gdtr - NullSegSel - 1
.long NullSegSel
.code:
#IA32_REGS STRUC 4t
#_EDI DD ?
#_ESI DD ?
@@ -79,158 +79,158 @@ _16Gdtr:
#SavedCr0 DD ?
#SavedCr4 DD ?
#_STK16 ENDS
ASM_PFX(Thunk16):
push %rbp
push %rbx
push %rsi
push %rdi
push %r12
push %r13
push %r14
push %r15
pushq %fs
pushq %gs
movl %ds,%r12d
movl %es,%r13d
movl %ss,%r14d
mov %rsp,%r15
mov %rcx,%rsi
movzwq 0x36(%rsi),%r10 #movzx r10, (IA32_REGS ptr [rsi])._SS
xor %rdi,%rdi
mov 0xc(%rsi),%edi #mov edi, (IA32_REGS ptr [rsi])._ESP
add $0xffffffffffffffb0,%rdi #add rdi, - sizeof (IA32_REGS) - sizeof (_STK16)
push %rdi
imul $0x10,%r10,%rax
add %rax,%rdi
pushq $0xe #push sizeof (IA32_REGS) / 4
pop %rcx
rep movsl %ds:(%rsi),%es:(%rdi)
pop %rbx #rbx <- 16-bit stack offset
lea Label,%eax #42 <_Thunk16+0x42>
stos %eax,%es:(%rdi)
movl %cs,%eax #return segment
stos %ax,%es:(%rdi)
mov %edx,%eax #THUNK Flags
stos %ax,%es:(%rdi)
sgdt 0x58(%rsp) #save GDTR
mov 0x58(%rsp),%rax
stos %rax,%es:(%rdi)
mov %cr0,%rax #save CR0
mov %eax,%esi #esi <- CR0 to set
stos %eax,%es:(%rdi)
mov %cr4,%rax #save CR4
stos %eax,%es:(%rdi)
sidt 0x58(%rsp) #save IDTR
and $0x7ffffffe,%esi #clear PE & PG bits
mov %r10,%rdi #rdi <- 16-bit stack segment
shl $0x10,%r8
push %r8 #far jmp address
lea Label_16Bit,%eax
push %rax
movw $0x8,0x4(%rsp)
lgdt _16Gdtr #bugbug: may not match.
lret
Label_16Bit:
.byte 0x66
movl $0xc0000080,%ecx
mov %rsi,%cr0 #disable PE & PG
rdmsr
and $0xfe,%ah
wrmsr #clear LME bit
mov %cr4,%rax
and $0xcf,%al #clear PAE & PSE
mov %rax,%cr4
lret
Label:
xor %rax,%rax
movl %ss,%eax
shl $0x4,%eax
add %esp,%eax
mov %r15,%rsp
lidt 0x58(%rsp)
movl %r12d,%ds
movl %r13d,%es
movl %r14d,%ss
popq %gs
popq %fs
pop %r15
pop %r14
pop %r13
pop %r12
pop %rdi
pop %rsi
pop %rbx
pop %rbp
retq
.align 0x10
_Code16Addr:
ASM_PFX(RealMode):
movl %edi,%ss
mov %bx,%sp #set up 16-bit stack
.byte 0x2e
.byte 0x0f
.byte 0x01
ASM_PFX(Thunk16):
push %rbp
push %rbx
push %rsi
push %rdi
push %r12
push %r13
push %r14
push %r15
pushq %fs
pushq %gs
movl %ds,%r12d
movl %es,%r13d
movl %ss,%r14d
mov %rsp,%r15
mov %rcx,%rsi
movzwq 0x36(%rsi),%r10 #movzx r10, (IA32_REGS ptr [rsi])._SS
xor %rdi,%rdi
mov 0xc(%rsi),%edi #mov edi, (IA32_REGS ptr [rsi])._ESP
add $0xffffffffffffffb0,%rdi #add rdi, - sizeof (IA32_REGS) - sizeof (_STK16)
push %rdi
imul $0x10,%r10,%rax
add %rax,%rdi
pushq $0xe #push sizeof (IA32_REGS) / 4
pop %rcx
rep movsl %ds:(%rsi),%es:(%rdi)
pop %rbx #rbx <- 16-bit stack offset
lea Label,%eax #42 <_Thunk16+0x42>
stos %eax,%es:(%rdi)
movl %cs,%eax #return segment
stos %ax,%es:(%rdi)
mov %edx,%eax #THUNK Flags
stos %ax,%es:(%rdi)
sgdt 0x58(%rsp) #save GDTR
mov 0x58(%rsp),%rax
stos %rax,%es:(%rdi)
mov %cr0,%rax #save CR0
mov %eax,%esi #esi <- CR0 to set
stos %eax,%es:(%rdi)
mov %cr4,%rax #save CR4
stos %eax,%es:(%rdi)
sidt 0x58(%rsp) #save IDTR
and $0x7ffffffe,%esi #clear PE & PG bits
mov %r10,%rdi #rdi <- 16-bit stack segment
shl $0x10,%r8
push %r8 #far jmp address
lea Label_16Bit,%eax
push %rax
movw $0x8,0x4(%rsp)
lgdt _16Gdtr #bugbug: may not match.
lret
Label_16Bit:
.byte 0x66
movl $0xc0000080,%ecx
mov %rsi,%cr0 #disable PE & PG
rdmsr
and $0xfe,%ah
wrmsr #clear LME bit
mov %cr4,%rax
and $0xcf,%al #clear PAE & PSE
mov %rax,%cr4
lret
Label:
xor %rax,%rax
movl %ss,%eax
shl $0x4,%eax
add %esp,%eax
mov %r15,%rsp
lidt 0x58(%rsp)
movl %r12d,%ds
movl %r13d,%es
movl %r14d,%ss
popq %gs
popq %fs
pop %r15
pop %r14
pop %r13
pop %r12
pop %rdi
pop %rsi
pop %rbx
pop %rbp
retq
.align 0x10
_Code16Addr:
ASM_PFX(RealMode):
movl %edi,%ss
mov %bx,%sp #set up 16-bit stack
.byte 0x2e
.byte 0x0f
.byte 0x01
.byte 0x1e
.word _16Idtr - _Code16Addr #lidt _16Idtr
.byte 0x66
.byte 0x66
.byte 0x61 #popad
.byte 0x1f #pop ds
.byte 0x07 #pop es
.byte 0x07 #pop es
popq %fs
popq %gs
add $0x8,%esp #skip RFLAGS
.byte 0x67 #test [esp + 0eh], 1
.byte 0xf7
.byte 0x44
.byte 0x24
.byte 0x0e
.byte 0x01
.byte 0x00
jz 1f
pushfq #pushf, actually
1:
.byte 0x0e #push cs
.byte 0x68 #push /iw
.word FarCallRet - _Code16Addr
jz 2f
.byte 0x66
ljmp *6(%esp)
2:
.byte 0x66
ljmp *4(%esp)
FarCallRet:
.byte 0x66
push $0x00 #push a dword of zero
.byte 0x66
pushf #pushfd, actually
pushq %gs
pushq %fs
.byte 0x06 #push %es
.byte 0x1e #push %ds
.byte 0x66
.byte 0x60
cli
.byte 0x66 #sizeof (IA32_REGS) = 13 * 4 = 52
lgdt 64(%esp) #lgdt (_STK16 ptr [esp + sizeof (IA32_REGS)]).SavedGdtr
.byte 0x66
mov 76(%esp), %eax
mov %rax, %cr4
.byte 0x66
mov $0xc0000080, %ecx
rdmsr
orb $1, %ah
wrmsr
.byte 0x66
mov 72(%esp), %eax
mov %rax, %cr0 #restore CR0
.byte 0x66
ljmpl *52(%esp)
_16Idtr:
.word 0x3ff #FWORD (1 SHL 10) - 1
.byte 0x00
.byte 0x67 #test [esp + 0eh], 1
.byte 0xf7
.byte 0x44
.byte 0x24
.byte 0x0e
.byte 0x01
.byte 0x00
jz 1f
pushfq #pushf, actually
1:
.byte 0x0e #push cs
.byte 0x68 #push /iw
.word FarCallRet - _Code16Addr
jz 2f
.byte 0x66
ljmp *6(%esp)
2:
.byte 0x66
ljmp *4(%esp)
FarCallRet:
.byte 0x66
push $0x00 #push a dword of zero
.byte 0x66
pushf #pushfd, actually
pushq %gs
pushq %fs
.byte 0x06 #push %es
.byte 0x1e #push %ds
.byte 0x66
.byte 0x60
cli
.byte 0x66 #sizeof (IA32_REGS) = 13 * 4 = 52
lgdt 64(%esp) #lgdt (_STK16 ptr [esp + sizeof (IA32_REGS)]).SavedGdtr
.byte 0x66
mov 76(%esp), %eax
mov %rax, %cr4
.byte 0x66
mov $0xc0000080, %ecx
rdmsr
orb $1, %ah
wrmsr
.byte 0x66
mov 72(%esp), %eax
mov %rax, %cr0 #restore CR0
.byte 0x66
ljmpl *52(%esp)
_16Idtr:
.word 0x3ff #FWORD (1 SHL 10) - 1
.byte 0x00