summaryrefslogtreecommitdiff
path: root/src/arch/arm64/armv8/lib
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2017-05-10 22:07:55 +0200
committerPatrick Georgi <pgeorgi@google.com>2017-05-16 10:52:53 +0200
commitff2938ff4b63bedae1ab402b8f8f6272b3120a35 (patch)
tree0b418b971a32c1dc5e38cf360f2a648a4d461c4d /src/arch/arm64/armv8/lib
parent6d3ce3a9960dff3ab6a6ff80d87361e9e2fed72f (diff)
arch/arm64: Use variables of the right size for msr/mrs opcodes
They do 64bit accesses, and gcc does the necessary fix ups to handle 32bit values as zero-padded 64bit values. clang, however, isn't happy with it. Change-Id: I9c8b9fe3a1adc521e393c2e2a0216f7f425a2a3e Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/19661 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/arch/arm64/armv8/lib')
-rw-r--r--src/arch/arm64/armv8/lib/clock.c2
-rw-r--r--src/arch/arm64/armv8/lib/pstate.c50
-rw-r--r--src/arch/arm64/armv8/lib/sysctrl.c118
3 files changed, 84 insertions, 86 deletions
diff --git a/src/arch/arm64/armv8/lib/clock.c b/src/arch/arm64/armv8/lib/clock.c
index 7cd4bc6c55..f15adf404d 100644
--- a/src/arch/arm64/armv8/lib/clock.c
+++ b/src/arch/arm64/armv8/lib/clock.c
@@ -23,5 +23,5 @@
void set_cntfrq(uint32_t freq)
{
- __asm__ __volatile__("msr cntfrq_el0, %0" :: "r"(freq));
+ __asm__ __volatile__("msr cntfrq_el0, %0" :: "r"((uint64_t)freq));
}
diff --git a/src/arch/arm64/armv8/lib/pstate.c b/src/arch/arm64/armv8/lib/pstate.c
index f3189f06b8..e068031bd2 100644
--- a/src/arch/arm64/armv8/lib/pstate.c
+++ b/src/arch/arm64/armv8/lib/pstate.c
@@ -25,7 +25,7 @@
/* CurrentEL */
uint32_t raw_read_current_el(void)
{
- uint32_t current_el;
+ uint64_t current_el;
__asm__ __volatile__("mrs %0, CurrentEL\n\t" : "=r" (current_el) : : "memory");
@@ -41,7 +41,7 @@ uint32_t get_current_el(void)
/* DAIF */
uint32_t raw_read_daif(void)
{
- uint32_t daif;
+ uint64_t daif;
__asm__ __volatile__("mrs %0, DAIF\n\t" : "=r" (daif) : : "memory");
@@ -50,7 +50,7 @@ uint32_t raw_read_daif(void)
void raw_write_daif(uint32_t daif)
{
- __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
+ __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" ((uint64_t)daif) : "memory");
}
void enable_debug_exceptions(void)
@@ -189,7 +189,7 @@ void raw_write_elr(uint64_t elr, uint32_t el)
/* FPCR */
uint32_t raw_read_fpcr(void)
{
- uint32_t fpcr;
+ uint64_t fpcr;
__asm__ __volatile__("mrs %0, FPCR\n\t" : "=r" (fpcr) : : "memory");
@@ -198,13 +198,13 @@ uint32_t raw_read_fpcr(void)
void raw_write_fpcr(uint32_t fpcr)
{
- __asm__ __volatile__("msr FPCR, %0\n\t" : : "r" (fpcr) : "memory");
+ __asm__ __volatile__("msr FPCR, %0\n\t" : : "r" ((uint64_t)fpcr) : "memory");
}
/* FPSR */
uint32_t raw_read_fpsr(void)
{
- uint32_t fpsr;
+ uint64_t fpsr;
__asm__ __volatile__("mrs %0, FPSR\n\t" : "=r" (fpsr) : : "memory");
@@ -213,13 +213,13 @@ uint32_t raw_read_fpsr(void)
void raw_write_fpsr(uint32_t fpsr)
{
- __asm__ __volatile__("msr FPSR, %0\n\t" : : "r" (fpsr) : "memory");
+ __asm__ __volatile__("msr FPSR, %0\n\t" : : "r" ((uint64_t)fpsr) : "memory");
}
/* NZCV */
uint32_t raw_read_nzcv(void)
{
- uint32_t nzcv;
+ uint64_t nzcv;
__asm__ __volatile__("mrs %0, NZCV\n\t" : "=r" (nzcv) : : "memory");
@@ -228,7 +228,7 @@ uint32_t raw_read_nzcv(void)
void raw_write_nzcv(uint32_t nzcv)
{
- __asm__ __volatile__("msr NZCV, %0\n\t" : : "r" (nzcv) : "memory");
+ __asm__ __volatile__("msr NZCV, %0\n\t" : : "r" ((uint64_t)nzcv) : "memory");
}
/* SP */
@@ -277,7 +277,7 @@ void raw_write_sp_el2(uint64_t sp_el2)
/* SPSel */
uint32_t raw_read_spsel(void)
{
- uint32_t spsel;
+ uint64_t spsel;
__asm__ __volatile__("mrs %0, SPSel\n\t" : "=r" (spsel) : : "memory");
@@ -286,7 +286,7 @@ uint32_t raw_read_spsel(void)
void raw_write_spsel(uint32_t spsel)
{
- __asm__ __volatile__("msr SPSel, %0\n\t" : : "r" (spsel) : "memory");
+ __asm__ __volatile__("msr SPSel, %0\n\t" : : "r" ((uint64_t)spsel) : "memory");
}
uint64_t raw_read_sp_el3(void)
@@ -333,7 +333,7 @@ void raw_write_sp_elx(uint64_t sp_elx, uint32_t el)
/* SPSR */
uint32_t raw_read_spsr_abt(void)
{
- uint32_t spsr_abt;
+ uint64_t spsr_abt;
__asm__ __volatile__("mrs %0, SPSR_abt\n\t" : "=r" (spsr_abt) : : "memory");
@@ -342,12 +342,12 @@ uint32_t raw_read_spsr_abt(void)
void raw_write_spsr_abt(uint32_t spsr_abt)
{
- __asm__ __volatile__("msr SPSR_abt, %0\n\t" : : "r" (spsr_abt) : "memory");
+ __asm__ __volatile__("msr SPSR_abt, %0\n\t" : : "r" ((uint64_t)spsr_abt) : "memory");
}
uint32_t raw_read_spsr_el1(void)
{
- uint32_t spsr_el1;
+ uint64_t spsr_el1;
__asm__ __volatile__("mrs %0, SPSR_EL1\n\t" : "=r" (spsr_el1) : : "memory");
@@ -356,12 +356,12 @@ uint32_t raw_read_spsr_el1(void)
void raw_write_spsr_el1(uint32_t spsr_el1)
{
- __asm__ __volatile__("msr SPSR_EL1, %0\n\t" : : "r" (spsr_el1) : "memory");
+ __asm__ __volatile__("msr SPSR_EL1, %0\n\t" : : "r" ((uint64_t)spsr_el1) : "memory");
}
uint32_t raw_read_spsr_el2(void)
{
- uint32_t spsr_el2;
+ uint64_t spsr_el2;
__asm__ __volatile__("mrs %0, SPSR_EL2\n\t" : "=r" (spsr_el2) : : "memory");
@@ -370,12 +370,12 @@ uint32_t raw_read_spsr_el2(void)
void raw_write_spsr_el2(uint32_t spsr_el2)
{
- __asm__ __volatile__("msr SPSR_EL2, %0\n\t" : : "r" (spsr_el2) : "memory");
+ __asm__ __volatile__("msr SPSR_EL2, %0\n\t" : : "r" ((uint64_t)spsr_el2) : "memory");
}
uint32_t raw_read_spsr_el3(void)
{
- uint32_t spsr_el3;
+ uint64_t spsr_el3;
__asm__ __volatile__("mrs %0, SPSR_EL3\n\t" : "=r" (spsr_el3) : : "memory");
@@ -384,7 +384,7 @@ uint32_t raw_read_spsr_el3(void)
void raw_write_spsr_el3(uint32_t spsr_el3)
{
- __asm__ __volatile__("msr SPSR_EL3, %0\n\t" : : "r" (spsr_el3) : "memory");
+ __asm__ __volatile__("msr SPSR_EL3, %0\n\t" : : "r" ((uint64_t)spsr_el3) : "memory");
}
uint32_t raw_read_spsr_current(void)
@@ -411,7 +411,7 @@ void raw_write_spsr(uint32_t spsr, uint32_t el)
uint32_t raw_read_spsr_fiq(void)
{
- uint32_t spsr_fiq;
+ uint64_t spsr_fiq;
__asm__ __volatile__("mrs %0, SPSR_fiq\n\t" : "=r" (spsr_fiq) : : "memory");
@@ -420,12 +420,12 @@ uint32_t raw_read_spsr_fiq(void)
void raw_write_spsr_fiq(uint32_t spsr_fiq)
{
- __asm__ __volatile__("msr SPSR_fiq, %0\n\t" : : "r" (spsr_fiq) : "memory");
+ __asm__ __volatile__("msr SPSR_fiq, %0\n\t" : : "r" ((uint64_t)spsr_fiq) : "memory");
}
uint32_t raw_read_spsr_irq(void)
{
- uint32_t spsr_irq;
+ uint64_t spsr_irq;
__asm__ __volatile__("mrs %0, SPSR_irq\n\t" : "=r" (spsr_irq) : : "memory");
@@ -434,12 +434,12 @@ uint32_t raw_read_spsr_irq(void)
void raw_write_spsr_irq(uint32_t spsr_irq)
{
- __asm__ __volatile__("msr SPSR_irq, %0\n\t" : : "r" (spsr_irq) : "memory");
+ __asm__ __volatile__("msr SPSR_irq, %0\n\t" : : "r" ((uint64_t)spsr_irq) : "memory");
}
uint32_t raw_read_spsr_und(void)
{
- uint32_t spsr_und;
+ uint64_t spsr_und;
__asm__ __volatile__("mrs %0, SPSR_und\n\t" : "=r" (spsr_und) : : "memory");
@@ -448,5 +448,5 @@ uint32_t raw_read_spsr_und(void)
void raw_write_spsr_und(uint32_t spsr_und)
{
- __asm__ __volatile__("msr SPSR_und, %0\n\t" : : "r" (spsr_und) : "memory");
+ __asm__ __volatile__("msr SPSR_und, %0\n\t" : : "r" ((uint64_t)spsr_und) : "memory");
}
diff --git a/src/arch/arm64/armv8/lib/sysctrl.c b/src/arch/arm64/armv8/lib/sysctrl.c
index e349a25508..9cf26a5c69 100644
--- a/src/arch/arm64/armv8/lib/sysctrl.c
+++ b/src/arch/arm64/armv8/lib/sysctrl.c
@@ -25,7 +25,7 @@
/* ACTLR */
uint32_t raw_read_actlr_el1(void)
{
- uint32_t actlr_el1;
+ uint64_t actlr_el1;
__asm__ __volatile__("mrs %0, ACTLR_EL1\n\t" : "=r" (actlr_el1) : : "memory");
@@ -34,12 +34,12 @@ uint32_t raw_read_actlr_el1(void)
void raw_write_actlr_el1(uint32_t actlr_el1)
{
- __asm__ __volatile__("msr ACTLR_EL1, %0\n\t" : : "r" (actlr_el1) : "memory");
+ __asm__ __volatile__("msr ACTLR_EL1, %0\n\t" : : "r" ((uint64_t)actlr_el1) : "memory");
}
uint32_t raw_read_actlr_el2(void)
{
- uint32_t actlr_el2;
+ uint64_t actlr_el2;
__asm__ __volatile__("mrs %0, ACTLR_EL2\n\t" : "=r" (actlr_el2) : : "memory");
@@ -48,12 +48,12 @@ uint32_t raw_read_actlr_el2(void)
void raw_write_actlr_el2(uint32_t actlr_el2)
{
- __asm__ __volatile__("msr ACTLR_EL2, %0\n\t" : : "r" (actlr_el2) : "memory");
+ __asm__ __volatile__("msr ACTLR_EL2, %0\n\t" : : "r" ((uint64_t)actlr_el2) : "memory");
}
uint32_t raw_read_actlr_el3(void)
{
- uint32_t actlr_el3;
+ uint64_t actlr_el3;
__asm__ __volatile__("mrs %0, ACTLR_EL3\n\t" : "=r" (actlr_el3) : : "memory");
@@ -62,7 +62,7 @@ uint32_t raw_read_actlr_el3(void)
void raw_write_actlr_el3(uint32_t actlr_el3)
{
- __asm__ __volatile__("msr ACTLR_EL3, %0\n\t" : : "r" (actlr_el3) : "memory");
+ __asm__ __volatile__("msr ACTLR_EL3, %0\n\t" : : "r" ((uint64_t)actlr_el3) : "memory");
}
uint32_t raw_read_actlr_current(void)
@@ -90,7 +90,7 @@ void raw_write_actlr(uint32_t actlr, uint32_t el)
/* AFSR0 */
uint32_t raw_read_afsr0_el1(void)
{
- uint32_t afsr0_el1;
+ uint64_t afsr0_el1;
__asm__ __volatile__("mrs %0, AFSR0_EL1\n\t" : "=r" (afsr0_el1) : : "memory");
@@ -99,12 +99,12 @@ uint32_t raw_read_afsr0_el1(void)
void raw_write_afsr0_el1(uint32_t afsr0_el1)
{
- __asm__ __volatile__("msr AFSR0_EL1, %0\n\t" : : "r" (afsr0_el1) : "memory");
+ __asm__ __volatile__("msr AFSR0_EL1, %0\n\t" : : "r" ((uint64_t)afsr0_el1) : "memory");
}
uint32_t raw_read_afsr0_el2(void)
{
- uint32_t afsr0_el2;
+ uint64_t afsr0_el2;
__asm__ __volatile__("mrs %0, AFSR0_EL2\n\t" : "=r" (afsr0_el2) : : "memory");
@@ -113,12 +113,12 @@ uint32_t raw_read_afsr0_el2(void)
void raw_write_afsr0_el2(uint32_t afsr0_el2)
{
- __asm__ __volatile__("msr AFSR0_EL2, %0\n\t" : : "r" (afsr0_el2) : "memory");
+ __asm__ __volatile__("msr AFSR0_EL2, %0\n\t" : : "r" ((uint64_t)afsr0_el2) : "memory");
}
uint32_t raw_read_afsr0_el3(void)
{
- uint32_t afsr0_el3;
+ uint64_t afsr0_el3;
__asm__ __volatile__("mrs %0, AFSR0_EL3\n\t" : "=r" (afsr0_el3) : : "memory");
@@ -127,7 +127,7 @@ uint32_t raw_read_afsr0_el3(void)
void raw_write_afsr0_el3(uint32_t afsr0_el3)
{
- __asm__ __volatile__("msr AFSR0_EL3, %0\n\t" : : "r" (afsr0_el3) : "memory");
+ __asm__ __volatile__("msr AFSR0_EL3, %0\n\t" : : "r" ((uint64_t)afsr0_el3) : "memory");
}
uint32_t raw_read_afsr0_current(void)
@@ -155,7 +155,7 @@ void raw_write_afsr0(uint32_t afsr0, uint32_t el)
/* AFSR1 */
uint32_t raw_read_afsr1_el1(void)
{
- uint32_t afsr1_el1;
+ uint64_t afsr1_el1;
__asm__ __volatile__("mrs %0, AFSR1_EL1\n\t" : "=r" (afsr1_el1) : : "memory");
@@ -164,12 +164,12 @@ uint32_t raw_read_afsr1_el1(void)
void raw_write_afsr1_el1(uint32_t afsr1_el1)
{
- __asm__ __volatile__("msr AFSR1_EL1, %0\n\t" : : "r" (afsr1_el1) : "memory");
+ __asm__ __volatile__("msr AFSR1_EL1, %0\n\t" : : "r" ((uint64_t)afsr1_el1) : "memory");
}
uint32_t raw_read_afsr1_el2(void)
{
- uint32_t afsr1_el2;
+ uint64_t afsr1_el2;
__asm__ __volatile__("mrs %0, AFSR1_EL2\n\t" : "=r" (afsr1_el2) : : "memory");
@@ -178,12 +178,12 @@ uint32_t raw_read_afsr1_el2(void)
void raw_write_afsr1_el2(uint32_t afsr1_el2)
{
- __asm__ __volatile__("msr AFSR1_EL2, %0\n\t" : : "r" (afsr1_el2) : "memory");
+ __asm__ __volatile__("msr AFSR1_EL2, %0\n\t" : : "r" ((uint64_t)afsr1_el2) : "memory");
}
uint32_t raw_read_afsr1_el3(void)
{
- uint32_t afsr1_el3;
+ uint64_t afsr1_el3;
__asm__ __volatile__("mrs %0, AFSR1_EL3\n\t" : "=r" (afsr1_el3) : : "memory");
@@ -192,7 +192,7 @@ uint32_t raw_read_afsr1_el3(void)
void raw_write_afsr1_el3(uint32_t afsr1_el3)
{
- __asm__ __volatile__("msr AFSR1_EL3, %0\n\t" : : "r" (afsr1_el3) : "memory");
+ __asm__ __volatile__("msr AFSR1_EL3, %0\n\t" : : "r" ((uint64_t)afsr1_el3) : "memory");
}
uint32_t raw_read_afsr1_current(void)
@@ -220,7 +220,7 @@ void raw_write_afsr1(uint32_t afsr1, uint32_t el)
/* AIDR */
uint32_t raw_read_aidr_el1(void)
{
- uint32_t aidr_el1;
+ uint64_t aidr_el1;
__asm__ __volatile__("mrs %0, AIDR_EL1\n\t" : "=r" (aidr_el1) : : "memory");
@@ -295,7 +295,7 @@ void raw_write_amair(uint64_t amair, uint32_t el)
/* CCSIDR */
uint32_t raw_read_ccsidr_el1(void)
{
- uint32_t ccsidr_el1;
+ uint64_t ccsidr_el1;
__asm__ __volatile__("mrs %0, CCSIDR_EL1\n\t" : "=r" (ccsidr_el1) : : "memory");
@@ -305,7 +305,7 @@ uint32_t raw_read_ccsidr_el1(void)
/* CLIDR */
uint32_t raw_read_clidr_el1(void)
{
- uint32_t clidr_el1;
+ uint64_t clidr_el1;
__asm__ __volatile__("mrs %0, CLIDR_EL1\n\t" : "=r" (clidr_el1) : : "memory");
@@ -315,7 +315,7 @@ uint32_t raw_read_clidr_el1(void)
/* CPACR */
uint32_t raw_read_cpacr_el1(void)
{
- uint32_t cpacr_el1;
+ uint64_t cpacr_el1;
__asm__ __volatile__("mrs %0, CPACR_EL1\n\t" : "=r" (cpacr_el1) : : "memory");
@@ -324,13 +324,13 @@ uint32_t raw_read_cpacr_el1(void)
void raw_write_cpacr_el1(uint32_t cpacr_el1)
{
- __asm__ __volatile__("msr CPACR_EL1, %0\n\t" : : "r" (cpacr_el1) : "memory");
+ __asm__ __volatile__("msr CPACR_EL1, %0\n\t" : : "r" ((uint64_t)cpacr_el1) : "memory");
}
/* CPTR */
uint32_t raw_read_cptr_el2(void)
{
- uint32_t cptr_el2;
+ uint64_t cptr_el2;
__asm__ __volatile__("mrs %0, CPTR_EL2\n\t" : "=r" (cptr_el2) : : "memory");
@@ -339,12 +339,12 @@ uint32_t raw_read_cptr_el2(void)
void raw_write_cptr_el2(uint32_t cptr_el2)
{
- __asm__ __volatile__("msr CPTR_EL2, %0\n\t" : : "r" (cptr_el2) : "memory");
+ __asm__ __volatile__("msr CPTR_EL2, %0\n\t" : : "r" ((uint64_t)cptr_el2) : "memory");
}
uint32_t raw_read_cptr_el3(void)
{
- uint32_t cptr_el3;
+ uint64_t cptr_el3;
__asm__ __volatile__("mrs %0, CPTR_EL3\n\t" : "=r" (cptr_el3) : : "memory");
@@ -353,13 +353,13 @@ uint32_t raw_read_cptr_el3(void)
void raw_write_cptr_el3(uint32_t cptr_el3)
{
- __asm__ __volatile__("msr CPTR_EL3, %0\n\t" : : "r" (cptr_el3) : "memory");
+ __asm__ __volatile__("msr CPTR_EL3, %0\n\t" : : "r" ((uint64_t)cptr_el3) : "memory");
}
/* CSSELR */
uint32_t raw_read_csselr_el1(void)
{
- uint32_t csselr_el1;
+ uint64_t csselr_el1;
__asm__ __volatile__("mrs %0, CSSELR_EL1\n\t" : "=r" (csselr_el1) : : "memory");
@@ -368,13 +368,13 @@ uint32_t raw_read_csselr_el1(void)
void raw_write_csselr_el1(uint32_t csselr_el1)
{
- __asm__ __volatile__("msr CSSELR_EL1, %0\n\t" : : "r" (csselr_el1) : "memory");
+ __asm__ __volatile__("msr CSSELR_EL1, %0\n\t" : : "r" ((uint64_t)csselr_el1) : "memory");
}
/* CTR */
uint32_t raw_read_ctr_el0(void)
{
- uint32_t ctr_el0;
+ uint64_t ctr_el0;
__asm__ __volatile__("mrs %0, CTR_EL0\n\t" : "=r" (ctr_el0) : : "memory");
@@ -384,7 +384,7 @@ uint32_t raw_read_ctr_el0(void)
/* ESR */
uint32_t raw_read_esr_el1(void)
{
- uint32_t esr_el1;
+ uint64_t esr_el1;
__asm__ __volatile__("mrs %0, ESR_EL1\n\t" : "=r" (esr_el1) : : "memory");
@@ -393,12 +393,12 @@ uint32_t raw_read_esr_el1(void)
void raw_write_esr_el1(uint32_t esr_el1)
{
- __asm__ __volatile__("msr ESR_EL1, %0\n\t" : : "r" (esr_el1) : "memory");
+ __asm__ __volatile__("msr ESR_EL1, %0\n\t" : : "r" ((uint64_t)esr_el1) : "memory");
}
uint32_t raw_read_esr_el2(void)
{
- uint32_t esr_el2;
+ uint64_t esr_el2;
__asm__ __volatile__("mrs %0, ESR_EL2\n\t" : "=r" (esr_el2) : : "memory");
@@ -407,12 +407,12 @@ uint32_t raw_read_esr_el2(void)
void raw_write_esr_el2(uint32_t esr_el2)
{
- __asm__ __volatile__("msr ESR_EL2, %0\n\t" : : "r" (esr_el2) : "memory");
+ __asm__ __volatile__("msr ESR_EL2, %0\n\t" : : "r" ((uint64_t)esr_el2) : "memory");
}
uint32_t raw_read_esr_el3(void)
{
- uint32_t esr_el3;
+ uint64_t esr_el3;
__asm__ __volatile__("mrs %0, ESR_EL3\n\t" : "=r" (esr_el3) : : "memory");
@@ -421,7 +421,7 @@ uint32_t raw_read_esr_el3(void)
void raw_write_esr_el3(uint32_t esr_el3)
{
- __asm__ __volatile__("msr ESR_EL3, %0\n\t" : : "r" (esr_el3) : "memory");
+ __asm__ __volatile__("msr ESR_EL3, %0\n\t" : : "r" ((uint64_t)esr_el3) : "memory");
}
uint32_t raw_read_esr_current(void)
@@ -604,7 +604,7 @@ void raw_write_mair(uint64_t mair, uint32_t el)
/* MIDR */
uint32_t raw_read_midr_el1(void)
{
- uint32_t midr_el1;
+ uint64_t midr_el1;
__asm__ __volatile__("mrs %0, MIDR_EL1\n\t" : "=r" (midr_el1) : : "memory");
@@ -624,7 +624,7 @@ uint64_t raw_read_mpidr_el1(void)
/* RMR */
uint32_t raw_read_rmr_el1(void)
{
- uint32_t rmr_el1;
+ uint64_t rmr_el1;
__asm__ __volatile__("mrs %0, RMR_EL1\n\t" : "=r" (rmr_el1) : : "memory");
@@ -633,12 +633,12 @@ uint32_t raw_read_rmr_el1(void)
void raw_write_rmr_el1(uint32_t rmr_el1)
{
- __asm__ __volatile__("msr RMR_EL1, %0\n\t" : : "r" (rmr_el1) : "memory");
+ __asm__ __volatile__("msr RMR_EL1, %0\n\t" : : "r" ((uint64_t)rmr_el1) : "memory");
}
uint32_t raw_read_rmr_el2(void)
{
- uint32_t rmr_el2;
+ uint64_t rmr_el2;
__asm__ __volatile__("mrs %0, RMR_EL2\n\t" : "=r" (rmr_el2) : : "memory");
@@ -647,12 +647,12 @@ uint32_t raw_read_rmr_el2(void)
void raw_write_rmr_el2(uint32_t rmr_el2)
{
- __asm__ __volatile__("msr RMR_EL2, %0\n\t" : : "r" (rmr_el2) : "memory");
+ __asm__ __volatile__("msr RMR_EL2, %0\n\t" : : "r" ((uint64_t)rmr_el2) : "memory");
}
uint32_t raw_read_rmr_el3(void)
{
- uint32_t rmr_el3;
+ uint64_t rmr_el3;
__asm__ __volatile__("mrs %0, RMR_EL3\n\t" : "=r" (rmr_el3) : : "memory");
@@ -661,7 +661,7 @@ uint32_t raw_read_rmr_el3(void)
void raw_write_rmr_el3(uint32_t rmr_el3)
{
- __asm__ __volatile__("msr RMR_EL3, %0\n\t" : : "r" (rmr_el3) : "memory");
+ __asm__ __volatile__("msr RMR_EL3, %0\n\t" : : "r" ((uint64_t)rmr_el3) : "memory");
}
uint32_t raw_read_rmr_current(void)
@@ -754,7 +754,7 @@ void raw_write_rvbar(uint64_t rvbar, uint32_t el)
/* Scr */
uint32_t raw_read_scr_el3(void)
{
- uint32_t scr_el3;
+ uint64_t scr_el3;
__asm__ __volatile__("mrs %0, SCR_EL3\n\t" : "=r" (scr_el3) : : "memory");
@@ -763,13 +763,13 @@ uint32_t raw_read_scr_el3(void)
void raw_write_scr_el3(uint32_t scr_el3)
{
- __asm__ __volatile__("msr SCR_EL3, %0\n\t" : : "r" (scr_el3) : "memory");
+ __asm__ __volatile__("msr SCR_EL3, %0\n\t" : : "r" ((uint64_t)scr_el3) : "memory");
}
/* SCTLR */
uint32_t raw_read_sctlr_el1(void)
{
- uint32_t sctlr_el1;
+ uint64_t sctlr_el1;
__asm__ __volatile__("mrs %0, SCTLR_EL1\n\t" : "=r" (sctlr_el1) : : "memory");
@@ -778,12 +778,12 @@ uint32_t raw_read_sctlr_el1(void)
void raw_write_sctlr_el1(uint32_t sctlr_el1)
{
- __asm__ __volatile__("msr SCTLR_EL1, %0\n\t" : : "r" (sctlr_el1) : "memory");
+ __asm__ __volatile__("msr SCTLR_EL1, %0\n\t" : : "r" ((uint64_t)sctlr_el1) : "memory");
}
uint32_t raw_read_sctlr_el2(void)
{
- uint32_t sctlr_el2;
+ uint64_t sctlr_el2;
__asm__ __volatile__("mrs %0, SCTLR_EL2\n\t" : "=r" (sctlr_el2) : : "memory");
@@ -792,12 +792,12 @@ uint32_t raw_read_sctlr_el2(void)
void raw_write_sctlr_el2(uint32_t sctlr_el2)
{
- __asm__ __volatile__("msr SCTLR_EL2, %0\n\t" : : "r" (sctlr_el2) : "memory");
+ __asm__ __volatile__("msr SCTLR_EL2, %0\n\t" : : "r" ((uint64_t)sctlr_el2) : "memory");
}
uint32_t raw_read_sctlr_el3(void)
{
- uint32_t sctlr_el3;
+ uint64_t sctlr_el3;
__asm__ __volatile__("mrs %0, SCTLR_EL3\n\t" : "=r" (sctlr_el3) : : "memory");
@@ -806,7 +806,7 @@ uint32_t raw_read_sctlr_el3(void)
void raw_write_sctlr_el3(uint32_t sctlr_el3)
{
- __asm__ __volatile__("msr SCTLR_EL3, %0\n\t" : : "r" (sctlr_el3) : "memory");
+ __asm__ __volatile__("msr SCTLR_EL3, %0\n\t" : : "r" ((uint64_t)sctlr_el3) : "memory");
}
uint32_t raw_read_sctlr_current(void)
@@ -848,7 +848,7 @@ void raw_write_tcr_el1(uint64_t tcr_el1)
uint32_t raw_read_tcr_el2(void)
{
- uint32_t tcr_el2;
+ uint64_t tcr_el2;
__asm__ __volatile__("mrs %0, TCR_EL2\n\t" : "=r" (tcr_el2) : : "memory");
@@ -857,12 +857,12 @@ uint32_t raw_read_tcr_el2(void)
void raw_write_tcr_el2(uint32_t tcr_el2)
{
- __asm__ __volatile__("msr TCR_EL2, %0\n\t" : : "r" (tcr_el2) : "memory");
+ __asm__ __volatile__("msr TCR_EL2, %0\n\t" : : "r" ((uint64_t)tcr_el2) : "memory");
}
uint32_t raw_read_tcr_el3(void)
{
- uint32_t tcr_el3;
+ uint64_t tcr_el3;
__asm__ __volatile__("mrs %0, TCR_EL3\n\t" : "=r" (tcr_el3) : : "memory");
@@ -871,7 +871,7 @@ uint32_t raw_read_tcr_el3(void)
void raw_write_tcr_el3(uint32_t tcr_el3)
{
- __asm__ __volatile__("msr TCR_EL3, %0\n\t" : : "r" (tcr_el3) : "memory");
+ __asm__ __volatile__("msr TCR_EL3, %0\n\t" : : "r" ((uint64_t)tcr_el3) : "memory");
}
@@ -1049,15 +1049,13 @@ void raw_write_vbar(uint64_t vbar, uint32_t el)
uint32_t raw_read_cntfrq_el0(void)
{
- uint32_t cntfrq_el0;
+ uint64_t cntfrq_el0;
- __asm__ __volatile__("mrs %0, CNTFRQ_EL0\n\t" : "=r" (cntfrq_el0) : :
- "memory");
+ __asm__ __volatile__("mrs %0, CNTFRQ_EL0\n\t" : "=r" (cntfrq_el0) : : "memory");
return cntfrq_el0;
}
void raw_write_cntfrq_el0(uint32_t cntfrq_el0)
{
- __asm__ __volatile__("msr CNTFRQ_EL0, %0\n\t" : : "r" (cntfrq_el0) :
- "memory");
+ __asm__ __volatile__("msr CNTFRQ_EL0, %0\n\t" : : "r" ((uint64_t)cntfrq_el0) : "memory");
}