]> git.saurik.com Git - apple/xnu.git/blob - osfmk/console/ppc/video_scroll.s
xnu-792.10.96.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_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_FREE_COPYRIGHT@
24 *
25 */
26
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
29 * of (at least) 16.
30 */
31
32 #include <ppc/asm.h>
33 #include <ppc/proc_reg.h>
34
35 /*
36 * void video_scroll_up(unsigned long start,
37 * unsigned long end,
38 * unsigned long dest)
39 */
40
41 ENTRY(video_scroll_up, TAG_NO_FRAME_USED)
42
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 */
49
50 mtmsr r7 /* Turn on FPU */
51 isync /* Wait for it */
52
53 vsufpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
54 stfd f1,(FM_SIZE+8)(r1) /* and the second */
55
56 /* ok, now we can use the FPU registers to do some fast copying
57 */
58
59 .L_vscr_up_loop:
60 lfd f0, 0(r3)
61 lfd f1, 8(r3)
62
63 addi r3, r3, 16
64
65 stfd f0, 0(r5)
66
67 cmpl cr0, r3, r4
68
69 stfd f1, 8(r5)
70
71 addi r5, r5, 16
72
73 blt+ cr0, .L_vscr_up_loop
74
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 */
78
79 mtmsr r0 /* Turn off FPU again */
80 isync /* Wait for it */
81 blr /* Go away, don't bother me... */
82
83
84 /*
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
88 */
89
90 ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
91
92 /* Save off the link register, we want to call fpu_save.
93 */
94
95
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 */
102
103 mtmsr r7 /* Turn on FPU */
104 isync /* Wait for it */
105
106 vsdfpuon1: stfd f0,(FM_SIZE+0)(r1) /* Save one register */
107 stfd f1,(FM_SIZE+8)(r1) /* and the second */
108
109 /* ok, now we can use the FPU registers to do some fast copying */
110
111 .L_vscr_down_loop:
112 lfd f0, -16(r3)
113 lfd f1, -8(r3)
114
115 subi r3, r3, 16
116
117 stfd f0, -16(r5)
118
119 cmpl cr0, r3, r4
120
121 stfd f1, -8(r5)
122
123 subi r5, r5, 16
124
125 bgt+ cr0, .L_vscr_down_loop
126
127
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 */
131
132 mtmsr r0 /* Turn off FPU again */
133 isync /* Wait for it */
134 blr /* Go away, don't bother me... */
135