Files
foc/l4/pkg/sigma0/server/src/init.cc
Sebastian Sumpf e720764a9b Sigma0: raise sigma0's priority to maximum.
When sigma0 runs on a lower priority than the rest of the threads in the system
it might come to the point that while answering a page fault or I/O memory area
request the timeslice of the caller (core-pager) gets fully consumed. As long as
other threads are still executable and don't block sigma0 won't do progress
anymore, because it runs at the lowest priority.  This commit simply sets
sigma0's priority to the highest in the system.

Was: 'sigma0_prio.patch'
2013-01-11 17:48:18 +01:00

85 lines
2.1 KiB
C++

/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* This file is part of TUD:OS and distributed under the terms of the
* GNU General Public License 2.
* Please see the COPYING-GPL-2 file for details.
*/
/* startup stuff */
/* it should be possible to throw away the text/data/bss of the object
file resulting from this source -- so, we don't define here
anything we could still use at a later time. instead, globals are
defined in globals.c */
#include <l4/sys/ipc.h>
#include <l4/cxx/iostream>
#include "globals.h"
#include "mem_man.h"
#include "page_alloc.h"
#include "memmap.h"
#include "init.h"
#include "init_mem.h"
#include "ioports.h"
#include "mem_man_test.h"
#include <l4/sys/debugger.h>
#include <l4/sys/scheduler.h>
/* started as the L4 sigma0 task from crt0.S */
extern "C" void _init(void);
typedef void Ctor();
extern Ctor *__preinit_array_start[];
extern Ctor *__preinit_array_end [];
extern Ctor *__init_array_start [];
extern Ctor *__init_array_end [];
static void call_init_array(Ctor **start, Ctor **end)
{
for (; start < end; ++start)
if (*start)
(*start)();
}
void
init(l4_kernel_info_t *info)
{
call_init_array(__preinit_array_start, __preinit_array_end);
_init();
call_init_array(__init_array_start, __init_array_end);
l4_info = info;
L4::cout << PROG_NAME": Hello!\n";
L4::cout << " KIP @ " << info << '\n';
l4_debugger_set_object_name(L4_BASE_TASK_CAP, "sigma0");
l4_debugger_set_object_name(L4_BASE_FACTORY_CAP, "root factory");
l4_debugger_set_object_name(L4_BASE_THREAD_CAP, "sigma0");
l4_sched_param_t params = l4_sched_param(255);
l4_scheduler_run_thread(L4_BASE_SCHEDULER_CAP, L4_BASE_THREAD_CAP, &params);
Page_alloc_base::init();
init_memory(info);
init_io_ports(info);
//mem_man_test();
L4::cout << " allocated " << Page_alloc_base::total()/1024
<< "KB for maintenance structures\n";
if (debug_memory_maps)
dump_all();
/* now start the memory manager */
pager();
}