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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [sys/] [w65/] [syscalls.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
#include <_ansi.h>
2
#include <sys/types.h>
3
#include <sys/stat.h>
4
#include "sys/syscall.h"
5
int errno;
6
 
7
 
8
 
9
int
10
_read (int file,
11
       char *ptr,
12
       int len)
13
{
14
  return __trap3 (SYS_read, file, ptr, len);
15
}
16
 
17
 
18
int
19
_lseek (int file,
20
        int ptr,
21
        int dir)
22
{
23
  return __trap3 (SYS_lseek, file, ptr, dir);
24
}
25
 
26
static
27
writechar (char c)
28
{
29
  asm ("lda %0" : : "r" (c));
30
  asm ("wdm");
31
}
32
 
33
 
34
 
35
int
36
_write (
37
         int file,
38
         char *ptr,
39
         int len)
40
{
41
  return __trap3 (SYS_write, file, ptr, len);
42
}
43
 
44
 
45
 
46
int
47
_close (int file)
48
{
49
  return __trap3 (SYS_close, file, 0, 0);
50
}
51
 
52
 
53
 
54
caddr_t
55
_sbrk (int incr)
56
{
57
  extern char end;              /* Defined by the linker */
58
  static char *heap_end;
59
  char *prev_heap_end;
60
 
61
  if (heap_end == 0)
62
    {
63
      heap_end = &end;
64
    }
65
  prev_heap_end = heap_end;
66
  if (heap_end + incr > stack_ptr)
67
    {
68
      _write (1, "Heap and stack collision\n", 25);
69
      abort ();
70
    }
71
 
72
  heap_end += incr;
73
  return (caddr_t) prev_heap_end;
74
}
75
 
76
 
77
 
78
 
79
int
80
_fstat (int file,
81
        struct stat *st)
82
{
83
  st->st_mode = S_IFCHR;
84
  return 0;
85
}
86
 
87
 
88
int
89
_open (
90
        char *path,
91
        int flags)
92
{
93
  return __trap3 (SYS_open, path, flags, 0);
94
}
95
 
96
int
97
_unlink ()
98
{
99
  return -1;
100
}
101
 
102
isatty (fd)
103
     int fd;
104
{
105
  return 1;
106
}
107
 
108
 
109
 
110
_exit (n)
111
{
112
  return __trap3 (SYS_exit, n, 0, 0);
113
}
114
 
115
 
116
_kill (n, m)
117
{
118
  return __trap3 (SYS_exit, 0xdead, 0, 0);
119
}
120
 
121
 
122
_getpid (n)
123
{
124
  return 1;
125
}
126
 
127
 
128
 
129
 
130
_raise ()
131
{
132
 
133
}
134
 
135
int
136
_stat (const char *path, struct stat *st)
137
 
138
{
139
  return _trap3 (SYS_stat, path, st, 0);
140
}
141
 
142
int
143
_chmod (const char *path, short mode)
144
{
145
  return _trap3 (SYS_chmod, path, mode);
146
}
147
 
148
int
149
_chown (const char *path, short owner, short group)
150
{
151
  return _trap3 (SYS_chown, path, owner, group);
152
}
153
 
154
int
155
_utime (path, times)
156
     const char *path;
157
     char *times;
158
{
159
  return _trap3 (SYS_utime, path, times);
160
}
161
 
162
int
163
_fork ()
164
{
165
  return _trap3 (SYS_fork);
166
}
167
 
168
int
169
_wait (statusp)
170
     int *statusp;
171
{
172
  return _trap3 (SYS_wait);
173
}
174
 
175
int
176
_execve (const char *path, char *const argv[], char *const envp[])
177
{
178
  return _trap3 (SYS_execve, path, argv, envp);
179
}
180
 
181
int
182
_execv (const char *path, char *const argv[])
183
{
184
  return _trap3 (SYS_execv, path, argv);
185
}
186
 
187
int
188
_pipe (int *fd)
189
{
190
  return _trap3 (SYS_pipe, fd);
191
}

powered by: WebSVN 2.1.0

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