mirror of https://github.com/acidanthera/audk.git
Ring3: Fixed line endings.
This commit is contained in:
parent
90ecffbc25
commit
efcbf1946d
|
@ -320,10 +320,10 @@ NoTTBR0Switch:
|
|||
// We do not try to recover.
|
||||
bl ASM_PFX(CommonCExceptionHandler) // Call exception handler
|
||||
|
||||
ldr x2, [x28, #(FP_CONTEXT_SIZE + 0x8)] // Saved Processor Status Register
|
||||
and x2, x2, #0xF
|
||||
cmp x2, 0 // Check whether EL0 process was interrupted
|
||||
b.ne NoTTBR0Switch2
|
||||
ldr x2, [x28, #(FP_CONTEXT_SIZE + 0x8)] // Saved Processor Status Register
|
||||
and x2, x2, #0xF
|
||||
cmp x2, 0 // Check whether EL0 process was interrupted
|
||||
b.ne NoTTBR0Switch2
|
||||
adrp x1, ASM_PFX(CorePageTable)
|
||||
EL1_OR_EL2(x3)
|
||||
1:ldr x4, [x1, #0x8] // UserPageTable
|
||||
|
@ -431,6 +431,6 @@ ASM_PFX(CorePageTable):
|
|||
UserPageTable:
|
||||
.ds.d 1
|
||||
|
||||
.balign 4096
|
||||
Padding:
|
||||
.ds.b 1
|
||||
.balign 4096
|
||||
Padding:
|
||||
.ds.b 1
|
||||
|
|
|
@ -255,23 +255,23 @@ NoAdjustNeeded:
|
|||
vpush {d0-d15} @ save vstm registers in case they are used in optimizations
|
||||
#endif
|
||||
|
||||
ldr R5, [SP, #0x40] @ Saved Processor Status Register
|
||||
and R5, R5, #0xF
|
||||
cmp R5, 0 @ Check whether EL0 process was interrupted
|
||||
bne NoTTBR0Switch
|
||||
mrc p15,0,R5,c2,c0,0 @ R5 == TTBR0
|
||||
ADRL (R6, UserPageTable)
|
||||
str R5, [R6]
|
||||
and R5, R5, #0x7F @ Preserve TTBR0 attributes
|
||||
LDRL (R6, ASM_PFX(CorePageTable))
|
||||
orr R6, R6, R5 @ Assign TTBR0 attributes
|
||||
ldr R5, [SP, #0x40] @ Saved Processor Status Register
|
||||
and R5, R5, #0xF
|
||||
cmp R5, 0 @ Check whether EL0 process was interrupted
|
||||
bne NoTTBR0Switch
|
||||
mrc p15,0,R5,c2,c0,0 @ R5 == TTBR0
|
||||
ADRL (R6, UserPageTable)
|
||||
str R5, [R6]
|
||||
and R5, R5, #0x7F @ Preserve TTBR0 attributes
|
||||
LDRL (R6, ASM_PFX(CorePageTable))
|
||||
orr R6, R6, R5 @ Assign TTBR0 attributes
|
||||
mcr p15,0,R6,c2,c0,0 @ TTBR0 == R6
|
||||
mcr p15,0,r0,c8,c7,0 @ TLBIALL, TLB Invalidate All.
|
||||
mcr p15,0,r0,c7,c5,6 @ BPIALL, Branch Predictor Invalidate All.
|
||||
dsb
|
||||
isb
|
||||
|
||||
NoTTBR0Switch:
|
||||
NoTTBR0Switch:
|
||||
|
||||
mov R4, SP @ Save current SP
|
||||
tst R4, #4
|
||||
|
@ -327,18 +327,18 @@ NoTTBR0Switch2:
|
|||
ldmfd SP!,{LR} @ restore the link register for this context
|
||||
rfefd SP! @ return from exception via srsfd stack slot
|
||||
|
||||
ASM_FUNC_ALIGN(ExceptionHandlerFinal, 4096)
|
||||
|
||||
.data
|
||||
|
||||
.global ASM_PFX(CorePageTable)
|
||||
.balign 4096
|
||||
ASM_PFX(CorePageTable):
|
||||
.ds.l 1
|
||||
|
||||
UserPageTable:
|
||||
.ds.l 1
|
||||
|
||||
.balign 4096
|
||||
Padding:
|
||||
.ds.b 1
|
||||
ASM_FUNC_ALIGN(ExceptionHandlerFinal, 4096)
|
||||
|
||||
.data
|
||||
|
||||
.global ASM_PFX(CorePageTable)
|
||||
.balign 4096
|
||||
ASM_PFX(CorePageTable):
|
||||
.ds.l 1
|
||||
|
||||
UserPageTable:
|
||||
.ds.l 1
|
||||
|
||||
.balign 4096
|
||||
Padding:
|
||||
.ds.b 1
|
||||
|
|
|
@ -91,32 +91,32 @@ SysCallBootService (
|
|||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
MakeUserPageTableTemplate (
|
||||
OUT UINTN *UserPageTableTemplate,
|
||||
OUT UINTN *UserPageTableTemplateSize
|
||||
)
|
||||
{
|
||||
ARM_MEMORY_REGION_DESCRIPTOR Descriptor;
|
||||
VOID *MemorySizeHob;
|
||||
|
||||
MemorySizeHob = GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid);
|
||||
ASSERT (MemorySizeHob != NULL);
|
||||
if (MemorySizeHob == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Descriptor.PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
|
||||
Descriptor.VirtualBase = Descriptor.PhysicalBase;
|
||||
Descriptor.Length = *(UINT64 *)GET_GUID_HOB_DATA (MemorySizeHob);
|
||||
Descriptor.Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
|
||||
ArmMakeUserPageTableTemplate (
|
||||
&Descriptor,
|
||||
UserPageTableTemplate,
|
||||
UserPageTableTemplateSize
|
||||
);
|
||||
VOID
|
||||
EFIAPI
|
||||
MakeUserPageTableTemplate (
|
||||
OUT UINTN *UserPageTableTemplate,
|
||||
OUT UINTN *UserPageTableTemplateSize
|
||||
)
|
||||
{
|
||||
ARM_MEMORY_REGION_DESCRIPTOR Descriptor;
|
||||
VOID *MemorySizeHob;
|
||||
|
||||
MemorySizeHob = GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid);
|
||||
ASSERT (MemorySizeHob != NULL);
|
||||
if (MemorySizeHob == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Descriptor.PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
|
||||
Descriptor.VirtualBase = Descriptor.PhysicalBase;
|
||||
Descriptor.Length = *(UINT64 *)GET_GUID_HOB_DATA (MemorySizeHob);
|
||||
Descriptor.Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
|
||||
ArmMakeUserPageTableTemplate (
|
||||
&Descriptor,
|
||||
UserPageTableTemplate,
|
||||
UserPageTableTemplateSize
|
||||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -809,315 +809,315 @@ CoreOpenVolume (
|
|||
return Status;
|
||||
}
|
||||
|
||||
INTN
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStriColl (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN CHAR16 *Str1,
|
||||
IN CHAR16 *Str2
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
UINTN Size2;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (Str1);
|
||||
Size2 = StrSize (Str2);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1 + Size2),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str1, Size1);
|
||||
CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Str2, Size2);
|
||||
EntryPoint = (VOID *)This->StriColl;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
3,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem,
|
||||
(UINTN)UserMem + Size1
|
||||
);
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2));
|
||||
|
||||
return (INTN)Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CoreUnicodeCollationMetaiMatch (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN CHAR16 *String,
|
||||
IN CHAR16 *Pattern
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
UINTN Size2;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (String);
|
||||
Size2 = StrSize (Pattern);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1 + Size2),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1);
|
||||
CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Pattern, Size2);
|
||||
EntryPoint = (VOID *)This->MetaiMatch;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
3,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem,
|
||||
(UINTN)UserMem + Size1
|
||||
);
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2));
|
||||
|
||||
return (BOOLEAN)Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStrLwr (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN OUT CHAR16 *Str
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (Str);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1);
|
||||
EntryPoint = (VOID *)This->StrLwr;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
2,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1));
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStrUpr (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN OUT CHAR16 *Str
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (Str);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1);
|
||||
EntryPoint = (VOID *)This->StrUpr;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
2,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1));
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreUnicodeCollationFatToStr (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN UINTN FatSize,
|
||||
IN CHAR8 *Fat,
|
||||
OUT CHAR16 *String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (FatSize * 3),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Fat, FatSize);
|
||||
EntryPoint = (VOID *)This->FatToStr;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
4,
|
||||
EntryPoint,
|
||||
This,
|
||||
FatSize,
|
||||
(UINTN)UserMem,
|
||||
(UINTN)UserMem + FatSize
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)String, (VOID *)((UINTN)UserMem + FatSize), FatSize * 2);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize * 3));
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStrToFat (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN CHAR16 *String,
|
||||
IN UINTN FatSize,
|
||||
OUT CHAR8 *Fat
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (String);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (FatSize + Size1),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1);
|
||||
EntryPoint = (VOID *)This->StrToFat;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
4,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem,
|
||||
FatSize,
|
||||
(UINTN)UserMem + Size1
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)Fat, (VOID *)((UINTN)UserMem + Size1), FatSize);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize + Size1));
|
||||
|
||||
return (BOOLEAN)Status;
|
||||
}
|
||||
INTN
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStriColl (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN CHAR16 *Str1,
|
||||
IN CHAR16 *Str2
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
UINTN Size2;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (Str1);
|
||||
Size2 = StrSize (Str2);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1 + Size2),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str1, Size1);
|
||||
CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Str2, Size2);
|
||||
EntryPoint = (VOID *)This->StriColl;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
3,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem,
|
||||
(UINTN)UserMem + Size1
|
||||
);
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2));
|
||||
|
||||
return (INTN)Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CoreUnicodeCollationMetaiMatch (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN CHAR16 *String,
|
||||
IN CHAR16 *Pattern
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
UINTN Size2;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (String);
|
||||
Size2 = StrSize (Pattern);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1 + Size2),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1);
|
||||
CopyMem ((VOID *)((UINTN)UserMem + Size1), (VOID *)Pattern, Size2);
|
||||
EntryPoint = (VOID *)This->MetaiMatch;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
3,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem,
|
||||
(UINTN)UserMem + Size1
|
||||
);
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1 + Size2));
|
||||
|
||||
return (BOOLEAN)Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStrLwr (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN OUT CHAR16 *Str
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (Str);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1);
|
||||
EntryPoint = (VOID *)This->StrLwr;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
2,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1));
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStrUpr (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN OUT CHAR16 *Str
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (Str);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (Size1),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Str, Size1);
|
||||
EntryPoint = (VOID *)This->StrUpr;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
2,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)Str, (VOID *)(UINTN)UserMem, Size1);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (Size1));
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreUnicodeCollationFatToStr (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN UINTN FatSize,
|
||||
IN CHAR8 *Fat,
|
||||
OUT CHAR16 *String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (FatSize * 3),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)Fat, FatSize);
|
||||
EntryPoint = (VOID *)This->FatToStr;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
4,
|
||||
EntryPoint,
|
||||
This,
|
||||
FatSize,
|
||||
(UINTN)UserMem,
|
||||
(UINTN)UserMem + FatSize
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)String, (VOID *)((UINTN)UserMem + FatSize), FatSize * 2);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize * 3));
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CoreUnicodeCollationStrToFat (
|
||||
IN EFI_UNICODE_COLLATION_PROTOCOL *This,
|
||||
IN CHAR16 *String,
|
||||
IN UINTN FatSize,
|
||||
OUT CHAR8 *Fat
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS UserMem;
|
||||
USER_SPACE_DRIVER *UserDriver;
|
||||
VOID *EntryPoint;
|
||||
UINTN Size1;
|
||||
|
||||
UserDriver = FindUserSpaceDriver (This);
|
||||
ASSERT (UserDriver != NULL);
|
||||
|
||||
This = UserDriver->UserSpaceDriver;
|
||||
gUserPageTable = UserDriver->UserPageTable;
|
||||
|
||||
Size1 = StrSize (String);
|
||||
|
||||
Status = CoreAllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiRing3MemoryType,
|
||||
EFI_SIZE_TO_PAGES (FatSize + Size1),
|
||||
&UserMem
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)(UINTN)UserMem, (VOID *)String, Size1);
|
||||
EntryPoint = (VOID *)This->StrToFat;
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
Status = GoToRing3 (
|
||||
4,
|
||||
EntryPoint,
|
||||
This,
|
||||
(UINTN)UserMem,
|
||||
FatSize,
|
||||
(UINTN)UserMem + Size1
|
||||
);
|
||||
|
||||
AllowSupervisorAccessToUserMemory ();
|
||||
CopyMem ((VOID *)Fat, (VOID *)((UINTN)UserMem + Size1), FatSize);
|
||||
ForbidSupervisorAccessToUserMemory ();
|
||||
|
||||
CoreFreePages (UserMem, EFI_SIZE_TO_PAGES (FatSize + Size1));
|
||||
|
||||
return (BOOLEAN)Status;
|
||||
}
|
||||
|
|
|
@ -468,18 +468,18 @@ DoReturn:
|
|||
|
||||
DoIret:
|
||||
iretd
|
||||
ReturnToRing3:
|
||||
mov ecx, [ASM_PFX(UserPageTable)]
|
||||
mov cr3, ecx
|
||||
pop ecx
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
add esp, 8
|
||||
iretd
|
||||
ReturnToRing3:
|
||||
mov ecx, [ASM_PFX(UserPageTable)]
|
||||
mov cr3, ecx
|
||||
pop ecx
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
add esp, 8
|
||||
iretd
|
||||
|
||||
ALIGN 4096
|
||||
global ASM_PFX(ExceptionHandlerEnd)
|
||||
ASM_PFX(ExceptionHandlerEnd):
|
||||
ALIGN 4096
|
||||
global ASM_PFX(ExceptionHandlerEnd)
|
||||
ASM_PFX(ExceptionHandlerEnd):
|
||||
|
||||
;---------------------------------------;
|
||||
; _AsmGetTemplateAddressMap ;
|
||||
|
|
|
@ -63,13 +63,13 @@ global ASM_PFX(UserPageTable)
|
|||
ASM_PFX(UserPageTable):
|
||||
resq 1
|
||||
|
||||
global ASM_PFX(mSwitchCr3Flag)
|
||||
ASM_PFX(mSwitchCr3Flag):
|
||||
db 0x0
|
||||
global ASM_PFX(mSwitchCr3Flag)
|
||||
ASM_PFX(mSwitchCr3Flag):
|
||||
db 0x0
|
||||
|
||||
ALIGN 4096
|
||||
Padding:
|
||||
db 0x0
|
||||
ALIGN 4096
|
||||
Padding:
|
||||
db 0x0
|
||||
|
||||
DEFAULT REL
|
||||
SECTION .text
|
||||
|
@ -493,17 +493,17 @@ DoReturn:
|
|||
DoIret:
|
||||
iretq
|
||||
ReturnToRing3:
|
||||
mov rcx, [ASM_PFX(UserPageTable)]
|
||||
mov cr3, rcx
|
||||
pop rcx
|
||||
mov rsp, rbp
|
||||
pop rbp
|
||||
add rsp, 16
|
||||
mov rcx, [ASM_PFX(UserPageTable)]
|
||||
mov cr3, rcx
|
||||
pop rcx
|
||||
mov rsp, rbp
|
||||
pop rbp
|
||||
add rsp, 16
|
||||
iretq
|
||||
|
||||
ALIGN 4096
|
||||
global ASM_PFX(ExceptionHandlerEnd)
|
||||
ASM_PFX(ExceptionHandlerEnd):
|
||||
global ASM_PFX(ExceptionHandlerEnd)
|
||||
ASM_PFX(ExceptionHandlerEnd):
|
||||
|
||||
;-------------------------------------------------------------------------------------
|
||||
; GetTemplateAddressMap (&AddressMap);
|
||||
|
|
Loading…
Reference in New Issue