ARM: Implement *context routines.
[glibc.git] / sysdeps / m68k / sysdep.h
blobf36b584ee743a40e7cdba2c37b8f521b82713a37
1 /* Assembler macros for m68k.
2 Copyright (C) 1998, 2003, 2010, 2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #include <sysdeps/generic/sysdep.h>
22 #ifdef __ASSEMBLER__
24 /* Syntactic details of assembler. */
26 /* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
27 # define ALIGNARG(log2) 1<<log2
28 /* For ELF we need the `.type' directive to make shared libs work right. */
29 # define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg
30 # define ASM_SIZE_DIRECTIVE(name) .size name,.-name
32 /* Define an entry point visible from C.
34 There is currently a bug in gdb which prevents us from specifying
35 incomplete stabs information. Fake some entries here which specify
36 the current source file. */
37 # define ENTRY(name) \
38 .globl C_SYMBOL_NAME(name); \
39 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function); \
40 .align ALIGNARG(2); \
41 C_LABEL(name) \
42 cfi_startproc; \
43 CALL_MCOUNT
45 # undef END
46 # define END(name) \
47 cfi_endproc; \
48 ASM_SIZE_DIRECTIVE(name)
51 /* If compiled for profiling, call `_mcount' at the start of each function. */
52 # ifdef PROF
53 /* The mcount code relies on a normal frame pointer being on the stack
54 to locate our caller, so push one just for its benefit. */
55 # define CALL_MCOUNT \
56 move.l %fp, -(%sp); \
57 cfi_adjust_cfa_offset (4); cfi_rel_offset (%fp, 0); \
58 move.l %sp, %fp; \
59 jbsr JUMPTARGET (_mcount); \
60 move.l (%sp)+, %fp; \
61 cfi_adjust_cfa_offset (-4); cfi_restore (%fp);
62 # else
63 # define CALL_MCOUNT /* Do nothing. */
64 # endif
66 # define PSEUDO(name, syscall_name, args) \
67 .globl __syscall_error; \
68 ENTRY (name) \
69 DO_CALL (syscall_name, args); \
70 jcc JUMPTARGET(__syscall_error)
72 # undef PSEUDO_END
73 # define PSEUDO_END(name) \
74 END (name)
76 # undef JUMPTARGET
77 # ifdef PIC
78 # define JUMPTARGET(name) name##@PLTPC
79 # else
80 # define JUMPTARGET(name) name
81 # endif
83 #endif /* __ASSEMBLER__ */