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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [h8500hms/] [syscalls.c] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
 
2
#include <_ansi.h>
3
#include <sys/types.h>
4
#include <sys/stat.h>
5
#include <unistd.h>
6
 
7
int
8
_read (file, ptr, len)
9
     int file;
10
     char *ptr;
11
     size_t len;
12
 
13
{
14
  return 0;
15
}
16
 
17
 
18
int
19
_lseek (file, ptr, dir)
20
     int file;
21
     int ptr;
22
     int dir;
23
 
24
{
25
  return 0;
26
 
27
}
28
 
29
static
30
writechar (c)
31
     char c;
32
 
33
 
34
{
35
  register int n asm ("r3");
36
  n = c;
37
asm ("clr.w     r1;mov.w %0,r0; mov.w #6,r3; trapa #15": :"g" (n) : "r3","r1","r0");
38
}
39
 
40
 
41
 
42
int
43
_write (file, ptr, len)
44
     int file;
45
     char *ptr;
46
     size_t len;
47
{
48
 
49
  int todo;
50
 
51
  for (todo = 0; todo < len; todo++)
52
    {
53
      writechar (*ptr++);
54
    }
55
  return len;
56
 
57
}
58
 
59
 
60
 
61
int
62
_close (file)
63
     int file;
64
{
65
 
66
  return -1;
67
}
68
 
69
 
70
 
71
caddr_t
72
_sbrk (incr)
73
     size_t incr;
74
{
75
  extern char end;              /* Defined by the linker */
76
  static char *heap_end;
77
  char *prev_heap_end;
78
 
79
  if (heap_end == 0)
80
    {
81
      heap_end = &end;
82
    }
83
  prev_heap_end = heap_end;
84
  if (heap_end + incr > stack_ptr)
85
    {
86
      _write (1, "Heap and stack collision\n", 25);
87
      abort ();
88
    }
89
  heap_end += incr;
90
  return (caddr_t) prev_heap_end;
91
}
92
 
93
 
94
 
95
int
96
_isatty (file)
97
     int file;
98
{
99
  return 1;
100
}
101
 
102
 
103
 
104
int
105
_fstat (file, stat)
106
     int file;
107
     struct stat *stat;
108
 
109
{
110
  stat->st_mode = S_IFCHR;
111
  return 0;
112
}
113
 
114
int
115
_open (path, flags)
116
     const char *path;
117
     int flags;
118
 
119
{
120
  return 0;
121
}
122
 
123
 
124
void
125
_exit (status)
126
     int status;
127
{
128
  asm (" mov.w #33,r3; trapa #15");
129
}

powered by: WebSVN 2.1.0

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