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