blob: 48bd7d7a0e14712e3af0dcb64a5bd145dd539125 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// MIT License, Copyright (c) 2020 Marvin Borner
#ifndef PROC_H
#define PROC_H
#include <def.h>
#include <event.h>
#include <interrupts.h>
#include <list.h>
#define PROC_QUANTUM 42 // Milliseconds
#define EFLAGS_ALWAYS 0x2 // Always one
#define EFLAGS_INTERRUPTS 0x200 // Enable interrupts
#define GDT_USER_CODE_OFFSET 0x1b // User code segment offset in GDT (with ring3 mask)
#define GDT_USER_DATA_OFFSET 0x23 // User data segment offset in GDT (with ring3 mask)
enum proc_state { PROC_DEFAULT, PROC_IN_EVENT, PROC_RESOLVED };
struct proc {
u32 pid;
char name[32];
struct regs regs;
struct regs regs_backup;
enum proc_state state;
struct list *events;
};
struct proc_event {
struct event_descriptor *desc;
void *data;
};
void proc_init();
void proc_print();
struct proc *proc_current();
void proc_resolve(struct proc *proc);
void proc_exit(struct proc *proc, int status);
struct proc *proc_make();
#endif
|