2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * @OSF_FREE_COPYRIGHT@
35 /* Routines to perform high-speed scrolling, assuming that the memory is
36 * non-cached, and that the amount of memory to be scrolled is a multiple
41 #include <ppc/proc_reg.h>
44 * void video_scroll_up(unsigned long start,
49 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
51 mfmsr r0 /* Get the MSR */
52 mflr r6 /* Get the LR */
53 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
54 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
55 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
56 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
58 mtmsr r7 /* Turn on FPU */
59 isync /* Wait for it */
61 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
62 stfd f1,(FM_SIZE+8)(r1) /* and the second */
64 /* ok, now we can use the FPU registers to do some fast copying
81 blt+ cr0, .L_vscr_up_loop
83 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
84 lfd f1,(FM_SIZE+8)(r1) /* and the second */
85 lwz r1,0(r1) /* Pop the stack */
87 mtmsr r0 /* Turn off FPU again */
88 isync /* Wait for it */
89 blr /* Go away, don't bother me... */
93 * void video_scroll_down(unsigned long start, HIGH address to scroll from
94 * unsigned long end, LOW address
95 * unsigned long dest) HIGH address
98 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
100 /* Save off the link register, we want to call fpu_save.
104 mfmsr r0 /* Get the MSR */
105 mflr r6 /* Get the LR */
106 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
107 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
108 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
109 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
111 mtmsr r7 /* Turn on FPU */
112 isync /* Wait for it */
114 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
115 stfd f1,(FM_SIZE+8)(r1) /* and the second */
117 /* ok, now we can use the FPU registers to do some fast copying */
133 bgt+ cr0, .L_vscr_down_loop
136 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
137 lfd f1,(FM_SIZE+8)(r1) /* and the second */
138 lwz r1,0(r1) /* Pop the stack */
140 mtmsr r0 /* Turn off FPU again */
141 isync /* Wait for it */
142 blr /* Go away, don't bother me... */