mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-11 21:32:57 +00:00
lx_emul: allow setup of the persistent clock
This commit adds support to initialize the timekeeping for the Linux subsystem with the value from the RTC. Only the seconds part of timespec64 is supported. Issue genodelabs/genode#4957
This commit is contained in:
parent
9aa0de24af
commit
f66a7db87f
@ -40,6 +40,7 @@ SRC_C += lx_emul/shadow/mm/slab_common.c
|
||||
SRC_C += lx_emul/shadow/mm/slub.c
|
||||
SRC_C += lx_emul/shadow/mm/vmstat.c
|
||||
SRC_C += lx_emul/start.c
|
||||
SRC_C += lx_emul/time_initial.c
|
||||
SRC_C += lx_emul/virt_to_page.c
|
||||
|
||||
SRC_CC += lx_kit/console.cc
|
||||
|
@ -30,6 +30,8 @@ void lx_emul_time_handle(void);
|
||||
|
||||
void lx_emul_time_update_jiffies(void);
|
||||
|
||||
void lx_emul_time_initial(unsigned long long);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
29
repos/dde_linux/src/lib/lx_emul/time_initial.c
Normal file
29
repos/dde_linux/src/lib/lx_emul/time_initial.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* \brief Lx_emul initial time (persistent clock)
|
||||
* \author Pirmin Duss
|
||||
* \date 2023-10-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 Genode Labs GmbH
|
||||
* Copyright (C) 2023 gapfruit AG
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/time.h>
|
||||
|
||||
static unsigned long long genode_initial_ts_sec = 0;
|
||||
|
||||
void lx_emul_time_initial(unsigned long long seconds)
|
||||
{
|
||||
genode_initial_ts_sec = seconds;
|
||||
}
|
||||
|
||||
void read_persistent_clock64(struct timespec64 *ts)
|
||||
{
|
||||
ts->tv_sec = genode_initial_ts_sec;
|
||||
ts->tv_nsec = 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user