Warning, cross-references for /libc/include/syscall.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 struct sched_param
0021 {
0022 int sched_priority;
0023
0024
0025 int C;
0026 int T;
0027 int m;
0028 int k;
0029 };
0030
0031 #define CLOBBERS1 "memory","cc","%ebx","%ecx","%edx","%esi","%edi"
0032 #define CLOBBERS2 "memory","cc","%ecx","%edx","%esi","%edi"
0033 #define CLOBBERS3 "memory","cc","%ebx","%edx","%esi","%edi"
0034 #define CLOBBERS4 "memory","cc","%ebx","%ecx","%esi","%edi"
0035 #define CLOBBERS5 "memory","cc","%edx","%esi","%edi"
0036
0037
0038
0039
0040
0041
0042
0043
0044 static inline void
0045 putchar (int c)
0046 {
0047
0048 asm volatile ("int $0x30\n"::"a" (0L), "b" (c):CLOBBERS2);
0049
0050 }
0051
0052 static inline void
0053 usleep (unsigned usec)
0054 {
0055
0056 asm volatile ("int $0x30\n"::"a" (1L), "b" (usec):CLOBBERS2);
0057
0058 }
0059
0060 static inline unsigned short
0061 fork (void)
0062 {
0063
0064 unsigned int retval;
0065
0066 asm volatile ("int $0x31\n":"=a" (retval)::CLOBBERS1);
0067
0068 return (unsigned short) retval;
0069 }
0070
0071
0072 static inline void
0073 switch_to (unsigned pid)
0074 {
0075
0076 asm volatile ("int $0x32\n"::"a" (pid):CLOBBERS1);
0077
0078 }
0079
0080
0081 static inline void
0082 exec (char *file, char *argv[])
0083 {
0084
0085 asm volatile ("int $0x33\n"::"a" (file), "b" (argv):CLOBBERS2);
0086 }
0087
0088
0089 static inline char
0090 getchar (void)
0091 {
0092
0093 char c;
0094
0095 asm volatile ("int $0x34\n":"=a" (c): "b" (0):CLOBBERS2);
0096
0097 return c;
0098 }
0099
0100 static inline unsigned int
0101 getcode (void)
0102 {
0103
0104 unsigned int c;
0105
0106 asm volatile ("int $0x34\n":"=a" (c): "b" (1):CLOBBERS2);
0107
0108 return c;
0109 }
0110
0111 static inline int
0112 open (const char *pathname, int flags)
0113 {
0114
0115 int c;
0116
0117 asm volatile ("int $0x35\n":"=a" (c):"a" (pathname), "b" (flags):CLOBBERS2);
0118
0119 return c;
0120 }
0121
0122 static inline int
0123 read (char *pathname, void *buf, int count)
0124 {
0125
0126 int c;
0127
0128 asm volatile ("int $0x36\n":"=a" (c):"a" (pathname), "b" (buf),
0129 "c" (count):CLOBBERS5);
0130
0131 return c;
0132 }
0133
0134
0135 static inline int
0136 uname (char *name)
0137 {
0138
0139 int c;
0140
0141 asm volatile ("int $0x37\n":"=a" (c):"a" (name):CLOBBERS1);
0142
0143 return c;
0144 }
0145
0146
0147 static inline unsigned
0148 meminfo (void)
0149 {
0150
0151 unsigned c;
0152
0153 asm volatile ("int $0x38\n":"=a" (c):"a" (0L):CLOBBERS1);
0154
0155 return c;
0156 }
0157
0158 static inline unsigned
0159 shared_mem_alloc (void)
0160 {
0161 unsigned c;
0162
0163 asm volatile ("int $0x38\n":"=a" (c):"a" (1L):CLOBBERS1);
0164
0165 return c;
0166 }
0167
0168 static inline void *
0169 shared_mem_attach (unsigned id)
0170 {
0171 unsigned c;
0172
0173 asm volatile ("int $0x38\n":"=a" (c):"a" (2L), "d" (id):CLOBBERS4);
0174
0175 return (void *) c;
0176 }
0177
0178 static inline unsigned
0179 shared_mem_detach (void *addr)
0180 {
0181 unsigned c;
0182
0183 asm volatile ("int $0x38\n":"=a" (c):"a" (3L), "d" ((unsigned) addr):CLOBBERS4);
0184
0185 return c;
0186 }
0187
0188 static inline unsigned
0189 shared_mem_free (unsigned id)
0190 {
0191 unsigned c;
0192
0193 asm volatile ("int $0x38\n":"=a" (c):"a" (4L), "d" (id):CLOBBERS4);
0194
0195 return c;
0196 }
0197
0198
0199
0200 static inline unsigned
0201 time (void)
0202 {
0203
0204 unsigned c;
0205
0206 asm volatile ("int $0x39\n":"=a" (c):);
0207
0208 return c;
0209 }
0210
0211
0212 static inline void _exit (int) __attribute__ ((noreturn));
0213 static inline void
0214 _exit (int status)
0215 {
0216
0217 asm volatile ("int $0x3a\n"::"a" (status):CLOBBERS1);
0218
0219 while (1);
0220 }
0221
0222 static inline int
0223 waitpid (int pid)
0224 {
0225
0226 int ret;
0227
0228 asm volatile ("int $0x3B\n":"=a" (ret):"a" (pid):CLOBBERS1);
0229
0230 return ret;
0231 }
0232
0233
0234 static inline int
0235 sched_setparam (int pid, const struct sched_param *p)
0236 {
0237
0238 int ret;
0239
0240 asm volatile ("int $0x3C\n":"=a" (ret):"a" (pid), "b" (p):CLOBBERS2);
0241
0242 return ret;
0243 }
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254