mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 12:34:33 +00:00
- Implemented vDSO functionality for the RISC-V architecture, including the necessary source files and linker scripts. - Introduced a new `vdso_sys.c` file for RISC-V, containing functions to handle time retrieval using the vDSO mechanism. - Created architecture-specific linker scripts (`vdso.lds.S`) for both AArch64 and RISC-V. - Updated the build system to support vDSO compilation for RISC-V, including necessary adjustments in `SConstruct` files. - Refactored existing vDSO code to improve compatibility and maintainability across architectures. - Adjusted the maximum number of PTY devices in the terminal configuration from 64 to 32 for better resource management. - Fixed minor issues in existing code, including correcting the path for the vDSO shared library and ensuring proper function definitions.
35 lines
915 B
C
35 lines
915 B
C
/*
|
|
* Copyright (c) 2006-2025 RT-Thread Development Team
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2025-04-22 ScuDays Add VDSO functionality under the riscv64 architecture.
|
|
*/
|
|
|
|
#include <rtthread.h>
|
|
#include <ktime.h>
|
|
#include <time.h>
|
|
#include <vdso_datapage.h>
|
|
#include <vdso_data.h>
|
|
#include <encoding.h>
|
|
|
|
void rt_vdso_update_glob_time(void)
|
|
{
|
|
struct vdso_data *vdata = get_k_vdso_data();
|
|
struct timespec *vdso_ts;
|
|
uint64_t initdata = vdata->realtime_initdata;
|
|
rt_vdso_write_begin(vdata);
|
|
|
|
vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_REALTIME];
|
|
rt_ktime_boottime_get_ns(vdso_ts);
|
|
vdso_ts->tv_sec = initdata + vdso_ts->tv_sec;
|
|
|
|
vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_MONOTONIC];
|
|
rt_ktime_boottime_get_ns(vdso_ts);
|
|
|
|
vdata->cycle_last = rdtime();
|
|
rt_vdso_write_end(vdata);
|
|
}
|