FreeNOS
Main.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <FreeNOS/Config.h>
19 #include <FreeNOS/Support.h>
20 #include <FreeNOS/System.h>
21 #include <intel/IntelKernel.h>
22 #include <i8250.h>
23 #include <DeviceLog.h>
24 #include <CoreInfo.h>
25 #include <Macros.h>
26 #include <Log.h>
27 
28 extern C int kernel_main(CoreInfo *info)
29 {
30  // Initialize heap
32 
33  // Open serial console as default Log
34  i8250 *uart = new i8250(4, 0x3f8);
35  uart->initialize();
36  DeviceLog *console = new DeviceLog(*uart);
37 
38  // Only the boot core outputs notifications
39  if (info->coreId == 0)
41  else
43 
44  // Run all constructors first
45  constructors();
46 
47  // Create and run the kernel
48  IntelKernel *kernel = new IntelKernel(info);
49  return kernel->run();
50 }
DeviceLog
Generic logger that writes to a Device object.
Definition: DeviceLog.h:38
Macros.h
Log::setMinimumLogLevel
void setMinimumLogLevel(Level level)
Set the minimum logging level.
Definition: Log.cpp:38
i8250::initialize
virtual FileSystem::Result initialize()
Initializes the i8250 serial UART.
Definition: i8250.cpp:36
Kernel::initializeHeap
static Error initializeHeap()
Initialize heap.
Definition: Kernel.cpp:108
Kernel::run
int run()
Execute the kernel.
Definition: Kernel.cpp:392
kernel_main
C int kernel_main(void)
Definition: Main.cpp:35
Log.h
CoreInfo::coreId
uint coreId
Core identifier.
Definition: CoreInfo.h:66
C
#define C
Used to define external C functions.
Definition: Macros.h:134
IntelKernel.h
IntelKernel
Implements an x86 compatible kernel.
Definition: IntelKernel.h:43
Log::Notice
@ Notice
Definition: Log.h:113
constructors
C void constructors()
Invokes all function pointers inside the .ctors section.
Definition: Support.cpp:22
CoreInfo
Per-Core information structure.
Definition: CoreInfo.h:60
DeviceLog.h
Log::Warning
@ Warning
Definition: Log.h:112
i8250.h
CoreInfo.h
i8250
i8250 serial UART.
Definition: i8250.h:36