vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / os / arch / arm / system_time.c
blobbef6175a182ea9efafe57a3f46232eaa53d4614f
1 /*
2 * Copyright 2012, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * François Revol <revol@free.fr>
7 */
9 #include <OS.h>
11 #include <arch_cpu.h>
12 #include <libroot_private.h>
13 #include <real_time_data.h>
15 static vint32 *sConversionFactor;
17 void
18 __arm_setup_system_time(vint32 *cvFactor)
20 sConversionFactor = cvFactor;
24 //XXX: this is a hack
25 // remove me when platform code works
26 static int64
27 __arm_get_time_base(void)
29 static uint64 time_dilation_field = 0;
30 return time_dilation_field++;
33 bigtime_t
34 system_time(void)
36 uint64 timeBase = __arm_get_time_base();
38 uint32 cv = sConversionFactor ? *sConversionFactor : 0;
39 return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32);