mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-02 07:30:58 +00:00
parent
effeb765b9
commit
7bdb8c9007
@ -12,9 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
|
#include <kernel/multiprocessor.h>
|
||||||
#include <kernel/irq.h>
|
#include <kernel/irq.h>
|
||||||
#include <pic.h>
|
#include <pic.h>
|
||||||
#include <processor_driver.h>
|
|
||||||
|
|
||||||
using namespace Kernel;
|
using namespace Kernel;
|
||||||
|
|
||||||
@ -22,4 +22,4 @@ namespace Kernel { Pic * pic(); }
|
|||||||
|
|
||||||
void Irq::_disable() const { pic()->mask(_id()); }
|
void Irq::_disable() const { pic()->mask(_id()); }
|
||||||
|
|
||||||
void Irq::_enable() const { pic()->unmask(_id(), Processor_driver::id()); }
|
void Irq::_enable() const { pic()->unmask(_id(), Processor::id()); }
|
||||||
|
@ -183,7 +183,7 @@ extern "C" void init_kernel_uniprocessor()
|
|||||||
multiprocessor();
|
multiprocessor();
|
||||||
|
|
||||||
/* go multiprocessor mode */
|
/* go multiprocessor mode */
|
||||||
Processor_driver::start_secondary_processors(&_start_secondary_processors);
|
Processor::start_secondary_processors(&_start_secondary_processors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,16 +199,16 @@ extern "C" void init_kernel_multiprocessor()
|
|||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
/* synchronize data view of all processors */
|
/* synchronize data view of all processors */
|
||||||
Processor_driver::flush_data_caches();
|
Processor::flush_data_caches();
|
||||||
Processor_driver::invalidate_instruction_caches();
|
Processor::invalidate_instruction_caches();
|
||||||
Processor_driver::invalidate_control_flow_predictions();
|
Processor::invalidate_control_flow_predictions();
|
||||||
Processor_driver::data_synchronization_barrier();
|
Processor::data_synchronization_barrier();
|
||||||
|
|
||||||
/* initialize processor in physical mode */
|
/* initialize processor in physical mode */
|
||||||
Processor_driver::init_phys_kernel();
|
Processor::init_phys_kernel();
|
||||||
|
|
||||||
/* switch to core address space */
|
/* switch to core address space */
|
||||||
Processor_driver::init_virt_kernel(core_tlb_base, core_pd_id);
|
Processor::init_virt_kernel(core_tlb_base, core_pd_id);
|
||||||
|
|
||||||
/************************************
|
/************************************
|
||||||
** Now it's safe to use 'cmpxchg' **
|
** Now it's safe to use 'cmpxchg' **
|
||||||
@ -236,11 +236,11 @@ extern "C" void init_kernel_multiprocessor()
|
|||||||
|
|
||||||
/* initialize interrupt controller */
|
/* initialize interrupt controller */
|
||||||
pic()->init_processor_local();
|
pic()->init_processor_local();
|
||||||
unsigned const processor_id = Processor_driver::id();
|
unsigned const processor_id = Processor::id();
|
||||||
pic()->unmask(Timer::interrupt_id(processor_id), processor_id);
|
pic()->unmask(Timer::interrupt_id(processor_id), processor_id);
|
||||||
|
|
||||||
/* as primary processor create the core main thread */
|
/* as primary processor create the core main thread */
|
||||||
if (Processor_driver::primary_id() == processor_id)
|
if (Processor::primary_id() == processor_id)
|
||||||
{
|
{
|
||||||
/* get stack memory that fullfills the constraints for core stacks */
|
/* get stack memory that fullfills the constraints for core stacks */
|
||||||
enum {
|
enum {
|
||||||
@ -278,7 +278,7 @@ extern "C" void init_kernel_multiprocessor()
|
|||||||
extern "C" void kernel()
|
extern "C" void kernel()
|
||||||
{
|
{
|
||||||
data_lock().lock();
|
data_lock().lock();
|
||||||
unsigned const processor_id = Processor_driver::id();
|
unsigned const processor_id = Processor::id();
|
||||||
Processor * const processor = multiprocessor()->select(processor_id);
|
Processor * const processor = multiprocessor()->select(processor_id);
|
||||||
Processor_scheduler * const scheduler = processor->scheduler();
|
Processor_scheduler * const scheduler = processor->scheduler();
|
||||||
scheduler->head()->exception(processor_id);
|
scheduler->head()->exception(processor_id);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
#include <kernel/thread.h>
|
#include <kernel/thread.h>
|
||||||
|
#include <processor_driver.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
{
|
{
|
||||||
@ -67,9 +68,7 @@ class Kernel::Idle_thread : public Thread
|
|||||||
*/
|
*/
|
||||||
static void _main()
|
static void _main()
|
||||||
{
|
{
|
||||||
while (1) {
|
while (1) { Processor_driver::wait_for_interrupt(); }
|
||||||
Processor_driver::wait_for_interrupt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -89,7 +88,7 @@ class Kernel::Idle_thread : public Thread
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Kernel::Processor
|
class Kernel::Processor : public Processor_driver
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ class Kernel::Multiprocessor
|
|||||||
*/
|
*/
|
||||||
Processor * primary() const
|
Processor * primary() const
|
||||||
{
|
{
|
||||||
return (Processor *)_data[Processor_driver::primary_id()];
|
return (Processor *)_data[Processor::primary_id()];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
/* core includes */
|
/* core includes */
|
||||||
#include <kernel/configuration.h>
|
#include <kernel/configuration.h>
|
||||||
#include <kernel/object.h>
|
#include <kernel/object.h>
|
||||||
|
#include <kernel/multiprocessor.h>
|
||||||
#include <tlb.h>
|
#include <tlb.h>
|
||||||
#include <processor_driver.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/* structure of the mode transition */
|
/* structure of the mode transition */
|
||||||
@ -150,7 +150,7 @@ class Kernel::Mode_transition_control
|
|||||||
enum {
|
enum {
|
||||||
SIZE_LOG2 = Tlb::MIN_PAGE_SIZE_LOG2,
|
SIZE_LOG2 = Tlb::MIN_PAGE_SIZE_LOG2,
|
||||||
SIZE = 1 << SIZE_LOG2,
|
SIZE = 1 << SIZE_LOG2,
|
||||||
VIRT_BASE = Processor_driver::EXCEPTION_ENTRY,
|
VIRT_BASE = Processor::EXCEPTION_ENTRY,
|
||||||
VIRT_END = VIRT_BASE + SIZE,
|
VIRT_END = VIRT_BASE + SIZE,
|
||||||
ALIGNM_LOG2 = SIZE_LOG2,
|
ALIGNM_LOG2 = SIZE_LOG2,
|
||||||
};
|
};
|
||||||
@ -160,7 +160,7 @@ class Kernel::Mode_transition_control
|
|||||||
*
|
*
|
||||||
* \param c CPU context for kernel mode entry
|
* \param c CPU context for kernel mode entry
|
||||||
*/
|
*/
|
||||||
Mode_transition_control(Processor_driver::Context * const c)
|
Mode_transition_control(Processor::Context * const c)
|
||||||
:
|
:
|
||||||
_virt_user_entry(VIRT_BASE + ((addr_t)&_mt_user_entry_pic -
|
_virt_user_entry(VIRT_BASE + ((addr_t)&_mt_user_entry_pic -
|
||||||
(addr_t)&_mt_begin))
|
(addr_t)&_mt_begin))
|
||||||
@ -175,11 +175,11 @@ class Kernel::Mode_transition_control
|
|||||||
addr_t const kc_begin = (addr_t)&_mt_master_context_begin;
|
addr_t const kc_begin = (addr_t)&_mt_master_context_begin;
|
||||||
addr_t const kc_end = (addr_t)&_mt_master_context_end;
|
addr_t const kc_end = (addr_t)&_mt_master_context_end;
|
||||||
size_t const kc_size = kc_end - kc_begin;
|
size_t const kc_size = kc_end - kc_begin;
|
||||||
assert(sizeof(Processor_driver::Context) <= kc_size);
|
assert(sizeof(Processor::Context) <= kc_size);
|
||||||
|
|
||||||
/* fetch kernel-mode context */
|
/* fetch kernel-mode context */
|
||||||
Genode::memcpy(&_mt_master_context_begin, c,
|
Genode::memcpy(&_mt_master_context_begin, c,
|
||||||
sizeof(Processor_driver::Context));
|
sizeof(Processor::Context));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ class Kernel::Mode_transition_control
|
|||||||
* \param context targeted userland context
|
* \param context targeted userland context
|
||||||
* \param processor_id kernel name of targeted processor
|
* \param processor_id kernel name of targeted processor
|
||||||
*/
|
*/
|
||||||
void continue_user(Processor_driver::Context * const context,
|
void continue_user(Processor::Context * const context,
|
||||||
unsigned const processor_id)
|
unsigned const processor_id)
|
||||||
{
|
{
|
||||||
_continue_client(context, processor_id, _virt_user_entry);
|
_continue_client(context, processor_id, _virt_user_entry);
|
||||||
@ -275,7 +275,7 @@ class Kernel::Pd : public Object<Pd, MAX_PDS, Pd_ids, pd_ids, pd_pool>
|
|||||||
/**
|
/**
|
||||||
* Let the CPU context 'c' join the PD
|
* Let the CPU context 'c' join the PD
|
||||||
*/
|
*/
|
||||||
void admit(Processor_driver::Context * const c)
|
void admit(Processor::Context * const c)
|
||||||
{
|
{
|
||||||
c->protection_domain(id());
|
c->protection_domain(id());
|
||||||
c->tlb(tlb()->base());
|
c->tlb(tlb()->base());
|
||||||
|
@ -311,7 +311,7 @@ void Thread::_call_bin_pd()
|
|||||||
tlb->~Tlb();
|
tlb->~Tlb();
|
||||||
|
|
||||||
/* clean up buffers of memory management */
|
/* clean up buffers of memory management */
|
||||||
Processor_driver::flush_tlb_by_pid(pd->id());
|
Processor::flush_tlb_by_pid(pd->id());
|
||||||
user_arg_0(0);
|
user_arg_0(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ void Thread::_call_resume_thread()
|
|||||||
|
|
||||||
void Thread_event::_signal_acknowledged()
|
void Thread_event::_signal_acknowledged()
|
||||||
{
|
{
|
||||||
Processor_driver::tlb_insertions();
|
Processor::tlb_insertions();
|
||||||
_thread->_resume();
|
_thread->_resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ void Thread::_call_access_thread_regs()
|
|||||||
void Thread::_call_update_pd()
|
void Thread::_call_update_pd()
|
||||||
{
|
{
|
||||||
assert(_core());
|
assert(_core());
|
||||||
Processor_driver::flush_tlb_by_pid(user_arg_1());
|
Processor::flush_tlb_by_pid(user_arg_1());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -605,8 +605,8 @@ void Thread::_call_update_region()
|
|||||||
assert(_core());
|
assert(_core());
|
||||||
|
|
||||||
/* FIXME we don't handle instruction caches by now */
|
/* FIXME we don't handle instruction caches by now */
|
||||||
Processor_driver::flush_data_cache_by_virt_region((addr_t)user_arg_1(),
|
Processor::flush_data_cache_by_virt_region((addr_t)user_arg_1(),
|
||||||
(size_t)user_arg_2());
|
(size_t)user_arg_2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include <kernel/scheduler.h>
|
#include <kernel/scheduler.h>
|
||||||
#include <kernel/signal_receiver.h>
|
#include <kernel/signal_receiver.h>
|
||||||
#include <kernel/ipc_node.h>
|
#include <kernel/ipc_node.h>
|
||||||
#include <cpu_support.h>
|
|
||||||
#include <processor_driver.h>
|
#include <processor_driver.h>
|
||||||
|
#include <cpu_support.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <kernel/pd.h>
|
#include <kernel/pd.h>
|
||||||
#include <kernel/multiprocessor.h>
|
#include <kernel/multiprocessor.h>
|
||||||
#include <kernel/signal_receiver.h>
|
#include <kernel/signal_receiver.h>
|
||||||
#include <processor_driver.h>
|
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
{
|
{
|
||||||
@ -90,7 +89,7 @@ class Kernel::Vm : public Object<Vm, MAX_VMS, Vm_ids, vm_ids, vm_pool>,
|
|||||||
_interrupt(processor_id);
|
_interrupt(processor_id);
|
||||||
return;
|
return;
|
||||||
case Genode::Cpu_state::DATA_ABORT:
|
case Genode::Cpu_state::DATA_ABORT:
|
||||||
_state->dfar = Processor_driver::Dfar::read();
|
_state->dfar = Processor::Dfar::read();
|
||||||
default:
|
default:
|
||||||
Execution_context::_unschedule();
|
Execution_context::_unschedule();
|
||||||
_context->submit(1);
|
_context->submit(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user