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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [libgloss/] [fr30/] [syscalls.c] - Blame information for rev 243

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

Line No. Rev Author Line
1 207 jeremybenn
/* FR30 system call emulation code
2
   Copyright (C) 1998 Free Software Foundation, Inc.
3
   Contributed by Cygnus Solutions.
4
 
5
This file is part of GNU CC.
6
 
7
GNU CC is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
10
any later version.
11
 
12
GNU CC is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GNU CC; see the file COPYING.  If not, write to
19
the Free Software Foundation, 59 Temple Place - Suite 330,
20
Boston, MA 02111-1307, USA.  */
21
 
22
#include <sys/stat.h>
23
#include "../syscall.h"
24
 
25
int
26
_read (file, ptr, len)
27
     int    file;
28
     char * ptr;
29
     int    len;
30
{
31
  asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
32
  asm ("int   #10");
33
 
34
  return;
35
}
36
 
37
int
38
_lseek (file, ptr, dir)
39
     int file;
40
     int ptr;
41
     int dir;
42
{
43
  asm ("ldi:8 %0, r0" :: "i" (SYS_lseek) : "r0");
44
  asm ("int   #10");
45
 
46
  return;
47
}
48
 
49
int
50
_write (file, ptr, len)
51
     int    file;
52
     char * ptr;
53
     int    len;
54
{
55
  asm ("ldi:8 %0, r0" :: "i" (SYS_write) : "r0");
56
  asm ("int   #10");
57
 
58
  return;
59
}
60
 
61
int
62
_open (path, flags)
63
     const char * path;
64
     int flags;
65
{
66
  asm ("ldi:8  %0, r0" :: "i" (SYS_open) : "r0");
67
  asm ("int    #10");
68
 
69
  return;
70
}
71
 
72
int
73
_close (file)
74
     int file;
75
{
76
  asm ("ldi:8  %0, r0" :: "i" (SYS_close) : "r0");
77
  asm ("int    #10");
78
 
79
  return 0;
80
}
81
 
82
void
83
_exit (n)
84
     int n;
85
{
86
  asm ("ldi:8  %0, r0" :: "i" (SYS_exit) : "r0");
87
  asm ("int    #10");
88
}
89
 
90
 
91
caddr_t
92
_sbrk (incr)
93
     int incr;
94
{
95
  extern char   end asm ("_end");       /* Defined by the linker */
96
  extern int    __stack;                /* Defined by linker script.  */
97
  static char * heap_end;
98
  char *        prev_heap_end;
99
 
100
  if (heap_end == NULL)
101
    heap_end = & end;
102
 
103
  prev_heap_end = heap_end;
104
#if 0  
105
  if (heap_end + incr > __stack)
106
    {
107
      _write ( 1, "_sbrk: Heap and stack collision\n", 32);
108
      abort ();
109
    }
110
#endif
111
  heap_end += incr;
112
 
113
  return (caddr_t) prev_heap_end;
114
}
115
 
116
int
117
_fstat (file, st)
118
     int file;
119
     struct stat * st;
120
{
121
  st->st_mode = S_IFCHR;
122
  return 0;
123
}
124
 
125
int
126
_unlink ()
127
{
128
  return -1;
129
}
130
 
131
int
132
_isatty (fd)
133
     int fd;
134
{
135
  return 0;
136
}
137
 
138
int
139
_raise ()
140
{
141
  return 0;
142
}
143
 
144
int
145
_times ()
146
{
147
  return 0;
148
}
149
 
150
int
151
_kill (pid, sig)
152
     int pid;
153
     int sig;
154
{
155
  return 0;
156
}
157
 
158
int
159
_getpid (void)
160
{
161
  return 0;
162
}

powered by: WebSVN 2.1.0

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