git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: readdir fix and demo
[lunaix-os.git]
/
lunaix-os
/
kernel
/
sched.c
diff --git
a/lunaix-os/kernel/sched.c
b/lunaix-os/kernel/sched.c
index 5081ccf83ed6c6d03b6ad194ff2e7b2b6c3132a4..ee596b17c7d67d4b63f3c607ea4ba15f4b815513 100644
(file)
--- a/
lunaix-os/kernel/sched.c
+++ b/
lunaix-os/kernel/sched.c
@@
-6,6
+6,7
@@
#include <lunaix/mm/kalloc.h>
#include <lunaix/mm/pmm.h>
#include <lunaix/mm/kalloc.h>
#include <lunaix/mm/pmm.h>
+#include <lunaix/mm/valloc.h>
#include <lunaix/mm/vmm.h>
#include <lunaix/process.h>
#include <lunaix/sched.h>
#include <lunaix/mm/vmm.h>
#include <lunaix/process.h>
#include <lunaix/sched.h>
@@
-59,7
+60,8
@@
run(struct proc_info* proc)
apic_done_servicing();
asm volatile("pushl %0\n"
apic_done_servicing();
asm volatile("pushl %0\n"
- "jmp switch_to\n" ::"r"(proc)); // kernel/asm/x86/interrupt.S
+ "jmp switch_to\n" ::"r"(proc)
+ : "memory"); // kernel/asm/x86/interrupt.S
}
int
}
int
@@
-266,6
+268,7
@@
alloc_process()
proc->pid = i;
proc->created = clock_systime();
proc->pgid = proc->pid;
proc->pid = i;
proc->created = clock_systime();
proc->pgid = proc->pid;
+ proc->fdtable = vzalloc(sizeof(struct v_fdtable));
llist_init_head(&proc->mm.regions);
llist_init_head(&proc->children);
llist_init_head(&proc->mm.regions);
llist_init_head(&proc->children);
@@
-281,7
+284,7
@@
commit_process(struct proc_info* process)
assert(process == &sched_ctx._procs[process->pid]);
if (process->state != PS_CREATED) {
assert(process == &sched_ctx._procs[process->pid]);
if (process->state != PS_CREATED) {
- __current->k_status =
LXINV
L;
+ __current->k_status =
EINVA
L;
return;
}
return;
}
@@
-304,7
+307,7
@@
destroy_process(pid_t pid)
{
int index = pid;
if (index <= 0 || index > sched_ctx.ptable_len) {
{
int index = pid;
if (index <= 0 || index > sched_ctx.ptable_len) {
- __current->k_status =
LXINVLDPID
;
+ __current->k_status =
EINVAL
;
return;
}
struct proc_info* proc = &sched_ctx._procs[index];
return;
}
struct proc_info* proc = &sched_ctx._procs[index];