diff -Naur -X exclude-files ac_cur/arch/um/include/user_util.h ac/arch/um/include/user_util.h --- ac_cur/arch/um/include/user_util.h Fri Jun 1 21:06:05 2001 +++ ac/arch/um/include/user_util.h Fri Jun 1 21:35:45 2001 @@ -90,6 +90,7 @@ extern void trace_myself(void); extern void block_shlib_mem(void); extern void unblock_shlib_mem(void); +extern void timer(void); extern void get_profile_timer(void); extern void set_timers(int set_signal); extern int clone_and_wait(int (*fn)(void *), void *arg, void *sp, int flags); diff -Naur -X exclude-files ac_cur/arch/um/kernel/sys_call_table.c ac/arch/um/kernel/sys_call_table.c --- ac_cur/arch/um/kernel/sys_call_table.c Fri Jun 1 21:09:38 2001 +++ ac/arch/um/kernel/sys_call_table.c Fri Jun 1 21:47:26 2001 @@ -18,7 +18,6 @@ extern syscall_handler_t sys_link; extern syscall_handler_t sys_unlink; extern syscall_handler_t sys_chdir; -extern syscall_handler_t sys_time; extern syscall_handler_t sys_mknod; extern syscall_handler_t sys_chmod; extern syscall_handler_t sys_lchown16; @@ -29,7 +28,6 @@ extern syscall_handler_t sys_oldumount; extern syscall_handler_t sys_setuid16; extern syscall_handler_t sys_getuid16; -extern syscall_handler_t sys_stime; extern syscall_handler_t sys_ptrace; extern syscall_handler_t sys_alarm; extern syscall_handler_t sys_fstat; @@ -221,6 +219,8 @@ extern syscall_handler_t sys_madvise; extern syscall_handler_t um_mount; +extern syscall_handler_t um_time; +extern syscall_handler_t um_stime; syscall_handler_t *sys_call_table[] = { [ 0 ] = sys_ni_syscall, @@ -240,7 +240,7 @@ /* declared differently in kern_util.h */ [ __NR_execve ] = (syscall_handler_t *) sys_execve, [ __NR_chdir ] = sys_chdir, - [ __NR_time ] = sys_time, + [ __NR_time ] = um_time, [ __NR_mknod ] = sys_mknod, [ __NR_chmod ] = sys_chmod, [ __NR_lchown ] = sys_lchown16, @@ -252,7 +252,7 @@ [ __NR_umount ] = sys_oldumount, [ __NR_setuid ] = sys_setuid16, [ __NR_getuid ] = sys_getuid16, - [ __NR_stime ] = sys_stime, + [ __NR_stime ] = um_stime, [ __NR_ptrace ] = sys_ptrace, [ __NR_alarm ] = sys_alarm, [ __NR_oldfstat ] = sys_fstat, diff -Naur -X exclude-files ac_cur/arch/um/kernel/time.c ac/arch/um/kernel/time.c --- ac_cur/arch/um/kernel/time.c Fri Jun 1 20:50:47 2001 +++ ac/arch/um/kernel/time.c Fri Jun 1 21:39:01 2001 @@ -17,9 +17,16 @@ #include "user.h" #include "process.h" +extern struct timeval xtime; + void timer_handler(int sig, void *sc, int usermode) { timer_irq(usermode); +} + +void timer(void) +{ + gettimeofday(&xtime, NULL); } static struct itimerval profile_interval; diff -Naur -X exclude-files ac_cur/arch/um/kernel/time_kern.c ac/arch/um/kernel/time_kern.c --- ac_cur/arch/um/kernel/time_kern.c Fri Jun 1 20:50:47 2001 +++ ac/arch/um/kernel/time_kern.c Fri Jun 1 21:40:25 2001 @@ -3,6 +3,7 @@ * Licensed under the GPL */ +#include "linux/kernel.h" #include "linux/unistd.h" #include "linux/stddef.h" #include "linux/spinlock.h" @@ -17,8 +18,6 @@ extern rwlock_t xtime_lock; -extern struct timeval xtime; - int hz(void) { return(HZ); @@ -40,14 +39,39 @@ do_timer(®s); } -void timer(int irq, void *dev, struct pt_regs *regs) +void um_timer(int irq, void *dev, struct pt_regs *regs) { do_timer(regs); write_lock(&xtime_lock); - gettimeofday(&xtime, NULL); + timer(); write_unlock(&xtime_lock); } +long um_time(int * tloc) +{ + struct timeval now; + + do_gettimeofday(&now); + if (tloc) { + if (put_user(now.tv_sec,tloc)) + now.tv_sec = -EFAULT; + } + return now.tv_sec; +} + +long um_stime(int * tptr) +{ + int value; + struct timeval new; + + if (get_user(value, tptr)) + return -EFAULT; + new.tv_sec = value; + new.tv_usec = 0; + do_settimeofday(&new); + return 0; +} + void __delay(um_udelay_t time) { int i; @@ -75,7 +99,7 @@ { int err; - if((err = request_irq(TIMER_IRQ, timer, SA_INTERRUPT, "timer", + if((err = request_irq(TIMER_IRQ, um_timer, SA_INTERRUPT, "timer", NULL)) != 0) printk("timer_init : request_irq failed - errno = %d\n", -err); timer_irq_inited = 1;