2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * @OSF_FREE_COPYRIGHT@
30 /* Routines to perform high-speed scrolling, assuming that the memory is
31 * non-cached, and that the amount of memory to be scrolled is a multiple
36 #include <ppc/proc_reg.h>
39 * void video_scroll_up(unsigned long start,
44 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
46 mfmsr r0 /* Get the MSR */
47 rlwinm r0,r0,0,MSR_FP_BIT+1,MSR_FP_BIT-1 ; Force floating point off
48 rlwinm r0,r0,0,MSR_VEC_BIT+1,MSR_VEC_BIT-1 ; Force vectors off
49 mflr r6 /* Get the LR */
50 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
51 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
52 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
53 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
55 mtmsr r7 /* Turn on FPU */
56 isync /* Wait for it */
58 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
59 stfd f1,(FM_SIZE+8)(r1) /* and the second */
61 /* ok, now we can use the FPU registers to do some fast copying
78 blt+ cr0, .L_vscr_up_loop
80 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
81 lfd f1,(FM_SIZE+8)(r1) /* and the second */
82 lwz r1,0(r1) /* Pop the stack */
84 mtmsr r0 /* Turn off FPU again */
85 isync /* Wait for it */
86 blr /* Go away, don't bother me... */
90 * void video_scroll_down(unsigned long start, HIGH address to scroll from
91 * unsigned long end, LOW address
92 * unsigned long dest) HIGH address
95 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
97 /* Save off the link register, we want to call fpu_save.
101 mfmsr r0 /* Get the MSR */
102 rlwinm r0,r0,0,MSR_FP_BIT+1,MSR_FP_BIT-1 ; Force floating point off
103 rlwinm r0,r0,0,MSR_VEC_BIT+1,MSR_VEC_BIT-1 ; Force vectors off
104 mflr r6 /* Get the LR */
105 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
106 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
107 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
108 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
110 mtmsr r7 /* Turn on FPU */
111 isync /* Wait for it */
113 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
114 stfd f1,(FM_SIZE+8)(r1) /* and the second */
116 /* ok, now we can use the FPU registers to do some fast copying */
132 bgt+ cr0, .L_vscr_down_loop
135 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
136 lfd f1,(FM_SIZE+8)(r1) /* and the second */
137 lwz r1,0(r1) /* Pop the stack */
139 mtmsr r0 /* Turn off FPU again */
140 isync /* Wait for it */
141 blr /* Go away, don't bother me... */