2012-05-30 20:13:09 +02:00
|
|
|
/*
|
2018-11-26 11:18:57 +01:00
|
|
|
* \brief Kernel entrypoint
|
2012-05-30 20:13:09 +02:00
|
|
|
* \author Martin Stein
|
hw: restrict processor broadcast to TLB flushing
Removes the generic processor broadcast function call. By now, that call
was used for cross processor TLB maintance operations only. When core/kernel
gets its memory mapped on demand, and unmapped again, the previous cross
processor flush routine doesn't work anymore, because of a hen-egg problem.
The previous cross processor broadcast is realized using a thread constructed
by core running on top of each processor core. When constructing threads in
core, a dataspace for its thread context is constructed. Each constructed
RAM dataspace gets attached, zeroed out, and detached again. The detach
routine requires a TLB flush operation executed on each processor core.
Instead of executing a thread on each processor core, now a thread waiting
for a global TLB flush is removed from the scheduler queue, and gets attached
to a TLB flush queue of each processor. The processor local queue gets checked
whenever the kernel is entered. The last processor, which executed the TLB
flush, re-attaches the blocked thread to its scheduler queue again.
To ease uo the above described mechanism, a platform thread is now directly
associated with a platform pd object, instead of just associate it with the
kernel pd's id.
Ref #723
2014-04-28 20:36:00 +02:00
|
|
|
* \author Stefan Kalkowski
|
2012-05-30 20:13:09 +02:00
|
|
|
* \date 2011-10-20
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2011-2017 Genode Labs GmbH
|
2012-05-30 20:13:09 +02:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2012-05-30 20:13:09 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* core includes */
|
2015-12-09 12:02:00 +01:00
|
|
|
#include <kernel/cpu.h>
|
2018-11-26 11:18:57 +01:00
|
|
|
#include <kernel/lock.h>
|
|
|
|
#include <kernel/kernel.h>
|
2013-12-18 16:18:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern "C" void kernel()
|
|
|
|
{
|
2015-12-09 12:02:00 +01:00
|
|
|
using namespace Kernel;
|
|
|
|
|
base/core: use references instead of pointers
This patch replaces the former prominent use of pointers by references
wherever feasible. This has the following benefits:
* The contract between caller and callee becomes more obvious. When
passing a reference, the contract says that the argument cannot be
a null pointer. The caller is responsible to ensure that. Therefore,
the use of reference eliminates the need to add defensive null-pointer
checks at the callee site, which sometimes merely exist to be on the
safe side. The bottom line is that the code becomes easier to follow.
* Reference members must be initialized via an object initializer,
which promotes a programming style that avoids intermediate object-
construction states. Within core, there are still a few pointers
as member variables left though. E.g., caused by the late association
of 'Platform_thread' objects with their 'Platform_pd' objects.
* If no pointers are present as member variables, we don't need to
manually provide declarations of a private copy constructor and
an assignment operator to avoid -Weffc++ errors "class ... has
pointer data members [-Werror=effc++]".
This patch also changes a few system bindings on NOVA and Fiasco.OC,
e.g., the return value of the global 'cap_map' accessor has become a
reference. Hence, the patch touches a few places outside of core.
Fixes #3135
2019-01-24 22:00:01 +01:00
|
|
|
Cpu &cpu = cpu_pool().cpu(Cpu::executing_id());
|
2018-11-26 11:18:57 +01:00
|
|
|
Cpu_job * new_job;
|
2016-01-11 11:02:52 +01:00
|
|
|
|
2018-11-26 11:18:57 +01:00
|
|
|
{
|
|
|
|
Lock::Guard guard(data_lock());
|
2016-01-11 11:02:52 +01:00
|
|
|
|
2018-11-26 11:18:57 +01:00
|
|
|
new_job = &cpu.schedule();
|
|
|
|
}
|
2016-01-11 11:02:52 +01:00
|
|
|
|
2018-11-26 11:18:57 +01:00
|
|
|
new_job->proceed(cpu);
|
|
|
|
}
|