Ticket #2662: tsc.S

File tsc.S, 27.3 KB (added by houhongxun, 14 years ago)
Line 
1 .file "tsc.c"
2 .text
3.globl check_tsc_unstable
4 .type check_tsc_unstable, @function
5check_tsc_unstable:
6 movl tsc_unstable(%rip), %eax
7 ret
8 .size check_tsc_unstable, .-check_tsc_unstable
9.globl recalibrate_cpu_khz
10 .type recalibrate_cpu_khz, @function
11recalibrate_cpu_khz:
12 movl $-19, %eax
13 ret
14 .size recalibrate_cpu_khz, .-recalibrate_cpu_khz
15 .type read_tsc, @function
16read_tsc:
17#APP
18# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
19 rdtsc
20# 0 "" 2
21#NO_APP
22 salq $32, %rdx
23 mov %eax, %eax
24 orq %rax, %rdx
25 movq clocksource_tsc+128(%rip), %rax
26 cmpq %rax, %rdx
27 cmovae %rdx, %rax
28 ret
29 .size read_tsc, .-read_tsc
30 .section .vsyscall_fn,"ax",@progbits
31 .type vread_tsc, @function
32vread_tsc:
33#APP
34# 456 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/system.h" 1
35 661:
36 .byte 0x0f,0x1f,0x00
37
38662:
39.section .altinstructions,"a"
40 .balign 8
41 .quad 661b
42 .quad 663f
43 .byte (3*32+17)
44 .byte 662b-661b
45 .byte 664f-663f
46 .byte 0xff + (664f-663f) - (662b-661b)
47.previous
48.section .altinstr_replacement, "ax"
49663:
50 mfence
51664:
52.previous
53# 0 "" 2
54# 457 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/system.h" 1
55 661:
56 .byte 0x0f,0x1f,0x00
57
58662:
59.section .altinstructions,"a"
60 .balign 8
61 .quad 661b
62 .quad 663f
63 .byte (3*32+18)
64 .byte 662b-661b
65 .byte 664f-663f
66 .byte 0xff + (664f-663f) - (662b-661b)
67.previous
68.section .altinstr_replacement, "ax"
69663:
70 lfence
71664:
72.previous
73# 0 "" 2
74# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
75 rdtsc
76# 0 "" 2
77# 456 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/system.h" 1
78 661:
79 .byte 0x0f,0x1f,0x00
80
81662:
82.section .altinstructions,"a"
83 .balign 8
84 .quad 661b
85 .quad 663f
86 .byte (3*32+17)
87 .byte 662b-661b
88 .byte 664f-663f
89 .byte 0xff + (664f-663f) - (662b-661b)
90.previous
91.section .altinstr_replacement, "ax"
92663:
93 mfence
94664:
95.previous
96# 0 "" 2
97# 457 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/system.h" 1
98 661:
99 .byte 0x0f,0x1f,0x00
100
101662:
102.section .altinstructions,"a"
103 .balign 8
104 .quad 661b
105 .quad 663f
106 .byte (3*32+18)
107 .byte 662b-661b
108 .byte 664f-663f
109 .byte 0xff + (664f-663f) - (662b-661b)
110.previous
111.section .altinstr_replacement, "ax"
112663:
113 lfence
114664:
115.previous
116# 0 "" 2
117#NO_APP
118 salq $32, %rdx
119 mov %eax, %eax
120 orq %rax, %rdx
121 movq __vsyscall_gtod_data+40(%rip), %rax
122 cmpq %rax, %rdx
123 cmovae %rdx, %rax
124 ret
125 .size vread_tsc, .-vread_tsc
126 .text
127 .type resume_tsc, @function
128resume_tsc:
129 movq $0, clocksource_tsc+128(%rip)
130 ret
131 .size resume_tsc, .-resume_tsc
132 .section .rodata.str1.1,"aMS",@progbits,1
133.LC0:
134 .string "reliable"
135 .section .init.text,"ax",@progbits
136 .type tsc_setup, @function
137tsc_setup:
138 subq $8, %rsp
139 movq $.LC0, %rsi
140 call strcmp
141 testl %eax, %eax
142 jne .L7
143 movl $1, tsc_clocksource_reliable(%rip)
144.L7:
145 movl $1, %eax
146 addq $8, %rsp
147 ret
148 .size tsc_setup, .-tsc_setup
149 .type cpufreq_tsc, @function
150cpufreq_tsc:
151 subq $8, %rsp
152 testb $16, boot_cpu_data+20(%rip)
153 je .L9
154 testb $1, boot_cpu_data+33(%rip)
155 jne .L9
156 xorl %esi, %esi
157 movq $time_cpufreq_notifier_block, %rdi
158 call cpufreq_register_notifier
159.L9:
160 xorl %eax, %eax
161 addq $8, %rsp
162 ret
163 .size cpufreq_tsc, .-cpufreq_tsc
164 .text
165 .type set_cyc2ns_scale, @function
166set_cyc2ns_scale:
167 pushq %r12
168 movl %esi, %r12d
169 pushq %rbp
170 movq %rdi, %rbp
171 pushq %rbx
172#APP
173# 20 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
174 # __raw_save_flags
175 pushf ; pop %rbx
176# 0 "" 2
177# 39 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
178 cli
179# 0 "" 2
180#NO_APP
181 call sched_clock_idle_sleep_event
182 movslq %r12d, %rsi
183 movq $cyc2ns, %rdi
184 movq __per_cpu_offset(,%rsi,8), %r8
185 movq $cyc2ns_offset, %rcx
186#APP
187# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
188 rdtsc
189# 0 "" 2
190# 50 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/timer.h" 1
191 movl %gs:cpu_number,%esi
192# 0 "" 2
193#NO_APP
194 testq %rbp, %rbp
195 movslq %esi, %rsi
196 movq __per_cpu_offset(,%rsi,8), %rsi
197 movq (%rsi,%rcx), %r9
198 movq (%rsi,%rdi), %r10
199 je .L11
200 movq %rdx, %rsi
201 mov %eax, %eax
202 salq $32, %rsi
203 xorl %edx, %edx
204 orq %rax, %rsi
205 movl $1024000000, %eax
206 imulq %rsi, %r10
207 divq %rbp
208 shrq $10, %r10
209 movq %rax, (%rdi,%r8)
210 imulq %rax, %rsi
211 shrq $10, %rsi
212 subq %rsi, %r10
213 addq %r9, %r10
214 movq %r10, (%rcx,%r8)
215.L11:
216 xorl %edi, %edi
217 call sched_clock_idle_wakeup_event
218#APP
219# 31 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
220 push %rbx ; popf
221# 0 "" 2
222#NO_APP
223 popq %rbx
224 popq %rbp
225 popq %r12
226 ret
227 .size set_cyc2ns_scale, .-set_cyc2ns_scale
228 .section .rodata.str1.1
229.LC1:
230 .string "<5>%s detected: marking TSC unstable.\n"
231 .section .init.text
232 .type dmi_mark_tsc_unstable, @function
233dmi_mark_tsc_unstable:
234 subq $8, %rsp
235 xorl %eax, %eax
236 movq 8(%rdi), %rsi
237 movq $.LC1, %rdi
238 call printk
239 movl $1, tsc_unstable(%rip)
240 xorl %eax, %eax
241 addq $8, %rsp
242 ret
243 .size dmi_mark_tsc_unstable, .-dmi_mark_tsc_unstable
244 .section .rodata.str1.1
245.LC2:
246 .string "<4>notsc: Kernel compiled with CONFIG_X86_TSC, cannot disable TSC completely.\n"
247 .section .init.text
248.globl notsc_setup
249 .type notsc_setup, @function
250notsc_setup:
251 subq $8, %rsp
252 movq $.LC2, %rdi
253 xorl %eax, %eax
254 call printk
255 movl $1, tsc_disabled(%rip)
256 movl $1, %eax
257 addq $8, %rsp
258 ret
259 .size notsc_setup, .-notsc_setup
260 .section .rodata.str1.1
261.LC3:
262 .string "<6>Marking TSC unstable due to %s\n"
263 .text
264.globl mark_tsc_unstable
265 .type mark_tsc_unstable, @function
266mark_tsc_unstable:
267 subq $8, %rsp
268 movq %rdi, %rsi
269 cmpl $0, tsc_unstable(%rip)
270 jne .L16
271 xorl %eax, %eax
272 movl $1, tsc_unstable(%rip)
273 movl $0, sched_clock_stable(%rip)
274 movq $.LC3, %rdi
275 call printk
276 cmpl $0, clocksource_tsc+64(%rip)
277 je .L18
278 movq $clocksource_tsc, %rdi
279 addq $8, %rsp
280 jmp clocksource_mark_unstable
281.L18:
282 orq $64, clocksource_tsc+80(%rip)
283 movl $0, clocksource_tsc+24(%rip)
284.L16:
285 addq $8, %rsp
286 ret
287 .size mark_tsc_unstable, .-mark_tsc_unstable
288 .section .rodata.str1.1
289.LC4:
290 .string "cpufreq changes"
291 .text
292 .type time_cpufreq_notifier, @function
293time_cpufreq_notifier:
294 pushq %rbx
295 movq $cpu_info, %rax
296 movq %rdx, %rbx
297 mov (%rdx), %edx
298 movq __per_cpu_offset(,%rdx,8), %rdx
299 testb $1, 33(%rdx,%rax)
300 jne .L20
301 movq $boot_cpu_data+152, %rdi
302 testb $2, 12(%rbx)
303 jne .L21
304 leaq 152(%rdx,%rax), %rdi
305.L21:
306 cmpl $0, ref_freq(%rip)
307 jne .L22
308 movl 4(%rbx), %eax
309 movl %eax, ref_freq(%rip)
310 movq (%rdi), %rax
311 movq %rax, loops_per_jiffy_ref(%rip)
312 mov tsc_khz(%rip), %eax
313 movq %rax, tsc_khz_ref(%rip)
314.L22:
315 testq %rsi, %rsi
316 jne .L23
317 movl 8(%rbx), %eax
318 cmpl %eax, 4(%rbx)
319 jb .L24
320 jmp .L25
321.L23:
322 cmpq $1, %rsi
323 jne .L26
324 movl 8(%rbx), %eax
325 cmpl %eax, 4(%rbx)
326 ja .L24
327 jmp .L25
328.L26:
329 cmpq $8, %rsi
330 jne .L25
331.L24:
332 mov ref_freq(%rip), %ecx
333 mov 8(%rbx), %eax
334 xorl %edx, %edx
335 imulq loops_per_jiffy_ref(%rip), %rax
336 divq %rcx
337 xorl %edx, %edx
338 movq %rax, (%rdi)
339 mov 8(%rbx), %eax
340 imulq tsc_khz_ref(%rip), %rax
341 divq %rcx
342 testb $2, 12(%rbx)
343 movl %eax, tsc_khz(%rip)
344 jne .L25
345 movq $.LC4, %rdi
346 call mark_tsc_unstable
347.L25:
348 mov tsc_khz(%rip), %edi
349 movl (%rbx), %esi
350 call set_cyc2ns_scale
351.L20:
352 xorl %eax, %eax
353 popq %rbx
354 ret
355 .size time_cpufreq_notifier, .-time_cpufreq_notifier
356 .type tsc_read_refs, @function
357tsc_read_refs:
358 pushq %r13
359 movl %esi, %r13d
360 pushq %r12
361 pushq %rbp
362 movl $5, %ebp
363 pushq %rbx
364 movq %rdi, %rbx
365 subq $8, %rsp
366.L33:
367#APP
368# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
369 rdtsc
370# 0 "" 2
371#NO_APP
372 movq %rdx, %r12
373 mov %eax, %eax
374 salq $32, %r12
375 orq %rax, %r12
376 testl %r13d, %r13d
377 je .L29
378 movl $240, %edi
379 call hpet_readl
380 jmp .L31
381.L29:
382 xorl %eax, %eax
383 cmpl $0, pmtmr_ioport(%rip)
384 je .L31
385 call acpi_pm_read_verified
386 andl $16777215, %eax
387.L31:
388 mov %eax, %eax
389 movq %rax, (%rbx)
390#APP
391# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
392 rdtsc
393# 0 "" 2
394#NO_APP
395 movl %eax, %ecx
396 movq %rdx, %rax
397 mov %ecx, %ecx
398 salq $32, %rax
399 orq %rcx, %rax
400 movq %rax, %rdx
401 subq %r12, %rdx
402 cmpq $49999, %rdx
403 jbe .L32
404 decl %ebp
405 jne .L33
406 orq $-1, %rax
407.L32:
408 addq $8, %rsp
409 popq %rbx
410 popq %rbp
411 popq %r12
412 popq %r13
413 ret
414 .size tsc_read_refs, .-tsc_read_refs
415.globl native_sched_clock
416 .type native_sched_clock, @function
417native_sched_clock:
418 cmpl $0, tsc_disabled(%rip)
419 je .L37
420 imulq $1000000, jiffies_64(%rip), %rdx
421 movabsq $-4294667296000000, %rax
422 addq %rax, %rdx
423 jmp .L38
424.L37:
425#APP
426# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
427 rdtsc
428# 0 "" 2
429# 50 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/timer.h" 1
430 movl %gs:cpu_number,%esi
431# 0 "" 2
432#NO_APP
433 movq $cyc2ns_offset, %rcx
434 movslq %esi, %rsi
435 salq $32, %rdx
436 movq __per_cpu_offset(,%rsi,8), %rdi
437 movq $cyc2ns, %rsi
438 mov %eax, %eax
439 orq %rax, %rdx
440 imulq (%rdi,%rsi), %rdx
441 shrq $10, %rdx
442 addq (%rdi,%rcx), %rdx
443.L38:
444 movq %rdx, %rax
445 ret
446 .size native_sched_clock, .-native_sched_clock
447 .section .rodata.str1.1
448.LC5:
449 .string "HPET"
450.LC6:
451 .string "PMTIMER"
452.LC7:
453 .string "Fast TSC calibration failed\n"
454.LC8:
455 .string "Fast TSC calibration using PIT\n"
456.LC9:
457 .string "<6>TSC: PIT calibration matches %s. %d loops\n"
458.LC10:
459 .string "<4>TSC: Unable to calibrate against PIT\n"
460.LC11:
461 .string "TSC: No reference (HPET/PMTIMER) available\n"
462.LC12:
463 .string "<4>TSC: HPET/PMTIMER calibration failed.\n"
464.LC13:
465 .string "<6>TSC: using %s reference calibration\n"
466.LC14:
467 .string "<6>TSC: Using PIT calibration value\n"
468.LC15:
469 .string "<4>TSC: HPET/PMTIMER calibration failed. Using PIT calibration\n"
470.LC16:
471 .string "<4>TSC: PIT calibration deviates from %s: %lu %lu.\n"
472 .text
473.globl native_calibrate_tsc
474 .type native_calibrate_tsc, @function
475native_calibrate_tsc:
476 pushq %r15
477 pushq %r14
478 pushq %r13
479 pushq %r12
480 pushq %rbp
481 pushq %rbx
482 subq $56, %rsp
483 call is_hpet_enabled
484 movl %eax, %r12d
485#APP
486# 20 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
487 # __raw_save_flags
488 pushf ; pop %rbx
489# 0 "" 2
490# 39 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
491 cli
492# 0 "" 2
493# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
494 inb $97, %al
495# 0 "" 2
496#NO_APP
497 andl $-4, %eax
498 orl $1, %eax
499#APP
500# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
501 outb %al, $97
502# 0 "" 2
503#NO_APP
504 movb $-80, %al
505#APP
506# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
507 outb %al, $67
508# 0 "" 2
509#NO_APP
510 movb $-1, %al
511#APP
512# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
513 outb %al, $66
514# 0 "" 2
515# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
516 outb %al, $66
517# 0 "" 2
518# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
519 inb $66, %al
520# 0 "" 2
521# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
522 inb $66, %al
523# 0 "" 2
524#NO_APP
525 xorl %edi, %edi
526 xorl %esi, %esi
527.L41:
528#APP
529# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
530 inb $66, %al
531# 0 "" 2
532# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
533 inb $66, %al
534# 0 "" 2
535#NO_APP
536 incb %al
537 jne .L40
538#APP
539# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
540 rdtsc
541# 0 "" 2
542#NO_APP
543 movq %rdx, %rdi
544 mov %eax, %eax
545 salq $32, %rdi
546 incl %esi
547 orq %rax, %rdi
548 cmpl $50000, %esi
549 jne .L41
550.L40:
551#APP
552# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
553 rdtsc
554# 0 "" 2
555#NO_APP
556 movq %rdx, %rcx
557 mov %eax, %eax
558 salq $32, %rcx
559 orq %rax, %rcx
560 subq %rdi, %rcx
561 cmpl $5, %esi
562 jle .L42
563 movl $1, %esi
564.L46:
565 movb %sil, %al
566 movb %sil, %r8b
567 notl %eax
568 xorl %r13d, %r13d
569 movb %al, %r9b
570 xorl %ebp, %ebp
571.L44:
572#APP
573# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
574 inb $66, %al
575# 0 "" 2
576# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
577 inb $66, %al
578# 0 "" 2
579#NO_APP
580 cmpb %r9b, %al
581 jne .L43
582#APP
583# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
584 rdtsc
585# 0 "" 2
586#NO_APP
587 movq %rdx, %r13
588 mov %eax, %eax
589 salq $32, %r13
590 incl %ebp
591 orq %rax, %r13
592 cmpl $50000, %ebp
593 jne .L44
594.L43:
595#APP
596# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
597 rdtsc
598# 0 "" 2
599#NO_APP
600 cmpl $5, %ebp
601 jle .L42
602 salq $32, %rdx
603 mov %eax, %eax
604 orq %rax, %rdx
605 subq %r13, %rdx
606 subq %rdi, %r13
607 leaq (%rdx,%rcx), %rbp
608 movq %r13, %rax
609 shrq $11, %rax
610 cmpq %rax, %rbp
611 jb .L45
612 incl %esi
613 cmpl $117, %esi
614 jne .L46
615 jmp .L42
616.L45:
617#APP
618# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
619 inb $66, %al
620# 0 "" 2
621# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
622 inb $66, %al
623# 0 "" 2
624#NO_APP
625 movb $-2, %dil
626 subb %r8b, %dil
627 cmpb %dil, %al
628 je .L47
629.L42:
630 movq $.LC7, %rdi
631 xorl %eax, %eax
632 xorl %r13d, %r13d
633 call printk
634 jmp .L48
635.L47:
636 movq %rdx, %rax
637 imull $256000, %esi, %esi
638 subq %rcx, %rax
639 mov %esi, %esi
640 movl $2, %ecx
641 cqto
642 movq $.LC8, %rdi
643 idivq %rcx
644 xorl %edx, %edx
645 leaq (%rax,%r13), %r13
646 imulq $1193182, %r13, %r13
647 movq %r13, %rax
648 divq %rsi
649 movq %rax, %r13
650 xorl %eax, %eax
651 call printk
652.L48:
653#APP
654# 31 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
655 push %rbx ; popf
656# 0 "" 2
657#NO_APP
658 testq %r13, %r13
659 jne .L51
660 orq $-1, %rbp
661 movl $1000, 28(%rsp)
662 movl $0, 24(%rsp)
663 movl $10, %r15d
664 movl $11931, %r14d
665 movq %rbp, %rbx
666.L67:
667#APP
668# 20 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
669 # __raw_save_flags
670 pushf ; pop 16(%rsp)
671# 0 "" 2
672# 39 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
673 cli
674# 0 "" 2
675#NO_APP
676 movl %r12d, %esi
677 leaq 40(%rsp), %rdi
678 call tsc_read_refs
679 movq %rax, %r11
680#APP
681# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
682 inb $97, %al
683# 0 "" 2
684#NO_APP
685 andl $-4, %eax
686 orl $1, %eax
687#APP
688# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
689 outb %al, $97
690# 0 "" 2
691#NO_APP
692 movb $-80, %al
693#APP
694# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
695 outb %al, $67
696# 0 "" 2
697#NO_APP
698 movb %r14b, %al
699#APP
700# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
701 outb %al, $66
702# 0 "" 2
703#NO_APP
704 movl %r14d, %eax
705 shrl $8, %eax
706#APP
707# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
708 outb %al, $66
709# 0 "" 2
710# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
711 rdtsc
712# 0 "" 2
713#NO_APP
714 xorl %r9d, %r9d
715 movq %rdx, %rcx
716 mov %eax, %eax
717 salq $32, %rcx
718 xorl %esi, %esi
719 orq %rax, %rcx
720 orq $-1, %rdi
721 movq %rcx, %r8
722 jmp .L52
723.L55:
724#APP
725# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
726 rdtsc
727# 0 "" 2
728#NO_APP
729 salq $32, %rdx
730 mov %eax, %eax
731 orq %rax, %rdx
732 movq %rdx, %rax
733 subq %r8, %rax
734 mov %eax, %r8d
735 cmpq %rdi, %rax
736 cmovb %r8, %rdi
737 cmpq %rsi, %rax
738 cmova %r8, %rsi
739 incl %r9d
740 movq %rdx, %r8
741.L52:
742#APP
743# 327 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/io.h" 1
744 inb $97, %al
745# 0 "" 2
746#NO_APP
747 testb $32, %al
748 je .L55
749 orq $-1, %r10
750 cmpl 28(%rsp), %r9d
751 jl .L56
752 imulq $10, %rdi, %rdi
753 cmpq %rdi, %rsi
754 ja .L56
755 subq %rcx, %r8
756 xorl %edx, %edx
757 mov %r15d, %ecx
758 movq %r8, %rax
759 divq %rcx
760 movq %rax, %r10
761.L56:
762 movq %r10, (%rsp)
763 movq %r11, 8(%rsp)
764 movl %r12d, %esi
765 leaq 32(%rsp), %rdi
766 call tsc_read_refs
767 movq (%rsp), %r10
768 movq 8(%rsp), %r11
769#APP
770# 31 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
771 push 16(%rsp) ; popf
772# 0 "" 2
773#NO_APP
774 cmpq %r10, %rbx
775 cmova %r10, %rbx
776 testl %r12d, %r12d
777 jne .L59
778 cmpq $0, 40(%rsp)
779 jne .L59
780 cmpq $0, 32(%rsp)
781 je .L60
782.L59:
783 cmpq $-1, %rax
784 je .L60
785 cmpq $-1, %r11
786 je .L60
787 subq %r11, %rax
788 movq 32(%rsp), %rsi
789 imulq $1000000, %rax, %rax
790 movq 40(%rsp), %rcx
791 movq %rax, 16(%rsp)
792 testl %r12d, %r12d
793 je .L61
794 cmpq %rcx, %rsi
795 movq %rcx, (%rsp)
796 movabsq $4294967296, %rax
797 movl $4, %edi
798 leaq (%rsi,%rax), %rax
799 cmovb %rax, %rsi
800 movq %rsi, 8(%rsp)
801 call hpet_readl
802 movq (%rsp), %rcx
803 mov %eax, %eax
804 movq 8(%rsp), %rsi
805 subq %rcx, %rsi
806 movl $1000000, %ecx
807 imulq %rsi, %rax
808 jmp .L86
809.L61:
810 orq $-1, %rax
811 movq %rcx, %rdx
812 orq %rsi, %rdx
813 je .L63
814 cmpq %rcx, %rsi
815 leaq 16777216(%rsi), %rax
816 cmovb %rax, %rsi
817 subq %rcx, %rsi
818 movl $3579545, %ecx
819 imulq $1000000000, %rsi, %rax
820.L86:
821 xorl %edx, %edx
822 divq %rcx
823 xorl %edx, %edx
824 mov %eax, %ecx
825 movq 16(%rsp), %rax
826 divq %rcx
827.L63:
828 cmpq %rax, %rbp
829 cmova %rax, %rbp
830 imulq $100, %rbx, %rax
831 xorl %edx, %edx
832 mov %ebp, %ecx
833 divq %rcx
834 subq $90, %rax
835 cmpq $20, %rax
836 ja .L65
837 movl 24(%rsp), %edx
838 movq $.LC6, %rax
839 incl %edx
840 movq $.LC5, %rsi
841 testl %r12d, %r12d
842 movq $.LC9, %rdi
843 cmove %rax, %rsi
844 xorl %eax, %eax
845 call printk
846 jmp .L87
847.L65:
848 cmpq $-1, %rbx
849 jne .L60
850 cmpl $1, 24(%rsp)
851 movl $5000, %ecx
852 sete %al
853 cmovne 28(%rsp), %ecx
854 movl $50, %edx
855 testb %al, %al
856 movl %ecx, 28(%rsp)
857 cmovne %rdx, %r15
858 movl $59659, %ecx
859 cmovne %rcx, %r14
860.L60:
861 incl 24(%rsp)
862 cmpl $3, 24(%rsp)
863 jne .L67
864 cmpq $-1, %rbx
865 jne .L68
866 xorl %eax, %eax
867 movq $.LC10, %rdi
868 call printk
869 testl %r12d, %r12d
870 jne .L69
871 cmpq $0, 40(%rsp)
872 jne .L69
873 movq $.LC11, %rdi
874 cmpq $0, 32(%rsp)
875 je .L89
876.L69:
877 cmpq $-1, %rbp
878 jne .L70
879 movq $.LC12, %rdi
880.L89:
881 xorl %eax, %eax
882 call printk
883 jmp .L51
884.L70:
885 testl %r12d, %r12d
886 movq $.LC6, %rax
887 movq $.LC5, %rsi
888 movq $.LC13, %rdi
889 cmove %rax, %rsi
890 xorl %eax, %eax
891 call printk
892.L87:
893 movq %rbp, %r13
894 jmp .L51
895.L68:
896 testl %r12d, %r12d
897 jne .L72
898 cmpq $0, 40(%rsp)
899 jne .L72
900 cmpq $0, 32(%rsp)
901 je .L90
902.L72:
903 movq $.LC15, %rdi
904 cmpq $-1, %rbp
905 je .L88
906 testl %r12d, %r12d
907 movq $.LC6, %rax
908 movq $.LC5, %rsi
909 movq %rbp, %rcx
910 cmove %rax, %rsi
911 movq %rbx, %rdx
912 movq $.LC16, %rdi
913 xorl %eax, %eax
914 call printk
915.L90:
916 movq $.LC14, %rdi
917.L88:
918 xorl %eax, %eax
919 movq %rbx, %r13
920 call printk
921.L51:
922 addq $56, %rsp
923 movq %r13, %rax
924 popq %rbx
925 popq %rbp
926 popq %r12
927 popq %r13
928 popq %r14
929 popq %r15
930 ret
931 .size native_calibrate_tsc, .-native_calibrate_tsc
932 .section .cpuinit.text,"ax",@progbits
933.globl unsynchronized_tsc
934 .type unsynchronized_tsc, @function
935unsynchronized_tsc:
936 pushq %rbx
937 testb $16, boot_cpu_data+20(%rip)
938 movl $1, %ebx
939 je .L92
940 cmpl $0, tsc_unstable(%rip)
941 jne .L92
942 call apic_is_clustered_box
943 testl %eax, %eax
944 jne .L92
945 xorb %bl, %bl
946 testb $1, boot_cpu_data+33(%rip)
947 jne .L92
948 cmpb $0, boot_cpu_data+1(%rip)
949 je .L93
950 movq cpu_possible_mask(%rip), %rax
951 movq (%rax), %rdi
952 andl $15, %edi
953 call hweight64
954 cmpl $1, %eax
955 jbe .L93
956 movl $1, tsc_unstable(%rip)
957.L93:
958 movl tsc_unstable(%rip), %ebx
959.L92:
960 movl %ebx, %eax
961 popq %rbx
962 ret
963 .size unsynchronized_tsc, .-unsynchronized_tsc
964 .section .rodata.str1.1
965.LC17:
966 .string "could not calculate TSC khz"
967.LC18:
968 .string "<4>Warning: AMD perfctrs busy ... cpu_khz value may be incorrect.\n"
969.LC19:
970 .string "arch/x86/kernel/tsc.c"
971.LC20:
972 .string "Detected %lu.%03lu MHz processor.\n"
973.LC21:
974 .string "TSCs unsynchronized"
975 .section .init.text
976.globl tsc_init
977 .type tsc_init, @function
978tsc_init:
979 pushq %r13
980 pushq %r12
981 pushq %rbp
982 pushq %rbx
983 subq $8, %rsp
984 call *x86_init+152(%rip)
985 testb $16, boot_cpu_data+20(%rip)
986 je .L98
987 call *x86_platform(%rip)
988 movl %eax, tsc_khz(%rip)
989 movl %eax, cpu_khz(%rip)
990 testl %eax, %eax
991 jne .L100
992 addq $8, %rsp
993 movq $.LC17, %rdi
994 popq %rbx
995 popq %rbp
996 popq %r12
997 popq %r13
998 jmp mark_tsc_unstable
999.L100:
1000 testb $1, boot_cpu_data+33(%rip)
1001 je .L101
1002 cmpb $2, boot_cpu_data+1(%rip)
1003 jne .L101
1004 xorl %ebp, %ebp
1005.L103:
1006 movl %ebp, %edi
1007 call avail_to_resrv_perfctr_nmi_bit
1008 testl %eax, %eax
1009 jne .L102
1010 incl %ebp
1011 cmpl $4, %ebp
1012 jne .L103
1013.L102:
1014 xorl %ebx, %ebx
1015 cmpl $4, %ebp
1016 sete %bl
1017 jne .L104
1018 movq $.LC18, %rdx
1019 movl $879, %esi
1020 movq $.LC19, %rdi
1021 xorl %eax, %eax
1022 call warn_slowpath_fmt
1023 movl $-1073676285, %ecx
1024#APP
1025# 72 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1026 rdmsr
1027# 0 "" 2
1028#NO_APP
1029 movq %rdx, %rsi
1030 mov %eax, %eax
1031 salq $32, %rsi
1032 orq %rax, %rsi
1033 xorl %eax, %eax
1034 movl %eax, %edx
1035#APP
1036# 95 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1037 wrmsr
1038# 0 "" 2
1039#NO_APP
1040 movl $-1073676281, %ecx
1041#APP
1042# 72 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1043 rdmsr
1044# 0 "" 2
1045#NO_APP
1046 movq %rdx, %r8
1047 mov %eax, %eax
1048 salq $32, %r8
1049 movb $3, %bpl
1050 orq %rax, %r8
1051 jmp .L105
1052.L104:
1053 leal -1073676284(%rbp), %edi
1054 call reserve_perfctr_nmi
1055 leal -1073676288(%rbp), %edi
1056 call reserve_evntsel_nmi
1057 xorl %r8d, %r8d
1058 xorl %esi, %esi
1059.L105:
1060#APP
1061# 20 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
1062 # __raw_save_flags
1063 pushf ; pop %r9
1064# 0 "" 2
1065# 39 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
1066 cli
1067# 0 "" 2
1068#NO_APP
1069 xorl %edx, %edx
1070 leal -1073676284(%rbp), %edi
1071 movl %edx, %eax
1072 movl %edi, %ecx
1073#APP
1074# 95 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1075 wrmsr
1076# 0 "" 2
1077#NO_APP
1078 movl $4391030, %eax
1079 subl $1073676288, %ebp
1080 movl %ebp, %ecx
1081#APP
1082# 95 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1083 wrmsr
1084# 0 "" 2
1085# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1086 rdtsc
1087# 0 "" 2
1088#NO_APP
1089 movl %eax, %r10d
1090.L106:
1091 movl %edi, %ecx
1092#APP
1093# 72 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1094 rdmsr
1095# 0 "" 2
1096#NO_APP
1097 movq %rdx, %r12
1098 mov %eax, %eax
1099 salq $32, %r12
1100 orq %rax, %r12
1101#APP
1102# 125 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1103 rdtsc
1104# 0 "" 2
1105#NO_APP
1106 movl %eax, %r13d
1107 subl %r10d, %r13d
1108 cmpl $99999999, %r13d
1109 jle .L106
1110#APP
1111# 31 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/irqflags.h" 1
1112 push %r9 ; popf
1113# 0 "" 2
1114#NO_APP
1115 testl %ebx, %ebx
1116 je .L109
1117 movl $-1073676285, %ebx
1118 xorl %eax, %eax
1119 movl %ebx, %ecx
1120 movl %eax, %edx
1121#APP
1122# 95 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1123 wrmsr
1124# 0 "" 2
1125#NO_APP
1126 movl $-1073676281, %ecx
1127 movq %r8, %rdx
1128 movl %r8d, %eax
1129 shrq $32, %rdx
1130#APP
1131# 95 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1132 wrmsr
1133# 0 "" 2
1134#NO_APP
1135 movq %rsi, %rdx
1136 movl %ebx, %ecx
1137 shrq $32, %rdx
1138 movl %esi, %eax
1139#APP
1140# 95 "/home/hongxun/tmp/comp/linux-2.6.34/arch/x86/include/asm/msr.h" 1
1141 wrmsr
1142# 0 "" 2
1143#NO_APP
1144 jmp .L110
1145.L109:
1146 call release_perfctr_nmi
1147 movl %ebp, %edi
1148 call release_evntsel_nmi
1149.L110:
1150 mov tsc_khz(%rip), %eax
1151 movslq %r13d, %r13
1152 imulq %r12, %rax
1153 xorl %edx, %edx
1154 divq %r13
1155 movl %eax, cpu_khz(%rip)
1156.L101:
1157 movl cpu_khz(%rip), %eax
1158 movl $1000, %ecx
1159 xorl %edx, %edx
1160 movq $.LC20, %rdi
1161 divl %ecx
1162 orl $-1, %ebp
1163 mov %eax, %esi
1164 mov %edx, %edx
1165 xorl %eax, %eax
1166 call printk
1167 movq cpu_possible_mask(%rip), %rbx
1168 jmp .L111
1169.L112:
1170 mov cpu_khz(%rip), %edi
1171 movl %eax, %esi
1172 call set_cyc2ns_scale
1173.L111:
1174 incl %ebp
1175 movl $4, %esi
1176 movslq %ebp, %rdx
1177 movq %rbx, %rdi
1178 call find_next_bit
1179 movl %eax, %ebp
1180 cmpl nr_cpu_ids(%rip), %eax
1181 jl .L112
1182 cmpl $0, tsc_disabled(%rip)
1183 jg .L98
1184 movl $1000, %ecx
1185 mov tsc_khz(%rip), %eax
1186 xorl %edx, %edx
1187 imulq $1000, %rax, %rax
1188 movl $0, tsc_disabled(%rip)
1189 divq %rcx
1190 movq %rax, lpj_fine(%rip)
1191 call use_tsc_delay
1192 movq $bad_tsc_dmi_table, %rdi
1193 call dmi_check_system
1194 call unsynchronized_tsc
1195 testl %eax, %eax
1196 je .L113
1197 movq $.LC21, %rdi
1198 call mark_tsc_unstable
1199.L113:
1200 testb $-128, boot_cpu_data+34(%rip)
1201 je .L114
1202 movl $1, tsc_clocksource_reliable(%rip)
1203.L114:
1204 mov tsc_khz(%rip), %ebx
1205 movl $1000000, %eax
1206 movl clocksource_tsc+68(%rip), %ecx
1207 movl %ebx, %edx
1208 salq %cl, %rax
1209 shrl %edx
1210 mov %edx, %edx
1211 leaq (%rdx,%rax), %rax
1212 xorl %edx, %edx
1213 divq %rbx
1214 cmpl $0, tsc_clocksource_reliable(%rip)
1215 movl %eax, clocksource_tsc+64(%rip)
1216 je .L115
1217 andq $-3, clocksource_tsc+80(%rip)
1218.L115:
1219 cmpl $0, tsc_unstable(%rip)
1220 je .L116
1221 movl $0, clocksource_tsc+24(%rip)
1222 andq $-2, clocksource_tsc+80(%rip)
1223.L116:
1224 addq $8, %rsp
1225 movq $clocksource_tsc, %rdi
1226 popq %rbx
1227 popq %rbp
1228 popq %r12
1229 popq %r13
1230 jmp clocksource_register
1231.L98:
1232 addq $8, %rsp
1233 popq %rbx
1234 popq %rbp
1235 popq %r12
1236 popq %r13
1237 ret
1238 .size tsc_init, .-tsc_init
1239.globl cpu_khz
1240 .section .data.read_mostly,"aw",@progbits
1241 .align 4
1242 .type cpu_khz, @object
1243 .size cpu_khz, 4
1244cpu_khz:
1245 .zero 4
1246.globl tsc_khz
1247 .align 4
1248 .type tsc_khz, @object
1249 .size tsc_khz, 4
1250tsc_khz:
1251 .zero 4
1252.globl cyc2ns
1253 .section .data.percpu,"aw",@progbits
1254 .align 8
1255 .type cyc2ns, @object
1256 .size cyc2ns, 8
1257cyc2ns:
1258 .zero 8
1259.globl cyc2ns_offset
1260 .align 8
1261 .type cyc2ns_offset, @object
1262 .size cyc2ns_offset, 8
1263cyc2ns_offset:
1264 .zero 8
1265 .section __ksymtab_gpl,"a",@progbits
1266 .align 16
1267 .type __ksymtab_mark_tsc_unstable, @object
1268 .size __ksymtab_mark_tsc_unstable, 16
1269__ksymtab_mark_tsc_unstable:
1270 .quad mark_tsc_unstable
1271 .quad __kstrtab_mark_tsc_unstable
1272 .section .initcall1.init,"aw",@progbits
1273 .align 8
1274 .type __initcall_cpufreq_tsc1, @object
1275 .size __initcall_cpufreq_tsc1, 8
1276__initcall_cpufreq_tsc1:
1277 .quad cpufreq_tsc
1278 .section __ksymtab,"a",@progbits
1279 .align 16
1280 .type __ksymtab_recalibrate_cpu_khz, @object
1281 .size __ksymtab_recalibrate_cpu_khz, 16
1282__ksymtab_recalibrate_cpu_khz:
1283 .quad recalibrate_cpu_khz
1284 .quad __kstrtab_recalibrate_cpu_khz
1285 .section .init.setup,"aw",@progbits
1286 .align 8
1287 .type __setup_tsc_setup, @object
1288 .size __setup_tsc_setup, 24
1289__setup_tsc_setup:
1290 .quad __setup_str_tsc_setup
1291 .quad tsc_setup
1292 .long 0
1293 .zero 4
1294 .align 8
1295 .type __setup_notsc_setup, @object
1296 .size __setup_notsc_setup, 24
1297__setup_notsc_setup:
1298 .quad __setup_str_notsc_setup
1299 .quad notsc_setup
1300 .long 0
1301 .zero 4
1302 .section __ksymtab_gpl
1303 .align 16
1304 .type __ksymtab_check_tsc_unstable, @object
1305 .size __ksymtab_check_tsc_unstable, 16
1306__ksymtab_check_tsc_unstable:
1307 .quad check_tsc_unstable
1308 .quad __kstrtab_check_tsc_unstable
1309 .section __ksymtab
1310 .align 16
1311 .type __ksymtab_tsc_khz, @object
1312 .size __ksymtab_tsc_khz, 16
1313__ksymtab_tsc_khz:
1314 .quad tsc_khz
1315 .quad __kstrtab_tsc_khz
1316 .align 16
1317 .type __ksymtab_cpu_khz, @object
1318 .size __ksymtab_cpu_khz, 16
1319__ksymtab_cpu_khz:
1320 .quad cpu_khz
1321 .quad __kstrtab_cpu_khz
1322 .local tsc_clocksource_reliable
1323 .comm tsc_clocksource_reliable,4,4
1324 .data
1325 .align 16
1326 .type time_cpufreq_notifier_block, @object
1327 .size time_cpufreq_notifier_block, 24
1328time_cpufreq_notifier_block:
1329 .quad time_cpufreq_notifier
1330 .zero 16
1331 .local ref_freq
1332 .comm ref_freq,4,4
1333 .local loops_per_jiffy_ref
1334 .comm loops_per_jiffy_ref,8,8
1335 .local tsc_khz_ref
1336 .comm tsc_khz_ref,8,8
1337 .section .data.read_mostly
1338 .align 4
1339 .type tsc_disabled, @object
1340 .size tsc_disabled, 4
1341tsc_disabled:
1342 .long -1
1343 .section .rodata.str1.1
1344.LC22:
1345 .string "IBM Thinkpad 380XD"
1346 .section .init.data,"aw",@progbits
1347 .align 16
1348 .type bad_tsc_dmi_table, @object
1349 .size bad_tsc_dmi_table, 688
1350bad_tsc_dmi_table:
1351 .quad dmi_mark_tsc_unstable
1352 .quad .LC22
1353 .byte 9
1354 .string "IBM"
1355 .zero 75
1356 .byte 10
1357 .string "2635FA0"
1358 .zero 71
1359 .zero 160
1360 .zero 8
1361 .zero 344
1362 .section .data.read_mostly
1363 .align 4
1364 .type tsc_unstable, @object
1365 .size tsc_unstable, 4
1366tsc_unstable:
1367 .zero 4
1368 .section .rodata.str1.1
1369.LC23:
1370 .string "tsc"
1371 .data
1372 .align 64
1373 .type clocksource_tsc, @object
1374 .size clocksource_tsc, 192
1375clocksource_tsc:
1376 .quad .LC23
1377 .zero 16
1378 .long 300
1379 .zero 4
1380 .quad read_tsc
1381 .zero 16
1382 .quad -1
1383 .zero 4
1384 .long 22
1385 .zero 8
1386 .quad 3
1387 .quad vread_tsc
1388 .zero 8
1389 .quad resume_tsc
1390 .zero 80
1391 .section __ksymtab_strings,"a",@progbits
1392 .type __kstrtab_mark_tsc_unstable, @object
1393 .size __kstrtab_mark_tsc_unstable, 18
1394__kstrtab_mark_tsc_unstable:
1395 .string "mark_tsc_unstable"
1396 .type __kstrtab_recalibrate_cpu_khz, @object
1397 .size __kstrtab_recalibrate_cpu_khz, 20
1398__kstrtab_recalibrate_cpu_khz:
1399 .string "recalibrate_cpu_khz"
1400 .section .init.rodata,"a",@progbits
1401 .type __setup_str_tsc_setup, @object
1402 .size __setup_str_tsc_setup, 5
1403__setup_str_tsc_setup:
1404 .string "tsc="
1405 .type __setup_str_notsc_setup, @object
1406 .size __setup_str_notsc_setup, 6
1407__setup_str_notsc_setup:
1408 .string "notsc"
1409 .section __ksymtab_strings
1410 .type __kstrtab_check_tsc_unstable, @object
1411 .size __kstrtab_check_tsc_unstable, 19
1412__kstrtab_check_tsc_unstable:
1413 .string "check_tsc_unstable"
1414 .type __kstrtab_tsc_khz, @object
1415 .size __kstrtab_tsc_khz, 8
1416__kstrtab_tsc_khz:
1417 .string "tsc_khz"
1418 .type __kstrtab_cpu_khz, @object
1419 .size __kstrtab_cpu_khz, 8
1420__kstrtab_cpu_khz:
1421 .string "cpu_khz"
1422.globl sched_clock
1423 .set sched_clock,native_sched_clock
1424 .ident "GCC: (GNU) 4.5.1 20100522 (prerelease)"
1425 .section .note.GNU-stack,"",@progbits