summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-21 08:47:38 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-21 08:47:38 +0000
commit3f566587aea64bb986866c7f69a6b82891bf59db (patch)
tree406fa713c2baaa46f9c357f49bcef7d710e7f044 /MdePkg/Library/BaseLib/Ia32/Thunk16.asm
parent31a9215c3223d3818d1709f39d06774e18df103f (diff)
downloadedk2-platforms-3f566587aea64bb986866c7f69a6b82891bf59db.tar.xz
1. Updated function headers in all assembly files.
2. Split x86LowLevel.c into a bunch of C files to make images linked with BaseLib smaller. 3. Fixed a few minor bugs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1066 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseLib/Ia32/Thunk16.asm')
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Thunk16.asm29
1 files changed, 23 insertions, 6 deletions
diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.asm b/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
index 9fba03ac05..5e35799127 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
@@ -29,6 +29,10 @@ EXTERNDEF C m16Gdt:WORD
EXTERNDEF C m16GdtrBase:WORD
EXTERNDEF C mTransition:WORD
+;
+; Here is the layout of the real mode stack. _ToUserCode() is responsible for
+; loading all these registers from real mode stack.
+;
IA32_REGS STRUC 4t
_EDI DD ?
_ESI DD ?
@@ -50,6 +54,9 @@ IA32_REGS ENDS
.const
+;
+; These are global constant to convey information to C code.
+;
m16Size DW InternalAsmThunk16 - m16Start
mThunk16Attr DW _ThunkAttr - m16Start
m16Gdt DW _NullSegDesc - m16Start
@@ -63,7 +70,10 @@ m16Start LABEL BYTE
SavedGdt LABEL FWORD
DW ?
DD ?
-
+;------------------------------------------------------------------------------
+; _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
push ss
push cs
@@ -122,6 +132,10 @@ _16Gdtr LABEL FWORD
DW GdtEnd - _NullSegDesc - 1
_16GdtrBase DD _NullSegDesc
+;------------------------------------------------------------------------------
+; _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 edx, ss
mov ss, ecx ; set new segment selectors
@@ -174,11 +188,14 @@ _16DsDesc LABEL QWORD
DB 0
GdtEnd LABEL QWORD
-;
-; @param RegSet Pointer to a IA32_DWORD_REGS structure
-; @param Transition Pointer to the transition code
-; @return The address of the 16-bit stack after returning from user code
-;
+;------------------------------------------------------------------------------
+; IA32_REGISTER_SET *
+; EFIAPI
+; InternalAsmThunk16 (
+; IN IA32_REGISTER_SET *RegisterSet,
+; IN OUT VOID *Transition
+; );
+;------------------------------------------------------------------------------
InternalAsmThunk16 PROC USES ebp ebx esi edi ds es fs gs
mov esi, [esp + 36] ; esi <- RegSet
movzx edx, (IA32_REGS ptr [esi])._SS