2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * @OSF_FREE_COPYRIGHT@
28 /* Routines to perform high-speed scrolling, assuming that the memory is
29 * non-cached, and that the amount of memory to be scrolled is a multiple
34 #include <ppc/proc_reg.h>
37 * void video_scroll_up(unsigned long start,
42 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
44 mfmsr r0 /* Get the MSR */
45 mflr r6 /* Get the LR */
46 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
47 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
48 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
49 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
51 mtmsr r7 /* Turn on FPU */
52 isync /* Wait for it */
54 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
55 stfd f1,(FM_SIZE+8)(r1) /* and the second */
57 /* ok, now we can use the FPU registers to do some fast copying
74 blt+ cr0, .L_vscr_up_loop
76 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
77 lfd f1,(FM_SIZE+8)(r1) /* and the second */
78 lwz r1,0(r1) /* Pop the stack */
80 mtmsr r0 /* Turn off FPU again */
81 isync /* Wait for it */
82 blr /* Go away, don't bother me... */
86 * void video_scroll_down(unsigned long start, HIGH address to scroll from
87 * unsigned long end, LOW address
88 * unsigned long dest) HIGH address
91 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
93 /* Save off the link register, we want to call fpu_save.
97 mfmsr r0 /* Get the MSR */
98 mflr r6 /* Get the LR */
99 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
100 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
101 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
102 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
104 mtmsr r7 /* Turn on FPU */
105 isync /* Wait for it */
107 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
108 stfd f1,(FM_SIZE+8)(r1) /* and the second */
110 /* ok, now we can use the FPU registers to do some fast copying */
126 bgt+ cr0, .L_vscr_down_loop
129 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
130 lfd f1,(FM_SIZE+8)(r1) /* and the second */
131 lwz r1,0(r1) /* Pop the stack */
133 mtmsr r0 /* Turn off FPU again */
134 isync /* Wait for it */
135 blr /* Go away, don't bother me... */