Annotation of qemu/roms/SLOF/llfw/io_generic/io_generic.S, revision 1.1.1.1

1.1       root        1: /******************************************************************************
                      2:  * Copyright (c) 2004, 2008 IBM Corporation
                      3:  * All rights reserved.
                      4:  * This program and the accompanying materials
                      5:  * are made available under the terms of the BSD License
                      6:  * which accompanies this distribution, and is available at
                      7:  * http://www.opensource.org/licenses/bsd-license.php
                      8:  *
                      9:  * Contributors:
                     10:  *     IBM Corporation - initial implementation
                     11:  *****************************************************************************/
                     12: #include "macros.h"
                     13: #include "calculatecrc.h"
                     14: #include "calculatecrc.h"
                     15: 
                     16:        .text
                     17: 
                     18: /****************************************************************************
                     19:  * prints a 0-terminated string to serial console
                     20:  *
                     21:  * Input:
                     22:  * R3 - pointer to string in memory
                     23:  *
                     24:  * Returns: -
                     25:  *
                     26:  * Modifies Registers:
                     27:  * R3, R4, R5, R6, R7, R8, R9
                     28:  ****************************************************************************/
                     29: ASM_ENTRY(io_print)
                     30:        mflr    r8
                     31:        mr      r9, r3
                     32: 
                     33: 0:
                     34:        lbz     r3, 0(r9)
                     35:        cmpwi   r3, 0
                     36:        beq     1f
                     37:        bl      io_putchar
                     38:        addi    r9, r9, 1
                     39:        b               0b
                     40: 1:
                     41:        mtlr    r8
                     42:        blr
                     43: 
                     44: /****************************************************************************
                     45:  * prints Hex integer to the UART and the NVRAM (using board io_putchar)
                     46:  *
                     47:  * Input:
                     48:  * R3 - integer to print
                     49:  *
                     50:  * Returns: -
                     51:  *
                     52:  * Modifies Registers:
                     53:  * R3, R4, R5, R6, R7, R8, R9
                     54:  ****************************************************************************/
                     55: #define _io_gen_print_nib(reg, src, shift)     \
                     56:        srdi    reg, src, shift;                \
                     57:        andi.   reg, reg, 0x0F;                 \
                     58:        cmpwi   reg, 0x0A;                      \
                     59:        blt     0f;                             \
                     60:        addi    reg, reg, ('A'-'0'-10);         \
                     61: 0:;                                            \
                     62:        addi    reg, reg, '0';                  \
                     63:        bl      io_putchar
                     64: 
                     65: ASM_ENTRY(io_printhex64)
                     66:        mflr    r8
                     67:        mr      r9, r3
                     68: 
                     69: _io_printhex64:
                     70:        _io_gen_print_nib(r3, r9, 60)
                     71:        _io_gen_print_nib(r3, r9, 56)
                     72:        _io_gen_print_nib(r3, r9, 52)
                     73:        _io_gen_print_nib(r3, r9, 48)
                     74:        _io_gen_print_nib(r3, r9, 44)
                     75:        _io_gen_print_nib(r3, r9, 40)
                     76:        _io_gen_print_nib(r3, r9, 36)
                     77:        _io_gen_print_nib(r3, r9, 32)
                     78: _io_printhex32:
                     79:        _io_gen_print_nib(r3, r9, 28)
                     80:        _io_gen_print_nib(r3, r9, 24)
                     81:        _io_gen_print_nib(r3, r9, 20)
                     82:        _io_gen_print_nib(r3, r9, 16)
                     83: _io_printhex16:
                     84:        _io_gen_print_nib(r3, r9, 12)
                     85:        _io_gen_print_nib(r3, r9,  8)
                     86: _io_printhex8:
                     87:        _io_gen_print_nib(r3, r9,  4)
                     88:        _io_gen_print_nib(r3, r9,  0)
                     89: 
                     90:        mtlr    r8
                     91:        blr
                     92: 
                     93: ASM_ENTRY(io_printhex32)
                     94:        mflr    r8
                     95:        mr      r9, r3
                     96:        b       _io_printhex32
                     97: 
                     98: ASM_ENTRY(io_printhex16)
                     99:        mflr    r8
                    100:        mr      r9, r3
                    101:        b       _io_printhex16
                    102: 
                    103: ASM_ENTRY(io_printhex8)
                    104:        mflr    r8
                    105:        mr      r9, r3
                    106:        b       _io_printhex8
                    107: 
                    108: 
                    109: /****************************************************************************
                    110:  * print the address and its contents as 64-bit hex values
                    111:  *
                    112:  * Input:
                    113:  * R3 - Address to read from
                    114:  *
                    115:  * Returns: -
                    116:  *
                    117:  * Modifies Registers:
                    118:  * R3, R4, R5, R6, R7, R8, R9, R10
                    119:  ****************************************************************************/
                    120: #if 0   /* currently unused */
                    121: ASM_ENTRY(io_dump)
                    122:         mflr    r10
                    123:         bl      io_printhex64
                    124:         li      r3,':'
                    125:         bl      io_putchar
                    126:         ld      r9,0(r9)
                    127:         mr      r8,r10
                    128:         b       _io_printhex64
                    129: #endif

unix.superglobalmegacorp.com

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