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

Subversion Repositories or1k

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

powered by: WebSVN 2.1.0

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