diff options
author | Michael I. Bushnell <mib@gnu.org> | 1995-08-09 17:17:36 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1995-08-09 17:17:36 +0000 |
commit | 993101436ef7b739f3c47c705ccb7b45fdf6c619 (patch) | |
tree | 76d8440d21bbf183acfadc92fe2879675df3230a /pfinet | |
parent | 4b8644ef26011e3ebf4740a0630a8c5dd4916d43 (diff) |
Formerly timer-emul.c.~3~
Diffstat (limited to 'pfinet')
-rw-r--r-- | pfinet/timer-emul.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/pfinet/timer-emul.c b/pfinet/timer-emul.c index aa23c82a..721631af 100644 --- a/pfinet/timer-emul.c +++ b/pfinet/timer-emul.c @@ -20,7 +20,11 @@ #include <linux/timer.h> #include <asm/system.h> +#include <linux/sched.h> +#include "pfinet.h" +long long root_jiffies; +volatile struct mapped_time_value *mapped_time; static void timer_function (any_t timerp) @@ -34,7 +38,7 @@ timer_function (any_t timerp) timer->thread = mach_thread_self (); err = mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT, - 0, 0, recv, timer->expires, MACH_PORT_NULL); + 0, 0, recv, timer->expires * (1000 / HZ), MACH_PORT_NULL); timer->thread = MACH_PORT_NULL; @@ -96,4 +100,29 @@ init_timer (struct timer_list *timer) timer->thread = MACH_PORT_NULL; } +void +init_root_jiffies () +{ + struct timeval tp; + + fill_timeval (&tp); + root_jiffies = (long long) tp.tv_sec * HZ + + (long long) tp.tv_usec * HZ / 1000.0; +} + +void +init_mapped_time () +{ + device_t timedev; + memory_object_t timeobj; + + device_open (master_device, 0, "time", &timedev); + device_map (timedev, VM_PROT_READ, 0, sizeof (mapped_time_value_t), + &timeobj, 0); + vm_map (mach_task_self (), (vm_address_t *)&mapped_time, + sizeof (mapped_time_value_t), 0, 1, timeobj, 0, 0, + VM_PROT_READ, VM_PROT_READ, VM_INHERIT_NONE); + mach_port_deallocate (mach_task_self (), timedev); + mach_port_deallocate (mach_task_self (), timeobj); +} |