lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Assembler macros for m68k. |
| 2 | Copyright (C) 1998-2015 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library 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 GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library. If not, see |
| 17 | <http://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #include <sysdeps/generic/sysdep.h> |
| 20 | |
| 21 | #ifdef __ASSEMBLER__ |
| 22 | |
| 23 | /* Define an entry point visible from C. |
| 24 | |
| 25 | There is currently a bug in gdb which prevents us from specifying |
| 26 | incomplete stabs information. Fake some entries here which specify |
| 27 | the current source file. */ |
| 28 | # define ENTRY(name) \ |
| 29 | .globl C_SYMBOL_NAME(name); \ |
| 30 | .type C_SYMBOL_NAME(name),@function; \ |
| 31 | .p2align 2; \ |
| 32 | C_LABEL(name) \ |
| 33 | cfi_startproc; \ |
| 34 | CALL_MCOUNT |
| 35 | |
| 36 | # undef END |
| 37 | # define END(name) \ |
| 38 | cfi_endproc; \ |
| 39 | .size name,.-name |
| 40 | |
| 41 | |
| 42 | /* If compiled for profiling, call `_mcount' at the start of each function. */ |
| 43 | # ifdef PROF |
| 44 | /* The mcount code relies on a normal frame pointer being on the stack |
| 45 | to locate our caller, so push one just for its benefit. */ |
| 46 | # define CALL_MCOUNT \ |
| 47 | move.l %fp, -(%sp); \ |
| 48 | cfi_adjust_cfa_offset (4); cfi_rel_offset (%a6, 0); \ |
| 49 | move.l %sp, %fp; \ |
| 50 | jbsr JUMPTARGET (_mcount); \ |
| 51 | move.l (%sp)+, %fp; \ |
| 52 | cfi_adjust_cfa_offset (-4); cfi_restore (%a6); |
| 53 | # else |
| 54 | # define CALL_MCOUNT /* Do nothing. */ |
| 55 | # endif |
| 56 | |
| 57 | # define PSEUDO(name, syscall_name, args) \ |
| 58 | .globl __syscall_error; \ |
| 59 | ENTRY (name) \ |
| 60 | DO_CALL (syscall_name, args); \ |
| 61 | jcc JUMPTARGET(__syscall_error) |
| 62 | |
| 63 | # undef PSEUDO_END |
| 64 | # define PSEUDO_END(name) \ |
| 65 | END (name) |
| 66 | |
| 67 | # undef JUMPTARGET |
| 68 | # ifdef PIC |
| 69 | # define JUMPTARGET(name) name##@PLTPC |
| 70 | # else |
| 71 | # define JUMPTARGET(name) name |
| 72 | # endif |
| 73 | |
| 74 | #endif /* __ASSEMBLER__ */ |