DO-NOT-UPSTREAM arm, firmware, LLVMLinux: replace naked function with hard coded...
authorBehan Webster <behanw@converseincode.com>
Fri, 30 May 2014 18:35:50 +0000 (11:35 -0700)
committerStefan Agner <stefan@agner.ch>
Mon, 7 Aug 2017 06:21:10 +0000 (23:21 -0700)
As documented in GCC naked functions should only use Basic asm syntax. The
Extended asm or mixture of Basic asm and "C" code is not guarantee. Currently
this works because it was hard coded to follow and check GCC behavior for
arguments and register placement.

By replacing the naked function with an inline one it is possible to have the
same result in a more portable and reliable way. Register placement checks
are not needed since there is no hard code.

Not-signed-off-by: Behan Webster <behanw@converseincode.com>
Not-signed-off-by: Vinícius Tinti <viniciustinti@gmail.com>
arch/arm/firmware/trusted_foundations.c

index 3fb1b5a1dce968d028c8f17057c277e29302caaf..f319c3fa0fe52e4dbdf92b6f3936a41b31d814a5 100644 (file)
 
 static unsigned long cpu_boot_addr;
 
-static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2)
+static inline void tf_generic_smc(u32 type, u32 arg1, u32 arg2)
 {
        asm volatile(
                ".arch_extension        sec\n\t"
                "stmfd  sp!, {r4 - r11, lr}\n\t"
-               __asmeq("%0", "r0")
-               __asmeq("%1", "r1")
-               __asmeq("%2", "r2")
                "mov    r3, #0\n\t"
                "mov    r4, #0\n\t"
                "smc    #0\n\t"