annotate cos/kernel/kernel.c @ 37:5c20bd53cccd

Cleanup
author windel
date Mon, 16 Jan 2012 21:38:55 +0100
parents 91f91ff07ea8
children 35cc54e078dd
rev   line source
9
92ace1ca50a8 64 bits kernel without interrupts but with printf in C
windel
parents:
diff changeset
1 #include "kernel.h"
92ace1ca50a8 64 bits kernel without interrupts but with printf in C
windel
parents:
diff changeset
2
29
7e3bdcb391dc Added get_page function to mm
windel
parents: 28
diff changeset
3 /* This routine initializes the kernel.
7e3bdcb391dc Added get_page function to mm
windel
parents: 28
diff changeset
4 * We are left here in 64-bit long mode with the first 6 MB identity mapped.
7e3bdcb391dc Added get_page function to mm
windel
parents: 28
diff changeset
5 * */
9
92ace1ca50a8 64 bits kernel without interrupts but with printf in C
windel
parents:
diff changeset
6 void kmain()
92ace1ca50a8 64 bits kernel without interrupts but with printf in C
windel
parents:
diff changeset
7 {
34
8012221dd740 Fixes for uninitialized data. This causes problems on real machines
windel
parents: 33
diff changeset
8 // No kmalloc required here yet:
29
7e3bdcb391dc Added get_page function to mm
windel
parents: 28
diff changeset
9 init_screen();
7e3bdcb391dc Added get_page function to mm
windel
parents: 28
diff changeset
10 setupIDT();
37
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
11 read_multiboot_info(); // Parse the GRUB multiboot header.
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
12 init_memory(available_memory); // Setup a new paging scheme and memory manager
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
13 // From here kmalloc can be used.
36
91f91ff07ea8 Removed test variables
windel
parents: 35
diff changeset
14 keyboard_init();
91f91ff07ea8 Removed test variables
windel
parents: 35
diff changeset
15 timer_init();
37
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
16 printf("Ramdisk location: %p\n", ramdisk_location);
36
91f91ff07ea8 Removed test variables
windel
parents: 35
diff changeset
17
34
8012221dd740 Fixes for uninitialized data. This causes problems on real machines
windel
parents: 33
diff changeset
18 /*
32
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
19 fs_node_t *fs_root = 0;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
20
37
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
21 fs_root = initialize_initrd(ramdisk_location);
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
22
32
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
23 if (fs_root != 0)
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
24 {
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
25 fs_dirent_t *node = 0;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
26 int i = 0;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
27 while ( (node = readdir_fs(fs_root, i)) != 0)
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
28 {
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
29
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
30 }
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents: 31
diff changeset
31 }
34
8012221dd740 Fixes for uninitialized data. This causes problems on real machines
windel
parents: 33
diff changeset
32 */
29
7e3bdcb391dc Added get_page function to mm
windel
parents: 28
diff changeset
33
37
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
34 // TODO: make shell a user space program!
5c20bd53cccd Cleanup
windel
parents: 36
diff changeset
35 shell(); // Start user shell
9
92ace1ca50a8 64 bits kernel without interrupts but with printf in C
windel
parents:
diff changeset
36 }
92ace1ca50a8 64 bits kernel without interrupts but with printf in C
windel
parents:
diff changeset
37