mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-05 00:50:54 +00:00
libc: remove residues of noux fork support
This commit is contained in:
parent
0977574372
commit
ab953a534c
@ -983,7 +983,6 @@ _ZN4Libc14pthread_createEPP7pthreadRN6Genode6ThreadE T
|
|||||||
#
|
#
|
||||||
# Libc plugin interface
|
# Libc plugin interface
|
||||||
#
|
#
|
||||||
_ZN4Libc16schedule_suspendEPFvvE T
|
|
||||||
_ZN4Libc25File_descriptor_allocator15find_by_libc_fdEi T
|
_ZN4Libc25File_descriptor_allocator15find_by_libc_fdEi T
|
||||||
_ZN4Libc25File_descriptor_allocator4freeEPNS_15File_descriptorE T
|
_ZN4Libc25File_descriptor_allocator4freeEPNS_15File_descriptorE T
|
||||||
_ZN4Libc25File_descriptor_allocator5allocEPNS_6PluginEPNS_14Plugin_contextEi T
|
_ZN4Libc25File_descriptor_allocator5allocEPNS_6PluginEPNS_14Plugin_contextEi T
|
||||||
|
@ -233,7 +233,6 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
|||||||
bool _app_returned = false;
|
bool _app_returned = false;
|
||||||
|
|
||||||
bool _resume_main_once = false;
|
bool _resume_main_once = false;
|
||||||
bool _suspend_scheduled = false;
|
|
||||||
|
|
||||||
Select_handler_base *_scheduled_select_handler = nullptr;
|
Select_handler_base *_scheduled_select_handler = nullptr;
|
||||||
|
|
||||||
@ -297,20 +296,6 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
|||||||
|
|
||||||
Absolute_path _cwd { "/" };
|
Absolute_path _cwd { "/" };
|
||||||
|
|
||||||
struct Resumer
|
|
||||||
{
|
|
||||||
GENODE_RPC(Rpc_resume, void, resume);
|
|
||||||
GENODE_RPC_INTERFACE(Rpc_resume);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Resumer_component : Rpc_object<Resumer, Resumer_component>
|
|
||||||
{
|
|
||||||
Kernel &_kernel;
|
|
||||||
|
|
||||||
Resumer_component(Kernel &kernel) : _kernel(kernel) { }
|
|
||||||
|
|
||||||
void resume() { _kernel.run_after_resume(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trampoline to application (user) code
|
* Trampoline to application (user) code
|
||||||
@ -447,7 +432,7 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
|||||||
|
|
||||||
/* _setjmp() returned after _longjmp() - user context suspended */
|
/* _setjmp() returned after _longjmp() - user context suspended */
|
||||||
|
|
||||||
while ((!_app_returned) && (!_suspend_scheduled)) {
|
while ((!_app_returned)) {
|
||||||
|
|
||||||
if (_kernel_routine) {
|
if (_kernel_routine) {
|
||||||
Kernel_routine &routine = *_kernel_routine;
|
Kernel_routine &routine = *_kernel_routine;
|
||||||
@ -479,25 +464,6 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
|||||||
if (!_kernel_routine && _resume_main_once && !_setjmp(_kernel_context))
|
if (!_kernel_routine && _resume_main_once && !_setjmp(_kernel_context))
|
||||||
_switch_to_user();
|
_switch_to_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
_suspend_scheduled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Run libc application main context after suspend and resume
|
|
||||||
*/
|
|
||||||
void run_after_resume()
|
|
||||||
{
|
|
||||||
if (!_setjmp(_kernel_context))
|
|
||||||
_switch_to_user();
|
|
||||||
|
|
||||||
while ((!_app_returned) && (!_suspend_scheduled)) {
|
|
||||||
_env.ep().wait_and_dispatch_one_io_signal();
|
|
||||||
if (_resume_main_once && !_setjmp(_kernel_context))
|
|
||||||
_switch_to_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
_suspend_scheduled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -590,11 +556,6 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
|||||||
return _timer_accessor.timer().curr_time();
|
return _timer_accessor.timer().curr_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from the main context (by fork)
|
|
||||||
*/
|
|
||||||
void schedule_suspend(void(*original_suspended_callback) ());
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select interface
|
* Select interface
|
||||||
*/
|
*/
|
||||||
@ -611,33 +572,6 @@ struct Libc::Kernel final : Vfs::Io_response_handler,
|
|||||||
_scheduled_select_handler = nullptr;
|
_scheduled_select_handler = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from the context of the initial thread (on fork)
|
|
||||||
*/
|
|
||||||
void entrypoint_suspended()
|
|
||||||
{
|
|
||||||
_resume_main_handler.destruct();
|
|
||||||
|
|
||||||
_original_suspended_callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from the context of the initial thread (after fork)
|
|
||||||
*/
|
|
||||||
void entrypoint_resumed()
|
|
||||||
{
|
|
||||||
_resume_main_handler.construct(_env.ep(), *this, &Kernel::_resume_main);
|
|
||||||
|
|
||||||
Resumer_component resumer { *this };
|
|
||||||
|
|
||||||
Capability<Resumer> resumer_cap =
|
|
||||||
_env.ep().rpc_ep().manage(&resumer);
|
|
||||||
|
|
||||||
resumer_cap.call<Resumer::Rpc_resume>();
|
|
||||||
|
|
||||||
_env.ep().rpc_ep().dissolve(&resumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if main is currently suspended
|
* Return if main is currently suspended
|
||||||
*/
|
*/
|
||||||
|
@ -26,11 +26,6 @@ namespace Libc {
|
|||||||
* XXX called only by 'Libc::Vfs_plugin::read'
|
* XXX called only by 'Libc::Vfs_plugin::read'
|
||||||
*/
|
*/
|
||||||
void dispatch_pending_io_signals();
|
void dispatch_pending_io_signals();
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX this function is solely needed to support noux fork mechanism
|
|
||||||
*/
|
|
||||||
void schedule_suspend(void (*) ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _LIBC__INTERNAL__LEGACY_H_ */
|
#endif /* _LIBC__INTERNAL__LEGACY_H_ */
|
||||||
|
@ -40,28 +40,6 @@ inline void Libc::Main_blockade::wakeup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main context execution was suspended (on fork)
|
|
||||||
*
|
|
||||||
* This function is executed in the context of the initial thread.
|
|
||||||
*/
|
|
||||||
static void suspended_callback()
|
|
||||||
{
|
|
||||||
Libc::Kernel::kernel().entrypoint_suspended();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resume main context execution (after fork)
|
|
||||||
*
|
|
||||||
* This function is executed in the context of the initial thread.
|
|
||||||
*/
|
|
||||||
static void resumed_callback()
|
|
||||||
{
|
|
||||||
Libc::Kernel::kernel().entrypoint_resumed();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t Libc::Kernel::_user_stack_size()
|
size_t Libc::Kernel::_user_stack_size()
|
||||||
{
|
{
|
||||||
size_t size = Component::stack_size();
|
size_t size = Component::stack_size();
|
||||||
@ -75,31 +53,6 @@ size_t Libc::Kernel::_user_stack_size()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Libc::Kernel::schedule_suspend(void(*original_suspended_callback) ())
|
|
||||||
{
|
|
||||||
if (_state != USER) {
|
|
||||||
error(__PRETTY_FUNCTION__, " called from non-user context");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We hook into suspend-resume callback chain to destruct and
|
|
||||||
* reconstruct parts of the kernel from the context of the initial
|
|
||||||
* thread, i.e., without holding any object locks.
|
|
||||||
*/
|
|
||||||
_original_suspended_callback = original_suspended_callback;
|
|
||||||
_env.ep().schedule_suspend(suspended_callback, resumed_callback);
|
|
||||||
|
|
||||||
if (!_setjmp(_user_context)) {
|
|
||||||
_valid_user_context = true;
|
|
||||||
_suspend_scheduled = true;
|
|
||||||
_switch_to_kernel();
|
|
||||||
} else {
|
|
||||||
_valid_user_context = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Libc::Kernel::reset_malloc_heap()
|
void Libc::Kernel::reset_malloc_heap()
|
||||||
{
|
{
|
||||||
_malloc_ram.construct(_heap, _env.ram());
|
_malloc_ram.construct(_heap, _env.ram());
|
||||||
|
@ -24,8 +24,3 @@ void Libc::dispatch_pending_io_signals()
|
|||||||
Kernel::kernel().dispatch_pending_io_signals();
|
Kernel::kernel().dispatch_pending_io_signals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Libc::schedule_suspend(void (*suspended) ())
|
|
||||||
{
|
|
||||||
Kernel::kernel().schedule_suspend(suspended);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user