From 3407cab7da440eefcae5ac8f110cc6475cbc09be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 9 Nov 2004 13:50:52 +0000 Subject: [PATCH] Temporarily added initialization of the system time conversion factor (x86) to the arch independent section (pure laziness + I am not yet sure how this will look like on other platforms). Fixed the clone_area() command: B_CLONE_ADDRESS must not be used in the same address space, because the area creation then can only fail. Added an explanation on why the area is cloned at all. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9885 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/real_time_clock.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/kernel/core/real_time_clock.c b/src/kernel/core/real_time_clock.c index 727f484673..0cf2bde0cd 100644 --- a/src/kernel/core/real_time_clock.c +++ b/src/kernel/core/real_time_clock.c @@ -77,9 +77,10 @@ rtc_debug(int argc, char **argv) status_t -rtc_init(kernel_args *ka) +rtc_init(kernel_args *args) { void *clonedRealTimeData; + area_id area = create_area("real time data", (void **)&sRealTimeData, B_ANY_KERNEL_ADDRESS, PAGE_ALIGN(sizeof(struct real_time_data)), B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); @@ -88,12 +89,22 @@ rtc_init(kernel_args *ka) return area; } - if (clone_area("real time data userland", &clonedRealTimeData, B_CLONE_ADDRESS, + // On some systems like x86, a page cannot be read-only in userland and writable + // in the kernel. Therefore, we clone the real time data area here for user + // access; it doesn't hurt on other platforms, too. + // The area is used to share time critical information, such as the system + // time conversion factor which can change at any time. + + if (clone_area("real time data userland", &clonedRealTimeData, B_ANY_KERNEL_ADDRESS, B_READ_AREA, area) < B_OK) { dprintf("rtc_init: error creating real time data userland area\n"); // we don't panic because it's not kernel critical } + // ToDo: initialization of the system time conversion factor is an x86 thing + // and should be moved there + sRealTimeData->system_time_conversion_factor = args->arch_args.system_time_cv_factor; + rtc_hw_to_system(); add_debugger_command("rtc", &rtc_debug, "Set and test the real-time clock");