summaryrefslogtreecommitdiff
path: root/src/kernel/kernel.c
blob: 11df1f1dddb1b8ae0864acf011cbfdf1ac075a2e (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdbool.h>
#include <smp.h>
#include <klog.h>
#include <printf.h>
#include <paging.h>
#include <video.h>
#include <acpi.h>
#include <panic.h>
#include <addr.h>
#include <stdbool.h>
#include <int.h>
#include <io.h>
#include <cpuid.h>
#include <heap.h>
#include <random.h>
#include <timer.h>
#include <libc.h>

//testing headers
#include <testmalloc.h>

void kmain() {
  PANIC(KERNEL_PANIC_KERNEL_RETURNED);
}

void smp_kinit() {
  printf("\nKernal started on core\n"); //TODO get lapic working, then print core number
  kmain();
}

//TODO move to global constructors
void kernel_init() {
  size_t pmap_size; 

  get_mem_capabilities(); 
  pmap_size = map_complete_physical();
  init_klog();
  init_pmap(pmap_size); 
  printf("\nKernal started on CPU 1!\n");
 
  
  find_root_sdp();
  debug_acpi();
  
  init_interrupts_bsp();

  
  randinit();

  smp_boot();
  fix_stack();
  //unmap_lowmem();
  kmain();
}