aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/tasks/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/tasks/process.c')
-rw-r--r--src/kernel/tasks/process.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c
index efd55c3..0ba3fbe 100644
--- a/src/kernel/tasks/process.c
+++ b/src/kernel/tasks/process.c
@@ -21,7 +21,6 @@ extern u32 stack_hold;
void scheduler(struct regs *regs)
{
- cli();
memcpy(&current_proc->registers, regs, sizeof(struct regs));
timer_handler(regs);
@@ -45,12 +44,10 @@ void scheduler(struct regs *regs)
memcpy(regs, &current_proc->registers, sizeof(struct regs));
paging_switch_directory(current_proc->cr3);
- sti();
}
void process_init(struct process *proc)
{
- cli();
log("Initializing process %d", pid);
root = proc;
root->pid = pid++;
@@ -60,13 +57,11 @@ void process_init(struct process *proc)
current_proc = root;
irq_install_handler(0, scheduler);
- sti();
userspace_enter(proc);
}
u32 process_spawn(struct process *process)
{
- cli();
debug("Spawning process %d", process->pid);
process->next = root->next;
root->next = process;
@@ -76,13 +71,11 @@ u32 process_spawn(struct process *process)
//process_suspend(current_proc->pid);
- sti();
return process->pid;
}
u32 process_wait_gid(u32 gid, u32 *status)
{
- cli(); // ?
struct process *i = root;
while (i != NULL) {
@@ -95,13 +88,11 @@ u32 process_wait_gid(u32 gid, u32 *status)
i = i->next;
}
- sti();
return WAIT_OKAY;
}
u32 process_wait_pid(u32 pid, u32 *status)
{
- cli(); // ?
struct process *i = current_proc->next;
while (i != NULL) {
@@ -116,13 +107,11 @@ u32 process_wait_pid(u32 pid, u32 *status)
i = i->next;
}
- sti();
return WAIT_ERROR;
}
void process_suspend(u32 pid)
{
- cli();
debug("Suspending process %d", pid);
struct process *proc = process_from_pid(pid);
@@ -132,12 +121,10 @@ void process_suspend(u32 pid)
}
proc->state = PROC_ASLEEP;
- sti();
}
void process_wake(u32 pid)
{
- cli();
debug("Waking process %d", pid);
struct process *proc = process_from_pid(pid);
@@ -145,12 +132,10 @@ void process_wake(u32 pid)
return;
proc->state = PROC_RUNNING;
- sti();
}
u32 process_child(struct process *child, u32 pid)
{
- cli();
debug("Spawning child process %d", pid);
process_suspend(pid);
@@ -161,13 +146,11 @@ u32 process_child(struct process *child, u32 pid)
child->parent = parent;
- sti();
return process_spawn(child);
}
struct process *process_from_pid(u32 pid)
{
- cli();
struct process *proc = root;
while (proc != NULL) {
@@ -177,13 +160,11 @@ struct process *process_from_pid(u32 pid)
proc = proc->next;
}
- sti();
return PID_NOT_FOUND;
}
struct process *process_make_new()
{
- cli();
debug("Making new process %d", pid);
struct process *proc = (struct process *)kmalloc_a(sizeof(struct process));
proc->registers.cs = 0x1B;
@@ -197,26 +178,22 @@ struct process *process_make_new()
proc->cr3->tables[i] = paging_root_directory->tables[i];
proc->pid = pid++;
- sti();
return proc;
}
u32 kexec(char *path)
{
- cli();
debug("Starting kernel process %s", path);
struct process *proc = elf_load(path);
if (proc == NULL)
return -1;
process_init(proc);
- sti();
return 0;
}
u32 uexec(char *path)
{
- cli();
debug("Starting user process %s", path);
process_suspend(current_proc->pid);
@@ -228,13 +205,11 @@ u32 uexec(char *path)
proc->gid = current_proc->pid;
process_spawn(proc);
log("Spawned");
- sti();
return 0;
}
u32 uspawn(char *path)
{
- cli();
debug("Spawning user process %s", path);
struct process *proc = elf_load(path);
@@ -245,6 +220,5 @@ u32 uspawn(char *path)
proc->gid = current_proc->pid;
process_spawn(proc);
log("Spawned");
- sti();
return 0;
} \ No newline at end of file