summaryrefslogtreecommitdiff
path: root/kern/syscall_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/syscall_misc.c')
-rw-r--r--kern/syscall_misc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kern/syscall_misc.c b/kern/syscall_misc.c
index 8bcacf1..6bc91d6 100644
--- a/kern/syscall_misc.c
+++ b/kern/syscall_misc.c
@@ -29,6 +29,7 @@
#include <sched.h>
#include <sync.h>
#include <timer.h>
+#include <toad.h>
#include <usermem.h>
/**
@@ -159,3 +160,22 @@ static reg_t read_dot_file(va_t buf, int count, int offset) {
}
return (reg_t)written;
}
+
+void sys_new_console_real(stack_frame_t* f) {
+ thread_t* t = get_current();
+ pts_t* old_pts = t->pts;
+ pts_t* pts = smalloc(sizeof(pts_t));
+ if (pts == NULL) {
+ f->eax = (reg_t)-1;
+ return;
+ }
+ pts_init(pts);
+
+ pts->refcount++;
+ t->pts = pts;
+ mutex_lock(&old_pts->lock);
+ old_pts->refcount--;
+ mutex_unlock(&old_pts->lock);
+ switch_pts(pts);
+ print_toad();
+}