MdePkg/Library/BaseLib/X64/Thunk16.nasm File Reference


Functions

 Copyright (c) 2006-2013
 _BackFromUserCode () takes control in real mode after 'retf'has been executed
 _ToUserCode () takes control in real mode before passing control to user code.

Variables

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 __pad0__
THE PROGRAM IS DISTRIBUTED
UNDER THE BSD LICENSE ON AN AS
IS 
BASIS
THE PROGRAM IS DISTRIBUTED
UNDER THE BSD LICENSE ON AN AS
IS WITHOUT WARRANTIES OR
REPRESENTATIONS OF ANY 
KIND
THE PROGRAM IS DISTRIBUTED
UNDER THE BSD LICENSE ON AN AS
IS WITHOUT WARRANTIES OR
REPRESENTATIONS OF ANY EITHER
EXPRESS OR 
IMPLIED
Module Name
Thunk asm
Abstract __pad1__
Real mode thunk
 global (m16Size) global(mThunk16Attr) global(m16Gdt) global(m16GdtrBase) global(mTransition) global(m16Start) struc IA32_REGS._EDI
These are global constant to
convey information to C 
code
m16Size DW (InternalAsmThunk16)-(m16Start)(mThunk16Attr) DW _BackFromUserCode.ThunkAttrEnd-4-(m16Start)(m16Gdt) DW _NullSeg-(m16Start)(m16GdtrBase) DW _16GdtrBase-(m16Start)(mTransition) DW _EntryPoint-(m16Start) SECTION.text(m16Start)
by user code It will be
shadowed to somewhere in
memory 
below
_BackFromUserCode __pad2__
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
BITS push ss push cs
Note __pad3__
in NASM through
call dword Base
reserved high order bits of
EFlags pushfd 
cli
disable interrupts push gs
push fs push es push ds pushad
mov 
edx
disable interrupts push gs
push fs push es push ds pushad
mov strict dword 
ThunkAttrEnd
disable interrupts push gs
push fs push es push ds pushad
mov strict dword
THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15
jz mov 
ax
disable interrupts jnc
disable interrupts
THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL
jz in 
al
disable interrupts
THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL
jz in or 
out
deactivate A20M
deactivate eax mov ss lea ebp
deactivate eax mov ss lea mov [bp-IA32_REGS.size+IA32_REGS._ESP]
deactivate eax mov ss lea ebp mov ebx
deactivate eax mov ss lea ebp
mov shl 
eax
add eax mov cs shl lea eax mov
strict dword 
SavedCr4End
add eax mov cs shl lea eax mov
strict dword eax o32 lgdt[cs:bx+(SavedGdt-.Base)]
mov 
ecx
add eax mov cs shl lea eax mov
strict dword eax o32 lgdt[cs:bx+(SavedGdt-.Base)]
mov rdmsr or 
ah
add eax mov cs shl lea eax mov
strict dword eax o32 lgdt[cs:bx+(SavedGdt-.Base)]
mov rdmsr or wrmsr mov strict
dword 
SavedCr0End
add eax mov cs shl lea eax mov
strict dword eax o32 lgdt[cs:bx+(SavedGdt-.Base)]
mov rdmsr or wrmsr mov strict
dword eax 
jmp
add eax mov cs shl lea eax mov
strict dword eax o32 lgdt[cs:bx+(SavedGdt-.Base)]
mov rdmsr or wrmsr mov strict
dword eax strict qword 
SavedSpEnd
_ToUserCode __pad4__
_ToUserCode dx
set new segment selectors mov ds
set new segment selectors mov
dx mov 
es
set new segment selectors mov
dx mov dx mov 
fs
set new segment selectors mov
dx mov dx mov dx mov 
gs
set new segment selectors mov
dx mov dx mov dx mov dx mov
mov 
cr0
real mode starts at next
instruction rdmsr and wrmsr
mov 
cr4
real mode starts at next
instruction rdmsr and wrmsr
mov ebp mov 
ss
real mode starts at next
instruction rdmsr and wrmsr
mov ebp mov 
si
set up bit stack segment mov esp

Function Documentation

_BackFromUserCode (  ) 

_ToUserCode (  ) 

Copyright (  ) 


Variable Documentation

http __pad0__

Abstract __pad1__

_BackFromUserCode __pad2__

Note __pad3__

_ToUserCode __pad4__

deactivate A20M

real mode starts at next instruction rdmsr and ah

disable interrupts THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL jz in or al

Referenced by IoRead8(), and IoWrite8().

The order of saved registers on the stack matches the order they appears

Thunk asm

which accompanies this distribution The full text of the license may be found at

deactivate eax mov ax

push eip Base

Referenced by PeCoffLoaderLoadImage().

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN AS IS BASIS

It will be shadowed to somewhere in memory below

disable interrupts push gs push fs push es push ds pushad mov strict dword THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 jz mov int cli

These are global constant to convey information to C code

set new segment selectors mov dx mov dx mov dx mov dx mov mov cr0

real mode starts at next instruction rdmsr and wrmsr mov cr4

BITS push ss push cs

Referenced by AsmReadCs().

set new segment selectors mov ds

Referenced by AsmReadDs().

_ToUserCode dx

set new segment selectors mov cx mov cx mov cx mov cx mov eax

add ebp

Referenced by __declspec(), and _declspec().

set up bit stack segment mov ebx

set new segment selectors mov dx mov dx mov dx mov dx mov ecx

disable interrupts push gs push fs push es push ds pushad mov edx

set new segment selectors mov dx mov es

Referenced by AsmReadEs().

set up bit stack segment mov esp

set new segment selectors mov dx mov dx mov fs

Referenced by AsmReadFs().

set new segment selectors mov dx mov dx mov dx mov gs

Referenced by AsmReadGs().

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN AS IS WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY EITHER EXPRESS OR IMPLIED

add eax mov cs shl lea eax mov strict dword eax o32 lgdt [cs:bx + (SavedGdt - .Base)] mov rdmsr or wrmsr mov strict dword eax jmp

disable interrupts jnc

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN AS IS WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND

are licensed and made available under the terms and conditions of the BSD License

Intel Corporation All rights reserved<BR> This program and the accompanying materials

set up bit stack pointer mov dx mov

Module Name

disable interrupts THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL jz in or out

Referenced by IoWrite16(), IoWrite32(), and IoWrite8().

add eax mov cs shl lea eax mov strict dword eax o32 lgdt [cs:bx + (SavedGdt - .Base)] mov rdmsr or wrmsr mov strict dword SavedCr0End

add eax mov cs shl lea eax mov strict dword SavedCr4End

add eax mov cs shl lea eax mov strict dword eax o32 lgdt [cs:bx + (SavedGdt - .Base)] mov rdmsr or wrmsr mov strict dword eax strict qword SavedSpEnd

real mode starts at next instruction rdmsr and wrmsr mov ebp mov si

real mode starts at next instruction rdmsr and wrmsr mov ebp mov ss

Referenced by AsmReadSs().

into that structure

in IA32_REGS structure This facilitates wrapper function to extract them

in NASM through

Real mode thunk

disable interrupts push gs push fs push es push ds pushad mov strict dword ThunkAttrEnd


Generated on Thu Sep 24 23:14:22 2015 for MdePkg[ALL] by  doxygen 1.5.7.1