Commit 8b779620 authored by Kévin Petit's avatar Kévin Petit
Browse files

Add support to indicate size and end of assembly functions



In order for the symbol table in the ELF file to contain the size of
functions written in assembly, it is necessary to report it to the
assembler using the .size directive.

To fulfil the above requirements, this patch introduces an 'endfunc'
macro which contains the .endfunc and .size directives. It also adds
a .func directive to the 'func' assembler macro.

The .func/.endfunc have been used so the assembler can fail if
endfunc is omitted.

Fixes ARM-Software/tf-issues#295

Change-Id: If8cb331b03d7f38fe7e3694d4de26f1075b278fc
Signed-off-by: default avatarKévin Petit <kevin.petit@arm.com>
parent cd319142
......@@ -35,3 +35,4 @@
func semihosting_call
hlt #0xf000
ret
endfunc semihosting_call
......@@ -52,6 +52,7 @@ func platform_get_core_pos
and x0, x0, #MPIDR_CLUSTER_MASK
add x0, x1, x0, LSR #6
ret
endfunc platform_get_core_pos
/* -----------------------------------------------------
* Placeholder function which should be redefined by
......@@ -61,6 +62,7 @@ func platform_get_core_pos
func platform_check_mpidr
mov x0, xzr
ret
endfunc platform_check_mpidr
/* -----------------------------------------------------
* Placeholder function which should be redefined by
......@@ -69,6 +71,7 @@ func platform_check_mpidr
*/
func plat_report_exception
ret
endfunc plat_report_exception
/* -----------------------------------------------------
* Placeholder function which should be redefined by
......@@ -78,6 +81,7 @@ func plat_report_exception
func plat_crash_console_init
mov x0, #0
ret
endfunc plat_crash_console_init
/* -----------------------------------------------------
* Placeholder function which should be redefined by
......@@ -86,6 +90,7 @@ func plat_crash_console_init
*/
func plat_crash_console_putc
ret
endfunc plat_crash_console_putc
/* -----------------------------------------------------
* Placeholder function which should be redefined by
......@@ -94,6 +99,7 @@ func plat_crash_console_putc
*/
func plat_reset_handler
ret
endfunc plat_reset_handler
/* -----------------------------------------------------
* Placeholder function which should be redefined by
......@@ -103,3 +109,4 @@ func plat_reset_handler
*/
func plat_disable_acp
ret
endfunc plat_disable_acp
......@@ -49,6 +49,7 @@ func platform_get_stack
mov x10, x30 // lr
get_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE
ret x10
endfunc platform_get_stack
/* -----------------------------------------------------
* void platform_set_stack (unsigned long mpidr)
......@@ -62,6 +63,7 @@ func platform_set_stack
bl platform_get_stack
mov sp, x0
ret x9
endfunc platform_set_stack
/* -----------------------------------------------------
* Per-cpu stacks in normal memory. Each cpu gets a
......
......@@ -48,6 +48,7 @@
func platform_get_stack
get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
ret
endfunc platform_get_stack
/* -----------------------------------------------------
* void platform_set_stack (unsigned long)
......@@ -61,6 +62,7 @@ func platform_set_stack
get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
mov sp, x0
ret
endfunc platform_set_stack
/* -----------------------------------------------------
* Single cpu stack in normal memory.
......
......@@ -97,6 +97,7 @@ func plat_secondary_cold_boot_setup
wfi
cb_panic:
b cb_panic
endfunc plat_secondary_cold_boot_setup
/* -----------------------------------------------------
......@@ -148,6 +149,7 @@ warm_reset:
exit:
ret x9
_panic: b _panic
endfunc platform_get_entrypoint
/* -----------------------------------------------------
......@@ -170,6 +172,7 @@ loop:
subs w1, w1, #1
b.gt loop
ret
endfunc platform_mem_init
/* ---------------------------------------------
* void plat_report_exception(unsigned int type)
......@@ -191,12 +194,14 @@ func plat_report_exception
add x1, x1, #V2M_SYS_LED
str w0, [x1]
ret
endfunc plat_report_exception
func platform_is_primary_cpu
and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
cmp x0, #FVP_PRIMARY_CPU
cset x0, eq
ret
endfunc platform_is_primary_cpu
/* Define a crash console for the plaform */
#define FVP_CRASH_CONSOLE_BASE PL011_UART1_BASE
......@@ -213,6 +218,7 @@ func plat_crash_console_init
mov_imm x1, PL011_UART1_CLK_IN_HZ
mov_imm x2, PL011_BAUDRATE
b console_core_init
endfunc plat_crash_console_init
/* ---------------------------------------------
* int plat_crash_console_putc(int c)
......@@ -224,3 +230,4 @@ func plat_crash_console_init
func plat_crash_console_putc
mov_imm x1, FVP_CRASH_CONSOLE_BASE
b console_core_putc
endfunc plat_crash_console_putc
......@@ -53,6 +53,7 @@ func platform_is_primary_cpu
cmp x0, x1
cset x0, eq
ret x9
endfunc platform_is_primary_cpu
/* -----------------------------------------------------
* void plat_secondary_cold_boot_setup (void);
......@@ -67,6 +68,7 @@ func plat_secondary_cold_boot_setup
/* Juno todo: Implement secondary CPU cold boot setup on Juno */
cb_panic:
b cb_panic
endfunc plat_secondary_cold_boot_setup
/* -----------------------------------------------------
......@@ -91,6 +93,7 @@ func platform_get_entrypoint
lsl x0, x0, #TRUSTED_MAILBOX_SHIFT
ldr x0, [x1, x0]
ret x9
endfunc platform_get_entrypoint
/* -----------------------------------------------------
......@@ -140,3 +143,4 @@ func platform_cold_boot_init
cb_init_panic:
b cb_init_panic
endfunc platform_cold_boot_init
......@@ -58,6 +58,7 @@ func plat_crash_console_init
mov_imm x1, PL011_UART3_CLK_IN_HZ
mov_imm x2, PL011_BAUDRATE
b console_core_init
endfunc plat_crash_console_init
/* ---------------------------------------------
* int plat_crash_console_putc(int c)
......@@ -69,6 +70,7 @@ func plat_crash_console_init
func plat_crash_console_putc
mov_imm x1, JUNO_CRASH_CONSOLE_BASE
b console_core_putc
endfunc plat_crash_console_putc
/* ---------------------------------------------
* void plat_report_exception(unsigned int type)
......@@ -90,6 +92,7 @@ func plat_report_exception
add x1, x1, #V2M_SYS_LED
str w0, [x1]
ret
endfunc plat_report_exception
/*
* Return 0 to 3 for the A53s and 4 or 5 for the A57s
......@@ -100,6 +103,7 @@ func platform_get_core_pos
eor x0, x0, #(1 << MPIDR_AFFINITY_BITS) // swap A53/A57 order
add x0, x1, x0, LSR #6
ret
endfunc platform_get_core_pos
/* -----------------------------------------------------
......@@ -111,6 +115,7 @@ func platform_get_core_pos
*/
func platform_mem_init
ret
endfunc platform_mem_init
/* --------------------------------------------------------------------
* void plat_reset_handler(void);
......@@ -197,3 +202,4 @@ ret:
isb
#endif /* FIRST_RESET_HANDLER_CALL */
ret
endfunc plat_reset_handler
......@@ -64,6 +64,7 @@ func opteed_enter_sp
* ---------------------------------------------
*/
b el3_exit
endfunc opteed_enter_sp
/* ---------------------------------------------
* This function is called 'x0' pointing to a C
......@@ -99,3 +100,4 @@ func opteed_exit_sp
*/
mov x0, x1
ret
endfunc opteed_exit_sp
\ No newline at end of file
......@@ -66,6 +66,7 @@ func tlkd_enter_sp
* ----------------------------------------------
*/
b el3_exit
endfunc tlkd_enter_sp
/* ----------------------------------------------
* This function is called with 'x0' pointing to
......@@ -100,3 +101,4 @@ func tlkd_exit_sp
*/
mov x0, x1
ret
endfunc tlkd_exit_sp
......@@ -64,6 +64,7 @@ func tspd_enter_sp
* ---------------------------------------------
*/
b el3_exit
endfunc tspd_enter_sp
/* ---------------------------------------------
* This function is called 'x0' pointing to a C
......@@ -99,3 +100,4 @@ func tspd_exit_sp
*/
mov x0, x1
ret
endfunc tspd_exit_sp
......@@ -148,6 +148,7 @@ psci_aff_common_finish_entry:
bl psci_afflvl_power_on_finish
b el3_exit
endfunc psci_aff_on_finish_entry
/* --------------------------------------------
* This function is called to indicate to the
......@@ -163,4 +164,5 @@ func psci_power_down_wfi
wfi
wfi_spill:
b wfi_spill
endfunc psci_power_down_wfi
......@@ -120,6 +120,7 @@ do_stack_maintenance:
ldp x19, x20, [sp], #16
ldp x29, x30, [sp], #16
ret
endfunc psci_do_pwrdown_cache_maintenance
/* -----------------------------------------------------------------------
......@@ -164,3 +165,4 @@ func psci_do_pwrup_cache_maintenance
ldp x29, x30, [sp], #16
ret
endfunc psci_do_pwrup_cache_maintenance
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