Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
e4ded0c6
Commit
e4ded0c6
authored
Aug 18, 2020
by
Alexei Fedorov
Committed by
TrustedFirmware Code Review
Aug 18, 2020
Browse files
Merge "el3_runtime: Update context save and restore routines for EL1 and EL2" into integration
parents
6b76d1e9
fb2072b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/el3_runtime/aarch64/context.S
View file @
e4ded0c6
...
...
@@ -233,21 +233,6 @@ endfunc el2_sysregs_context_save
*/
func
el2_sysregs_context_restore
#if ERRATA_SPECULATIVE_AT
/*
Clear
EPD0
and
EPD1
bit
and
M
bit
to
disable
PTW
*/
mrs
x9
,
hcr_el2
tst
x9
,
#
HCR_E2H_BIT
bne
1
f
mrs
x9
,
tcr_el2
orr
x9
,
x9
,
#
TCR_EPD0_BIT
orr
x9
,
x9
,
#
TCR_EPD1_BIT
msr
tcr_el2
,
x9
1
:
mrs
x9
,
sctlr_el2
bic
x9
,
x9
,
#
SCTLR_M_BIT
msr
sctlr_el2
,
x9
isb
#endif
ldp
x9
,
x10
,
[
x0
,
#
CTX_ACTLR_EL2
]
msr
actlr_el2
,
x9
msr
afsr0_el2
,
x10
...
...
@@ -296,136 +281,127 @@ func el2_sysregs_context_restore
msr
mdcr_el2
,
x15
msr
PMSCR_EL2
,
x16
ldp
x17
,
x9
,
[
x0
,
#
CTX_SPSR_EL2
]
msr
spsr_el2
,
x17
msr
sp_el2
,
x9
ldp
x17
,
x9
,
[
x0
,
#
CTX_SCTLR_EL2
]
msr
sctlr_el2
,
x17
msr
spsr_el2
,
x9
ldp
x10
,
x11
,
[
x0
,
#
CTX_SP_EL2
]
msr
sp_el2
,
x10
msr
tcr_el2
,
x11
ldp
x1
0
,
x1
1
,
[
x0
,
#
CTX_TPIDR_EL2
]
msr
tpidr_el2
,
x1
0
ms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
9
,
[
x0
,
#
CTX_TRFCR_EL2
]
msr
TRFCR_EL2
,
x
9
#endif
#if ARM_ARCH_AT_LEAST(8, 5)
ldr
x9
,
[
x0
,
#
CTX_SCXTNUM_EL2
]
msr
scxtnum_el2
,
x9
#endif
#if ERRATA_SPECULATIVE_AT
/*
*
Make
sure
all
registers
are
stored
successfully
except
*
SCTLR_EL2
and
TCR_EL2
*/
isb
ldr
x10
,
[
x0
,
#
CTX_SCXTNUM_EL2
]
msr
scxtnum_el2
,
x10
#endif
ldr
x9
,
[
x0
,
#
CTX_SCTLR_EL2
]
msr
sctlr_el2
,
x9
ldr
x9
,
[
x0
,
#
CTX_TCR_EL2
]
msr
tcr_el2
,
x9
ret
endfunc
el2_sysregs_context_restore
...
...
@@ -537,22 +513,12 @@ endfunc el1_sysregs_context_save
*/
func
el1_sysregs_context_restore
#if ERRATA_SPECULATIVE_AT
mrs
x9
,
tcr_el1
orr
x9
,
x9
,
#
TCR_EPD0_BIT
orr
x9
,
x9
,
#
TCR_EPD1_BIT
msr
tcr_el1
,
x9
mrs
x9
,
sctlr_el1
bic
x9
,
x9
,
#
SCTLR_M_BIT
msr
sctlr_el1
,
x9
isb
#endif
ldp
x9
,
x10
,
[
x0
,
#
CTX_SPSR_EL1
]
msr
spsr_el1
,
x9
msr
elr_el1
,
x10
ldr
x16
,
[
x0
,
#
CTX_ACTLR_EL1
]
ldp
x15
,
x16
,
[
x0
,
#
CTX_SCTLR_EL1
]
msr
sctlr_el1
,
x15
msr
actlr_el1
,
x16
ldp
x17
,
x9
,
[
x0
,
#
CTX_CPACR_EL1
]
...
...
@@ -571,8 +537,9 @@ func el1_sysregs_context_restore
msr
mair_el1
,
x14
msr
amair_el1
,
x15
ldr
x16
,[
x0
,
#
CTX_TPIDR_EL1
]
msr
tpidr_el1
,
x16
ldp
x16
,
x17
,
[
x0
,
#
CTX_TCR_EL1
]
msr
tcr_el1
,
x16
msr
tpidr_el1
,
x17
ldp
x9
,
x10
,
[
x0
,
#
CTX_TPIDR_EL0
]
msr
tpidr_el0
,
x9
...
...
@@ -628,19 +595,6 @@ func el1_sysregs_context_restore
msr
GCR_EL1
,
x14
#endif
#if ERRATA_SPECULATIVE_AT
/*
*
Make
sure
all
registers
are
stored
successfully
except
*
SCTLR_EL1
and
TCR_EL1
*/
isb
#endif
ldr
x9
,
[
x0
,
#
CTX_SCTLR_EL1
]
msr
sctlr_el1
,
x9
ldr
x9
,
[
x0
,
#
CTX_TCR_EL1
]
msr
tcr_el1
,
x9
/
*
No
explict
ISB
required
here
as
ERET
covers
it
*/
ret
endfunc
el1_sysregs_context_restore
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment