aboutsummaryrefslogtreecommitdiff
path: root/kernel/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-03-02 19:04:53 +0100
committerMarvin Borner2021-03-02 19:04:53 +0100
commitacc4b7ccc133b64312e7ab1da3225b7945b1e13d (patch)
tree933d772ec33472cdcc3015d04d2afefab3ab5014 /kernel/inc
parent20b1a8e22301877a0cc311efa069eb3f491f7a42 (diff)
very good this is
Diffstat (limited to 'kernel/inc')
-rw-r--r--kernel/inc/mm.h (renamed from kernel/inc/memory.h)7
-rw-r--r--kernel/inc/proc.h8
2 files changed, 12 insertions, 3 deletions
diff --git a/kernel/inc/memory.h b/kernel/inc/mm.h
index 812b052..00d9e4b 100644
--- a/kernel/inc/memory.h
+++ b/kernel/inc/mm.h
@@ -18,6 +18,8 @@
#define PAGE_COUNT 1024
#define PAGE_ALIGN(x) ((x) + PAGE_SIZE - ((x) % PAGE_SIZE))
#define PAGE_ALIGNED(x) ((x) % PAGE_SIZE == 0)
+#define PAGE_ALIGN_UP(x) (((x) % PAGE_SIZE == 0) ? (x) : (x) + PAGE_SIZE - ((x) % PAGE_SIZE))
+#define PAGE_ALIGN_DOWN(x) ((x) - ((x) % PAGE_SIZE))
union page_table_entry {
struct PACKED {
@@ -77,4 +79,9 @@ struct memory_range {
u32 size;
};
+struct page_dir *memory_dir_create(void);
+void memory_dir_switch(struct page_dir *dir);
+void memory_alloc(struct page_dir *dir, u32 size, u32 flags, u32 *out);
+struct page_dir *memory_kernel_dir(void);
+
#endif
diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h
index 272a3ac..de4eb84 100644
--- a/kernel/inc/proc.h
+++ b/kernel/inc/proc.h
@@ -9,7 +9,7 @@
#include <stack.h>
#include <sys.h>
-#define PROC_QUANTUM 10 // Milliseconds or something // TODO
+#define PROC_QUANTUM 42 // Milliseconds or something // TODO
#define EFLAGS_ALWAYS 0x2 // Always one
#define EFLAGS_INTERRUPTS 0x200 // Enable interrupts
@@ -23,6 +23,7 @@
#define STREAM_MAX_SIZE 4096
enum stream_defaults { STREAM_IN, STREAM_OUT, STREAM_ERR, STREAM_LOG, STREAM_UNKNOWN = -1 };
+enum proc_priv { PROC_PRIV_NONE, PROC_PRIV_ROOT, PROC_PRIV_KERNEL };
enum proc_state { PROC_RUNNING, PROC_SLEEPING };
enum proc_wait_type { PROC_WAIT_DEV, PROC_WAIT_MSG };
@@ -47,9 +48,10 @@ struct stream {
struct proc {
u32 pid;
u32 entry;
- u8 super;
+ u8 priv;
char name[32];
struct stream streams[4];
+ struct page_dir *page_dir;
struct regs regs;
struct proc_wait wait; // dev_id
enum proc_state state;
@@ -67,6 +69,6 @@ void proc_yield(struct regs *r);
void proc_clear_quantum(void);
void proc_enable_waiting(u32 id, enum proc_wait_type type);
void proc_wait_for(u32 id, enum proc_wait_type type, u32 func_ptr);
-struct proc *proc_make(void);
+struct proc *proc_make(enum proc_priv priv);
#endif