Annotation of xinu/sys/sizmem.s, revision 1.1.1.2

1.1.1.2 ! root        1: |* sizmem.s - sizmem */
1.1       root        2: 
1.1.1.2 ! root        3: DISABLE        =       0x2700
        !             4: EXCPPC =       0x0008
1.1       root        5: 
1.1.1.2 ! root        6: |*------------------------------------------------------------------------
        !             7: |*  sizmem  --  size memory, placing highest valid address in _maxaddr
        !             8: |*------------------------------------------------------------------------
1.1       root        9:        .text
1.1.1.2 ! root       10:        .globl  _sizmem, _end
        !            11: .data
        !            12: savsp:  .long 0
        !            13: .text
        !            14: 
        !            15: _sizmem:
        !            16:        movw    sr, sp@-
        !            17:        movw    #DISABLE, sr
        !            18:        movl    a0, sp@-
        !            19:        movl    EXCPPC, sp@-
        !            20:        movl    #siztrap, EXCPPC
        !            21:        movl    sp,savsp       | remember sp for trap
        !            22:        movl    #_end, a0      | start from end of program
1.1       root       23: sizloop:
1.1.1.2 ! root       24:        movl    a0@,a0@+      | ref mem where a0 points
        !            25:        movl    a0, _maxaddr
        !            26:        bra     sizloop
        !            27: 
1.1       root       28: siztrap:
1.1.1.2 ! root       29:        movl    _maxaddr, a0
        !            30:        subl    #4,a0
        !            31:        movl    a0,_maxaddr     | adjust to last actual word addr
        !            32:        movl    savsp,sp        | drop stack frame from trap
        !            33:        movl    sp@+, EXCPPC | restore vector
        !            34:        movl    sp@+, a0     | and a0
        !            35:        movw    sp@+, sr   | | and sr
        !            36:        rts
        !            37: 

unix.superglobalmegacorp.com

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