2 * Standard x86 syscalls for user programs running under Cygmon
4 * Copyright (c) 1998, 2000 Cygnus Support
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
19 #include "cygmon-syscall.h"
24 _syscall3(int,write
,int,i
,char *,c
,int,len
);
26 _syscall3(int,read
,int,i
,char *,c
,int,len
);
29 read (int des
, char *dest
, int len
)
35 _syscall2(int,kill
,int,pid
,int,signal
);
37 _syscall2(void,__install_signal_handler
,int,arg
,void *,handler
);
38 _syscall1(char **,__get_program_arguments
,int *,argc
);
40 _syscall1(void,__sys_exit
,int,exitcode
);
41 _syscall1(void,putTtyChar
,int,character
);
42 _syscall1(time_t,time
,time_t *,ptr
);
43 _syscall2(int, gettimeofday
, struct timeval
*,time
, struct timezone
*,z
);
44 _syscall3(int, __open
, const char *, filename
, int, mode
, int, filemode
);
45 _syscall4(void, profil
, unsigned short *, buff
, unsigned int, bufsiz
,
46 unsigned int, offset
, unsigned int, scale
);
47 _syscall1(int, close
, int, fd
);
51 open (const char *filename
, int mode
, ...)
54 return __open (filename
, mode
, 0644);
60 /* Ultra-super cheezy. */
67 int unlink (const char *p
)
85 ptr
= ptr
+ (8 - (((long)(ptr
)) % 8));
101 fstat(int des
, struct stat
*buf
)
107 lseek(int des
,unsigned long offset
, int whence
)
118 /* Simple replacement for the clock() syscall. */
124 gettimeofday (&t
, 0);
125 return t
.tv_sec
* 1000 + (t
.tv_usec
/ 1000);
128 #if ! defined(COFF) && ! defined(AOUT)
129 typedef void (*ctp
)();
133 extern int __CTOR_LIST__
;
134 int *c
= &__CTOR_LIST__
;
147 extern int __DTOR_LIST__
;
148 int *c
= &__DTOR_LIST__
;
166 profil_write (int type
, char *buffer
, int len
)
172 des
= open ("gmon.out", O_WRONLY
| O_CREAT
| O_TRUNC
, 0644);
180 write (des
, buffer
, len
);