mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
wifi: remove 'Component::construct'
Init calls are not static constructors anymore, so 'Lx_kit::Env' is not required to be initialzed before static constructors are called. issue #5096
This commit is contained in:
parent
1b4f7ae0d3
commit
491ab232bf
@ -170,6 +170,9 @@ struct Main
|
||||
|
||||
Main(Genode::Env &env) : env(env)
|
||||
{
|
||||
/* prepare Lx_kit::Env */
|
||||
wifi_init(env, _wpa_startup_blockade);
|
||||
|
||||
_frontend.construct(env, _wifi_msg_buffer);
|
||||
_wifi_frontend = &*_frontend;
|
||||
|
||||
@ -192,44 +195,6 @@ void *wifi_get_buffer(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Since the wireless LAN driver incorporates the 'wpa_supplicant',
|
||||
* which itself is a libc-using application, we have to initialize
|
||||
* the libc environment. Normally this initialization is performed
|
||||
* by the libc (see 'src/lib/libc/component.cc') but as the various
|
||||
* initcalls of the Linux kernel are registered as ctor we have to
|
||||
* initialize the Lx_kit::Env before the static ctors are executed.
|
||||
* As those are called prior to calling 'Libc::Component::construct',
|
||||
* which is implemented by us, we pose as regular component and
|
||||
* call the libc 'Component::construct' explicitly after we have
|
||||
* finished our initialization (Lx_kit::Env include).
|
||||
*/
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
try {
|
||||
Genode::Heap shared_obj_heap(env.ram(), env.rm());
|
||||
|
||||
Shared_object shared_obj(env, shared_obj_heap, "libc.lib.so",
|
||||
Shared_object::BIND_LAZY,
|
||||
Shared_object::DONT_KEEP);
|
||||
|
||||
typedef void (*Construct_fn)(Genode::Env &);
|
||||
|
||||
Construct_fn const construct_fn =
|
||||
shared_obj.lookup<Construct_fn>("_ZN9Component9constructERN6Genode3EnvE");
|
||||
|
||||
/* prepare Lx_kit::Env */
|
||||
wifi_init(env, _wpa_startup_blockade);
|
||||
|
||||
construct_fn(env);
|
||||
} catch (... /* intentional catch-all */) {
|
||||
Genode::error("could not perform multi-staged construction");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
static Main server(env);
|
||||
|
Loading…
x
Reference in New Issue
Block a user