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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [sparc/] [cygmon-salib.c] - Blame information for rev 148

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
#ifdef TARGET_CPU_SPARC64
2
#include <sys/types.h>
3
#endif
4
#include <sys/time.h>
5
 
6
void
7
putTtyChar(int c)
8
{
9
  /* 2 is fork under solaris; bad juju */
10
  asm(" mov %i0,%o0             \n\
11
        or %g0,2,%g1            \n\
12
        ta 8                    \n\
13
        nop");
14
}
15
 
16
int
17
write(int fd,char *ptr,int amt)
18
{
19
  if (fd < 0 || fd > 2)
20
    {
21
      return -1;
22
    }
23
  asm(" or %g0, 4, %g1          \n\
24
        ta 8                    \n\
25
        nop");
26
  return amt;
27
}
28
 
29
int
30
read(int fd,char *ptr,int amt)
31
{
32
  if (fd < 0 || fd > 2)
33
    {
34
      return -1;
35
    }
36
  asm(" or %g0, 3, %g1          \n\
37
        ta 8                    \n\
38
        nop");
39
  return amt;
40
}
41
 
42
void
43
_exit(int code)
44
{
45
  while(1) {
46
    asm(" or %g0,1,%g1          \n\
47
          ta 8                  \n\
48
          nop                   \n\
49
          ta 1                  \n\
50
          nop");
51
  }
52
}
53
 
54
int
55
setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
56
{
57
  asm(" or %g0, 158, %g1        \n\
58
        ta 8                    \n\
59
        nop");
60
}
61
 
62
 
63
 
64
long
65
sbrk (unsigned long amt)
66
{
67
  extern char _end;
68
  static char *ptr = 0;
69
  char *res;
70
  if (ptr == 0)
71
    ptr = &_end;
72
  if (amt == 0)
73
    return (long)ptr;
74
 
75
  if (((long)ptr) % 8)
76
    ptr = ptr + (8 - (((long)(ptr)) % 8));
77
  res = ptr;
78
  ptr += amt;
79
  return (long)res;
80
}
81
 
82
#ifdef TARGET_CPU_SPARC64
83
long
84
_sbrk_r (void *foo, unsigned long amt)
85
{
86
  return sbrk(amt);
87
}
88
 
89
long
90
_fstat_r (void *foo, void *bar, void *baz)
91
{
92
  return -1;
93
}
94
 
95
long
96
_brk_r (void *foo)
97
{
98
  return sbrk(0);
99
}
100
 
101
int
102
_open_r (char *filename, int mode)
103
{
104
  return open (filename, mode);
105
}
106
 
107
int
108
_close_r (int fd)
109
{
110
  return close(fd);
111
}
112
#endif
113
 
114
int
115
close (int fd)
116
{
117
  return 0;
118
}
119
 
120
int
121
fstat(int des,void *buf)
122
{
123
  return -1;
124
}
125
 
126
int
127
lseek(int des,unsigned long offset, int whence)
128
{
129
  return -1;
130
}
131
 
132
int
133
isatty(int fd)
134
{
135
  return (fd < 3);
136
}
137
 
138
int
139
kill (int pid, int signal)
140
{
141
  asm ("or %g0, 37, %g1         \n\
142
        ta 8                    \n\
143
        nop");
144
}
145
 
146
int
147
getpid ()
148
{
149
  return -1;
150
}
151
 
152
int
153
getitimer (int which, struct itimerval *value)
154
{
155
  asm ("or %g0, 157, %g1        \n\
156
        ta 8                    \n\
157
        nop");
158
}
159
 
160
void
161
__install_signal_handler (void *func)
162
{
163
  asm ("mov %o0, %o1            \n\
164
        mov %g0, %o0            \n\
165
        or %g0, 48, %g1         \n\
166
        ta 8                    \n\
167
        nop");
168
}
169
 
170
int
171
gettimeofday (struct timeval *tp, void *tzp)
172
{
173
  asm ("or %g0, 156, %g1        \n\
174
        ta 8                    \n\
175
        nop");
176
}
177
 
178
int
179
stime (long *seconds)
180
{
181
  asm ("or %g0, 25, %g1         \n\
182
        ta 8                    \n\
183
        nop");
184
}
185
 
186
int
187
add_mapping (long vma, long pma, long size)
188
{
189
  asm ("or %g0, 115, %g1        \n\
190
        ta 8                    \n\
191
        nop");
192
}
193
 
194
int
195
remove_mapping (long vma, long vma_end)
196
{
197
  asm ("or %g0, 117, %g1        \n\
198
        ta 8                    \n\
199
        nop");
200
}
201
 
202
int
203
open (char *filename, int mode)
204
{
205
  return -1;
206
}
207
 
208
void *
209
__getProgramArgs (int *argv)
210
{
211
  int *res;
212
 
213
  /* 184 is tsolsys under solaris; bad juju */
214
  asm ("mov %1, %%o0            \n\
215
        or %%g0, 184, %%g1      \n\
216
        ta 8                    \n\
217
        nop                     \n\
218
        mov %%o0, %0" : "=r" (res) : "r" (argv): "g1");
219
  return res;
220
}

powered by: WebSVN 2.1.0

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