summaryrefslogtreecommitdiff
path: root/src/kernel/task.h
blob: 50be93aac2fd7eeb9ddebcaac9b28de04d96b5b0 (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
#ifndef TASK_H
#define TASK_H

#include <stdbool.h>
#include <stdint.h>

#define TASK_NAME_LEN 15

enum wait_mode {
  NONE,
  PROCESS_END,
};

struct task_state {
  uint32_t ret_addr;
  void *page_directory;

  uint32_t ebx;
  uint32_t ecx;
  uint32_t edx;
  uint32_t esi;
  uint32_t edi;
  uint32_t ebp;
  uint32_t esp;

  enum wait_mode wait_mode;
  uint32_t wait_arg;

  char name[TASK_NAME_LEN + 1];
} __attribute__ ((packed));

extern struct task_state *active_task;

void init_tasks();

uint32_t new_task(struct task_state state);
void advance_active_task();

void delete_task(struct task_state *state);

#endif