aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/time_kern.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/time_kern.c')
-rw-r--r--arch/um/kernel/time_kern.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index d7e044b5e5ee..8e56c58320ba 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -84,29 +84,6 @@ void timer_irq(union uml_pt_regs *regs)
84 } 84 }
85} 85}
86 86
87
88void time_init_kern(void)
89{
90 long long nsecs;
91
92 nsecs = os_nsecs();
93 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
94 -nsecs % BILLION);
95}
96
97void do_boot_timer_handler(struct sigcontext * sc)
98{
99 unsigned long flags;
100 struct pt_regs regs;
101
102 CHOOSE_MODE((void) (UPT_SC(&regs.regs) = sc),
103 (void) (regs.regs.skas.is_user = 0));
104
105 write_seqlock_irqsave(&xtime_lock, flags);
106 do_timer(&regs);
107 write_sequnlock_irqrestore(&xtime_lock, flags);
108}
109
110static DEFINE_SPINLOCK(timer_spinlock); 87static DEFINE_SPINLOCK(timer_spinlock);
111 88
112static unsigned long long local_offset = 0; 89static unsigned long long local_offset = 0;
@@ -142,6 +119,32 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
142 return IRQ_HANDLED; 119 return IRQ_HANDLED;
143} 120}
144 121
122static void register_timer(void)
123{
124 int err;
125
126 err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
127 if(err != 0)
128 printk(KERN_ERR "timer_init : request_irq failed - "
129 "errno = %d\n", -err);
130
131 timer_irq_inited = 1;
132
133 user_time_init();
134}
135
136extern void (*late_time_init)(void);
137
138void time_init(void)
139{
140 long long nsecs;
141
142 nsecs = os_nsecs();
143 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
144 -nsecs % BILLION);
145 late_time_init = register_timer;
146}
147
145void do_gettimeofday(struct timeval *tv) 148void do_gettimeofday(struct timeval *tv)
146{ 149{
147 unsigned long long nsecs = get_time(); 150 unsigned long long nsecs = get_time();
@@ -189,18 +192,3 @@ void timer_handler(int sig, union uml_pt_regs *regs)
189 if(current_thread->cpu == 0) 192 if(current_thread->cpu == 0)
190 timer_irq(regs); 193 timer_irq(regs);
191} 194}
192
193int __init timer_init(void)
194{
195 int err;
196
197 user_time_init();
198 err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
199 if(err != 0)
200 printk(KERN_ERR "timer_init : request_irq failed - "
201 "errno = %d\n", -err);
202 timer_irq_inited = 1;
203 return(0);
204}
205
206arch_initcall(timer_init);