Commit 0a30cf54 authored by Andrew Thoelke's avatar Andrew Thoelke
Browse files

Place assembler functions in separate sections

This extends the --gc-sections behaviour to the many assembler
support functions in the firmware images by placing each function
into its own code section. This is achieved by creating a 'func'
macro used to declare each function label.

Fixes ARM-software/tf-issues#80

Change-Id: I301937b630add292d2dec6d2561a7fcfa6fec690
parent dccc537a
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
*/ */
#include <arch.h> #include <arch.h>
#include <asm_macros.S>
.weak cpu_reset_handler .weak cpu_reset_handler
.section .text, "ax"; .align 3 func cpu_reset_handler
cpu_reset_handler: ; .type cpu_reset_handler, %function
mov x19, x30 // lr mov x19, x30 // lr
/* --------------------------------------------- /* ---------------------------------------------
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <asm_macros.S>
.globl read_icc_sre_el1 .globl read_icc_sre_el1
.globl read_icc_sre_el2 .globl read_icc_sre_el2
.globl read_icc_sre_el3 .globl read_icc_sre_el3
...@@ -48,42 +50,40 @@ ...@@ -48,42 +50,40 @@
#define ICC_CTLR_EL3 S3_6_C12_C12_4 #define ICC_CTLR_EL3 S3_6_C12_C12_4
#define ICC_PMR_EL1 S3_0_C4_C6_0 #define ICC_PMR_EL1 S3_0_C4_C6_0
.section .text, "ax"; .align 3 func read_icc_sre_el1
read_icc_sre_el1: ; .type read_icc_sre_el1, %function
mrs x0, ICC_SRE_EL1 mrs x0, ICC_SRE_EL1
ret ret
read_icc_sre_el2: ; .type read_icc_sre_el2, %function func read_icc_sre_el2
mrs x0, ICC_SRE_EL2 mrs x0, ICC_SRE_EL2
ret ret
read_icc_sre_el3: ; .type read_icc_sre_el3, %function func read_icc_sre_el3
mrs x0, ICC_SRE_EL3 mrs x0, ICC_SRE_EL3
ret ret
write_icc_sre_el1: ; .type write_icc_sre_el1, %function func write_icc_sre_el1
msr ICC_SRE_EL1, x0 msr ICC_SRE_EL1, x0
isb isb
ret ret
write_icc_sre_el2: ; .type write_icc_sre_el2, %function func write_icc_sre_el2
msr ICC_SRE_EL2, x0 msr ICC_SRE_EL2, x0
isb isb
ret ret
write_icc_sre_el3: ; .type write_icc_sre_el3, %function func write_icc_sre_el3
msr ICC_SRE_EL3, x0 msr ICC_SRE_EL3, x0
isb isb
ret ret
write_icc_pmr_el1: ; .type write_icc_pmr_el1, %function func write_icc_pmr_el1
msr ICC_PMR_EL1, x0 msr ICC_PMR_EL1, x0
isb isb
ret ret
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
*/ */
#include <arch.h> #include <arch.h>
#include <asm_macros.S>
.globl bl1_entrypoint .globl bl1_entrypoint
.section .text, "ax"; .align 3
/* ----------------------------------------------------- /* -----------------------------------------------------
* bl1_entrypoint() is the entry point into the trusted * bl1_entrypoint() is the entry point into the trusted
* firmware code when a cpu is released from warm or * firmware code when a cpu is released from warm or
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
bl1_entrypoint: ; .type bl1_entrypoint, %function func bl1_entrypoint
/* --------------------------------------------- /* ---------------------------------------------
* Perform any processor specific actions upon * Perform any processor specific actions upon
* reset e.g. cache, tlb invalidations etc. * reset e.g. cache, tlb invalidations etc.
......
...@@ -178,8 +178,7 @@ SErrorA32: ...@@ -178,8 +178,7 @@ SErrorA32:
.align 7 .align 7
.section .text, "ax" func process_exception
process_exception:
sub sp, sp, #0x40 sub sp, sp, #0x40
stp x0, x1, [sp, #0x0] stp x0, x1, [sp, #0x0]
stp x2, x3, [sp, #0x10] stp x2, x3, [sp, #0x10]
......
...@@ -30,15 +30,14 @@ ...@@ -30,15 +30,14 @@
#include <bl_common.h> #include <bl_common.h>
#include <arch.h> #include <arch.h>
#include <asm_macros.S>
.globl bl2_entrypoint .globl bl2_entrypoint
.section .text, "ax"; .align 3
func bl2_entrypoint
bl2_entrypoint: ; .type bl2_entrypoint, %function
/*--------------------------------------------- /*---------------------------------------------
* Store the extents of the tzram available to * Store the extents of the tzram available to
* BL2 for future use. Use the opcode param to * BL2 for future use. Use the opcode param to
......
...@@ -32,20 +32,19 @@ ...@@ -32,20 +32,19 @@
#include <platform.h> #include <platform.h>
#include <arch.h> #include <arch.h>
#include "cm_macros.S" #include "cm_macros.S"
#include <asm_macros.S>
.globl bl31_entrypoint .globl bl31_entrypoint
.section .text, "ax"; .align 3
/* ----------------------------------------------------- /* -----------------------------------------------------
* bl31_entrypoint() is the cold boot entrypoint, * bl31_entrypoint() is the cold boot entrypoint,
* executed only by the primary cpu. * executed only by the primary cpu.
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
bl31_entrypoint: ; .type bl31_entrypoint, %function func bl31_entrypoint
/* --------------------------------------------- /* ---------------------------------------------
* BL2 has populated x0 with the opcode * BL2 has populated x0 with the opcode
* indicating BL31 should be run, x3 with * indicating BL31 should be run, x3 with
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*/ */
#include <context.h> #include <context.h>
#include <asm_macros.S>
/* ----------------------------------------------------- /* -----------------------------------------------------
* The following function strictly follows the AArch64 * The following function strictly follows the AArch64
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
.global el3_sysregs_context_save .global el3_sysregs_context_save
el3_sysregs_context_save: func el3_sysregs_context_save
mrs x9, scr_el3 mrs x9, scr_el3
mrs x10, sctlr_el3 mrs x10, sctlr_el3
...@@ -75,7 +76,7 @@ el3_sysregs_context_save: ...@@ -75,7 +76,7 @@ el3_sysregs_context_save:
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
.global el3_sysregs_context_restore .global el3_sysregs_context_restore
el3_sysregs_context_restore: func el3_sysregs_context_restore
ldp x11, xzr, [x0, #CTX_CPTR_EL3] ldp x11, xzr, [x0, #CTX_CPTR_EL3]
msr cptr_el3, x11 msr cptr_el3, x11
...@@ -112,7 +113,7 @@ el3_sysregs_context_restore: ...@@ -112,7 +113,7 @@ el3_sysregs_context_restore:
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
.global el1_sysregs_context_save .global el1_sysregs_context_save
el1_sysregs_context_save: func el1_sysregs_context_save
mrs x9, spsr_el1 mrs x9, spsr_el1
mrs x10, elr_el1 mrs x10, elr_el1
...@@ -193,7 +194,7 @@ el1_sysregs_context_save: ...@@ -193,7 +194,7 @@ el1_sysregs_context_save:
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
.global el1_sysregs_context_restore .global el1_sysregs_context_restore
el1_sysregs_context_restore: func el1_sysregs_context_restore
ldp x9, x10, [x0, #CTX_SPSR_EL1] ldp x9, x10, [x0, #CTX_SPSR_EL1]
msr spsr_el1, x9 msr spsr_el1, x9
...@@ -284,7 +285,7 @@ el1_sysregs_context_restore: ...@@ -284,7 +285,7 @@ el1_sysregs_context_restore:
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
.global fpregs_context_save .global fpregs_context_save
fpregs_context_save: func fpregs_context_save
stp q0, q1, [x0, #CTX_FP_Q0] stp q0, q1, [x0, #CTX_FP_Q0]
stp q2, q3, [x0, #CTX_FP_Q2] stp q2, q3, [x0, #CTX_FP_Q2]
stp q4, q5, [x0, #CTX_FP_Q4] stp q4, q5, [x0, #CTX_FP_Q4]
...@@ -327,7 +328,7 @@ fpregs_context_save: ...@@ -327,7 +328,7 @@ fpregs_context_save:
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
.global fpregs_context_restore .global fpregs_context_restore
fpregs_context_restore: func fpregs_context_restore
ldp q0, q1, [x0, #CTX_FP_Q0] ldp q0, q1, [x0, #CTX_FP_Q0]
ldp q2, q3, [x0, #CTX_FP_Q2] ldp q2, q3, [x0, #CTX_FP_Q2]
ldp q4, q5, [x0, #CTX_FP_Q4] ldp q4, q5, [x0, #CTX_FP_Q4]
......
...@@ -203,7 +203,6 @@ serror_aarch32: ...@@ -203,7 +203,6 @@ serror_aarch32:
.align 7 .align 7
.section .text, "ax"
/* ----------------------------------------------------- /* -----------------------------------------------------
* The following code handles secure monitor calls. * The following code handles secure monitor calls.
* Depending upon the execution state from where the SMC * Depending upon the execution state from where the SMC
...@@ -217,6 +216,7 @@ serror_aarch32: ...@@ -217,6 +216,7 @@ serror_aarch32:
* used here * used here
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
func smc_handler
smc_handler32: smc_handler32:
/* Check whether aarch32 issued an SMC64 */ /* Check whether aarch32 issued an SMC64 */
tbnz x0, #FUNCID_CC_SHIFT, smc_prohibited tbnz x0, #FUNCID_CC_SHIFT, smc_prohibited
...@@ -330,6 +330,9 @@ smc_handler64: ...@@ -330,6 +330,9 @@ smc_handler64:
* This routine assumes that the SP_EL3 is pointing to * This routine assumes that the SP_EL3 is pointing to
* a valid context structure from where the gp regs and * a valid context structure from where the gp regs and
* other special registers can be retrieved. * other special registers can be retrieved.
*
* Keep it in the same section as smc_handler as this
* function uses a fall-through to el3_exit
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
el3_exit: ; .type el3_exit, %function el3_exit: ; .type el3_exit, %function
...@@ -383,7 +386,7 @@ rt_svc_fw_critical_error: ...@@ -383,7 +386,7 @@ rt_svc_fw_critical_error:
* within the 32 instructions per exception vector. * within the 32 instructions per exception vector.
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
save_scratch_registers: ; .type save_scratch_registers, %function func save_scratch_registers
stp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0] stp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0]
stp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2] stp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2]
stp x4, x5, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X4] stp x4, x5, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X4]
...@@ -397,7 +400,7 @@ save_scratch_registers: ; .type save_scratch_registers, %function ...@@ -397,7 +400,7 @@ save_scratch_registers: ; .type save_scratch_registers, %function
stp x18, x17, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X18] stp x18, x17, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X18]
ret ret
restore_scratch_registers: ; .type restore_scratch_registers, %function func restore_scratch_registers
ldp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0] ldp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0]
ldp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2] ldp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2]
...@@ -430,7 +433,7 @@ restore_scratch_registers_callee: ...@@ -430,7 +433,7 @@ restore_scratch_registers_callee:
* reporting unhandled exceptions * reporting unhandled exceptions
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
get_exception_stack: ; .type get_exception_stack, %function func get_exception_stack
mov x10, x30 // lr mov x10, x30 // lr
bl platform_get_core_pos bl platform_get_core_pos
add x0, x0, #1 add x0, x0, #1
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <bl_common.h> #include <bl_common.h>
#include <arch.h> #include <arch.h>
#include <tsp.h> #include <tsp.h>
#include <asm_macros.S>
.globl tsp_entrypoint .globl tsp_entrypoint
...@@ -53,10 +54,8 @@ ...@@ -53,10 +54,8 @@
smc #0 smc #0
.endm .endm
.section .text, "ax"; .align 3
func tsp_entrypoint
tsp_entrypoint: ; .type tsp_entrypoint, %function
/*--------------------------------------------- /*---------------------------------------------
* Store the extents of the tzram available to * Store the extents of the tzram available to
* BL32 for future use. * BL32 for future use.
...@@ -161,7 +160,7 @@ tsp_entrypoint_panic: ...@@ -161,7 +160,7 @@ tsp_entrypoint_panic:
* here except for acknowledging the request. * here except for acknowledging the request.
* --------------------------------------------- * ---------------------------------------------
*/ */
tsp_cpu_off_entry: ; .type tsp_cpu_off_entry, %function func tsp_cpu_off_entry
bl tsp_cpu_off_main bl tsp_cpu_off_main
restore_args_call_smc restore_args_call_smc
...@@ -176,7 +175,7 @@ tsp_cpu_off_entry: ; .type tsp_cpu_off_entry, %function ...@@ -176,7 +175,7 @@ tsp_cpu_off_entry: ; .type tsp_cpu_off_entry, %function
* will be aarch64 and exceptions masked. * will be aarch64 and exceptions masked.
* --------------------------------------------- * ---------------------------------------------
*/ */
tsp_cpu_on_entry: ; .type tsp_cpu_on_entry, %function func tsp_cpu_on_entry
/* --------------------------------------------- /* ---------------------------------------------
* Set the exception vector to something sane. * Set the exception vector to something sane.
* --------------------------------------------- * ---------------------------------------------
...@@ -236,7 +235,7 @@ tsp_cpu_on_entry_panic: ...@@ -236,7 +235,7 @@ tsp_cpu_on_entry_panic:
* the EL1 state. * the EL1 state.
* --------------------------------------------- * ---------------------------------------------
*/ */
tsp_cpu_suspend_entry: ; .type tsp_cpu_suspend_entry, %function func tsp_cpu_suspend_entry
bl tsp_cpu_suspend_main bl tsp_cpu_suspend_main
restore_args_call_smc restore_args_call_smc
...@@ -250,7 +249,7 @@ tsp_cpu_suspend_entry: ; .type tsp_cpu_suspend_entry, %function ...@@ -250,7 +249,7 @@ tsp_cpu_suspend_entry: ; .type tsp_cpu_suspend_entry, %function
* acknowledging the request. * acknowledging the request.
* --------------------------------------------- * ---------------------------------------------
*/ */
tsp_cpu_resume_entry: ; .type tsp_cpu_resume_entry, %function func tsp_cpu_resume_entry
bl tsp_cpu_resume_main bl tsp_cpu_resume_main
restore_args_call_smc restore_args_call_smc
tsp_cpu_resume_panic: tsp_cpu_resume_panic:
...@@ -261,7 +260,7 @@ tsp_cpu_resume_panic: ...@@ -261,7 +260,7 @@ tsp_cpu_resume_panic:
* the TSP to service a fast smc request. * the TSP to service a fast smc request.
* --------------------------------------------- * ---------------------------------------------
*/ */
tsp_fast_smc_entry: ; .type tsp_fast_smc_entry, %function func tsp_fast_smc_entry
bl tsp_fast_smc_handler bl tsp_fast_smc_handler
restore_args_call_smc restore_args_call_smc
tsp_fast_smc_entry_panic: tsp_fast_smc_entry_panic:
......
...@@ -29,18 +29,17 @@ ...@@ -29,18 +29,17 @@
*/ */
#include <tsp.h> #include <tsp.h>
#include <asm_macros.S>
.globl tsp_get_magic .globl tsp_get_magic
.section .text, "ax"; .align 3
/* /*
* This function raises an SMC to retrieve arguments from secure * This function raises an SMC to retrieve arguments from secure
* monitor/dispatcher, saves the returned arguments the array received in x0, * monitor/dispatcher, saves the returned arguments the array received in x0,
* and then returns to the caller * and then returns to the caller
*/ */
tsp_get_magic: func tsp_get_magic
/* Save address to stack */ /* Save address to stack */
stp x0, xzr, [sp, #-16]! stp x0, xzr, [sp, #-16]!
......
...@@ -80,3 +80,14 @@ ...@@ -80,3 +80,14 @@
.error "Vector exceeds 32 instructions" .error "Vector exceeds 32 instructions"
.endif .endif
.endm .endm
/*
* This macro is used to create a function label and place the
* code into a separate text section based on the function name
* to enable elimination of unused code during linking
*/
.macro func _name
.section .text.\_name, "ax"
.type \_name, %function
\_name:
.endm
...@@ -44,58 +44,56 @@ ...@@ -44,58 +44,56 @@
.globl dcsw_op_louis .globl dcsw_op_louis
.globl dcsw_op_all .globl dcsw_op_all
.section .text, "ax"; .align 3 func dcisw
dcisw: ; .type dcisw, %function
dc isw, x0 dc isw, x0
dsb sy dsb sy
isb isb
ret ret
dccisw: ; .type dccisw, %function func dccisw
dc cisw, x0 dc cisw, x0
dsb sy dsb sy
isb isb
ret ret
dccsw: ; .type dccsw, %function func dccsw
dc csw, x0 dc csw, x0
dsb sy dsb sy
isb isb
ret ret
dccvac: ; .type dccvac, %function func dccvac
dc cvac, x0 dc cvac, x0
dsb sy dsb sy
isb isb
ret ret
dcivac: ; .type dcivac, %function func dcivac
dc ivac, x0 dc ivac, x0
dsb sy dsb sy
isb isb
ret ret
dccivac: ; .type dccivac, %function func dccivac
dc civac, x0 dc civac, x0
dsb sy dsb sy
isb isb
ret ret
dccvau: ; .type dccvau, %function func dccvau
dc cvau, x0 dc cvau, x0
dsb sy dsb sy
isb isb
ret ret
dczva: ; .type dczva, %function func dczva
dc zva, x0 dc zva, x0
dsb sy dsb sy
isb isb
...@@ -107,7 +105,7 @@ dczva: ; .type dczva, %function ...@@ -107,7 +105,7 @@ dczva: ; .type dczva, %function
* size. 'x0' = addr, 'x1' = size * size. 'x0' = addr, 'x1' = size
* ------------------------------------------ * ------------------------------------------
*/ */
flush_dcache_range: ; .type flush_dcache_range, %function func flush_dcache_range
dcache_line_size x2, x3 dcache_line_size x2, x3
add x1, x0, x1 add x1, x0, x1
sub x3, x2, #1 sub x3, x2, #1
...@@ -126,7 +124,7 @@ flush_loop: ...@@ -126,7 +124,7 @@ flush_loop:
* size. 'x0' = addr, 'x1' = size * size. 'x0' = addr, 'x1' = size
* ------------------------------------------ * ------------------------------------------
*/ */
inv_dcache_range: ; .type inv_dcache_range, %function func inv_dcache_range
dcache_line_size x2, x3 dcache_line_size x2, x3
add x1, x0, x1 add x1, x0, x1
sub x3, x2, #1 sub x3, x2, #1
...@@ -151,7 +149,7 @@ inv_loop: ...@@ -151,7 +149,7 @@ inv_loop:
* x14 * x14
* ---------------------------------- * ----------------------------------
*/ */
dcsw_op: ; .type dcsw_op, %function func dcsw_op
all_start_at_level: all_start_at_level:
add x2, x10, x10, lsr #1 // work out 3x current cache level add x2, x10, x10, lsr #1 // work out 3x current cache level
lsr x1, x0, x2 // extract cache type bits from clidr lsr x1, x0, x2 // extract cache type bits from clidr
...@@ -197,7 +195,7 @@ finished: ...@@ -197,7 +195,7 @@ finished:
ret ret
do_dcsw_op: ; .type do_dcsw_op, %function func do_dcsw_op
cbz x3, exit cbz x3, exit
cmp x0, #DCISW cmp x0, #DCISW
b.eq dc_isw b.eq dc_isw
...@@ -221,13 +219,13 @@ exit: ...@@ -221,13 +219,13 @@ exit:
ret ret
dcsw_op_louis: ; .type dcsw_op_louis, %function func dcsw_op_louis
dsb sy dsb sy
setup_dcsw_op_args x10, x3, x9, #LOUIS_SHIFT, #CLIDR_FIELD_WIDTH, #LEVEL_SHIFT setup_dcsw_op_args x10, x3, x9, #LOUIS_SHIFT, #CLIDR_FIELD_WIDTH, #LEVEL_SHIFT
b do_dcsw_op b do_dcsw_op
dcsw_op_all: ; .type dcsw_op_all, %function func dcsw_op_all
dsb sy dsb sy
setup_dcsw_op_args x10, x3, x9, #LOC_SHIFT, #CLIDR_FIELD_WIDTH, #LEVEL_SHIFT setup_dcsw_op_args x10, x3, x9, #LOC_SHIFT, #CLIDR_FIELD_WIDTH, #LEVEL_SHIFT
b do_dcsw_op b do_dcsw_op
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <arch_helpers.h> #include <arch_helpers.h>
#include <runtime_svc.h> #include <runtime_svc.h>
#include <asm_macros.S>
.globl enable_irq .globl enable_irq
.globl disable_irq .globl disable_irq
...@@ -79,16 +80,15 @@ ...@@ -79,16 +80,15 @@
.globl zeromem16 .globl zeromem16
.globl memcpy16 .globl memcpy16
.section .text, "ax"
get_afflvl_shift: ; .type get_afflvl_shift, %function func get_afflvl_shift
cmp x0, #3 cmp x0, #3
cinc x0, x0, eq cinc x0, x0, eq
mov x1, #MPIDR_AFFLVL_SHIFT mov x1, #MPIDR_AFFLVL_SHIFT
lsl x0, x0, x1 lsl x0, x0, x1
ret ret
mpidr_mask_lower_afflvls: ; .type mpidr_mask_lower_afflvls, %function func mpidr_mask_lower_afflvls
cmp x1, #3 cmp x1, #3
cinc x1, x1, eq cinc x1, x1, eq
mov x2, #MPIDR_AFFLVL_SHIFT mov x2, #MPIDR_AFFLVL_SHIFT
...@@ -101,57 +101,57 @@ mpidr_mask_lower_afflvls: ; .type mpidr_mask_lower_afflvls, %function ...@@ -101,57 +101,57 @@ mpidr_mask_lower_afflvls: ; .type mpidr_mask_lower_afflvls, %function
* Asynchronous exception manipulation accessors * Asynchronous exception manipulation accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
enable_irq: ; .type enable_irq, %function func enable_irq
msr daifclr, #DAIF_IRQ_BIT msr daifclr, #DAIF_IRQ_BIT
ret ret
enable_fiq: ; .type enable_fiq, %function func enable_fiq
msr daifclr, #DAIF_FIQ_BIT msr daifclr, #DAIF_FIQ_BIT
ret ret
enable_serror: ; .type enable_serror, %function func enable_serror
msr daifclr, #DAIF_ABT_BIT msr daifclr, #DAIF_ABT_BIT
ret ret
enable_debug_exceptions: func enable_debug_exceptions
msr daifclr, #DAIF_DBG_BIT msr daifclr, #DAIF_DBG_BIT
ret ret
disable_irq: ; .type disable_irq, %function func disable_irq
msr daifset, #DAIF_IRQ_BIT msr daifset, #DAIF_IRQ_BIT
ret ret
disable_fiq: ; .type disable_fiq, %function func disable_fiq
msr daifset, #DAIF_FIQ_BIT msr daifset, #DAIF_FIQ_BIT
ret ret
disable_serror: ; .type disable_serror, %function func disable_serror
msr daifset, #DAIF_ABT_BIT msr daifset, #DAIF_ABT_BIT
ret ret
disable_debug_exceptions: func disable_debug_exceptions
msr daifset, #DAIF_DBG_BIT msr daifset, #DAIF_DBG_BIT
ret ret
read_daif: ; .type read_daif, %function func read_daif
mrs x0, daif mrs x0, daif
ret ret
write_daif: ; .type write_daif, %function func write_daif
msr daif, x0 msr daif, x0
ret ret
read_spsr: ; .type read_spsr, %function func read_spsr
mrs x0, CurrentEl mrs x0, CurrentEl
cmp x0, #(MODE_EL1 << MODE_EL_SHIFT) cmp x0, #(MODE_EL1 << MODE_EL_SHIFT)
b.eq read_spsr_el1 b.eq read_spsr_el1
...@@ -161,22 +161,22 @@ read_spsr: ; .type read_spsr, %function ...@@ -161,22 +161,22 @@ read_spsr: ; .type read_spsr, %function
b.eq read_spsr_el3 b.eq read_spsr_el3
read_spsr_el1: ; .type read_spsr_el1, %function func read_spsr_el1
mrs x0, spsr_el1 mrs x0, spsr_el1
ret ret
read_spsr_el2: ; .type read_spsr_el2, %function func read_spsr_el2
mrs x0, spsr_el2 mrs x0, spsr_el2
ret ret
read_spsr_el3: ; .type read_spsr_el3, %function func read_spsr_el3
mrs x0, spsr_el3 mrs x0, spsr_el3
ret ret
write_spsr: ; .type write_spsr, %function func write_spsr
mrs x1, CurrentEl mrs x1, CurrentEl
cmp x1, #(MODE_EL1 << MODE_EL_SHIFT) cmp x1, #(MODE_EL1 << MODE_EL_SHIFT)
b.eq write_spsr_el1 b.eq write_spsr_el1
...@@ -186,25 +186,25 @@ write_spsr: ; .type write_spsr, %function ...@@ -186,25 +186,25 @@ write_spsr: ; .type write_spsr, %function
b.eq write_spsr_el3 b.eq write_spsr_el3
write_spsr_el1: ; .type write_spsr_el1, %function func write_spsr_el1
msr spsr_el1, x0 msr spsr_el1, x0
isb isb
ret ret
write_spsr_el2: ; .type write_spsr_el2, %function func write_spsr_el2
msr spsr_el2, x0 msr spsr_el2, x0
isb isb
ret ret
write_spsr_el3: ; .type write_spsr_el3, %function func write_spsr_el3
msr spsr_el3, x0 msr spsr_el3, x0
isb isb
ret ret
read_elr: ; .type read_elr, %function func read_elr
mrs x0, CurrentEl mrs x0, CurrentEl
cmp x0, #(MODE_EL1 << MODE_EL_SHIFT) cmp x0, #(MODE_EL1 << MODE_EL_SHIFT)
b.eq read_elr_el1 b.eq read_elr_el1
...@@ -214,22 +214,22 @@ read_elr: ; .type read_elr, %function ...@@ -214,22 +214,22 @@ read_elr: ; .type read_elr, %function
b.eq read_elr_el3 b.eq read_elr_el3
read_elr_el1: ; .type read_elr_el1, %function func read_elr_el1
mrs x0, elr_el1 mrs x0, elr_el1
ret ret
read_elr_el2: ; .type read_elr_el2, %function func read_elr_el2
mrs x0, elr_el2 mrs x0, elr_el2
ret ret
read_elr_el3: ; .type read_elr_el3, %function func read_elr_el3
mrs x0, elr_el3 mrs x0, elr_el3
ret ret
write_elr: ; .type write_elr, %function func write_elr
mrs x1, CurrentEl mrs x1, CurrentEl
cmp x1, #(MODE_EL1 << MODE_EL_SHIFT) cmp x1, #(MODE_EL1 << MODE_EL_SHIFT)
b.eq write_elr_el1 b.eq write_elr_el1
...@@ -239,54 +239,54 @@ write_elr: ; .type write_elr, %function ...@@ -239,54 +239,54 @@ write_elr: ; .type write_elr, %function
b.eq write_elr_el3 b.eq write_elr_el3
write_elr_el1: ; .type write_elr_el1, %function func write_elr_el1
msr elr_el1, x0 msr elr_el1, x0
isb isb
ret ret
write_elr_el2: ; .type write_elr_el2, %function func write_elr_el2
msr elr_el2, x0 msr elr_el2, x0
isb isb
ret ret
write_elr_el3: ; .type write_elr_el3, %function func write_elr_el3
msr elr_el3, x0 msr elr_el3, x0
isb isb
ret ret
dsb: ; .type dsb, %function func dsb
dsb sy dsb sy
ret ret
isb: ; .type isb, %function func isb
isb isb
ret ret
sev: ; .type sev, %function func sev
sev sev
ret ret
wfe: ; .type wfe, %function func wfe
wfe wfe
ret ret
wfi: ; .type wfi, %function func wfi
wfi wfi
ret ret
eret: ; .type eret, %function func eret
eret eret
smc: ; .type smc, %function func smc
smc #0 smc #0
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
...@@ -296,7 +296,7 @@ smc: ; .type smc, %function ...@@ -296,7 +296,7 @@ smc: ; .type smc, %function
* The memory address must be 16-byte aligned. * The memory address must be 16-byte aligned.
* ----------------------------------------------------------------------- * -----------------------------------------------------------------------
*/ */
zeromem16: func zeromem16
add x2, x0, x1 add x2, x0, x1
/* zero 16 bytes at a time */ /* zero 16 bytes at a time */
z_loop16: z_loop16:
...@@ -322,7 +322,7 @@ z_end: ret ...@@ -322,7 +322,7 @@ z_end: ret
* Destination and source addresses must be 16-byte aligned. * Destination and source addresses must be 16-byte aligned.
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
memcpy16: func memcpy16
/* copy 16 bytes at a time */ /* copy 16 bytes at a time */
m_loop16: m_loop16:
cmp x2, #16 cmp x2, #16
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*/ */
#include <arch_helpers.h> #include <arch_helpers.h>
#include <asm_macros.S>
.globl read_vbar_el1 .globl read_vbar_el1
.globl read_vbar_el2 .globl read_vbar_el2
...@@ -164,19 +165,17 @@ ...@@ -164,19 +165,17 @@
#endif #endif
.section .text, "ax" func read_current_el
read_current_el: ; .type read_current_el, %function
mrs x0, CurrentEl mrs x0, CurrentEl
ret ret
read_id_pfr1_el1: ; .type read_id_pfr1_el1, %function func read_id_pfr1_el1
mrs x0, id_pfr1_el1 mrs x0, id_pfr1_el1
ret ret
read_id_aa64pfr0_el1: ; .type read_id_aa64pfr0_el1, %function func read_id_aa64pfr0_el1
mrs x0, id_aa64pfr0_el1 mrs x0, id_aa64pfr0_el1
ret ret
...@@ -185,34 +184,34 @@ read_id_aa64pfr0_el1: ; .type read_id_aa64pfr0_el1, %function ...@@ -185,34 +184,34 @@ read_id_aa64pfr0_el1: ; .type read_id_aa64pfr0_el1, %function
* VBAR accessors * VBAR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_vbar_el1: ; .type read_vbar_el1, %function func read_vbar_el1
mrs x0, vbar_el1 mrs x0, vbar_el1
ret ret
read_vbar_el2: ; .type read_vbar_el2, %function func read_vbar_el2
mrs x0, vbar_el2 mrs x0, vbar_el2
ret ret
read_vbar_el3: ; .type read_vbar_el3, %function func read_vbar_el3
mrs x0, vbar_el3 mrs x0, vbar_el3
ret ret
write_vbar_el1: ; .type write_vbar_el1, %function func write_vbar_el1
msr vbar_el1, x0 msr vbar_el1, x0
isb isb
ret ret
write_vbar_el2: ; .type write_vbar_el2, %function func write_vbar_el2
msr vbar_el2, x0 msr vbar_el2, x0
isb isb
ret ret
write_vbar_el3: ; .type write_vbar_el3, %function func write_vbar_el3
msr vbar_el3, x0 msr vbar_el3, x0
isb isb
ret ret
...@@ -222,34 +221,34 @@ write_vbar_el3: ; .type write_vbar_el3, %function ...@@ -222,34 +221,34 @@ write_vbar_el3: ; .type write_vbar_el3, %function
* AFSR0 accessors * AFSR0 accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_afsr0_el1: ; .type read_afsr0_el1, %function func read_afsr0_el1
mrs x0, afsr0_el1 mrs x0, afsr0_el1
ret ret
read_afsr0_el2: ; .type read_afsr0_el2, %function func read_afsr0_el2
mrs x0, afsr0_el2 mrs x0, afsr0_el2
ret ret
read_afsr0_el3: ; .type read_afsr0_el3, %function func read_afsr0_el3
mrs x0, afsr0_el3 mrs x0, afsr0_el3
ret ret
write_afsr0_el1: ; .type write_afsr0_el1, %function func write_afsr0_el1
msr afsr0_el1, x0 msr afsr0_el1, x0
isb isb
ret ret
write_afsr0_el2: ; .type write_afsr0_el2, %function func write_afsr0_el2
msr afsr0_el2, x0 msr afsr0_el2, x0
isb isb
ret ret
write_afsr0_el3: ; .type write_afsr0_el3, %function func write_afsr0_el3
msr afsr0_el3, x0 msr afsr0_el3, x0
isb isb
ret ret
...@@ -259,34 +258,34 @@ write_afsr0_el3: ; .type write_afsr0_el3, %function ...@@ -259,34 +258,34 @@ write_afsr0_el3: ; .type write_afsr0_el3, %function
* FAR accessors * FAR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_far_el1: ; .type read_far_el1, %function func read_far_el1
mrs x0, far_el1 mrs x0, far_el1
ret ret
read_far_el2: ; .type read_far_el2, %function func read_far_el2
mrs x0, far_el2 mrs x0, far_el2
ret ret
read_far_el3: ; .type read_far_el3, %function func read_far_el3
mrs x0, far_el3 mrs x0, far_el3
ret ret
write_far_el1: ; .type write_far_el1, %function func write_far_el1
msr far_el1, x0 msr far_el1, x0
isb isb
ret ret
write_far_el2: ; .type write_far_el2, %function func write_far_el2
msr far_el2, x0 msr far_el2, x0
isb isb
ret ret
write_far_el3: ; .type write_far_el3, %function func write_far_el3
msr far_el3, x0 msr far_el3, x0
isb isb
ret ret
...@@ -296,34 +295,34 @@ write_far_el3: ; .type write_far_el3, %function ...@@ -296,34 +295,34 @@ write_far_el3: ; .type write_far_el3, %function
* MAIR accessors * MAIR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_mair_el1: ; .type read_mair_el1, %function func read_mair_el1
mrs x0, mair_el1 mrs x0, mair_el1
ret ret
read_mair_el2: ; .type read_mair_el2, %function func read_mair_el2
mrs x0, mair_el2 mrs x0, mair_el2
ret ret
read_mair_el3: ; .type read_mair_el3, %function func read_mair_el3
mrs x0, mair_el3 mrs x0, mair_el3
ret ret
write_mair_el1: ; .type write_mair_el1, %function func write_mair_el1
msr mair_el1, x0 msr mair_el1, x0
isb isb
ret ret
write_mair_el2: ; .type write_mair_el2, %function func write_mair_el2
msr mair_el2, x0 msr mair_el2, x0
isb isb
ret ret
write_mair_el3: ; .type write_mair_el3, %function func write_mair_el3
msr mair_el3, x0 msr mair_el3, x0
isb isb
ret ret
...@@ -333,34 +332,34 @@ write_mair_el3: ; .type write_mair_el3, %function ...@@ -333,34 +332,34 @@ write_mair_el3: ; .type write_mair_el3, %function
* AMAIR accessors * AMAIR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_amair_el1: ; .type read_amair_el1, %function func read_amair_el1
mrs x0, amair_el1 mrs x0, amair_el1
ret ret
read_amair_el2: ; .type read_amair_el2, %function func read_amair_el2
mrs x0, amair_el2 mrs x0, amair_el2
ret ret
read_amair_el3: ; .type read_amair_el3, %function func read_amair_el3
mrs x0, amair_el3 mrs x0, amair_el3
ret ret
write_amair_el1: ; .type write_amair_el1, %function func write_amair_el1
msr amair_el1, x0 msr amair_el1, x0
isb isb
ret ret
write_amair_el2: ; .type write_amair_el2, %function func write_amair_el2
msr amair_el2, x0 msr amair_el2, x0
isb isb
ret ret
write_amair_el3: ; .type write_amair_el3, %function func write_amair_el3
msr amair_el3, x0 msr amair_el3, x0
isb isb
ret ret
...@@ -370,17 +369,17 @@ write_amair_el3: ; .type write_amair_el3, %function ...@@ -370,17 +369,17 @@ write_amair_el3: ; .type write_amair_el3, %function
* RVBAR accessors * RVBAR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_rvbar_el1: ; .type read_rvbar_el1, %function func read_rvbar_el1
mrs x0, rvbar_el1 mrs x0, rvbar_el1
ret ret
read_rvbar_el2: ; .type read_rvbar_el2, %function func read_rvbar_el2
mrs x0, rvbar_el2 mrs x0, rvbar_el2
ret ret
read_rvbar_el3: ; .type read_rvbar_el3, %function func read_rvbar_el3
mrs x0, rvbar_el3 mrs x0, rvbar_el3
ret ret
...@@ -389,34 +388,34 @@ read_rvbar_el3: ; .type read_rvbar_el3, %function ...@@ -389,34 +388,34 @@ read_rvbar_el3: ; .type read_rvbar_el3, %function
* RMR accessors * RMR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_rmr_el1: ; .type read_rmr_el1, %function func read_rmr_el1
mrs x0, rmr_el1 mrs x0, rmr_el1
ret ret
read_rmr_el2: ; .type read_rmr_el2, %function func read_rmr_el2
mrs x0, rmr_el2 mrs x0, rmr_el2
ret ret
read_rmr_el3: ; .type read_rmr_el3, %function func read_rmr_el3
mrs x0, rmr_el3 mrs x0, rmr_el3
ret ret
write_rmr_el1: ; .type write_rmr_el1, %function func write_rmr_el1
msr rmr_el1, x0 msr rmr_el1, x0
isb isb
ret ret
write_rmr_el2: ; .type write_rmr_el2, %function func write_rmr_el2
msr rmr_el2, x0 msr rmr_el2, x0
isb isb
ret ret
write_rmr_el3: ; .type write_rmr_el3, %function func write_rmr_el3
msr rmr_el3, x0 msr rmr_el3, x0
isb isb
ret ret
...@@ -426,34 +425,34 @@ write_rmr_el3: ; .type write_rmr_el3, %function ...@@ -426,34 +425,34 @@ write_rmr_el3: ; .type write_rmr_el3, %function
* AFSR1 accessors * AFSR1 accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_afsr1_el1: ; .type read_afsr1_el1, %function func read_afsr1_el1
mrs x0, afsr1_el1 mrs x0, afsr1_el1
ret ret
read_afsr1_el2: ; .type read_afsr1_el2, %function func read_afsr1_el2
mrs x0, afsr1_el2 mrs x0, afsr1_el2
ret ret
read_afsr1_el3: ; .type read_afsr1_el3, %function func read_afsr1_el3
mrs x0, afsr1_el3 mrs x0, afsr1_el3
ret ret
write_afsr1_el1: ; .type write_afsr1_el1, %function func write_afsr1_el1
msr afsr1_el1, x0 msr afsr1_el1, x0
isb isb
ret ret
write_afsr1_el2: ; .type write_afsr1_el2, %function func write_afsr1_el2
msr afsr1_el2, x0 msr afsr1_el2, x0
isb isb
ret ret
write_afsr1_el3: ; .type write_afsr1_el3, %function func write_afsr1_el3
msr afsr1_el3, x0 msr afsr1_el3, x0
isb isb
ret ret
...@@ -463,36 +462,36 @@ write_afsr1_el3: ; .type write_afsr1_el3, %function ...@@ -463,36 +462,36 @@ write_afsr1_el3: ; .type write_afsr1_el3, %function
* SCTLR accessors * SCTLR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_sctlr_el1: ; .type read_sctlr_el1, %function func read_sctlr_el1
mrs x0, sctlr_el1 mrs x0, sctlr_el1
ret ret
read_sctlr_el2: ; .type read_sctlr_el2, %function func read_sctlr_el2
mrs x0, sctlr_el2 mrs x0, sctlr_el2
ret ret
read_sctlr_el3: ; .type read_sctlr_el3, %function func read_sctlr_el3
mrs x0, sctlr_el3 mrs x0, sctlr_el3
ret ret
write_sctlr_el1: ; .type write_sctlr_el1, %function func write_sctlr_el1
msr sctlr_el1, x0 msr sctlr_el1, x0
dsb sy dsb sy
isb isb
ret ret
write_sctlr_el2: ; .type write_sctlr_el2, %function func write_sctlr_el2
msr sctlr_el2, x0 msr sctlr_el2, x0
dsb sy dsb sy
isb isb
ret ret
write_sctlr_el3: ; .type write_sctlr_el3, %function func write_sctlr_el3
msr sctlr_el3, x0 msr sctlr_el3, x0
dsb sy dsb sy
isb isb
...@@ -503,36 +502,36 @@ write_sctlr_el3: ; .type write_sctlr_el3, %function ...@@ -503,36 +502,36 @@ write_sctlr_el3: ; .type write_sctlr_el3, %function
* ACTLR accessors * ACTLR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_actlr_el1: ; .type read_actlr_el1, %function func read_actlr_el1
mrs x0, actlr_el1 mrs x0, actlr_el1
ret ret
read_actlr_el2: ; .type read_actlr_el2, %function func read_actlr_el2
mrs x0, actlr_el2 mrs x0, actlr_el2
ret ret
read_actlr_el3: ; .type read_actlr_el3, %function func read_actlr_el3
mrs x0, actlr_el3 mrs x0, actlr_el3
ret ret
write_actlr_el1: ; .type write_actlr_el1, %function func write_actlr_el1
msr actlr_el1, x0 msr actlr_el1, x0
dsb sy dsb sy
isb isb
ret ret
write_actlr_el2: ; .type write_actlr_el2, %function func write_actlr_el2
msr actlr_el2, x0 msr actlr_el2, x0
dsb sy dsb sy
isb isb
ret ret
write_actlr_el3: ; .type write_actlr_el3, %function func write_actlr_el3
msr actlr_el3, x0 msr actlr_el3, x0
dsb sy dsb sy
isb isb
...@@ -543,36 +542,36 @@ write_actlr_el3: ; .type write_actlr_el3, %function ...@@ -543,36 +542,36 @@ write_actlr_el3: ; .type write_actlr_el3, %function
* ESR accessors * ESR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_esr_el1: ; .type read_esr_el1, %function func read_esr_el1
mrs x0, esr_el1 mrs x0, esr_el1
ret ret
read_esr_el2: ; .type read_esr_el2, %function func read_esr_el2
mrs x0, esr_el2 mrs x0, esr_el2
ret ret
read_esr_el3: ; .type read_esr_el3, %function func read_esr_el3
mrs x0, esr_el3 mrs x0, esr_el3
ret ret
write_esr_el1: ; .type write_esr_el1, %function func write_esr_el1
msr esr_el1, x0 msr esr_el1, x0
dsb sy dsb sy
isb isb
ret ret
write_esr_el2: ; .type write_esr_el2, %function func write_esr_el2
msr esr_el2, x0 msr esr_el2, x0
dsb sy dsb sy
isb isb
ret ret
write_esr_el3: ; .type write_esr_el3, %function func write_esr_el3
msr esr_el3, x0 msr esr_el3, x0
dsb sy dsb sy
isb isb
...@@ -583,36 +582,36 @@ write_esr_el3: ; .type write_esr_el3, %function ...@@ -583,36 +582,36 @@ write_esr_el3: ; .type write_esr_el3, %function
* TCR accessors * TCR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_tcr_el1: ; .type read_tcr_el1, %function func read_tcr_el1
mrs x0, tcr_el1 mrs x0, tcr_el1
ret ret
read_tcr_el2: ; .type read_tcr_el2, %function func read_tcr_el2
mrs x0, tcr_el2 mrs x0, tcr_el2
ret ret
read_tcr_el3: ; .type read_tcr_el3, %function func read_tcr_el3
mrs x0, tcr_el3 mrs x0, tcr_el3
ret ret
write_tcr_el1: ; .type write_tcr_el1, %function func write_tcr_el1
msr tcr_el1, x0 msr tcr_el1, x0
dsb sy dsb sy
isb isb
ret ret
write_tcr_el2: ; .type write_tcr_el2, %function func write_tcr_el2
msr tcr_el2, x0 msr tcr_el2, x0
dsb sy dsb sy
isb isb
ret ret
write_tcr_el3: ; .type write_tcr_el3, %function func write_tcr_el3
msr tcr_el3, x0 msr tcr_el3, x0
dsb sy dsb sy
isb isb
...@@ -623,33 +622,33 @@ write_tcr_el3: ; .type write_tcr_el3, %function ...@@ -623,33 +622,33 @@ write_tcr_el3: ; .type write_tcr_el3, %function
* CPTR accessors * CPTR accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_cptr_el1: ; .type read_cptr_el1, %function func read_cptr_el1
b read_cptr_el1 b read_cptr_el1
ret ret
read_cptr_el2: ; .type read_cptr_el2, %function func read_cptr_el2
mrs x0, cptr_el2 mrs x0, cptr_el2
ret ret
read_cptr_el3: ; .type read_cptr_el3, %function func read_cptr_el3
mrs x0, cptr_el3 mrs x0, cptr_el3
ret ret
write_cptr_el1: ; .type write_cptr_el1, %function func write_cptr_el1
b write_cptr_el1 b write_cptr_el1
write_cptr_el2: ; .type write_cptr_el2, %function func write_cptr_el2
msr cptr_el2, x0 msr cptr_el2, x0
dsb sy dsb sy
isb isb
ret ret
write_cptr_el3: ; .type write_cptr_el3, %function func write_cptr_el3
msr cptr_el3, x0 msr cptr_el3, x0
dsb sy dsb sy
isb isb
...@@ -660,34 +659,34 @@ write_cptr_el3: ; .type write_cptr_el3, %function ...@@ -660,34 +659,34 @@ write_cptr_el3: ; .type write_cptr_el3, %function
* TTBR0 accessors * TTBR0 accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_ttbr0_el1: ; .type read_ttbr0_el1, %function func read_ttbr0_el1
mrs x0, ttbr0_el1 mrs x0, ttbr0_el1
ret ret
read_ttbr0_el2: ; .type read_ttbr0_el2, %function func read_ttbr0_el2
mrs x0, ttbr0_el2 mrs x0, ttbr0_el2
ret ret
read_ttbr0_el3: ; .type read_ttbr0_el3, %function func read_ttbr0_el3
mrs x0, ttbr0_el3 mrs x0, ttbr0_el3
ret ret
write_ttbr0_el1: ; .type write_ttbr0_el1, %function func write_ttbr0_el1
msr ttbr0_el1, x0 msr ttbr0_el1, x0
isb isb
ret ret
write_ttbr0_el2: ; .type write_ttbr0_el2, %function func write_ttbr0_el2
msr ttbr0_el2, x0 msr ttbr0_el2, x0
isb isb
ret ret
write_ttbr0_el3: ; .type write_ttbr0_el3, %function func write_ttbr0_el3
msr ttbr0_el3, x0 msr ttbr0_el3, x0
isb isb
ret ret
...@@ -697,121 +696,121 @@ write_ttbr0_el3: ; .type write_ttbr0_el3, %function ...@@ -697,121 +696,121 @@ write_ttbr0_el3: ; .type write_ttbr0_el3, %function
* TTBR1 accessors * TTBR1 accessors
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
read_ttbr1_el1: ; .type read_ttbr1_el1, %function func read_ttbr1_el1
mrs x0, ttbr1_el1 mrs x0, ttbr1_el1
ret ret
read_ttbr1_el2: ; .type read_ttbr1_el2, %function func read_ttbr1_el2
b read_ttbr1_el2 b read_ttbr1_el2
read_ttbr1_el3: ; .type read_ttbr1_el3, %function func read_ttbr1_el3
b read_ttbr1_el3 b read_ttbr1_el3
write_ttbr1_el1: ; .type write_ttbr1_el1, %function func write_ttbr1_el1
msr ttbr1_el1, x0 msr ttbr1_el1, x0
isb isb
ret ret
write_ttbr1_el2: ; .type write_ttbr1_el2, %function func write_ttbr1_el2
b write_ttbr1_el2 b write_ttbr1_el2
write_ttbr1_el3: ; .type write_ttbr1_el3, %function func write_ttbr1_el3
b write_ttbr1_el3 b write_ttbr1_el3
read_hcr: ; .type read_hcr, %function func read_hcr
mrs x0, hcr_el2 mrs x0, hcr_el2
ret ret
write_hcr: ; .type write_hcr, %function func write_hcr
msr hcr_el2, x0 msr hcr_el2, x0
dsb sy dsb sy
isb isb
ret ret
read_cpacr: ; .type read_cpacr, %function func read_cpacr
mrs x0, cpacr_el1 mrs x0, cpacr_el1
ret ret
write_cpacr: ; .type write_cpacr, %function func write_cpacr
msr cpacr_el1, x0 msr cpacr_el1, x0
ret ret
read_cntfrq_el0: ; .type read_cntfrq_el0, %function func read_cntfrq_el0
mrs x0, cntfrq_el0 mrs x0, cntfrq_el0
ret ret
write_cntfrq_el0: ; .type write_cntfrq_el0, %function func write_cntfrq_el0
msr cntfrq_el0, x0 msr cntfrq_el0, x0
ret ret
read_cpuectlr: ; .type read_cpuectlr, %function func read_cpuectlr
mrs x0, CPUECTLR_EL1 mrs x0, CPUECTLR_EL1
ret ret
write_cpuectlr: ; .type write_cpuectlr, %function func write_cpuectlr
msr CPUECTLR_EL1, x0 msr CPUECTLR_EL1, x0
dsb sy dsb sy
isb isb
ret ret
read_cnthctl_el2: ; .type read_cnthctl_el2, %function func read_cnthctl_el2
mrs x0, cnthctl_el2 mrs x0, cnthctl_el2
ret ret
write_cnthctl_el2: ; .type write_cnthctl_el2, %function func write_cnthctl_el2
msr cnthctl_el2, x0 msr cnthctl_el2, x0
ret ret
read_cntfrq: ; .type read_cntfrq, %function func read_cntfrq
mrs x0, cntfrq_el0 mrs x0, cntfrq_el0
ret ret
write_cntfrq: ; .type write_cntfrq, %function func write_cntfrq
msr cntfrq_el0, x0 msr cntfrq_el0, x0
ret ret
write_scr: ; .type write_scr, %function func write_scr
msr scr_el3, x0 msr scr_el3, x0
dsb sy dsb sy
isb isb
ret ret
read_scr: ; .type read_scr, %function func read_scr
mrs x0, scr_el3 mrs x0, scr_el3
ret ret
read_midr: ; .type read_midr, %function func read_midr
mrs x0, midr_el1 mrs x0, midr_el1
ret ret
read_mpidr: ; .type read_mpidr, %function func read_mpidr
mrs x0, mpidr_el1 mrs x0, mpidr_el1
ret ret
#if SUPPORT_VFP #if SUPPORT_VFP
enable_vfp: ; .type enable_vfp, %function func enable_vfp
mrs x0, cpacr_el1 mrs x0, cpacr_el1
orr x0, x0, #CPACR_VFP_BITS orr x0, x0, #CPACR_VFP_BITS
msr cpacr_el1, x0 msr cpacr_el1, x0
...@@ -822,14 +821,12 @@ enable_vfp: ; .type enable_vfp, %function ...@@ -822,14 +821,12 @@ enable_vfp: ; .type enable_vfp, %function
ret ret
// int read_fpexc(void) func read_fpexc
read_fpexc: ; .type read_fpexc, %function
b read_fpexc b read_fpexc
ret ret
// void write_fpexc(int fpexc) func write_fpexc
write_fpexc: ; .type write_fpexc, %function
b write_fpexc b write_fpexc
ret ret
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*/ */
#include <arch_helpers.h> #include <arch_helpers.h>
#include <asm_macros.S>
.globl tlbialle1 .globl tlbialle1
.globl tlbialle1is .globl tlbialle1is
...@@ -39,50 +40,48 @@ ...@@ -39,50 +40,48 @@
.globl tlbivmalle1 .globl tlbivmalle1
.section .text, "ax" func tlbialle1
tlbialle1: ; .type tlbialle1, %function
tlbi alle1 tlbi alle1
dsb sy dsb sy
isb isb
ret ret
tlbialle1is: ; .type tlbialle1is, %function func tlbialle1is
tlbi alle1is tlbi alle1is
dsb sy dsb sy
isb isb
ret ret
tlbialle2: ; .type tlbialle2, %function func tlbialle2
tlbi alle2 tlbi alle2
dsb sy dsb sy
isb isb
ret ret
tlbialle2is: ; .type tlbialle2is, %function func tlbialle2is
tlbi alle2is tlbi alle2is
dsb sy dsb sy
isb isb
ret ret
tlbialle3: ; .type tlbialle3, %function func tlbialle3
tlbi alle3 tlbi alle3
dsb sy dsb sy
isb isb
ret ret
tlbialle3is: ; .type tlbialle3is, %function func tlbialle3is
tlbi alle3is tlbi alle3is
dsb sy dsb sy
isb isb
ret ret
tlbivmalle1: ; .type tlbivmalle1, %function func tlbivmalle1
tlbi vmalle1 tlbi vmalle1
dsb sy dsb sy
isb isb
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
.globl semihosting_call #include <asm_macros.S>
.section .text, "ax" .globl semihosting_call
semihosting_call: ; .type semihosting_call, %function func semihosting_call
hlt #0xf000 hlt #0xf000
ret ret
...@@ -28,13 +28,13 @@ ...@@ -28,13 +28,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <asm_macros.S>
.globl spin_lock .globl spin_lock
.globl spin_unlock .globl spin_unlock
.section .text, "ax"; func spin_lock
spin_lock: ; .type spin_lock, %function
mov w2, #1 mov w2, #1
sevl sevl
l1: wfe l1: wfe
...@@ -45,6 +45,6 @@ l2: ldaxr w1, [x0] ...@@ -45,6 +45,6 @@ l2: ldaxr w1, [x0]
ret ret
spin_unlock: ; .type spin_unlock, %function func spin_unlock
stlr wzr, [x0] stlr wzr, [x0]
ret ret
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <arch.h> #include <arch.h>
#include <platform.h> #include <platform.h>
#include <asm_macros.S>
.globl pcpu_dv_mem_stack .globl pcpu_dv_mem_stack
...@@ -51,8 +52,6 @@ ...@@ -51,8 +52,6 @@
#define PCPU_DV_MEM_STACK_SIZE 0x300 #define PCPU_DV_MEM_STACK_SIZE 0x300
#endif #endif
.section .text, "ax"; .align 3
/* ----------------------------------------------------- /* -----------------------------------------------------
* unsigned long long platform_set_coherent_stack * unsigned long long platform_set_coherent_stack
* (unsigned mpidr); * (unsigned mpidr);
...@@ -62,7 +61,7 @@ ...@@ -62,7 +61,7 @@
* SCTLR.C bit e.g. while powering down a cpu * SCTLR.C bit e.g. while powering down a cpu
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_set_coherent_stack: ; .type platform_set_coherent_stack, %function func platform_set_coherent_stack
mov x5, x30 // lr mov x5, x30 // lr
bl platform_get_core_pos bl platform_get_core_pos
add x0, x0, #1 add x0, x0, #1
...@@ -79,7 +78,7 @@ platform_set_coherent_stack: ; .type platform_set_coherent_stack, %function ...@@ -79,7 +78,7 @@ platform_set_coherent_stack: ; .type platform_set_coherent_stack, %function
* CoreId * CoreId
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_get_core_pos: ; .type platform_get_core_pos, %function func platform_get_core_pos
and x1, x0, #MPIDR_CPU_MASK and x1, x0, #MPIDR_CPU_MASK
and x0, x0, #MPIDR_CLUSTER_MASK and x0, x0, #MPIDR_CLUSTER_MASK
add x0, x1, x0, LSR #6 add x0, x1, x0, LSR #6
...@@ -93,7 +92,7 @@ platform_get_core_pos: ; .type platform_get_core_pos, %function ...@@ -93,7 +92,7 @@ platform_get_core_pos: ; .type platform_get_core_pos, %function
* cpu (applicable ony after a cold boot) * cpu (applicable ony after a cold boot)
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_is_primary_cpu: ; .type platform_is_primary_cpu, %function func platform_is_primary_cpu
and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK) and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
cmp x0, #PRIMARY_CPU cmp x0, #PRIMARY_CPU
cset x0, eq cset x0, eq
...@@ -103,7 +102,7 @@ platform_is_primary_cpu: ; .type platform_is_primary_cpu, %function ...@@ -103,7 +102,7 @@ platform_is_primary_cpu: ; .type platform_is_primary_cpu, %function
* void platform_get_stack (unsigned long mpidr) * void platform_get_stack (unsigned long mpidr)
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_get_stack: ; .type platform_get_stack, %function func platform_get_stack
mov x10, x30 // lr mov x10, x30 // lr
bl platform_get_core_pos bl platform_get_core_pos
add x0, x0, #1 add x0, x0, #1
...@@ -117,7 +116,7 @@ platform_get_stack: ; .type platform_get_stack, %function ...@@ -117,7 +116,7 @@ platform_get_stack: ; .type platform_get_stack, %function
* void platform_set_stack (unsigned long mpidr) * void platform_set_stack (unsigned long mpidr)
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_set_stack: ; .type platform_set_stack, %function func platform_set_stack
mov x9, x30 // lr mov x9, x30 // lr
bl platform_get_stack bl platform_get_stack
mov sp, x0 mov sp, x0
...@@ -128,7 +127,7 @@ platform_set_stack: ; .type platform_set_stack, %function ...@@ -128,7 +127,7 @@ platform_set_stack: ; .type platform_set_stack, %function
* each platform. * each platform.
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_check_mpidr: ; .type platform_check_mpidr, %function func platform_check_mpidr
mov x0, xzr mov x0, xzr
ret ret
...@@ -137,7 +136,7 @@ platform_check_mpidr: ; .type platform_check_mpidr, %function ...@@ -137,7 +136,7 @@ platform_check_mpidr: ; .type platform_check_mpidr, %function
* each platform. * each platform.
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
plat_report_exception: func plat_report_exception
ret ret
/* ----------------------------------------------------- /* -----------------------------------------------------
......
...@@ -32,15 +32,13 @@ ...@@ -32,15 +32,13 @@
#include <platform.h> #include <platform.h>
#include <fvp_pwrc.h> #include <fvp_pwrc.h>
#include <gic.h> #include <gic.h>
#include <asm_macros.S>
.globl platform_get_entrypoint .globl platform_get_entrypoint
.globl platform_cold_boot_init .globl platform_cold_boot_init
.globl plat_secondary_cold_boot_setup .globl plat_secondary_cold_boot_setup
.section .text, "ax"; .align 3
.macro platform_choose_gicmmap param1, param2, x_tmp, w_tmp, res .macro platform_choose_gicmmap param1, param2, x_tmp, w_tmp, res
ldr \x_tmp, =VE_SYSREGS_BASE + V2M_SYS_ID ldr \x_tmp, =VE_SYSREGS_BASE + V2M_SYS_ID
ldr \w_tmp, [\x_tmp] ldr \w_tmp, [\x_tmp]
...@@ -60,7 +58,7 @@ ...@@ -60,7 +58,7 @@
* that the request has gone through. * that the request has gone through.
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
plat_secondary_cold_boot_setup: ; .type plat_secondary_cold_boot_setup, %function func plat_secondary_cold_boot_setup
bl read_mpidr bl read_mpidr
mov x19, x0 mov x19, x0
bl platform_get_core_pos bl platform_get_core_pos
...@@ -120,7 +118,7 @@ cb_panic: ...@@ -120,7 +118,7 @@ cb_panic:
* reset all cpus will read the same WK field * reset all cpus will read the same WK field
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_get_entrypoint: ; .type platform_get_entrypoint, %function func platform_get_entrypoint
mov x9, x30 // lr mov x9, x30 // lr
mov x2, x0 mov x2, x0
ldr x1, =PWRC_BASE ldr x1, =PWRC_BASE
...@@ -160,7 +158,7 @@ _panic: b _panic ...@@ -160,7 +158,7 @@ _panic: b _panic
* BL1 will always read the mailboxes with the MMU off * BL1 will always read the mailboxes with the MMU off
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_mem_init: ; .type platform_mem_init, %function func platform_mem_init
ldr x0, =TZDRAM_BASE + MBOX_OFF ldr x0, =TZDRAM_BASE + MBOX_OFF
stp xzr, xzr, [x0, #0] stp xzr, xzr, [x0, #0]
stp xzr, xzr, [x0, #0x10] stp xzr, xzr, [x0, #0x10]
...@@ -176,7 +174,7 @@ platform_mem_init: ; .type platform_mem_init, %function ...@@ -176,7 +174,7 @@ platform_mem_init: ; .type platform_mem_init, %function
* boot to perform early platform initialization * boot to perform early platform initialization
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
platform_cold_boot_init: ; .type platform_cold_boot_init, %function func platform_cold_boot_init
mov x20, x0 mov x20, x0
bl platform_mem_init bl platform_mem_init
bl read_mpidr bl read_mpidr
......
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
#include <arch.h> #include <arch.h>
#include <platform.h> #include <platform.h>
#include <asm_macros.S>
.globl plat_report_exception .globl plat_report_exception
.section .text, "ax"
/* --------------------------------------------- /* ---------------------------------------------
* void plat_report_exception(unsigned int type) * void plat_report_exception(unsigned int type)
* Function to report an unhandled exception * Function to report an unhandled exception
...@@ -43,7 +42,7 @@ ...@@ -43,7 +42,7 @@
* to indicate where we are * to indicate where we are
* --------------------------------------------- * ---------------------------------------------
*/ */
plat_report_exception: func plat_report_exception
mrs x1, CurrentEl mrs x1, CurrentEl
lsr x1, x1, #MODE_EL_SHIFT lsr x1, x1, #MODE_EL_SHIFT
lsl x1, x1, #SYS_LED_EL_SHIFT lsl x1, x1, #SYS_LED_EL_SHIFT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment