-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.copie.c
More file actions
105 lines (87 loc) · 3.12 KB
/
kernel.copie.c
File metadata and controls
105 lines (87 loc) · 3.12 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*!
* summary :
* version : 0.3
* last modification : 31/08/2007
* authors : Djekidel Mohamed Nadhir , Baghdadi Mohamed
* emails : djek_nad [at] yahoo.com , Baghdadi13 [at] gmail.com*/
/* -----------------------------------------------------------------------------
* This file is a part of the TestOs project (TOS), which aims to give students
* and researchers a full set of functions and libraries that can help them to
* test there own projects.
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License (GPL).
* -----------------------------------------------------------------------------
*/
#include "multiboot.h"
#include "../kernel_components/libc/stdio.c"
#include "../kernel_components/console/logo.c"
#include "idtloader.c"
#include "KeybordDriver.c"
#include "IrqHandler.c"
#include "../kernel_components/libc/string.h"
#include "../kernel_components/console/console.c"
#include "./memory/gdt.c"
extern void ChargerIDT();
/*void _start(void)
{
main();
} */
#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit)))
/*! main kernel entry*/
int main(unsigned long magic, unsigned long addr)
{
multiboot_info_t *mbi;
mbi = (multiboot_info_t *) addr;
signed long k = 1578921230456987885412021258789 ;
printf ("\nk is: %x \n ", k);
char cmd[256];
if (magic == MULTIBOOT_BOOTLOADER_MAGIC)
{
printf ("Valid magic number: 0x%x\n", (unsigned) magic);
}
/* logo(); */
if (CHECK_FLAG (mbi->flags, 6))
{
multiboot_memory_map_t *mmap;
unsigned int allmem = mbi->mem_upper + mbi->mem_lower+0x400;
printf ("\nMemory :%d Kbytes \n", allmem);
printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n",
(unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length);
for (mmap = (multiboot_memory_map_t *) mbi->mmap_addr;
(unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length;
mmap = (multiboot_memory_map_t *) ((unsigned long) mmap
+ mmap->size + sizeof (mmap->size)))
printf (" size = 0x%x, base_addr = 0x%x%x,"
" length = 0x%x%x, type = %d\n",
(unsigned) mmap->size,
mmap->addr >> 32,
mmap->addr & 0xffffffff,
mmap->len >> 32,
mmap->len & 0xffffffff,
(unsigned) mmap->type);
}
/* printf("\nKernel Loaded ..........................");
setTextColor(2);
printf("[OK]\n");
setTextColor(7); */
GDT_init();
/* printf("GDT Loaded .............................");
setTextColor(2);
printf("[OK]\n");
setTextColor(7);
*/
/* printf("Initializing interuptions...............");
*/
InitIDT();
/* setTextColor(2);
printf("[OK]\n");
setTextColor(7);
*/
ChargerIDT();
/* printf("IDT Loaded .............................");
setTextColor(2);
printf("[OK]\n\n");
*/
LoadConsole(); //loads the basic console
//we should never get here
}