Ring3: Fixed line endings.

This commit is contained in:
Mikhail Krichanov 2025-01-10 18:14:00 +03:00
parent 99b902bde1
commit 7a0bb88360
6 changed files with 396 additions and 396 deletions

View File

@ -303,10 +303,10 @@ NoTTBR0Switch:
// We do not try to recover. // We do not try to recover.
bl ASM_PFX(CommonCExceptionHandler) // Call exception handler bl ASM_PFX(CommonCExceptionHandler) // Call exception handler
ldr x2, [x28, #(FP_CONTEXT_SIZE + 0x8)] // Saved Processor Status Register ldr x2, [x28, #(FP_CONTEXT_SIZE + 0x8)] // Saved Processor Status Register
and x2, x2, #0xF and x2, x2, #0xF
cmp x2, 0 // Check whether EL0 process was interrupted cmp x2, 0 // Check whether EL0 process was interrupted
b.ne NoTTBR0Switch2 b.ne NoTTBR0Switch2
adrp x1, ASM_PFX(CorePageTable) adrp x1, ASM_PFX(CorePageTable)
EL1_OR_EL2(x3) EL1_OR_EL2(x3)
1:ldr x4, [x1, #0x8] // UserPageTable 1:ldr x4, [x1, #0x8] // UserPageTable
@ -411,6 +411,6 @@ ASM_PFX(CorePageTable):
UserPageTable: UserPageTable:
.ds.d 1 .ds.d 1
.balign 4096 .balign 4096
Padding: Padding:
.ds.b 1 .ds.b 1

View File

@ -255,23 +255,23 @@ NoAdjustNeeded:
vpush {d0-d15} @ save vstm registers in case they are used in optimizations vpush {d0-d15} @ save vstm registers in case they are used in optimizations
#endif #endif
ldr R5, [SP, #0x40] @ Saved Processor Status Register ldr R5, [SP, #0x40] @ Saved Processor Status Register
and R5, R5, #0xF and R5, R5, #0xF
cmp R5, 0 @ Check whether EL0 process was interrupted cmp R5, 0 @ Check whether EL0 process was interrupted
bne NoTTBR0Switch bne NoTTBR0Switch
mrc p15,0,R5,c2,c0,0 @ R5 == TTBR0 mrc p15,0,R5,c2,c0,0 @ R5 == TTBR0
ADRL (R6, UserPageTable) ADRL (R6, UserPageTable)
str R5, [R6] str R5, [R6]
and R5, R5, #0x7F @ Preserve TTBR0 attributes and R5, R5, #0x7F @ Preserve TTBR0 attributes
LDRL (R6, ASM_PFX(CorePageTable)) LDRL (R6, ASM_PFX(CorePageTable))
orr R6, R6, R5 @ Assign TTBR0 attributes orr R6, R6, R5 @ Assign TTBR0 attributes
mcr p15,0,R6,c2,c0,0 @ TTBR0 == R6 mcr p15,0,R6,c2,c0,0 @ TTBR0 == R6
mcr p15,0,r0,c8,c7,0 @ TLBIALL, TLB Invalidate All. mcr p15,0,r0,c8,c7,0 @ TLBIALL, TLB Invalidate All.
mcr p15,0,r0,c7,c5,6 @ BPIALL, Branch Predictor Invalidate All. mcr p15,0,r0,c7,c5,6 @ BPIALL, Branch Predictor Invalidate All.
dsb dsb
isb isb
NoTTBR0Switch: NoTTBR0Switch:
mov R4, SP @ Save current SP mov R4, SP @ Save current SP
tst R4, #4 tst R4, #4
@ -327,18 +327,18 @@ NoTTBR0Switch2:
ldmfd SP!,{LR} @ restore the link register for this context ldmfd SP!,{LR} @ restore the link register for this context
rfefd SP! @ return from exception via srsfd stack slot rfefd SP! @ return from exception via srsfd stack slot
ASM_FUNC_ALIGN(ExceptionHandlerFinal, 4096) ASM_FUNC_ALIGN(ExceptionHandlerFinal, 4096)
.data .data
.global ASM_PFX(CorePageTable) .global ASM_PFX(CorePageTable)
.balign 4096 .balign 4096
ASM_PFX(CorePageTable): ASM_PFX(CorePageTable):
.ds.l 1 .ds.l 1
UserPageTable: UserPageTable:
.ds.l 1 .ds.l 1
.balign 4096 .balign 4096
Padding: Padding:
.ds.b 1 .ds.b 1

View File

@ -91,32 +91,32 @@ SysCallBootService (
return Status; return Status;
} }
VOID VOID
EFIAPI EFIAPI
MakeUserPageTableTemplate ( MakeUserPageTableTemplate (
OUT UINTN *UserPageTableTemplate, OUT UINTN *UserPageTableTemplate,
OUT UINTN *UserPageTableTemplateSize OUT UINTN *UserPageTableTemplateSize
) )
{ {
ARM_MEMORY_REGION_DESCRIPTOR Descriptor; ARM_MEMORY_REGION_DESCRIPTOR Descriptor;
VOID *MemorySizeHob; VOID *MemorySizeHob;
MemorySizeHob = GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid); MemorySizeHob = GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid);
ASSERT (MemorySizeHob != NULL); ASSERT (MemorySizeHob != NULL);
if (MemorySizeHob == NULL) { if (MemorySizeHob == NULL) {
return; return;
} }
Descriptor.PhysicalBase = PcdGet64 (PcdSystemMemoryBase); Descriptor.PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
Descriptor.VirtualBase = Descriptor.PhysicalBase; Descriptor.VirtualBase = Descriptor.PhysicalBase;
Descriptor.Length = *(UINT64 *)GET_GUID_HOB_DATA (MemorySizeHob); Descriptor.Length = *(UINT64 *)GET_GUID_HOB_DATA (MemorySizeHob);
Descriptor.Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; Descriptor.Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
ArmMakeUserPageTableTemplate ( ArmMakeUserPageTableTemplate (
&Descriptor, &Descriptor,
UserPageTableTemplate, UserPageTableTemplate,
UserPageTableTemplateSize UserPageTableTemplateSize
); );
} }
VOID VOID

