\r
;------------------------------------------------------------------------------\r
;\r
-; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
; This program and the accompanying materials\r
; are licensed and made available under the terms and conditions of the BSD License\r
; which accompanies this distribution. The full text of the license may be found at\r
;\r
; These are global constant to convey information to C code.\r
;\r
-ASM_PFX(m16Size) DW InternalAsmThunk16 - ASM_PFX(m16Start)\r
+ASM_PFX(m16Size) DW ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start)\r
ASM_PFX(mThunk16Attr) DW _BackFromUserCode.ThunkAttrEnd - 4 - ASM_PFX(m16Start)\r
ASM_PFX(m16Gdt) DW _NullSeg - ASM_PFX(m16Start)\r
ASM_PFX(m16GdtrBase) DW _16GdtrBase - ASM_PFX(m16Start)\r
push rbx\r
push rsi\r
push rdi\r
- \r
+\r
mov ebx, ds\r
push rbx ; Save ds segment register on the stack\r
mov ebx, es\r
push rbx ; Save es segment register on the stack\r
mov ebx, ss\r
push rbx ; Save ss segment register on the stack\r
- \r
+\r
push fs\r
push gs\r
mov rsi, rcx\r
shl eax, 12 ; segment address in high order 16 bits\r
lea ax, [rdx + (_BackFromUserCode - ASM_PFX(m16Start))] ; offset address\r
stosd ; [edi] <- return address of user code\r
- \r
+\r
sgdt [rsp + 60h] ; save GDT stack in argument space\r
- movzx r10, word [rsp + 60h] ; r10 <- GDT limit \r
- lea r11, [rcx + (InternalAsmThunk16 - _BackFromUserCode.SavedCr4End) + 0xf]\r
+ movzx r10, word [rsp + 60h] ; r10 <- GDT limit\r
+ lea r11, [rcx + (ASM_PFX(InternalAsmThunk16) - _BackFromUserCode.SavedCr4End) + 0xf]\r
and r11, ~0xf ; r11 <- 16-byte aligned shadowed GDT table in real mode buffer\r
- \r
+\r
mov [rcx + (SavedGdt - _BackFromUserCode.SavedCr4End)], r10w ; save the limit of shadowed GDT table\r
mov [rcx + (SavedGdt - _BackFromUserCode.SavedCr4End) + 2], r11 ; save the base address of shadowed GDT table\r
- \r
+\r
mov rsi, [rsp + 62h] ; rsi <- the original GDT base address\r
xchg rcx, r10 ; save rcx to r10 and initialize rcx to be the limit of GDT table\r
inc rcx ; rcx <- the size of memory to copy\r
rep movsb ; perform memory copy to shadow GDT table\r
mov rcx, r10 ; restore the orignal rcx before memory copy\r
mov rdi, r11 ; restore the original rdi before memory copy\r
- \r
+\r
sidt [rsp + 50h] ; save IDT stack in argument space\r
mov rax, cr0\r
mov [rcx + (_BackFromUserCode.SavedCr0End - 4 - _BackFromUserCode.SavedCr4End)], eax\r