libroot/os: Fix missing time funcs on riscv64

Change-Id: I291ebc949d63860e20eb609e4d3d2f600309d4e9
Reviewed-on: https://review.haiku-os.org/c/1553
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Alexander von Gluck IV 2019-07-01 14:10:32 -05:00 committed by Alex von Gluck IV
parent a9d549c969
commit f1f452b3cf
4 changed files with 94 additions and 0 deletions

View File

@ -13,7 +13,11 @@ for architectureObject in [ MultiArchSubDirSetup riscv64 ] {
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o :
stack_frame.c
system_time.c
tls.c
time.c
thread.c
generic_atomic.cpp

View File

@ -0,0 +1,25 @@
/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include <SupportDefs.h>
#include <libroot_private.h>
void*
get_stack_frame(void)
{
// TODO: Implement!
return NULL;
}
void*
__arch_get_caller(void)
{
// TODO: Implement!
return NULL;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright 2012, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* François Revol <revol@free.fr>
*/
#include <OS.h>
#include <arch_cpu.h>
#include <libroot_private.h>
#include <real_time_data.h>
static vint32 *sConversionFactor;
//XXX: this is a hack
// remove me when platform code works
static int64
__riscv64_get_time_base(void)
{
static uint64 time_dilation_field = 0;
return time_dilation_field++;
}
bigtime_t
system_time(void)
{
uint64 timeBase = __riscv64_get_time_base();
uint32 cv = sConversionFactor ? *sConversionFactor : 0;
return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32);
}

View File

@ -0,0 +1,32 @@
/*
* Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* Distributed under the terms of the MIT License.
*/
#include <OS.h>
#include <arch_cpu.h>
#include <libroot_private.h>
#include <real_time_data.h>
static struct arch_real_time_data *sRealTimeData;
void
__arch_init_time(struct real_time_data *data, bool setDefaults)
{
sRealTimeData = &data->arch_data;
if (setDefaults) {
sRealTimeData->system_time_conversion_factor = 1000000000LL;
}
// __riscv64_setup_system_time(&sRealTimeData->system_time_conversion_factor);
}
bigtime_t
__arch_get_system_time_offset(struct real_time_data *data)
{
return 0;
}