blob: 14514cb46017caacc7d173a91b24550ee46b87f8 (
plain)
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
|
#include <kernel/arch/generic.h>
#include <kernel/main.h>
#include <kernel/mem/alloc.h>
#include <kernel/proc.h>
#include <kernel/tests/tests.h>
#include <kernel/util.h>
#include <stdint.h>
void kmain(struct kmain_info info) {
kprintf("mem...\n");
mem_init(&info);
kprintf("tests...\n");
tests_all();
kprintf("loading init...\n");
process_seed(&info);
kprintf("switching...\n");
process_switch_any();
}
void shutdown(void) {
size_t states[PS_LAST] = {0};
for (struct process *p = process_first; p; p = process_next(p))
states[p->state]++;
for (size_t i = 0; i < sizeof(states) / sizeof(*states); i++)
kprintf("state 0x%x: 0x%x\n", i, states[i]);
mem_debugprint();
// TODO generalize to process_cleanup
process_free(process_first);
mem_debugprint();
cpu_shutdown();
}
|