summaryrefslogtreecommitdiff
path: root/ulib.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-06-27 14:35:53 +0000
committerrtm <rtm>2006-06-27 14:35:53 +0000
commitc41f1de5d41a527a3fa2d1e94215766130eac456 (patch)
tree86f6a467be8b42aec42a05299789f39ace9cc5e2 /ulib.c
parentb61c2547b8b489cab16984c0940a1cb6593a2a3d (diff)
downloadxv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.tar.gz
xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.tar.bz2
xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.zip
file descriptors
pipes
Diffstat (limited to 'ulib.c')
-rw-r--r--ulib.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/ulib.c b/ulib.c
new file mode 100644
index 0000000..694501e
--- /dev/null
+++ b/ulib.c
@@ -0,0 +1,44 @@
+int
+fork()
+{
+ asm("mov $1, %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");
+}