mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-20 16:10:29 +00:00
base: remove dependency from deprecated APIs
This patch adjusts the implementation of the base library and core such that the code no longer relies on deprecated APIs except for very few cases, mainly to keep those deprecated APIs in tact for now. The most prominent changes are: - Removing the use of base/printf.h - Removing of the log backend for printf. The 'Console' with the format-string parser is still there along with 'snprintf.h' because the latter is still used at a few places, most prominently the 'Connection' classes. - Removing the notion of a RAM session, which does not exist in Genode anymore. Still the types were preserved (by typedefs to PD session) to keep up compatibility. But this transition should come to an end now. - Slight rennovation of core's tracing service, e.g., the use of an Attached_dataspace as the Argument_buffer. - Reducing the reliance on global accessors like deprecated_env() or core_env(). Still there is a longish way to go to eliminate all such calls. A useful pattern (or at least a stop-gap solution) is to pass the 'Env' to the individual compilation units via init functions. - Avoiding the use of the old 'Child_policy::resolve_session_request' interface that returned a 'Service' instead of a 'Route'. Issue #1987
This commit is contained in:
@ -12,9 +12,6 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
/* NOVA includes */
|
||||
#include <nova/native_thread.h>
|
||||
|
||||
@ -25,17 +22,6 @@ using namespace Genode;
|
||||
using namespace Nova;
|
||||
|
||||
|
||||
Timer::Time_source::Time_source(Env &env) : Threaded_time_source(env)
|
||||
{
|
||||
/* read out the tsc frequency once */
|
||||
Attached_rom_dataspace const platform_info { env, "platform_info" };
|
||||
Xml_node const hardware = platform_info.xml().sub_node("hardware");
|
||||
hardware.sub_node("tsc").attribute("freq_khz").value(&_tsc_khz);
|
||||
|
||||
start();
|
||||
}
|
||||
|
||||
|
||||
void Timer::Time_source::schedule_timeout(Microseconds duration,
|
||||
Timeout_handler &handler)
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <trace/timestamp.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
/* local includes */
|
||||
#include <threaded_time_source.h>
|
||||
@ -28,9 +29,24 @@ class Timer::Time_source : public Threaded_time_source
|
||||
{
|
||||
private:
|
||||
|
||||
/* read the tsc frequency from platform info */
|
||||
static unsigned long _obtain_tsc_khz(Genode::Env &env)
|
||||
{
|
||||
try {
|
||||
Genode::Attached_rom_dataspace info { env, "platform_info"};
|
||||
|
||||
return info.xml()
|
||||
.sub_node("hardware")
|
||||
.sub_node("tsc")
|
||||
.attribute_value("freq_khz", 0UL);
|
||||
} catch (...) { }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Genode::addr_t _sem { ~0UL };
|
||||
unsigned long _timeout_us { 0 };
|
||||
unsigned long _tsc_khz { 0 };
|
||||
unsigned long const _tsc_khz;
|
||||
Duration _curr_time { Microseconds(0) };
|
||||
Genode::Trace::Timestamp _tsc_start { Genode::Trace::timestamp() };
|
||||
Genode::Trace::Timestamp _tsc_last { _tsc_start };
|
||||
@ -52,8 +68,12 @@ class Timer::Time_source : public Threaded_time_source
|
||||
|
||||
public:
|
||||
|
||||
Time_source(Genode::Env &env);
|
||||
|
||||
Time_source(Genode::Env &env)
|
||||
:
|
||||
Threaded_time_source(env), _tsc_khz(_obtain_tsc_khz(env))
|
||||
{
|
||||
start();
|
||||
}
|
||||
|
||||
/*************************
|
||||
** Genode::Time_source **
|
||||
|
Reference in New Issue
Block a user