mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-20 08:03:56 +00:00
base-hw: no unmanaged_singleton in kernel thread
The unmanaged-singleton approach was used in this context only because of the alignment requirement of the Core main-UTCB. This, however can also be achieved with the new 'Aligned' utility, allowing the UTCB to be a member of the Core main-thread object. Ref #4217
This commit is contained in:
committed by
Norman Feske
parent
b6641eaa25
commit
0c61b25bcf
@ -17,8 +17,6 @@
|
|||||||
#include <cpu_session/cpu_session.h>
|
#include <cpu_session/cpu_session.h>
|
||||||
|
|
||||||
/* base-internal includes */
|
/* base-internal includes */
|
||||||
#include <base/internal/unmanaged_singleton.h>
|
|
||||||
#include <base/internal/native_utcb.h>
|
|
||||||
#include <base/internal/crt0.h>
|
#include <base/internal/crt0.h>
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
@ -884,24 +882,20 @@ Core_main_thread::Core_main_thread(Irq::Pool &user_irq_pool,
|
|||||||
{
|
{
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
static Native_utcb * const utcb =
|
Genode::map_local(Platform::core_phys_addr((addr_t)&_utcb_instance),
|
||||||
unmanaged_singleton<Native_utcb, get_page_size()>();
|
(addr_t)utcb_main_thread(),
|
||||||
static addr_t const utcb_phys = Platform::core_phys_addr((addr_t)utcb);
|
|
||||||
|
|
||||||
/* map UTCB */
|
|
||||||
Genode::map_local(utcb_phys, (addr_t)utcb_main_thread(),
|
|
||||||
sizeof(Native_utcb) / get_page_size());
|
sizeof(Native_utcb) / get_page_size());
|
||||||
|
|
||||||
utcb->cap_add(core_capid());
|
_utcb_instance.cap_add(core_capid());
|
||||||
utcb->cap_add(cap_id_invalid());
|
_utcb_instance.cap_add(cap_id_invalid());
|
||||||
utcb->cap_add(cap_id_invalid());
|
_utcb_instance.cap_add(cap_id_invalid());
|
||||||
|
|
||||||
/* start thread with stack pointer at the top of stack */
|
/* start thread with stack pointer at the top of stack */
|
||||||
regs->sp = (addr_t)&__initial_stack_base[0] + DEFAULT_STACK_SIZE;
|
regs->sp = (addr_t)&__initial_stack_base[0] + DEFAULT_STACK_SIZE;
|
||||||
regs->ip = (addr_t)&_core_start;
|
regs->ip = (addr_t)&_core_start;
|
||||||
|
|
||||||
affinity(_cpu_pool.primary_cpu());
|
affinity(_cpu_pool.primary_cpu());
|
||||||
_utcb = utcb;
|
_utcb = &_utcb_instance;
|
||||||
Thread::_pd = &core_pd;
|
Thread::_pd = &core_pd;
|
||||||
_become_active();
|
_become_active();
|
||||||
}
|
}
|
||||||
|
@ -445,6 +445,10 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
|
|||||||
*/
|
*/
|
||||||
class Kernel::Core_main_thread : public Core_object<Kernel::Thread>
|
class Kernel::Core_main_thread : public Core_object<Kernel::Thread>
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
Native_utcb _utcb_instance alignas(Hw::get_page_size()) { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Core_main_thread(Irq::Pool &user_irq_pool,
|
Core_main_thread(Irq::Pool &user_irq_pool,
|
||||||
|
Reference in New Issue
Block a user