View File

@ -809,315 +809,315 @@ CoreOpenVolume (
return Status; return Status;
} }
INTN INTN
EFIAPI EFIAPI
CoreUnicodeCollationStriColl ( CoreUnicodeCollationStriColl (
IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN EFI_UNICODE_COLLATION_PROTOCOL *This,
IN CHAR16 *Str1, IN CHAR16 *Str1,
IN CHAR16 *Str2 IN CHAR16 *Str2
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UserMem; EFI_PHYSICAL_ADDRESS UserMem;
USER_SPACE_DRIVER *UserDriver; USER_SPACE_DRIVER *UserDriver;
VOID *EntryPoint; VOID *EntryPoint;
UINTN Size1; UINTN Size1;
UINTN Size2; UINTN Size2;
UserDriver = FindUserSpaceDriver (This); UserDriver = FindUserSpaceDriver (This);
ASSERT (UserDriver != NULL); ASSERT (UserDriver != NULL);
This = UserDriver->UserSpaceDriver; This = UserDriver->UserSpaceDriver;
gUserPageTable = UserDriver->UserPageTable; gUserPageTable = UserDriver->UserPageTable;
Size1 = StrSize (Str1); Size1 = StrSize (Str1);
Size2 = StrSize (Str2); Size2 = StrSize (Str2);
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (Size1 + Size2), EFI_SIZE_TO_PAGES (Size1 + Size2),
&UserMem &UserMem
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return 0; return 0;
} }
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str1, Size1); CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str1, Size1);
CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Str2, Size2); CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Str2, Size2);
EntryPoint = (VOID *)This->StriColl; EntryPoint = (VOID *)This->StriColl;
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
Status = GoToRing3 ( Status = GoToRing3 (
3, 3,
EntryPoint, EntryPoint,
This, This,
(UINTN)UserMem, (UINTN)UserMem,
(UINTN)UserMem + Size1 (UINTN)UserMem + Size1
); );
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2)); CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2));
return (INTN)Status; return (INTN)Status;
} }
BOOLEAN BOOLEAN
EFIAPI EFIAPI
CoreUnicodeCollationMetaiMatch ( CoreUnicodeCollationMetaiMatch (
IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN EFI_UNICODE_COLLATION_PROTOCOL *This,
IN CHAR16 *String, IN CHAR16 *String,
IN CHAR16 *Pattern IN CHAR16 *Pattern
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UserMem; EFI_PHYSICAL_ADDRESS UserMem;
USER_SPACE_DRIVER *UserDriver; USER_SPACE_DRIVER *UserDriver;
VOID *EntryPoint; VOID *EntryPoint;
UINTN Size1; UINTN Size1;
UINTN Size2; UINTN Size2;
UserDriver = FindUserSpaceDriver (This); UserDriver = FindUserSpaceDriver (This);
ASSERT (UserDriver != NULL); ASSERT (UserDriver != NULL);
This = UserDriver->UserSpaceDriver; This = UserDriver->UserSpaceDriver;
gUserPageTable = UserDriver->UserPageTable; gUserPageTable = UserDriver->UserPageTable;
Size1 = StrSize (String); Size1 = StrSize (String);
Size2 = StrSize (Pattern); Size2 = StrSize (Pattern);
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (Size1 + Size2), EFI_SIZE_TO_PAGES (Size1 + Size2),
&UserMem &UserMem
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
} }
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1); CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1);
CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Pattern, Size2); CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Pattern, Size2);
EntryPoint = (VOID *)This->MetaiMatch; EntryPoint = (VOID *)This->MetaiMatch;
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
Status = GoToRing3 ( Status = GoToRing3 (
3, 3,
EntryPoint, EntryPoint,
This, This,
(UINTN)UserMem, (UINTN)UserMem,
(UINTN)UserMem + Size1 (UINTN)UserMem + Size1
); );
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2)); CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2));
return (BOOLEAN)Status; return (BOOLEAN)Status;
} }
VOID VOID
EFIAPI EFIAPI
CoreUnicodeCollationStrLwr ( CoreUnicodeCollationStrLwr (
IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN EFI_UNICODE_COLLATION_PROTOCOL *This,
IN OUT CHAR16 *Str IN OUT CHAR16 *Str
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UserMem; EFI_PHYSICAL_ADDRESS UserMem;
USER_SPACE_DRIVER *UserDriver; USER_SPACE_DRIVER *UserDriver;
VOID *EntryPoint; VOID *EntryPoint;
UINTN Size1; UINTN Size1;
UserDriver = FindUserSpaceDriver (This); UserDriver = FindUserSpaceDriver (This);
ASSERT (UserDriver != NULL); ASSERT (UserDriver != NULL);
This = UserDriver->UserSpaceDriver; This = UserDriver->UserSpaceDriver;
gUserPageTable = UserDriver->UserPageTable; gUserPageTable = UserDriver->UserPageTable;
Size1 = StrSize (Str); Size1 = StrSize (Str);
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (Size1), EFI_SIZE_TO_PAGES (Size1),
&UserMem &UserMem
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return; return;
} }
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1); CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1);
EntryPoint = (VOID *)This->StrLwr; EntryPoint = (VOID *)This->StrLwr;
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
Status = GoToRing3 ( Status = GoToRing3 (
2, 2,
EntryPoint, EntryPoint,
This, This,
(UINTN)UserMem (UINTN)UserMem
); );
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1); CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1);
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1)); CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1));
} }
VOID VOID
EFIAPI EFIAPI
CoreUnicodeCollationStrUpr ( CoreUnicodeCollationStrUpr (
IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN EFI_UNICODE_COLLATION_PROTOCOL *This,
IN OUT CHAR16 *Str IN OUT CHAR16 *Str
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UserMem; EFI_PHYSICAL_ADDRESS UserMem;
USER_SPACE_DRIVER *UserDriver; USER_SPACE_DRIVER *UserDriver;
VOID *EntryPoint; VOID *EntryPoint;
UINTN Size1; UINTN Size1;
UserDriver = FindUserSpaceDriver (This); UserDriver = FindUserSpaceDriver (This);
ASSERT (UserDriver != NULL); ASSERT (UserDriver != NULL);
This = UserDriver->UserSpaceDriver; This = UserDriver->UserSpaceDriver;
gUserPageTable = UserDriver->UserPageTable; gUserPageTable = UserDriver->UserPageTable;
Size1 = StrSize (Str); Size1 = StrSize (Str);
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (Size1), EFI_SIZE_TO_PAGES (Size1),
&UserMem &UserMem
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return; return;
} }
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1); CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1);
EntryPoint = (VOID *)This->StrUpr; EntryPoint = (VOID *)This->StrUpr;
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
Status = GoToRing3 ( Status = GoToRing3 (
2, 2,
EntryPoint, EntryPoint,
This, This,
(UINTN)UserMem (UINTN)UserMem
); );
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1); CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1);
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1)); CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1));
} }
VOID VOID
EFIAPI EFIAPI
CoreUnicodeCollationFatToStr ( CoreUnicodeCollationFatToStr (
IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN EFI_UNICODE_COLLATION_PROTOCOL *This,
IN UINTN FatSize, IN UINTN FatSize,
IN CHAR8 *Fat, IN CHAR8 *Fat,
OUT CHAR16 *String OUT CHAR16 *String
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UserMem; EFI_PHYSICAL_ADDRESS UserMem;
USER_SPACE_DRIVER *UserDriver; USER_SPACE_DRIVER *UserDriver;
VOID *EntryPoint; VOID *EntryPoint;
UserDriver = FindUserSpaceDriver (This); UserDriver = FindUserSpaceDriver (This);
ASSERT (UserDriver != NULL); ASSERT (UserDriver != NULL);
This = UserDriver->UserSpaceDriver; This = UserDriver->UserSpaceDriver;
gUserPageTable = UserDriver->UserPageTable; gUserPageTable = UserDriver->UserPageTable;
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (FatSize * 3), EFI_SIZE_TO_PAGES (FatSize * 3),
&UserMem &UserMem
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return; return;
} }
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Fat, FatSize); CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Fat, FatSize);
EntryPoint = (VOID *)This->FatToStr; EntryPoint = (VOID *)This->FatToStr;
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
Status = GoToRing3 ( Status = GoToRing3 (
4, 4,
EntryPoint, EntryPoint,
This, This,
FatSize, FatSize,
(UINTN)UserMem, (UINTN)UserMem,
(UINTN)UserMem + FatSize (UINTN)UserMem + FatSize
); );
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)String, (VOID *)((UINTN)UserMem + FatSize), FatSize * 2); CopyMem ((VOID *)String, (VOID *)((UINTN)UserMem + FatSize), FatSize * 2);
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize * 3)); CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize * 3));
} }
BOOLEAN BOOLEAN
EFIAPI EFIAPI
CoreUnicodeCollationStrToFat ( CoreUnicodeCollationStrToFat (
IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN EFI_UNICODE_COLLATION_PROTOCOL *This,
IN CHAR16 *String, IN CHAR16 *String,
IN UINTN FatSize, IN UINTN FatSize,
OUT CHAR8 *Fat OUT CHAR8 *Fat
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UserMem; EFI_PHYSICAL_ADDRESS UserMem;
USER_SPACE_DRIVER *UserDriver; USER_SPACE_DRIVER *UserDriver;
VOID *EntryPoint; VOID *EntryPoint;
UINTN Size1; UINTN Size1;
UserDriver = FindUserSpaceDriver (This); UserDriver = FindUserSpaceDriver (This);
ASSERT (UserDriver != NULL); ASSERT (UserDriver != NULL);
This = UserDriver->UserSpaceDriver; This = UserDriver->UserSpaceDriver;
gUserPageTable = UserDriver->UserPageTable; gUserPageTable = UserDriver->UserPageTable;
Size1 = StrSize (String); Size1 = StrSize (String);
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (FatSize + Size1), EFI_SIZE_TO_PAGES (FatSize + Size1),
&UserMem &UserMem
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return FALSE; return FALSE;
} }
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1); CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1);
EntryPoint = (VOID *)This->StrToFat; EntryPoint = (VOID *)This->StrToFat;
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
Status = GoToRing3 ( Status = GoToRing3 (
4, 4,
EntryPoint, EntryPoint,
This, This,
(UINTN)UserMem, (UINTN)UserMem,
FatSize, FatSize,
(UINTN)UserMem + Size1 (UINTN)UserMem + Size1
); );
AllowSupervisorAccessToUserMemory (); AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)Fat, (VOID *)((UINTN)UserMem + Size1), FatSize); CopyMem ((VOID *)Fat, (VOID *)((UINTN)UserMem + Size1), FatSize);
ForbidSupervisorAccessToUserMemory (); ForbidSupervisorAccessToUserMemory ();
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize + Size1)); CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize + Size1));
return (BOOLEAN)Status; return (BOOLEAN)Status;
} }

