xv6-cs450/ulib.c
rtm 8b4e2a08fe swtch saves callee-saved registers
swtch idles on per-CPU stack, not on calling process's stack
fix pipe bugs
usertest.c tests pipes, fork, exit, close
2006-07-01 21:26:01 +00:00

59 lines
564 B
C

int
fork()
{
asm("mov $1, %eax");
asm("int $48");
}
int
exit()
{
asm("mov $2, %eax");
asm("int $48");
}
void
cons_putc(int c)
{
asm("mov $4, %eax");
asm("int $48");
}
int
puts(char *s)
{
int i;
for(i = 0; s[i]; i++)
cons_putc(s[i]);
return i;
}
int
pipe(int fds[])
{
asm("mov $5, %eax");
asm("int $48");
}
int
read(int fd, char *buf, int n)
{
asm("mov $7, %eax");
asm("int $48");
}
int
write(int fd, char *buf, int n)
{
asm("mov $6, %eax");
asm("int $48");
}
int
close(int fd)
{
asm("mov $8, %eax");
asm("int $48");
}