2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * @OSF_FREE_COPYRIGHT@
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
33 #include <ppc/proc_reg.h>
36 * void video_scroll_up(unsigned long start,
41 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
43 mfmsr r0 /* Get the MSR */
44 mflr r6 /* Get the LR */
45 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
46 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
47 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
48 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
50 mtmsr r7 /* Turn on FPU */
51 isync /* Wait for it */
53 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
54 stfd f1,(FM_SIZE+8)(r1) /* and the second */
56 /* ok, now we can use the FPU registers to do some fast copying
73 blt+ cr0, .L_vscr_up_loop
75 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
76 lfd f1,(FM_SIZE+8)(r1) /* and the second */
77 lwz r1,0(r1) /* Pop the stack */
79 mtmsr r0 /* Turn off FPU again */
80 isync /* Wait for it */
81 blr /* Go away, don't bother me... */
85 * void video_scroll_down(unsigned long start, HIGH address to scroll from
86 * unsigned long end, LOW address
87 * unsigned long dest) HIGH address
90 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
92 /* Save off the link register, we want to call fpu_save.
96 mfmsr r0 /* Get the MSR */
97 mflr r6 /* Get the LR */
98 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
99 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
100 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
101 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
103 mtmsr r7 /* Turn on FPU */
104 isync /* Wait for it */
106 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
107 stfd f1,(FM_SIZE+8)(r1) /* and the second */
109 /* ok, now we can use the FPU registers to do some fast copying */
125 bgt+ cr0, .L_vscr_down_loop
128 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
129 lfd f1,(FM_SIZE+8)(r1) /* and the second */
130 lwz r1,0(r1) /* Pop the stack */
132 mtmsr r0 /* Turn off FPU again */
133 isync /* Wait for it */
134 blr /* Go away, don't bother me... */