Mercurial > hg > CbC > CbC_xv6
comparison src/main.c @ 0:83c23a36980d
Init
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 26 May 2017 23:11:05 +0900 |
parents | |
children | 3d7e1c9a852e |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:83c23a36980d |
---|---|
1 // BSP support routine | |
2 #include "types.h" | |
3 #include "defs.h" | |
4 #include "param.h" | |
5 #include "arm.h" | |
6 #include "proc.h" | |
7 #include "memlayout.h" | |
8 #include "mmu.h" | |
9 | |
10 extern void* end; | |
11 | |
12 struct cpu cpus[NCPU]; | |
13 struct cpu *cpu; | |
14 | |
15 #define MB (1024*1024) | |
16 | |
17 void kmain (void) | |
18 { | |
19 uint vectbl; | |
20 | |
21 cpu = &cpus[0]; | |
22 | |
23 uart_init (P2V(UART0)); | |
24 | |
25 // interrrupt vector table is in the middle of first 1MB. We use the left | |
26 // over for page tables | |
27 vectbl = P2V_WO (VEC_TBL & PDE_MASK); | |
28 | |
29 init_vmm (); | |
30 kpt_freerange (align_up(&end, PT_SZ), vectbl); | |
31 kpt_freerange (vectbl + PT_SZ, P2V_WO(INIT_KERNMAP)); | |
32 paging_init (INIT_KERNMAP, PHYSTOP); | |
33 | |
34 kmem_init (); | |
35 kmem_init2(P2V(INIT_KERNMAP), P2V(PHYSTOP)); | |
36 | |
37 trap_init (); // vector table and stacks for models | |
38 pic_init (P2V(VIC_BASE)); // interrupt controller | |
39 uart_enable_rx (); // interrupt for uart | |
40 consoleinit (); // console | |
41 pinit (); // process (locks) | |
42 | |
43 binit (); // buffer cache | |
44 fileinit (); // file table | |
45 iinit (); // inode cache | |
46 ideinit (); // ide (memory block device) | |
47 timer_init (HZ); // the timer (ticker) | |
48 | |
49 | |
50 sti (); | |
51 | |
52 userinit(); // first user process | |
53 scheduler(); // start running processes | |
54 } |