BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / 960f398b67fe616dfc3bc5c319e5c4cbabdbdaaa / task / clone.c

// Related

Nucleus

Barry Uninterruptable clone() 960f398 (3 years, 3 months ago)
diff --git a/task/clone.c b/task/clone.c
index f7496c9..2d9b8ea 100644
--- a/task/clone.c
+++ b/task/clone.c
@@ -21,6 +21,8 @@ read_eip(void)
 pid_t
 clone(int flags)
 {
+	asm volatile("cli");
+
 	Task *parent = current, *child = new(&taskType), *tmp;
 	pid_t tid = 0;
 
@@ -28,17 +30,13 @@ clone(int flags)
 	child->pageDir = clone_dir();
 
 	/* Split tasks here */
-	uintptr_t esp, ebp, eip;
-	eip = (uintptr_t) &&end;
-
-	asm volatile("mov %%esp, %0" : "=r" (esp));
-	asm volatile("mov %%ebp, %0" : "=r" (ebp));
-	child->esp = esp;
-	child->ebp = ebp;
-	child->eip = eip;
+	child->eip = (uintptr_t) &&end;
+	asm volatile("mov %%esp, %0" : "=r" (child->esp));
+	asm volatile("mov %%ebp, %0" : "=r" (child->ebp));
 	add_to_queue(readyQueue[child->priority], child);
 	tid = child->tid;
 	put(child);
 end:
+	asm volatile("sti");
 	return tid;
 }