annotate kernel/src/kernel.c3 @ 365:98ff43cfdd36

Nasty bug in adr instruction
author Windel Bouwman
date Wed, 19 Mar 2014 22:32:04 +0100
parents c49459768aaa
children 577ed7fb3fe4
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
363
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
9 var int G;
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
10
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
11 function void do()
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
12 {
364
c49459768aaa Work on globals
Windel Bouwman
parents: 363
diff changeset
13 G = G + 1;
363
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
14 io.print2("G = ", G);
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
15 }
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
16
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
17 // Main entry point of the kernel:
293
6aa721e7b10b Try to improve build sequence
Windel Bouwman
parents: 292
diff changeset
18 function void start()
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
19 {
363
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
20 G = 0;
353
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
21 arch.init();
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
22
360
42343d189e14 Bugfix in for loop
Windel Bouwman
parents: 359
diff changeset
23 io.println("Welcome to lcfos!");
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
24
363
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
25 do();
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
26 do();
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
27 do();
365
98ff43cfdd36 Nasty bug in adr instruction
Windel Bouwman
parents: 364
diff changeset
28 io.println("Welcome 2!");
98ff43cfdd36 Nasty bug in adr instruction
Windel Bouwman
parents: 364
diff changeset
29 do();
363
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
30 do();
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
31
360
42343d189e14 Bugfix in for loop
Windel Bouwman
parents: 359
diff changeset
32 io.print_int(0x1337);
364
c49459768aaa Work on globals
Windel Bouwman
parents: 363
diff changeset
33 io.print_int(cast<int>(&G));
363
396e5cefba13 Removed debuginfo instruction
Windel Bouwman
parents: 362
diff changeset
34 //io.print2("Test: ", 0x13);
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 308
diff changeset
35
360
42343d189e14 Bugfix in for loop
Windel Bouwman
parents: 359
diff changeset
36 var int a;
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
37 for (a = 0; a < 2; a = a + 1)
360
42343d189e14 Bugfix in for loop
Windel Bouwman
parents: 359
diff changeset
38 {
365
98ff43cfdd36 Nasty bug in adr instruction
Windel Bouwman
parents: 364
diff changeset
39 io.print2("a = ", a);
360
42343d189e14 Bugfix in for loop
Windel Bouwman
parents: 359
diff changeset
40 }
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
41
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
42 io.print2("PFR0 = ", arch.pfr0());
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
43 io.print2("PFR1 = ", arch.pfr1());
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
44 io.print2("MMFR0 = ", arch.mmfr0());
365
98ff43cfdd36 Nasty bug in adr instruction
Windel Bouwman
parents: 364
diff changeset
45 // io.print2("MPUIR = ", arch.mpuir());
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 360
diff changeset
46
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
47 // process.init();
301
6753763d3bec merge codegen into ppci package
Windel Bouwman
parents: 296
diff changeset
48 //memory:init();
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
49
296
9417caea2eb3 Directorized some backend files
Windel Bouwman
parents: 295
diff changeset
50 //Process proc = new process:Process();
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
51
296
9417caea2eb3 Directorized some backend files
Windel Bouwman
parents: 295
diff changeset
52 //scheduler:queue(proc);
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 308
diff changeset
53 while(true) {}
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
54 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
55
293
6aa721e7b10b Try to improve build sequence
Windel Bouwman
parents: 292
diff changeset
56 function void panic()
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
57 {
308
2e7f55319858 Merged analyse into codegenerator
Windel Bouwman
parents: 301
diff changeset
58 arch.halt();
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
59 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
60