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

1.1     ! root        1: |       @(#)s2map.s 1.1 86/02/03 Copyr 1983 Sun Micro
        !             2: |
        !             3: |      Copyright (c) 1984 by Sun Microsystems, Inc.
        !             4: |
        !             5: | /*
        !             6: |  * Memory Mapping and Paging on the Sun 2
        !             7: |  *
        !             8: |  * This is intended to be used for both standalone code (ROM Monitor, 
        !             9: |  * Diagnostics, boot programs, etc) and for the Unix kernel.  IF YOU HAVE
        !            10: |  * TO CHANGE IT to fit your application, MOVE THE CHANGE BACK TO THE PUBLIC
        !            11: |  * COPY, and make sure the change is upward-compatible.  The last thing we 
        !            12: |  * need is seventeen different copies of this file, like we have with the
        !            13: |  * Sun-1 header files.
        !            14: |  *
        !            15: |  * This file corresponds to version 1.0 of the Sun-2 Design Reference.
        !            16: |  * (1 April 83)
        !            17: |  */
        !            18: | 
        !            19: | /*
        !            20: |  * Mapping registers are accessed thru the  movs  instruction in the Sun-2.
        !            21: |  *
        !            22: |  * The following subroutines accept any address in the mappable range
        !            23: |  * (16 megs).  They access the map for the current context register.  They
        !            24: |  * assume that currently we are running in supervisor state.
        !            25: |  */ 
        !            26: | 
        !            27: | struct pgmapent
        !            28: | getpgmap(addr);
        !            29: | 
        !            30: | setpgmap(addr, entry);
        !            31: 
        !            32: NUMPMEGS = 256
        !            33: LOWMASK = 0xfffff800
        !            34: PMAPOFF = 0x0
        !            35: SMAPOFF = 0x5
        !            36: USERCONTEXTOFF = 0x7
        !            37: SUPCONTEXTOFF = 0x6
        !            38: CONTEXTMASK = 0x7
        !            39: FC_MAP = 0x3
        !            40: PME_INVALID = 0x80000000
        !            41: 
        !            42:        .text
        !            43: 
        !            44:        .globl  _getpgmap
        !            45: _getpgmap:
        !            46:        movl    sp@(4),d0       | Get access address
        !            47:        andw    #LOWMASK,d0     | Mask out low bits
        !            48:        movl    d0,a0
        !            49:        movc    sfc,d1          | Save source function code
        !            50:        lea     FC_MAP,a1       | Get function code in a reg
        !            51:        movc    a1,sfc          | Set source function code
        !            52:        movsl   a0@,d0          | Read page map entry
        !            53:        movc    d1,sfc          | Restore source function code
        !            54:        rts                     | done
        !            55: 
        !            56:        .globl  _setpgmap
        !            57: _setpgmap:
        !            58:        movl    sp@(4),d0       | Get access address
        !            59:        andw    #LOWMASK,d0     | Mask out low bits
        !            60:        movl    d0,a0
        !            61:        lea     FC_MAP,a1       | Get function code in a reg
        !            62: | The following code can be used to verify that the only page
        !            63: | table entries written to the Invalid Pmeg are invalid pages, since the 
        !            64: | consequences of writing valid entries here are somewhat spectacular.
        !            65:        movc    sfc,d0          | Save source function code
        !            66:        movc    a1,sfc          | Set source function code, too.
        !            67:        movsb   a0@(SMAPOFF),d1 | Get segment map entry number
        !            68:        movc    d0,sfc          | Restore source function code
        !            69: | If debug code is removed, next line must remain!
        !            70:        movl    sp@(8),d0       | Get page map entry to write
        !            71: | More debug code
        !            72:        cmpb    #NUMPMEGS-1,d1  | Are we writing in the Invalid Pmeg?
        !            73:        jne     1$              | Nope, go on.
        !            74:        cmpl    #PME_INVALID,d0 | Writing the Invalid Page Map Entry?
        !            75:        jeq     1$              | Yes, it's ok.
        !            76:        bras    .-1             | Fault out, this is nasty thing to do.
        !            77: 1$:
        !            78: | End of debugging code.
        !            79:        movc    dfc,d1          | Save dest function code
        !            80:        movc    a1,dfc          | Set destination function code
        !            81:        movsl   d0,a0@          | Write page map entry
        !            82:        movc    d1,dfc          | Restore dest function code
        !            83:        rts                     | done
        !            84: 
        !            85:        .globl  _setkcontext
        !            86: _setkcontext:
        !            87:        clrl    d0              | Get context value to set
        !            88:        movc    dfc,d1          | Save dest function code
        !            89:        lea     FC_MAP,a1       | Get function code in a reg
        !            90:        movc    a1,dfc          | Set destination function code
        !            91:        movsb   d0,USERCONTEXTOFF | Move value into context register
        !            92:        movc    d1,dfc          | Restore dest function code
        !            93:        rts
        !            94: 

unix.superglobalmegacorp.com

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