Unify assembler function handling
Instead of adding regparm(0) to each assembler function called by coreboot, add an asmlinkage macro (like the Linux kernel does) that can be different per architecture (and that is empty on ARM right now) Change-Id: I7ad10c463f6c552f1201f77ae24ed354ac48e2d9 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/1973 Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Ronald G. Minnich
parent
c269a9b51c
commit
399486e8fb
@ -17,26 +17,21 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <arch/cpu.h>
|
||||
|
||||
/* GCC's libgcc handling is quite broken. While the libgcc functions
|
||||
* are always regparm(0) the code that calls them uses whatever the
|
||||
* compiler call specifies. Therefore we need a wrapper around those
|
||||
* functions. See gcc bug PR41055 for more information.
|
||||
*/
|
||||
|
||||
#if CONFIG_ARCH_X86
|
||||
/* TODO: maybe this code should move to arch/x86 as architecture
|
||||
* specific implementations may vary
|
||||
*/
|
||||
#define WRAP_LIBGCC_CALL(type, name) \
|
||||
type __real_##name(type a, type b) __attribute__((regparm(0))); \
|
||||
type __real_##name(type a, type b) asmlinkage; \
|
||||
type __wrap_##name(type a, type b); \
|
||||
type __wrap_##name(type a, type b) { return __real_##name(a, b); }
|
||||
#elif CONFIG_ARCH_ARMV7
|
||||
#define WRAP_LIBGCC_CALL(type, name) \
|
||||
type __real_##name(type a, type b); \
|
||||
type __wrap_##name(type a, type b); \
|
||||
type __wrap_##name(type a, type b) { return __real_##name(a, b); }
|
||||
#else
|
||||
#error Architecture unsupported.
|
||||
#endif
|
||||
|
||||
|
||||
WRAP_LIBGCC_CALL(long long, __divdi3)
|
||||
WRAP_LIBGCC_CALL(unsigned long long, __udivdi3)
|
||||
|
Reference in New Issue
Block a user