/*
|
/*
|
* Standard x86 syscalls for user programs running under Cygmon
|
* Standard x86 syscalls for user programs running under Cygmon
|
*
|
*
|
* Copyright (c) 1998 Cygnus Support
|
* Copyright (c) 1998 Cygnus Support
|
*
|
*
|
* The authors hereby grant permission to use, copy, modify, distribute,
|
* The authors hereby grant permission to use, copy, modify, distribute,
|
* and license this software and its documentation for any purpose, provided
|
* and license this software and its documentation for any purpose, provided
|
* that existing copyright notices are retained in all copies and that this
|
* that existing copyright notices are retained in all copies and that this
|
* notice is included verbatim in any distributions. No written agreement,
|
* notice is included verbatim in any distributions. No written agreement,
|
* license, or royalty fee is required for any of the authorized uses.
|
* license, or royalty fee is required for any of the authorized uses.
|
* Modifications to this software may be copyrighted by their authors
|
* Modifications to this software may be copyrighted by their authors
|
* and need not follow the licensing terms described here, provided that
|
* and need not follow the licensing terms described here, provided that
|
* the new terms are clearly indicated on the first page of each file where
|
* the new terms are clearly indicated on the first page of each file where
|
* they apply.
|
* they apply.
|
*/
|
*/
|
|
|
#ifndef CYGMON_SYSCALL_H
|
#ifndef CYGMON_SYSCALL_H
|
#define CYGMON_SYSCALL_H
|
#define CYGMON_SYSCALL_H
|
|
|
#define __MAX_ERRNO 4096
|
#define __MAX_ERRNO 4096
|
|
|
#define _syscall0(type,name) \
|
#define _syscall0(type,name) \
|
type name(void) \
|
type name(void) \
|
{ \
|
{ \
|
long __res; \
|
long __res; \
|
__asm__ __volatile__ ("int $0x80" \
|
__asm__ __volatile__ ("int $0x80" \
|
: "=a" (__res) \
|
: "=a" (__res) \
|
: "0" (SYS_##name)); \
|
: "0" (SYS_##name)); \
|
return (type) __res; \
|
return (type) __res; \
|
}
|
}
|
|
|
#define _syscall1(type,name,atype,a) \
|
#define _syscall1(type,name,atype,a) \
|
type name(atype a) \
|
type name(atype a) \
|
{ \
|
{ \
|
long __res, dummy; \
|
long __res, dummy; \
|
__asm__ __volatile__ ("int $0x80" \
|
__asm__ __volatile__ ("int $0x80" \
|
: "=a" (__res), "=&b" (dummy) \
|
: "=a" (__res), "=&b" (dummy) \
|
: "0" (SYS_##name),"1" ((long)(a))); \
|
: "0" (SYS_##name),"1" ((long)(a))); \
|
return (type) __res; \
|
return (type) __res; \
|
}
|
}
|
|
|
#define _syscall2(type,name,atype,a,btype,b) \
|
#define _syscall2(type,name,atype,a,btype,b) \
|
type name(atype a,btype b) \
|
type name(atype a,btype b) \
|
{ \
|
{ \
|
long __res, dummy; \
|
long __res, dummy; \
|
__asm__ __volatile__ ("int $0x80" \
|
__asm__ __volatile__ ("int $0x80" \
|
: "=a" (__res), "=&b" (dummy) \
|
: "=a" (__res), "=&b" (dummy) \
|
: "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b))); \
|
: "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b))); \
|
return (type) __res; \
|
return (type) __res; \
|
}
|
}
|
|
|
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
|
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
|
type name(atype a,btype b,ctype c) \
|
type name(atype a,btype b,ctype c) \
|
{ \
|
{ \
|
long __res, dummy; \
|
long __res, dummy; \
|
__asm__ __volatile__ ("int $0x80" \
|
__asm__ __volatile__ ("int $0x80" \
|
: "=a" (__res), "=&b" (dummy) \
|
: "=a" (__res), "=&b" (dummy) \
|
: "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
|
: "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
|
return (type) __res; \
|
return (type) __res; \
|
}
|
}
|
|
|
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
|
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
|
type name (atype a, btype b, ctype c, dtype d) \
|
type name (atype a, btype b, ctype c, dtype d) \
|
{ \
|
{ \
|
long __res; \
|
long __res; \
|
__asm__ __volatile__ ("int $0x80" \
|
__asm__ __volatile__ ("int $0x80" \
|
: "=a" (__res) \
|
: "=a" (__res) \
|
: "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
|
: "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
|
"d" ((long)(c)),"S" ((long)(d))); \
|
"d" ((long)(c)),"S" ((long)(d))); \
|
return (type) __res; \
|
return (type) __res; \
|
}
|
}
|
|
|
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
|
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
|
type name (atype a,btype b,ctype c,dtype d,etype e) \
|
type name (atype a,btype b,ctype c,dtype d,etype e) \
|
{ \
|
{ \
|
long __res; \
|
long __res; \
|
__asm__ __volatile__ ("int $0x80" \
|
__asm__ __volatile__ ("int $0x80" \
|
: "=a" (__res) \
|
: "=a" (__res) \
|
: "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
|
: "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
|
"d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
|
"d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
|
return (type) __res; \
|
return (type) __res; \
|
}
|
}
|
|
|
#define SYS_putTtyChar 2
|
#define SYS_putTtyChar 2
|
#define SYS___sys_exit 1
|
#define SYS___sys_exit 1
|
#define SYS_read 3
|
#define SYS_read 3
|
#define SYS_write 4
|
#define SYS_write 4
|
#define SYS___open 5
|
#define SYS___open 5
|
#define SYS_close 6
|
#define SYS_close 6
|
#define SYS_kill 37
|
#define SYS_kill 37
|
#define SYS_time 13
|
#define SYS_time 13
|
#define SYS_gettimeofday 156
|
#define SYS_gettimeofday 156
|
#define SYS___install_signal_handler 48
|
#define SYS___install_signal_handler 48
|
#define SYS_profil 98
|
#define SYS_profil 98
|
#define SYS___get_program_arguments 184
|
#define SYS___get_program_arguments 184
|
#endif /* SYSCALL_H */
|
#endif /* SYSCALL_H */
|
|
|