View File

@ -468,18 +468,18 @@ DoReturn:
DoIret: DoIret:
iretd iretd
ReturnToRing3: ReturnToRing3:
mov ecx, [ASM_PFX(UserPageTable)] mov ecx, [ASM_PFX(UserPageTable)]
mov cr3, ecx mov cr3, ecx
pop ecx pop ecx
mov esp, ebp mov esp, ebp
pop ebp pop ebp
add esp, 8 add esp, 8
iretd iretd
ALIGN 4096 ALIGN 4096
global ASM_PFX(ExceptionHandlerEnd) global ASM_PFX(ExceptionHandlerEnd)
ASM_PFX(ExceptionHandlerEnd): ASM_PFX(ExceptionHandlerEnd):
;---------------------------------------; ;---------------------------------------;
; _AsmGetTemplateAddressMap ; ; _AsmGetTemplateAddressMap ;

View File

@ -63,13 +63,13 @@ global ASM_PFX(UserPageTable)
ASM_PFX(UserPageTable): ASM_PFX(UserPageTable):
resq 1 resq 1
global ASM_PFX(mSwitchCr3Flag) global ASM_PFX(mSwitchCr3Flag)
ASM_PFX(mSwitchCr3Flag): ASM_PFX(mSwitchCr3Flag):
db 0x0 db 0x0
ALIGN 4096 ALIGN 4096
Padding: Padding:
db 0x0 db 0x0
DEFAULT REL DEFAULT REL
SECTION .text SECTION .text
@ -493,17 +493,17 @@ DoReturn:
DoIret: DoIret:
iretq iretq
ReturnToRing3: ReturnToRing3:
mov rcx, [ASM_PFX(UserPageTable)] mov rcx, [ASM_PFX(UserPageTable)]
mov cr3, rcx mov cr3, rcx
pop rcx pop rcx
mov rsp, rbp mov rsp, rbp
pop rbp pop rbp
add rsp, 16 add rsp, 16
iretq iretq
ALIGN 4096 ALIGN 4096
global ASM_PFX(ExceptionHandlerEnd) global ASM_PFX(ExceptionHandlerEnd)
ASM_PFX(ExceptionHandlerEnd): ASM_PFX(ExceptionHandlerEnd):
;------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------
; GetTemplateAddressMap (&AddressMap); ; GetTemplateAddressMap (&AddressMap);