OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [cris/] [sysdep.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Assembler macros for CRIS.
2
   Copyright (C) 1999, 2000, 2001 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 Library General Public License as
7
   published by the Free Software Foundation; either version 2 of the
8
   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
   Library General Public License for more details.
14
 
15
   You should have received a copy of the GNU Library General Public
16
   License along with the GNU C Library; see the file COPYING.LIB.  If not,
17
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
   Boston, MA 02111-1307, USA.  */
19
 
20
#ifndef _SYSDEP_H_
21
#define _SYSDEP_H_
22
 
23
#ifndef C_LABEL
24
 
25
/* Define a macro we can use to construct the asm name for a C symbol.  */
26
#ifdef  __STDC__
27
#define C_LABEL(name)           name##:
28
#else
29
#define C_LABEL(name)           name/**/:
30
#endif
31
 
32
#endif /* C_LABEL */
33
 
34
#define __STR(x) #x
35
#define STR(x) __STR(x)
36
 
37
/* Mark the end of function named SYM.  This is used on some platforms
38
   to generate correct debugging information.  */
39
#ifndef END
40
#define END(sym)
41
#endif
42
 
43
#define C_SYMBOL_NAME(name) name
44
 
45
#ifdef  __ASSEMBLER__
46
 
47
/* Syntactic details of assembly-code.  */
48
 
49
/* It is *not* generally true that "ELF uses byte-counts for .align, most
50
   others use log2 of count of bytes", like some neighboring configs say.
51
   See "align" in gas/read.c which is not overridden by
52
   gas/config/obj-elf.c.  It takes a log2 argument.  *Some* targets
53
   override it to take a byte argument.  People should read source instead
54
   of relying on hearsay.  */
55
#define ALIGNARG(log2) log2
56
 
57
#define ASM_GLOBAL_DIRECTIVE .globl 
58
#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg
59
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
60
 
61
/* The non-PIC jump is preferred, since it does not stall, and does not
62
   invoke generation of a PLT.  These macros assume that $r0 is set up as
63
   GOT register.  */
64
#ifdef __PIC__
65
#define PLTJUMP(_x) \
66
  add.d C_SYMBOL_NAME (_x):PLT,$pc
67
 
68
#define PLTCALL(_x) \
69
  jsr [$r0+C_SYMBOL_NAME (_x):GOTPLT16]
70
 
71
#define SETUP_PIC \
72
  push  $r0                                             @ \
73
  move.d $pc,$r0                                        @ \
74
  sub.d .:GOTOFF,$r0
75
 
76
#define TEARDOWN_PIC pop $r0
77
#else
78
#define PLTJUMP(_x) jump C_SYMBOL_NAME (_x)
79
#define PLTCALL(_x) jsr  C_SYMBOL_NAME (_x)
80
#define SETUP_PIC
81
#define TEARDOWN_PIC
82
#endif
83
 
84
/* Define an entry point visible from C.  */
85
#define ENTRY(name) \
86
  .text                                                 @ \
87
  ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name)             @ \
88
  ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function)   @ \
89
  .align ALIGNARG (2)                                   @ \
90
  C_LABEL(name)                                         @ \
91
  CALL_MCOUNT
92
 
93
#undef  END
94
#define END(name) \
95
  ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name))
96
 
97
#define PSEUDO(name, syscall_name, args) \
98
  ENTRY (name)                      @ \
99
  DOARGS_##args                     @ \
100
  movu.w SYS_ify (syscall_name),$r9         @ \
101
  break 13                      @ \
102
  cmps.w -4096,$r10                 @ \
103
  bhs   0f                      @ \
104
  nop                           @ \
105
  UNDOARGS_return_##args
106
 
107
#define PSEUDO_END(name) \
108
0:                          @ \
109
  SETUP_PIC                     @ \
110
  PLTJUMP (__syscall_error)               @ \
111
  END (name)
112
 
113
/* If compiled for profiling, call `_mcount' at the start of each function.
114
   FIXME: Note that profiling is not actually implemented.  This is just
115
   example code which might not even compile, though it is believed to be
116
   correct.  */
117
#ifdef  PROF
118
#define CALL_MCOUNT \
119
  push  $srp                                            @ \
120
  push  $r9                                             @ \
121
  push  $r10                                            @ \
122
  push  $r11                                            @ \
123
  push  $r12                                            @ \
124
  push  $r13                                            @ \
125
  SETUP_PIC                                             @ \
126
  PLTCALL (_mcount)                                     @ \
127
  TEARDOWN_PIC                                          @ \
128
  pop   $r13                                            @ \
129
  pop   $r12                                            @ \
130
  pop   $r11                                            @ \
131
  pop   $r10                                            @ \
132
  pop   $r9                                             @ \
133
  pop   $srp
134
#else
135
#define CALL_MCOUNT             /* Do nothing.  */
136
#endif
137
 
138
 
139
#endif /* __ASSEMBLER__ */
140
#endif /* _SYSDEP_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.