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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [m88kbug/] [syscalls.c] - Blame information for rev 158

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

Line No. Rev Author Line
1 148 jeremybenn
/* Operating system  and traps for mvme187bug, the motorolola BUG
2
   monitor for m88k */
3
 
4
#include <sys/types.h>
5
#include <sys/stat.h>
6
#include <sys/times.h>
7
#include <errno.h>
8
 
9
#include "sys/systraps.h"
10
 
11
static void writechar(int c) {
12
  register int n asm ("r2");
13
  n = c;
14
  SYSTRAP(OUTCHR);
15
  return;
16
}
17
 
18
static int readchar(void) {
19
  register int n asm ("r2");
20
  SYSTRAP(INCHR);
21
  return(n);
22
}
23
 
24
int read(int file, char *ptr, int len) {
25
  int todo;
26
 
27
  for (todo = len; todo; --todo) {
28
    *ptr++ = readchar();
29
  }
30
 
31
  return(len);
32
}
33
 
34
int lseek(int file, int ptr, int dir) {
35
  return 0;
36
}
37
 
38
int write(int file, char *ptr, int len) {
39
  int todo;
40
 
41
  for (todo = len; todo; --todo) {
42
    writechar(*ptr++);
43
  }
44
  return(len);
45
}
46
 
47
int close(int file) {
48
  return(-1);
49
}
50
 
51
caddr_t sbrk(int incr) {
52
  extern char end;              /* Defined by the linker */
53
  static char *heap_end;
54
  char *prev_heap_end;
55
 
56
  if (heap_end == 0)
57
  {
58
    heap_end = &end;
59
  }
60
  prev_heap_end = heap_end;
61
  if (heap_end + incr > stack_ptr)
62
    {
63
      _write (1, "Heap and stack collision\n", 25);
64
      abort ();
65
    }
66
  heap_end += incr;
67
  return((caddr_t) prev_heap_end);
68
}
69
 
70
int isatty(int file) {
71
  return(1);
72
}
73
 
74
int fstat(int file, struct stat *st) {
75
  st->st_mode = S_IFCHR;
76
  return(0);
77
}
78
 
79
int stat(char *filename, struct stat *st) {
80
  st->st_mode = S_IFCHR;
81
  return(0);
82
}
83
 
84
int open(const char *path, int flags) {
85
  return(0);
86
}
87
 
88
 
89
int _exit() {
90
  SYSTRAP(RETURN);
91
}
92
 
93
int execve(char *name, char **argv, char **env) {
94
  errno = ENOMEM;
95
  return(-1);
96
}
97
 
98
int fork() {
99
  errno = EAGAIN;
100
  return(-1);
101
}
102
 
103
int getpid() {
104
  return(1);
105
}
106
 
107
int kill(int pid, int sig) {
108
  errno = EINVAL;
109
  return(-1);
110
}
111
 
112
int link(char *old, char *new) {
113
  errno = EMLINK;
114
  return(-1);
115
}
116
 
117
clock_t times(struct tms *buf) {
118
  return(-1);
119
}
120
 
121
int unlink(char *name) {
122
  errno = ENOENT;
123
  return(-1);
124
}
125
 
126
int wait(int *status) {
127
  errno = ECHILD;
128
  return(-1);
129
}
130
 
131
/* end of syscalls.c */

powered by: WebSVN 2.1.0

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