Annotation of researchv9/sys/boot/stand/probe.s, revision 1.1

1.1     ! root        1: |      @(#)probe.s 1.1 86/02/03 Copyr 1983 Sun Micro
        !             2: 
        !             3: |       Copyright (c) 1983 by Sun Microsystems, Inc.
        !             4: 
        !             5: | 
        !             6: | probe.s
        !             7: | 
        !             8: | Determine if an interface is present on the bus. 
        !             9: |
        !            10: 
        !            11: |
        !            12: | peek(addr)
        !            13: |
        !            14: | Temporarily re-routes Bus Errors, and then tries to
        !            15: | read a short from the specified address.  If a Bus Error occurs,
        !            16: | we return -1; otherwise, we return the unsigned short that we read.
        !            17: |
        !            18: 
        !            19:        .text
        !            20:        .globl  _peek
        !            21: _peek:
        !            22:        movl    a7@(4),a0       | Get address to probe
        !            23:        movc    vbr,a1          | get vbr
        !            24:        movl    a1@(8),d1       | save bus error handler
        !            25:        movl    #BEhand,a1@(8)  | set up our own handler
        !            26:        movl    sp,a1           | save current stack pointer
        !            27:        movl    a0,d0
        !            28:        btst    #0,d0           | See if odd address
        !            29:        bne     BEhand          | Yes, the probe fails.
        !            30:        moveq   #0,d0           | Clear top half
        !            31:        movw    a0@,d0          | Read a shortword.
        !            32: PAexit:
        !            33:        movc    vbr,a1          | get vbr
        !            34:        movl    d1,a1@(8)       | restore bus error handler
        !            35:        rts
        !            36: BEhand:
        !            37:        movl    a1,sp           | Restore stack after bus error
        !            38:        moveq   #-1,d0          | Set result of -1, indicating fault.
        !            39:        bra     PAexit
        !            40: 
        !            41: |
        !            42: | pokec(a,c)
        !            43: |  
        !            44: | This routine is the same, but uses a store instead of a read, due to
        !            45: | stupid I/O devices which do not respond to reads.
        !            46: |
        !            47: | if (pokec (charpointer, bytevalue)) itfailed;
        !            48: |
        !            49: 
        !            50:        .globl  _pokec
        !            51: _pokec:
        !            52:        movl    a7@(4),a0       | Get address to probe
        !            53:        movc    vbr,a1          | get vbr
        !            54:        movl    a1@(8),d1       | save bus error handler
        !            55:        movl    #BEhand,a1@(8)  | set up our own handler
        !            56:        movl    sp,a1           | save current stack pointer
        !            57:        movb    a7@(11),a0@     | Write a byte
        !            58: | A fault in the movb will vector us to BEhand above.
        !            59:        moveq   #0,d0           | It worked; return 0 as result.
        !            60:        bra     PAexit          | restores bus error handler and returns - above
        !            61: 
        !            62: |
        !            63: | poke(a,c)
        !            64: |  
        !            65: | if (poke(pointer, value)) itfailed;
        !            66: |
        !            67: 
        !            68:        .globl  _poke
        !            69: _poke:
        !            70:        movl    a7@(4),a0       | Get address to probe
        !            71:        movc    vbr,a1          | get vbr
        !            72:        movl    a1@(8),d1       | save bus error handler
        !            73:        movl    #BEhand,a1@(8)  | set up our own handler
        !            74:        movl    sp,a1           | save current stack pointer
        !            75:        movw    a7@(10),a0@     | Write a word
        !            76: | A fault in the movb will vector us to BEhand above.
        !            77:        moveq   #0,d0           | It worked; return 0 as result.
        !            78:        bra     PAexit          | restores bus error handler and returns - above

unix.superglobalmegacorp.com

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