Skip to content

Commit

Permalink
Ring3: Fixed line endings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Krichanov committed Jan 10, 2025
1 parent 90ecffb commit efcbf19
Show file tree
Hide file tree
Showing 6 changed files with 397 additions and 397 deletions.
14 changes: 7 additions & 7 deletions ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -431,6 +431,6 @@ ASM_PFX(CorePageTable):
UserPageTable:
.ds.d 1

.balign 4096
Padding:
.ds.b 1
.balign 4096
Padding:
.ds.b 1
52 changes: 26 additions & 26 deletions ArmPkg/Library/ArmExceptionLib/Arm/ExceptionSupport.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
52 changes: 26 additions & 26 deletions MdeModulePkg/Core/Dxe/SysCall/ARM/InitializeARM.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit efcbf19

Please sign in to comment.