Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion components/libc/compilers/common/ctime.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@

#define _WARNING_NO_RTC "Cannot find a RTC device!"

#if defined(RT_USING_SMART) && defined(RT_USING_VDSO)
#include <vdso_kernel.h>
#endif

/* days per month -- nonleap! */
static const short __spm[13] =
{
Expand Down Expand Up @@ -519,12 +523,26 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
{
if (_control_rtc(RT_DEVICE_CTRL_RTC_SET_TIMEVAL, (void *)tv) == RT_EOK)
{
#if defined(RT_USING_SMART) && defined(RT_USING_VDSO)
struct timespec ts = {
.tv_sec = tv->tv_sec,
.tv_nsec = tv->tv_usec * 1000L,
};
rt_vdso_set_realtime(&ts);
#endif
return 0;
}
else
{
if (_control_rtc(RT_DEVICE_CTRL_RTC_SET_TIME, (void *)&tv->tv_sec) == RT_EOK)
{
#if defined(RT_USING_SMART) && defined(RT_USING_VDSO)
struct timespec ts = {
.tv_sec = tv->tv_sec,
.tv_nsec = 0,
};
rt_vdso_set_realtime(&ts);
#endif
return 0;
}
}
Expand Down Expand Up @@ -736,7 +754,16 @@ int clock_settime(clockid_t clockid, const struct timespec *tp)
{
#ifdef RT_USING_RTC
case CLOCK_REALTIME:
return _control_rtc(RT_DEVICE_CTRL_RTC_SET_TIMESPEC, (void *)tp);
{
int ret = _control_rtc(RT_DEVICE_CTRL_RTC_SET_TIMESPEC, (void *)tp);
if (ret == RT_EOK)
{
#if defined(RT_USING_SMART) && defined(RT_USING_VDSO)
rt_vdso_set_realtime(tp);
#endif
}
return ret;
}
#endif /* RT_USING_RTC */

case CLOCK_REALTIME_COARSE:
Expand Down
8 changes: 5 additions & 3 deletions components/lwp/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ if platform in platform_file.keys(): # support platforms
asm_path = 'arch/' + arch + '/' + cpu + '/*_' + platform_file[platform]
arch_common = 'arch/' + arch + '/' + 'common/*.c'
common = 'arch/common/*.c'
common_excluded = []
if not GetDepend('RT_USING_VDSO'):
vdso_files = ['vdso_data.c', 'vdso.c']
src += [f for f in Glob(arch_common) if os.path.basename(str(f)) not in vdso_files]
src += [f for f in Glob(common) if os.path.basename(str(f)) not in vdso_files]
common_excluded.append('vdso_kernel.c')
src += Glob(arch_common)
src += [f for f in Glob(common) if os.path.basename(str(f)) not in common_excluded]
else:
CPPPATH += [cwd + '/vdso', cwd + '/vdso/kernel']
src += Glob(arch_common)
src += Glob(common)
if not GetDepend('ARCH_MM_MMU'):
Expand Down
34 changes: 0 additions & 34 deletions components/lwp/arch/aarch64/common/vdso_data.c

This file was deleted.

116 changes: 0 additions & 116 deletions components/lwp/arch/common/vdso.c

This file was deleted.

Loading
Loading