arch/m68k-all/exec: Get cachecontrol_.S to compile under gcc 4.8.3
[AROS.git] / arch / m68k-all / exec / cachecontrol_.S
blobd009969f7176602a5768785b4e81d3ed91b6d629
1 /*
2     Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3     $Id$
5     Desc: CacheControl() - Global control of the system caches.
6     Lang: english
7 */
9         #include "aros/m68k/asm.h"
10         #include "cache.h"
12         .chip 68060
14         .text
16         .balign 4
17         .globl  AROS_SLIB_ENTRY(CacheControl_00,Exec,108)
18         .type   AROS_SLIB_ENTRY(CacheControl_00,Exec,108),@function
19 AROS_SLIB_ENTRY(CacheControl_00,Exec,108):
20         /* 68000/010 have no caches */
22 #if CACHEDEBUG
23         bsr             cachedebug
24 #endif
26         moveq #0,%d0
28 #if CACHEDEBUG
29         bsr             cachedebug2
30 #endif
32         rts
34         .globl  AROS_SLIB_ENTRY(CacheControl_20,Exec,108)
35         .type   AROS_SLIB_ENTRY(CacheControl_20,Exec,108),@function
36 AROS_SLIB_ENTRY(CacheControl_20,Exec,108):
38 #if CACHEDEBUG
39         bsr             cachedebug
40 #endif
42         move.l  %a5,%a1
43         lea.l   cachecontrolsup_20,%a5
44         jmp     Supervisor(%a6)
46 cachecontrolsup_20:
47         move.l  %a1,%a5
48         movem.l %d2/%d3,-(%sp)
49         or.w    #0x0700,%sr
50         move.l  %d0,%d2
51         movec   %cacr,%d0
52         move.l  %d0,%d3
53         and.l   %d1,%d2
54         not.l   %d1
55         and.l   %d1,%d3
56         or.l    %d2,%d3
57         or.w    #0x0808,%d3 // CACRF_ClearI|CACRF_ClearD
58         movec   %d3,%cacr
59         movem.l (%sp)+,%d2/%d3
61 #if CACHEDEBUG
62         bsr             cachedebug2
63 #endif
65         rte
67         .balign 4
68         .globl  AROS_SLIB_ENTRY(CacheControl_40,Exec,108)
69         .type   AROS_SLIB_ENTRY(CacheControl_40,Exec,108),@function
70 AROS_SLIB_ENTRY(CacheControl_40,Exec,108):
72 #if CACHEDEBUG
73         bsr             cachedebug
74 #endif
76         move.l  %a5,%a1
77         lea.l   cachecontrolsup_40,%a5
78         jmp     Supervisor(%a6)
79         
80 cachecontrolsup_40:
81         move.l  %a1,%a5
82         movem.l %d2/%d3,-(%sp)
83     move.l      %d0,%d2
85         and.l   #0x0101,%d1 // CACRF_EnableI|CACRF_EnableD
86         and.l   #0x0101,%d2 // CACRF_EnableI|CACRF_EnableD
88         // code cache 0 -> 15
89     bclr        #0,%d1
90     beq.s       3f
91     or.l        #0x20808000,%d1
92 3:      bclr    #0,%d2
93         beq.s   4f
94     or.l        #0x20808000,%d2
95 4:  
96     // data cache 8 -> 31
97     bclr        #8,%d1
98     beq.s       5f
99     bset        #31,%d1
100 5:      bclr    #8,%d2
101         beq.s   2f
102         bset    #31,%d2
104         or.w    #0x0700,%sr
105         movec   %cacr,%d0
106         move.l  %d0,%d3
107         and.l   %d1,%d2
108         not.l   %d1
109         and.l   %d1,%d3
110         or.l    %d2,%d3
111         // documentation says caches must be
112         // flushed before modifying cache state.
113         nop
114         cpusha  %bc
115         nop
116         movec   %d3,%cacr
117         
118     move.l %d0,%d1
119     moveq #0,%d0
120         // 040/060 code cache?
121     btst #15,%d1
122     beq.s 1f
123     // ->code+burst
124     or.w #0x0011,%d0 // CACRF_IBE|CACRF_EnableI
125 1:      // 040/060 data cache?
126         btst #31,%d1
127         beq.s 0f
128         // ->data+burst+copyback
129         or.l #0x80001100,%d0 // CACRF_CopyBack|CACRF_DBE|CACRF_EnableE
131         movem.l (%sp)+,%d2/%d3
133 #if CACHEDEBUG
134         bsr             cachedebug2
135 #endif
137     rte
139 #if CACHEDEBUG
140 cachedebug:
141         movem.l %d0-%d1/%a0-%a1,-(%sp)
142         move.l  %d1,-(%sp)
143         move.l  %d0,-(%sp)
144         pea format
145         jsr kprintf
146         lea     12(%sp),%sp
147         movem.l (%sp)+,%d0-%d1/%a0-%a1
148         rts
149 cachedebug2:
150         movem.l %d0-%d1/%a0-%a1,-(%sp)
151         move.l  %d0,-(%sp)
152         pea format2
153         jsr kprintf
154         lea     8(%sp),%sp
155         movem.l (%sp)+,%d0-%d1/%a0-%a1
156         rts
157 format:
158         .string "CO(%08x,%08x)"
159 format2:
160         .string "=%08x\n"
161 #endif