Angel Pons | 118a9c7 | 2020-04-02 23:48:34 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 2 | |
Stefan Reinauer | 399486e | 2012-12-06 13:54:29 -0800 | [diff] [blame] | 3 | #include <arch/cpu.h> |
| 4 | |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 5 | /* GCC's libgcc handling is quite broken. While the libgcc functions |
| 6 | * are always regparm(0) the code that calls them uses whatever the |
| 7 | * compiler call specifies. Therefore we need a wrapper around those |
| 8 | * functions. See gcc bug PR41055 for more information. |
| 9 | */ |
David Hendricks | 421288d | 2012-11-28 20:19:23 -0800 | [diff] [blame] | 10 | |
Stefan Reinauer | 399486e | 2012-12-06 13:54:29 -0800 | [diff] [blame] | 11 | /* TODO: maybe this code should move to arch/x86 as architecture |
| 12 | * specific implementations may vary |
| 13 | */ |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 14 | #define WRAP_LIBGCC_CALL(type, name) \ |
Lee Leahy | 696ced6 | 2017-03-10 15:42:55 -0800 | [diff] [blame] | 15 | asmlinkage type __real_##name(type a, type b); \ |
Myles Watson | dc4ca9a | 2009-10-29 16:49:50 +0000 | [diff] [blame] | 16 | type __wrap_##name(type a, type b); \ |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 17 | type __wrap_##name(type a, type b) { return __real_##name(a, b); } |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 18 | |
| 19 | WRAP_LIBGCC_CALL(long long, __divdi3) |
| 20 | WRAP_LIBGCC_CALL(unsigned long long, __udivdi3) |
| 21 | WRAP_LIBGCC_CALL(long long, __moddi3) |
| 22 | WRAP_LIBGCC_CALL(unsigned long long, __umoddi3) |