summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface/crt0.s2
-rw-r--r--kernel/kernel.c2
-rw-r--r--kernel/scheduler.c4
-rw-r--r--kernel/syscalls.c9
-rw-r--r--userspace/Makefile1
-rw-r--r--userspace/crt0.s2
-rw-r--r--userspace/fd.c9
-rw-r--r--userspace/nonl.c15
-rw-r--r--userspace/sysfs_write.c2
9 files changed, 35 insertions, 11 deletions
diff --git a/interface/crt0.s b/interface/crt0.s
index 9ef2a67..26ad47c 100644
--- a/interface/crt0.s
+++ b/interface/crt0.s
@@ -31,7 +31,7 @@ call main
# push exit code and pass to _exit syscall
push %eax
-call _exit
+call exit
# this should never be reached!
.wait:
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 20bfab6..ba968d5 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -102,7 +102,7 @@ void kernel_main(uint32_t eax,uint32_t ebx)
ext2_dump_info(VMEM_EXT2_RAMIMAGE);
ext2_mount("/");
sysfs_mount("/sys");
- pipe_mount("/sys/pipes");
+ pipe_mount("/pipes");
// -- APIC -- //
klog("Advanced Programmable Interrupt Controller (APIC) config ...");
diff --git a/kernel/scheduler.c b/kernel/scheduler.c
index 8f7f6d6..e834afc 100644
--- a/kernel/scheduler.c
+++ b/kernel/scheduler.c
@@ -291,7 +291,7 @@ void task_syscall_worker()
{
uint32_t syscall=task_list[cpu][i].eax;
-// klog("task pid=%d waiting on syscall %d/%s on cpu %d slot %d.",task_list[cpu][i].pid,syscall,syscall_get_name(syscall),cpu,i);
+ klog("task pid=%d waiting on syscall %d/%s on cpu %d slot %d.",task_list[cpu][i].pid,syscall,syscall_get_name(syscall),cpu,i);
task_list[cpu][0].vmem=task_list[cpu][i].vmem; // switch syscall worker to pagedir of calling userprog
x86_set_page_directory(task_list[cpu][0].vmem);
@@ -313,6 +313,8 @@ void task_syscall_worker()
task_list[cpu][i].ecx,
task_list[cpu][i].ebx,
task_list[cpu][i].pid);
+
+ klog("... returned : %d",ret);
scheduler_wake_all();
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
index 4f6508a..3b599c0 100644
--- a/kernel/syscalls.c
+++ b/kernel/syscalls.c
@@ -348,17 +348,14 @@ uint32_t syscall_exit(int pid)
//
int syscall_close(int file,int none1,int none2)
{
-
- //if(file!=0&&file!=1&&file!=2)
- // kpanic("unhandled syscall: close");
-
- return -1;
+ if(file<3)return 0;
+ fd_close(&fds[file]);
+ return 0;
}
// TODO: check if file is termminal!
int syscall_isatty(int file,int none1,int none2)
{
-
return 1;
}
diff --git a/userspace/Makefile b/userspace/Makefile
index d39f15f..b3c962b 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -45,6 +45,7 @@ ext2.img: $(PROGS)
@mkdir -p mnt/bin
@mkdir -p mnt/doc/test
@mkdir -p mnt/sys # mountpoint for sysfs
+ @mkdir -p mnt/pipes # mountpoint for pipes
@cp test.txt mnt/doc/test/
@cp $(PROGS) mnt/bin
@cp fonts/binfont.bin mnt/
diff --git a/userspace/crt0.s b/userspace/crt0.s
index 9ef2a67..26ad47c 100644
--- a/userspace/crt0.s
+++ b/userspace/crt0.s
@@ -31,7 +31,7 @@ call main
# push exit code and pass to _exit syscall
push %eax
-call _exit
+call exit
# this should never be reached!
.wait:
diff --git a/userspace/fd.c b/userspace/fd.c
new file mode 100644
index 0000000..09cb28e
--- /dev/null
+++ b/userspace/fd.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <unistd.h>
+
+int main()
+{
+ dup(stdout);
+ printf("dup\n");
+
+}
diff --git a/userspace/nonl.c b/userspace/nonl.c
new file mode 100644
index 0000000..3940453
--- /dev/null
+++ b/userspace/nonl.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+void atex()
+{
+ printf("atex\n");
+}
+int main()
+{
+ printf("nonextline");
+// fflush(stdout);
+
+// atexit(&atex);
+ return EXIT_SUCCESS;
+}
diff --git a/userspace/sysfs_write.c b/userspace/sysfs_write.c
index b35f063..9f91632 100644
--- a/userspace/sysfs_write.c
+++ b/userspace/sysfs_write.c
@@ -5,5 +5,5 @@ int main()
uint32_t data=0xaabbccdd;
fwrite(&data,4,1,f);
// fclose(f); // not automatically by newlib?
- fflush(f);
+// fflush(f);
}