fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / libgloss / fr30 / syscalls.c
blobe59a14463339205e12ed3b73ce42c0f2c31aec50
1 /* FR30 system call emulation code
2 Copyright (C) 1998 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
5 This file is part of GNU CC.
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.
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.
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. */
22 #include <sys/stat.h>
23 #include "../syscall.h"
25 int
26 _read (file, ptr, len)
27 int file;
28 char * ptr;
29 int len;
31 asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
32 asm ("int #10");
34 return;
37 int
38 _lseek (file, ptr, dir)
39 int file;
40 int ptr;
41 int dir;
43 asm ("ldi:8 %0, r0" :: "i" (SYS_lseek) : "r0");
44 asm ("int #10");
46 return;
49 int
50 _write (file, ptr, len)
51 int file;
52 char * ptr;
53 int len;
55 asm ("ldi:8 %0, r0" :: "i" (SYS_write) : "r0");
56 asm ("int #10");
58 return;
61 int
62 _open (path, flags)
63 const char * path;
64 int flags;
66 asm ("ldi:8 %0, r0" :: "i" (SYS_open) : "r0");
67 asm ("int #10");
69 return;
72 int
73 _close (file)
74 int file;
76 asm ("ldi:8 %0, r0" :: "i" (SYS_close) : "r0");
77 asm ("int #10");
79 return 0;
82 void
83 _exit (n)
84 int n;
86 asm ("ldi:8 %0, r0" :: "i" (SYS_exit) : "r0");
87 asm ("int #10");
91 caddr_t
92 _sbrk (incr)
93 int incr;
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;
100 if (heap_end == NULL)
101 heap_end = & end;
103 prev_heap_end = heap_end;
104 #if 0
105 if (heap_end + incr > __stack)
107 _write ( 1, "_sbrk: Heap and stack collision\n", 32);
108 abort ();
110 #endif
111 heap_end += incr;
113 return (caddr_t) prev_heap_end;
117 _fstat (file, st)
118 int file;
119 struct stat * st;
121 st->st_mode = S_IFCHR;
122 return 0;
126 _unlink ()
128 return -1;
132 isatty (fd)
133 int fd;
135 return 0;
139 _raise ()
141 return 0;
145 _times ()
147 return 0;
151 _kill (pid, sig)
152 int pid;
153 int sig;
155 return 0;
159 _getpid (void)
161 return 0;