]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_FREE_COPYRIGHT@ | |
24 | * | |
25 | */ | |
26 | ||
27 | /* Routines to perform high-speed scrolling, assuming that the memory is | |
28 | * non-cached, and that the amount of memory to be scrolled is a multiple | |
29 | * of (at least) 16. | |
30 | */ | |
31 | ||
32 | #include <ppc/asm.h> | |
33 | #include <ppc/proc_reg.h> | |
34 | ||
35 | /* | |
36 | * void video_scroll_up(unsigned long start, | |
37 | * unsigned long end, | |
38 | * unsigned long dest) | |
39 | */ | |
40 | ||
41 | ENTRY(video_scroll_up, TAG_NO_FRAME_USED) | |
42 | ||
43 | mfmsr r0 /* Get the MSR */ | |
9bccf70c A |
44 | rlwinm r0,r0,0,MSR_FP_BIT+1,MSR_FP_BIT-1 ; Force floating point off |
45 | rlwinm r0,r0,0,MSR_VEC_BIT+1,MSR_VEC_BIT-1 ; Force vectors off | |
1c79356b A |
46 | mflr r6 /* Get the LR */ |
47 | ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */ | |
48 | stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */ | |
49 | rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */ | |
50 | stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */ | |
51 | ||
52 | mtmsr r7 /* Turn on FPU */ | |
53 | isync /* Wait for it */ | |
54 | ||
55 | vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */ | |
56 | stfd f1,(FM_SIZE+8)(r1) /* and the second */ | |
1c79356b A |
57 | |
58 | /* ok, now we can use the FPU registers to do some fast copying | |
59 | */ | |
60 | ||
61 | .L_vscr_up_loop: | |
62 | lfd f0, 0(r3) | |
63 | lfd f1, 8(r3) | |
64 | ||
65 | addi r3, r3, 16 | |
66 | ||
67 | stfd f0, 0(r5) | |
68 | ||
69 | cmpl cr0, r3, r4 | |
70 | ||
71 | stfd f1, 8(r5) | |
72 | ||
73 | addi r5, r5, 16 | |
74 | ||
75 | blt+ cr0, .L_vscr_up_loop | |
76 | ||
77 | lfd f0,(FM_SIZE+0)(r1) /* Load back one register */ | |
78 | lfd f1,(FM_SIZE+8)(r1) /* and the second */ | |
79 | lwz r1,0(r1) /* Pop the stack */ | |
80 | ||
81 | mtmsr r0 /* Turn off FPU again */ | |
82 | isync /* Wait for it */ | |
83 | blr /* Go away, don't bother me... */ | |
84 | ||
85 | ||
86 | /* | |
87 | * void video_scroll_down(unsigned long start, HIGH address to scroll from | |
88 | * unsigned long end, LOW address | |
89 | * unsigned long dest) HIGH address | |
90 | */ | |
91 | ||
92 | ENTRY(video_scroll_down, TAG_NO_FRAME_USED) | |
93 | ||
94 | /* Save off the link register, we want to call fpu_save. | |
95 | */ | |
96 | ||
97 | ||
98 | mfmsr r0 /* Get the MSR */ | |
9bccf70c A |
99 | rlwinm r0,r0,0,MSR_FP_BIT+1,MSR_FP_BIT-1 ; Force floating point off |
100 | rlwinm r0,r0,0,MSR_VEC_BIT+1,MSR_VEC_BIT-1 ; Force vectors off | |
1c79356b A |
101 | mflr r6 /* Get the LR */ |
102 | ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */ | |
103 | stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */ | |
104 | rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */ | |
105 | stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */ | |
106 | ||
107 | mtmsr r7 /* Turn on FPU */ | |
108 | isync /* Wait for it */ | |
109 | ||
110 | vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */ | |
111 | stfd f1,(FM_SIZE+8)(r1) /* and the second */ | |
1c79356b A |
112 | |
113 | /* ok, now we can use the FPU registers to do some fast copying */ | |
114 | ||
115 | .L_vscr_down_loop: | |
116 | lfd f0, -16(r3) | |
117 | lfd f1, -8(r3) | |
118 | ||
119 | subi r3, r3, 16 | |
120 | ||
121 | stfd f0, -16(r5) | |
122 | ||
123 | cmpl cr0, r3, r4 | |
124 | ||
125 | stfd f1, -8(r5) | |
126 | ||
127 | subi r5, r5, 16 | |
128 | ||
129 | bgt+ cr0, .L_vscr_down_loop | |
130 | ||
131 | ||
132 | lfd f0,(FM_SIZE+0)(r1) /* Load back one register */ | |
133 | lfd f1,(FM_SIZE+8)(r1) /* and the second */ | |
134 | lwz r1,0(r1) /* Pop the stack */ | |
135 | ||
136 | mtmsr r0 /* Turn off FPU again */ | |
137 | isync /* Wait for it */ | |
138 | blr /* Go away, don't bother me... */ | |
139 |