source: trunk/libs/newlib/src/libgloss/i386/cygmon-syscall.h @ 467

Last change on this file since 467 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.6 KB
Line 
1/*
2 * Standard x86 syscalls for user programs running under Cygmon
3 *
4 * Copyright (c) 1998 Cygnus Support
5 *
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
14 * they apply.
15 */
16
17#ifndef CYGMON_SYSCALL_H
18#define CYGMON_SYSCALL_H
19
20#define __MAX_ERRNO 4096
21
22#define _syscall0(type,name) \
23type name(void) \
24{ \
25long __res; \
26__asm__ __volatile__ ("int $0x80" \
27        : "=a" (__res) \
28        : "0" (SYS_##name)); \
29        return (type) __res; \
30}
31
32#define _syscall1(type,name,atype,a) \
33type name(atype a) \
34{ \
35long __res, dummy; \
36__asm__ __volatile__ ("int $0x80" \
37        : "=a" (__res), "=&b" (dummy) \
38        : "0" (SYS_##name),"1" ((long)(a))); \
39        return (type) __res; \
40}
41
42#define _syscall2(type,name,atype,a,btype,b) \
43type name(atype a,btype b) \
44{ \
45long __res, dummy; \
46__asm__ __volatile__ ("int $0x80" \
47        : "=a" (__res), "=&b" (dummy) \
48        : "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b))); \
49        return (type) __res; \
50}
51
52#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
53type name(atype a,btype b,ctype c) \
54{ \
55long __res, dummy; \
56__asm__ __volatile__ ("int $0x80" \
57        : "=a" (__res), "=&b" (dummy) \
58        : "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
59        return (type) __res; \
60}
61
62#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
63type name (atype a, btype b, ctype c, dtype d) \
64{ \
65long __res; \
66__asm__ __volatile__ ("int $0x80" \
67        : "=a" (__res) \
68        : "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
69          "d" ((long)(c)),"S" ((long)(d))); \
70        return (type) __res; \
71}
72
73#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
74type name (atype a,btype b,ctype c,dtype d,etype e) \
75{ \
76long __res; \
77__asm__ __volatile__ ("int $0x80" \
78        : "=a" (__res) \
79        : "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
80          "d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
81        return (type) __res; \
82}
83
84#define SYS_putTtyChar 2
85#define SYS___sys_exit 1
86#define SYS_read 3
87#define SYS_write 4
88#define SYS___open 5
89#define SYS_close 6
90#define SYS_kill 37
91#define SYS_time 13
92#define SYS_gettimeofday 156
93#define SYS___install_signal_handler 48
94#define SYS_profil 98
95#define SYS___get_program_arguments 184
96#endif /* SYSCALL_H */
Note: See TracBrowser for help on using the repository browser.