diff options
author | Marvin Borner | 2020-05-09 23:50:24 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-09 23:50:24 +0200 |
commit | c5b0305b3a6e7e6ec6742b99ceb6a1a0b3c6e286 (patch) | |
tree | 173965f614435bb9740d05bbc365aba7b76d7e45 /src/kernel/tasks | |
parent | e350804dc78ab01aaca6aba33792a652535028d9 (diff) |
Interrupt analysis - removed many useless cli/sti
Diffstat (limited to 'src/kernel/tasks')
-rw-r--r-- | src/kernel/tasks/process.c | 26 | ||||
-rw-r--r-- | src/kernel/tasks/userspace.c | 3 |
2 files changed, 1 insertions, 28 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(¤t_proc->registers, regs, sizeof(struct regs)); timer_handler(regs); @@ -45,12 +44,10 @@ void scheduler(struct regs *regs) memcpy(regs, ¤t_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 diff --git a/src/kernel/tasks/userspace.c b/src/kernel/tasks/userspace.c index aedec2b..c3fc7e2 100644 --- a/src/kernel/tasks/userspace.c +++ b/src/kernel/tasks/userspace.c @@ -21,7 +21,6 @@ u32 spawn_child(struct process *child) void userspace_enter(struct process *proc) { - cli(); proc_bottom = proc; proc->next = NULL; hl_eip = proc->registers.eip; @@ -31,7 +30,7 @@ void userspace_enter(struct process *proc) current_proc = proc; debug("Jumping to userspace!"); - sti(); // TODO: Prevent race conditions in userspace jumping + //sti(); // TODO: Prevent race conditions in userspace jumping jump_userspace(); } |