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)
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. */
23 #include "../syscall.h"
26 _read (file
, ptr
, len
)
31 asm ("ldi:8 %0, r0" :: "i" (SYS_read
) : "r0");
38 _lseek (file
, ptr
, dir
)
43 asm ("ldi:8 %0, r0" :: "i" (SYS_lseek
) : "r0");
50 _write (file
, ptr
, len
)
55 asm ("ldi:8 %0, r0" :: "i" (SYS_write
) : "r0");
66 asm ("ldi:8 %0, r0" :: "i" (SYS_open
) : "r0");
76 asm ("ldi:8 %0, r0" :: "i" (SYS_close
) : "r0");
86 asm ("ldi:8 %0, r0" :: "i" (SYS_exit
) : "r0");
95 extern char end
asm ("_end"); /* Defined by the linker */
96 extern int __stack
; /* Defined by linker script. */
97 static char * heap_end
;
100 if (heap_end
== NULL
)
103 prev_heap_end
= heap_end
;
105 if (heap_end
+ incr
> __stack
)
107 _write ( 1, "_sbrk: Heap and stack collision\n", 32);
113 return (caddr_t
) prev_heap_end
;
121 st
->st_mode
= S_IFCHR
;