]> git.saurik.com Git - apple/xnu.git/blob - osfmk/console/ppc/video_scroll.s
7beaa3f5956a253fb182419ecd38d8ad37584b16
[apple/xnu.git] / osfmk / console / ppc / video_scroll.s
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_FREE_COPYRIGHT@
25 *
26 */
27
28 /* Routines to perform high-speed scrolling, assuming that the memory is
29 * non-cached, and that the amount of memory to be scrolled is a multiple
30 * of (at least) 16.
31 */
32
33 #include <ppc/asm.h>
34 #include <ppc/proc_reg.h>
35
36 /*
37 * void video_scroll_up(unsigned long start,
38 * unsigned long end,
39 * unsigned long dest)
40 */
41
42 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
43
44 mfmsr r0 /* Get the MSR */
45 mflr r6 /* Get the LR */
46 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
47 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
48 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
49 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
50
51 mtmsr r7 /* Turn on FPU */
52 isync /* Wait for it */
53
54 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
55 stfd f1,(FM_SIZE+8)(r1) /* and the second */
56
57 /* ok, now we can use the FPU registers to do some fast copying
58 */
59
60 .L_vscr_up_loop:
61 lfd f0, 0(r3)
62 lfd f1, 8(r3)
63
64 addi r3, r3, 16
65
66 stfd f0, 0(r5)
67
68 cmpl cr0, r3, r4
69
70 stfd f1, 8(r5)
71
72 addi r5, r5, 16
73
74 blt+ cr0, .L_vscr_up_loop
75
76 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
77 lfd f1,(FM_SIZE+8)(r1) /* and the second */
78 lwz r1,0(r1) /* Pop the stack */
79
80 mtmsr r0 /* Turn off FPU again */
81 isync /* Wait for it */
82 blr /* Go away, don't bother me... */
83
84
85 /*
86 * void video_scroll_down(unsigned long start, HIGH address to scroll from
87 * unsigned long end, LOW address
88 * unsigned long dest) HIGH address
89 */
90
91 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
92
93 /* Save off the link register, we want to call fpu_save.
94 */
95
96
97 mfmsr r0 /* Get the MSR */
98 mflr r6 /* Get the LR */
99 ori r7,r0,1<<(31-MSR_FP_BIT) /* Turn on floating point */
100 stwu r1,-(FM_SIZE+16)(r1) /* Get space for a couple of registers on stack */
101 rlwinm r7,r7,0,MSR_EE_BIT+1,MSR_EE_BIT-1 /* Turn off interrupts */
102 stw r6,(FM_SIZE+16+FM_LR_SAVE)(r1) /* Save the return */
103
104 mtmsr r7 /* Turn on FPU */
105 isync /* Wait for it */
106
107 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
108 stfd f1,(FM_SIZE+8)(r1) /* and the second */
109
110 /* ok, now we can use the FPU registers to do some fast copying */
111
112 .L_vscr_down_loop:
113 lfd f0, -16(r3)
114 lfd f1, -8(r3)
115
116 subi r3, r3, 16
117
118 stfd f0, -16(r5)
119
120 cmpl cr0, r3, r4
121
122 stfd f1, -8(r5)
123
124 subi r5, r5, 16
125
126 bgt+ cr0, .L_vscr_down_loop
127
128
129 lfd f0,(FM_SIZE+0)(r1) /* Load back one register */
130 lfd f1,(FM_SIZE+8)(r1) /* and the second */
131 lwz r1,0(r1) /* Pop the stack */
132
133 mtmsr r0 /* Turn off FPU again */
134 isync /* Wait for it */
135 blr /* Go away, don't bother me... */
136