Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Stefan Reinauer | 399486e | 2012-12-06 13:54:29 -0800 | [diff] [blame] | 16 | #include <arch/cpu.h> |
| 17 | |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 18 | /* GCC's libgcc handling is quite broken. While the libgcc functions |
| 19 | * are always regparm(0) the code that calls them uses whatever the |
| 20 | * compiler call specifies. Therefore we need a wrapper around those |
| 21 | * functions. See gcc bug PR41055 for more information. |
| 22 | */ |
David Hendricks | 421288d | 2012-11-28 20:19:23 -0800 | [diff] [blame] | 23 | |
Stefan Reinauer | 399486e | 2012-12-06 13:54:29 -0800 | [diff] [blame] | 24 | /* TODO: maybe this code should move to arch/x86 as architecture |
| 25 | * specific implementations may vary |
| 26 | */ |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 27 | #define WRAP_LIBGCC_CALL(type, name) \ |
Lee Leahy | 696ced6 | 2017-03-10 15:42:55 -0800 | [diff] [blame] | 28 | asmlinkage type __real_##name(type a, type b); \ |
Myles Watson | dc4ca9a | 2009-10-29 16:49:50 +0000 | [diff] [blame] | 29 | type __wrap_##name(type a, type b); \ |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 30 | type __wrap_##name(type a, type b) { return __real_##name(a, b); } |
Stefan Reinauer | 5db685f | 2009-09-26 15:52:05 +0000 | [diff] [blame] | 31 | |
| 32 | WRAP_LIBGCC_CALL(long long, __divdi3) |
| 33 | WRAP_LIBGCC_CALL(unsigned long long, __udivdi3) |
| 34 | WRAP_LIBGCC_CALL(long long, __moddi3) |
| 35 | WRAP_LIBGCC_CALL(unsigned long long, __umoddi3) |