replacing static tables by lists
[quarnos.git] / manes / start.cpp
blobdb6adce0887e5bc83336232c576fcedb67eb3b09
1 /* Quarn OS
3 * Startup code
5 * Copyright (C) 2008 Pawel Dziepak
7 * This file consist of functions that are called in order to run Manes. It
8 * includes initialization of hardware and internal kernel data structures.
9 * After this operation kernel can change to the standard way of working witch
10 * preemption, resources, actors and so on.
13 #include "runtime.h"
14 #include "kernel_state.h"
16 #include "../services/logger.h"
17 #include "../services/early_logger.h"
18 #include "../services/service.h"
19 #include "../libs/delegate.h"
21 template<typename T, typename U>
22 T* create_object();
24 extern "C" void start() {
25 /* Prepare to execute C++ code */
26 runtime_start();
28 /* Set current kernel state */
29 kernel_state kern_stat;
31 /* Start early logger and show first message */
33 delegate<services::service *> serv;
34 serv.function(create_object<services::service,services::early_logger>);
35 services::service_name earlylogger_name(0,"early_logger",1,serv);
37 services::service_name::register_service(&earlylogger_name);
39 services::service::call("early_logger","print","OK.\nStarting Quarn OS...");
41 while (1);
45 template<typename T, typename U>
46 T* create_object() {
47 return new U();