Annotation of XNU/osfmk/ppc/POWERMAC/video_scroll.s, revision 1.1

1.1     ! root        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:                        stw             r0,(FM_SIZE+FM_LR_SAVE)(r1)                     /* Save return */
        !            57: 
        !            58: /* ok, now we can use the FPU registers to do some fast copying
        !            59:  */
        !            60: 
        !            61: .L_vscr_up_loop:
        !            62:                        lfd     f0,     0(r3)
        !            63:                        lfd     f1,     8(r3)
        !            64:                
        !            65:                        addi    r3,     r3,     16
        !            66:                        
        !            67:                        stfd    f0,     0(r5)
        !            68:                
        !            69:                        cmpl    cr0,    r3,     r4
        !            70:                
        !            71:                        stfd    f1,     8(r5)
        !            72:                
        !            73:                        addi    r5,     r5,     16
        !            74:                
        !            75:                        blt+    cr0,    .L_vscr_up_loop
        !            76: 
        !            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 */
        !            80:                
        !            81:                        mtmsr   r0                                                                      /* Turn off FPU again */
        !            82:                        isync                                                                           /* Wait for it */
        !            83:                        blr                                                                                     /* Go away, don't bother me... */
        !            84: 
        !            85: 
        !            86: /*
        !            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
        !            90:  */
        !            91: 
        !            92: ENTRY(video_scroll_down, TAG_NO_FRAME_USED)
        !            93: 
        !            94:        /* Save off the link register, we want to call fpu_save.
        !            95:         */
        !            96:        
        !            97: 
        !            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 */
        !           104:                        
        !           105:                        mtmsr   r7                                                                      /* Turn on FPU */
        !           106:                        isync                                                                           /* Wait for it */
        !           107:                        
        !           108: vsdfpuon1:     stfd    f0,(FM_SIZE+0)(r1)                                      /* Save one register */
        !           109:                        stfd    f1,(FM_SIZE+8)(r1)                                      /* and the second */
        !           110:                        
        !           111:                        stw             r0,(FM_SIZE+FM_LR_SAVE)(r1)                     /* Save return */
        !           112: 
        !           113: /* ok, now we can use the FPU registers to do some fast copying         */
        !           114: 
        !           115: .L_vscr_down_loop:
        !           116:                        lfd     f0,     -16(r3)
        !           117:                        lfd     f1,     -8(r3)
        !           118:                
        !           119:                        subi    r3,     r3,     16
        !           120:                        
        !           121:                        stfd    f0,     -16(r5)
        !           122:                
        !           123:                        cmpl    cr0,    r3,     r4
        !           124:                
        !           125:                        stfd    f1,     -8(r5)
        !           126:                
        !           127:                        subi    r5,     r5,     16
        !           128:                
        !           129:                        bgt+    cr0,    .L_vscr_down_loop
        !           130:                
        !           131: 
        !           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 */
        !           135:                
        !           136:                        mtmsr   r0                                                                      /* Turn off FPU again */
        !           137:                        isync                                                                           /* Wait for it */
        !           138:                        blr                                                                                     /* Go away, don't bother me... */
        !           139: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.