x86: Simplify the Makefile in a minor way through use of cc-ifversion
[pandora-kernel.git] / arch / mn10300 / kernel / profile-low.S
1 ###############################################################################
2 #
3 # Fast profiling interrupt handler
4 #
5 # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6 # Written by David Howells (dhowells@redhat.com)
7 #
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public Licence
10 # as published by the Free Software Foundation; either version
11 # 2 of the Licence, or (at your option) any later version.
12 #
13 ###############################################################################
14 #include <linux/sys.h>
15 #include <linux/linkage.h>
16 #include <asm/segment.h>
17 #include <asm/smp.h>
18 #include <asm/intctl-regs.h>
19 #include <asm/timer-regs.h>
20
21 #define pi break
22
23         .balign 4
24 counter:
25         .long   -1
26
27 ###############################################################################
28 #
29 # Profiling interrupt entry point
30 # - intended to run at interrupt priority 1
31 #
32 ###############################################################################
33 ENTRY(profile_handler)
34         movm    [d2,d3,a2],(sp)
35
36         # ignore userspace
37         mov     (12,sp),d2
38         and     EPSW_nSL,d2
39         bne     out
40
41         # do nothing if there's no buffer
42         mov     (prof_buffer),a2
43         and     a2,a2
44         beq     out
45         or      0x20000000,a2
46
47         # calculate relative position in text segment
48         mov     (16,sp),d2
49         sub     _stext,d2
50         mov     (prof_shift),d3
51         lsr     d3,d2
52         mov     (prof_len),d3
53         cmp     d3,d2
54         bcc     outside_text
55
56         # increment the appropriate profile bucket
57 do_inc:
58         asl2    d2
59         mov     (a2,d2),d3
60         inc     d3
61         mov     d3,(a2,d2)
62 out:
63         mov     GxICR_DETECT,d2
64         movbu   d2,(TM11ICR)            # ACK the interrupt
65         movbu   (TM11ICR),d2
66         movm    (sp),[d2,d3,a2]
67         rti
68
69 outside_text:
70         sub     1,d3
71         mov     d3,d2
72         bra     do_inc