aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/tasks
diff options
context:
space:
mode:
authorMarvin Borner2020-05-06 19:04:05 +0200
committerMarvin Borner2020-05-06 19:04:05 +0200
commitd94ffac4a584dc7a4f6f2ec567b8caab05ce9253 (patch)
tree559cd596a0a407d4b40c1d12d3c6a0686494da16 /src/kernel/tasks
parent1a8563a05608b5b5e27eada44cf4790926001c68 (diff)
New build parameters and shared includes
This changes many files but I've just applied some replace commands.. So - nothing special!
Diffstat (limited to 'src/kernel/tasks')
-rw-r--r--src/kernel/tasks/process.c46
-rw-r--r--src/kernel/tasks/process.h50
-rw-r--r--src/kernel/tasks/userspace.c28
-rw-r--r--src/kernel/tasks/userspace.h8
4 files changed, 66 insertions, 66 deletions
diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c
index 87a6ec9..efacc1f 100644
--- a/src/kernel/tasks/process.c
+++ b/src/kernel/tasks/process.c
@@ -1,22 +1,22 @@
#include <stdint.h>
#include <stddef.h>
-#include <kernel/tasks/process.h>
-#include <kernel/tasks/userspace.h>
-#include <kernel/interrupts/interrupts.h>
-#include <kernel/system.h>
-#include <kernel/lib/lib.h>
-#include <kernel/memory/paging.h>
-#include <kernel/memory/alloc.h>
-#include <kernel/timer/timer.h>
-#include <kernel/fs/elf.h>
-
-uint32_t pid = 0;
+#include <tasks/process.h>
+#include <tasks/userspace.h>
+#include <interrupts/interrupts.h>
+#include <system.h>
+#include <lib/lib.h>
+#include <memory/paging.h>
+#include <memory/alloc.h>
+#include <timer/timer.h>
+#include <fs/elf.h>
+
+u32 pid = 0;
struct process *root;
struct process *current_proc = NULL;
struct regs hold_root;
-extern uint32_t stack_hold;
+extern u32 stack_hold;
void scheduler(struct regs *regs)
{
@@ -54,7 +54,7 @@ void process_init(struct process *proc)
userspace_enter(proc);
}
-void process_kill(uint32_t pid)
+void process_kill(u32 pid)
{
struct process *proc = process_from_pid(pid);
@@ -71,7 +71,7 @@ void process_kill(uint32_t pid)
}
}
-uint32_t process_spawn(struct process *process)
+u32 process_spawn(struct process *process)
{
process->next = root->next;
root->next = process;
@@ -84,7 +84,7 @@ uint32_t process_spawn(struct process *process)
return process->pid;
}
-int process_wait_gid(uint32_t gid, int *status)
+int process_wait_gid(u32 gid, int *status)
{
struct process *i = root;
@@ -101,7 +101,7 @@ int process_wait_gid(uint32_t gid, int *status)
return WAIT_OKAY;
}
-int process_wait_pid(uint32_t pid, int *status)
+int process_wait_pid(u32 pid, int *status)
{
struct process *i = current_proc->next;
@@ -120,7 +120,7 @@ int process_wait_pid(uint32_t pid, int *status)
return WAIT_ERROR;
}
-void process_suspend(uint32_t pid)
+void process_suspend(u32 pid)
{
struct process *proc = process_from_pid(pid);
@@ -132,7 +132,7 @@ void process_suspend(uint32_t pid)
proc->state = PROC_ASLEEP;
}
-void process_wake(uint32_t pid)
+void process_wake(u32 pid)
{
struct process *proc = process_from_pid(pid);
@@ -142,7 +142,7 @@ void process_wake(uint32_t pid)
proc->state = PROC_RUNNING;
}
-uint32_t process_child(struct process *child, uint32_t pid)
+u32 process_child(struct process *child, u32 pid)
{
process_suspend(pid);
@@ -157,7 +157,7 @@ uint32_t process_child(struct process *child, uint32_t pid)
return process_spawn(child);
}
-uint32_t process_fork(uint32_t pid)
+u32 process_fork(u32 pid)
{
warn("Fork is not implemented");
@@ -173,7 +173,7 @@ uint32_t process_fork(uint32_t pid)
return 0; //pid++;
}
-struct process *process_from_pid(uint32_t pid)
+struct process *process_from_pid(u32 pid)
{
struct process *proc = root;
@@ -205,7 +205,7 @@ struct process *process_make_new()
return proc;
}
-uint32_t kexec(char *path)
+u32 kexec(char *path)
{
struct process *proc = elf_load(path);
if (proc == NULL)
@@ -219,7 +219,7 @@ uint32_t kexec(char *path)
return 0;
}
-uint32_t uexec(char *path)
+u32 uexec(char *path)
{
process_suspend(current_proc->pid);
diff --git a/src/kernel/tasks/process.h b/src/kernel/tasks/process.h
index b138f60..bd6a6e7 100644
--- a/src/kernel/tasks/process.h
+++ b/src/kernel/tasks/process.h
@@ -2,33 +2,33 @@
#define MELVIX_PROCESS_H
#include <stdint.h>
-#include <kernel/memory/paging.h>
-#include <kernel/interrupts/interrupts.h>
+#include <memory/paging.h>
+#include <interrupts/interrupts.h>
struct mmap {
- uint32_t text;
- uint32_t bss;
- uint32_t data;
- uint32_t stack;
+ u32 text;
+ u32 bss;
+ u32 data;
+ u32 stack;
};
struct process {
struct page_directory *cr3;
struct regs registers;
- uint32_t pid;
- uint32_t gid;
+ u32 pid;
+ u32 gid;
char *name;
int state;
int thread;
- uint32_t stdin;
- uint32_t stdout;
- uint32_t stderr;
+ u32 stdin;
+ u32 stdout;
+ u32 stderr;
- uint32_t brk;
- uint32_t handlers[6];
+ u32 brk;
+ u32 handlers[6];
struct process *parent;
struct process *next;
@@ -36,31 +36,31 @@ struct process {
void scheduler(struct regs *regs);
-void process_kill(uint32_t pid);
+void process_kill(u32 pid);
-uint32_t process_spawn(struct process *process);
+u32 process_spawn(struct process *process);
-void process_suspend(uint32_t pid);
-void process_wake(uint32_t pid);
-uint32_t process_child(struct process *process, uint32_t pid);
-uint32_t process_fork(uint32_t pid);
+void process_suspend(u32 pid);
+void process_wake(u32 pid);
+u32 process_child(struct process *process, u32 pid);
+u32 process_fork(u32 pid);
-int process_wait_gid(uint32_t gid, int *status);
-int process_wait_pid(uint32_t pid, int *status);
+int process_wait_gid(u32 gid, int *status);
+int process_wait_pid(u32 pid, int *status);
-struct process *process_from_pid(uint32_t pid);
+struct process *process_from_pid(u32 pid);
void process_init(struct process *proc);
struct process *process_make_new();
-uint32_t kexec(char *path);
+u32 kexec(char *path);
-uint32_t uexec(char *path);
+u32 uexec(char *path);
extern struct process *current_proc;
-extern uint32_t stack_hold;
+extern u32 stack_hold;
#define PID_NOT_FOUND ((struct process *)0xFFFFFFFF)
diff --git a/src/kernel/tasks/userspace.c b/src/kernel/tasks/userspace.c
index 696a9e9..9457b7e 100644
--- a/src/kernel/tasks/userspace.c
+++ b/src/kernel/tasks/userspace.c
@@ -1,22 +1,22 @@
#include <stdint.h>
#include <stddef.h>
-#include <kernel/system.h>
-#include <kernel/tasks/userspace.h>
-#include <kernel/tasks/process.h>
-#include <kernel/memory/paging.h>
-#include <kernel/io/io.h>
-#include <kernel/interrupts/interrupts.h>
-#include <kernel/lib/lib.h>
+#include <system.h>
+#include <tasks/userspace.h>
+#include <tasks/process.h>
+#include <memory/paging.h>
+#include <io/io.h>
+#include <interrupts/interrupts.h>
+#include <lib/lib.h>
struct process *proc_bottom = NULL;
-uint32_t hl_cr3;
-uint32_t hl_eip;
-uint32_t hl_esp;
+u32 hl_cr3;
+u32 hl_eip;
+u32 hl_esp;
-uint32_t spawn_child(struct process *child)
+u32 spawn_child(struct process *child)
{
- return (uint32_t)-1;
+ return (u32)-1;
}
void userspace_enter(struct process *proc)
@@ -48,12 +48,12 @@ void single_yield(struct process *proc, struct regs *regs)
paging_switch_directory(proc->cr3);
}
-uint32_t single_exit(struct regs *regs)
+u32 single_exit(struct regs *regs)
{
//close(current_proc->stdout);
//close(current_proc->stderr);
- uint32_t hold = regs->ebx;
+ u32 hold = regs->ebx;
proc_bottom = proc_bottom->next;
if (proc_bottom == NULL)
diff --git a/src/kernel/tasks/userspace.h b/src/kernel/tasks/userspace.h
index 90b64bf..208476a 100644
--- a/src/kernel/tasks/userspace.h
+++ b/src/kernel/tasks/userspace.h
@@ -2,15 +2,15 @@
#define MELVIX_USERSPACE_H
#include <stdint.h>
-#include <kernel/tasks/process.h>
-#include <kernel/interrupts/interrupts.h>
+#include <tasks/process.h>
+#include <interrupts/interrupts.h>
-uint32_t spawn_child(struct process *child);
+u32 spawn_child(struct process *child);
void userspace_enter(struct process *proc);
void single_yield(struct process *proc, struct regs *regs);
-uint32_t single_exit(struct regs *regs);
+u32 single_exit(struct regs *regs);
extern void jump_userspace();