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 stw r0,(FM_SIZE+FM_LR_SAVE)(r1) /* Save return */
58 /* ok, now we can use the FPU registers to do some fast copying
75 blt+ cr0, .L_vscr_up_loop
77 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
78 lfd f1,(FM_SIZE+8)(r1) /* and the second */
79 lwz r1,0(r1) /* Pop the stack */
81 mtmsr r0 /* Turn off FPU again */
82 isync /* Wait for it */
83 blr /* Go away, don't bother me... */
87 * void video_scroll_down(unsigned long start, HIGH address to scroll from
88 * unsigned long end, LOW address
89 * unsigned long dest) HIGH address
92 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
94 /* Save off the link register, we want to call fpu_save.
98 mfmsr r0 /* Get the MSR */
99 mflr r6 /* Get the LR */
100 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
101 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
102 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
103 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
105 mtmsr r7 /* Turn on FPU */
106 isync /* Wait for it */
108 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
109 stfd f1,(FM_SIZE+8)(r1) /* and the second */
111 stw r0,(FM_SIZE+FM_LR_SAVE)(r1) /* Save return */
113 /* ok, now we can use the FPU registers to do some fast copying */
129 bgt+ cr0, .L_vscr_down_loop
132 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
133 lfd f1,(FM_SIZE+8)(r1) /* and the second */
134 lwz r1,0(r1) /* Pop the stack */
136 mtmsr r0 /* Turn off FPU again */
137 isync /* Wait for it */
138 blr /* Go away, don't bother me... */