annotate kernel/src/kernel.c3 @ 400:0374c65cb437

Move compiler to seperate repo
author Windel Bouwman
date Mon, 14 Jul 2014 22:23:55 +0200
parents 6ae782a085e0
children
rev   line source
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
1 module kernel;
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
2
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
3 import memory;
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
4 import process;
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
5 import scheduler;
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
6 import arch;
355
c2ddc8a36f5e Enabled optimization
Windel Bouwman
parents: 354
diff changeset
7 import io;
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
8
393
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
9 // Globals:
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
10 var process.process_t* init_proc;
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
11
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 367
diff changeset
12
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
13 // Main entry point of the kernel:
293
6aa721e7b10b Try to improve build sequence
Windel Bouwman
parents: 292
diff changeset
14 function void start()
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
15 {
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 367
diff changeset
16 io.println("Welcome to lcfos!");
353
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
17 arch.init();
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
18
393
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
19 process.init();
367
577ed7fb3fe4 Try to make thumb work again
Windel Bouwman
parents: 365
diff changeset
20 memory.init();
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
21
393
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
22 init_proc = process.Create();
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
23
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
24 // TODO: copy content into process??
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
25 // Create a second process:
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
26 process.Create();
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
27
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
28 io.print2("init address ", cast<int>(init_proc));
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
29
296
9417caea2eb3 Directorized some backend files
Windel Bouwman
parents: 295
diff changeset
30 //scheduler:queue(proc);
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 367
diff changeset
31 io.println("Kernel finished");
393
6ae782a085e0 Added init program
Windel Bouwman
parents: 381
diff changeset
32 panic();
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
33 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
34
367
577ed7fb3fe4 Try to make thumb work again
Windel Bouwman
parents: 365
diff changeset
35 // Called in total stress:
293
6aa721e7b10b Try to improve build sequence
Windel Bouwman
parents: 292
diff changeset
36 function void panic()
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
37 {
308
2e7f55319858 Merged analyse into codegenerator
Windel Bouwman
parents: 301
diff changeset
38 arch.halt();
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
39 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
40