]> git.saurik.com Git - apple/xnu.git/blob - osfmk/console/ppc/video_scroll.s
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / console / ppc / video_scroll.s
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_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. 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
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
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.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_FREE_COPYRIGHT@
32 *
33 */
34
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
37 * of (at least) 16.
38 */
39
40 #include <ppc/asm.h>
41 #include <ppc/proc_reg.h>
42
43 /*
44 * void video_scroll_up(unsigned long start,
45 * unsigned long end,
46 * unsigned long dest)
47 */
48
49 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
50
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 */
57
58 mtmsr r7 /* Turn on FPU */
59 isync /* Wait for it */
60
61 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
62 stfd f1,(FM_SIZE+8)(r1) /* and the second */
63
64 /* ok, now we can use the FPU registers to do some fast copying
65 */
66
67 .L_vscr_up_loop:
68 lfd f0, 0(r3)
69 lfd f1, 8(r3)
70
71 addi r3, r3, 16
72
73 stfd f0, 0(r5)
74
75 cmpl cr0, r3, r4
76
77 stfd f1, 8(r5)
78
79 addi r5, r5, 16
80
81 blt+ cr0, .L_vscr_up_loop
82
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 */
86
87 mtmsr r0 /* Turn off FPU again */
88 isync /* Wait for it */
89 blr /* Go away, don't bother me... */
90
91
92 /*
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
96 */
97
98 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
99
100 /* Save off the link register, we want to call fpu_save.
101 */
102
103
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 */
110
111 mtmsr r7 /* Turn on FPU */
112 isync /* Wait for it */
113
114 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
115 stfd f1,(FM_SIZE+8)(r1) /* and the second */
116
117 /* ok, now we can use the FPU registers to do some fast copying */
118
119 .L_vscr_down_loop:
120 lfd f0, -16(r3)
121 lfd f1, -8(r3)
122
123 subi r3, r3, 16
124
125 stfd f0, -16(r5)
126
127 cmpl cr0, r3, r4
128
129 stfd f1, -8(r5)
130
131 subi r5, r5, 16
132
133 bgt+ cr0, .L_vscr_down_loop
134
135
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 */
139
140 mtmsr r0 /* Turn off FPU again */
141 isync /* Wait for it */
142 blr /* Go away, don't bother me... */
143