112 panic(
NULL,
"system time source '%s' returned non-monotonic time value %lu ns (last %lu ns)",
132 if (nanoseconds == 0)
140 panic(
NULL,
"clock_wait called before timer system initialized");
145 asm volatile(
"pause");
#define SYSCALL_DEFINE(num, returnType,...)
Macro to define a syscall.
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
#define LOG_INFO(format,...)
#define CLOCK_MAX_SOURCES
Maximum amount of system timer sources.
time_t clock_epoch(void)
Retrieve the seconds since the unix epoch.
void clock_wait(clock_t nanoseconds)
Wait for a specified number of nanoseconds.
clock_t clock_uptime(void)
Retrieve the time in nanoseconds since boot.
uint64_t clock_source_register(const clock_source_t *source)
Register a system timer source.
void clock_source_unregister(const clock_source_t *source)
Unregister a system timer source.
uint64_t thread_copy_to_user(thread_t *thread, void *dest, const void *userSrc, uint64_t length)
Safely copy data to user space.
thread_t * sched_thread(void)
Retrieves the currently running thread.
void rwlock_write_acquire(rwlock_t *lock)
Acquires a rwlock for writing, blocking until it is available.
#define RWLOCK_READ_SCOPE(lock)
Acquires a rwlock for reading for the reminder of the current scope.
void rwlock_write_release(rwlock_t *lock)
Releases a rwlock from writing.
#define RWLOCK_CREATE()
Create a rwlock initializer.
#define ENOSPC
No space left on device.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define NULL
Pointer error value.
#define ERR
Integer error value.
__UINT64_TYPE__ clock_t
A nanosecond time.
static clock_source_t source
Structure to describe the HPET to the sys time subsystem.
static rwlock_t sourcesLock
static const clock_source_t * bestEpochSource
static const clock_source_t * sources[CLOCK_MAX_SOURCES]
static const clock_source_t * bestNsSource
static uint32_t sourceCount
static void clock_update_best_sources(void)
#define atomic_exchange(object, desired)
#define ATOMIC_VAR_INIT(value)
_PUBLIC void * memmove(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
time_t(* read_epoch)(void)
Read-Write Ticket Lock structure.
_PUBLIC time_t time(time_t *timer)
long long unsigned time_t