Annotation of coherent/b/lib/libc/crt/i8086/count.s, revision 1.1.1.1

1.1       root        1: ////////
                      2: / Scount is called as follows:
                      3: /      mov     bx, address of m_flst
                      4: /      call    count
                      5: / It simply increments the count field, and if it was not already
                      6: / on the list pointed to by `_fnclst', it places it there.
                      7: / We also compare the stack pointer to the lowest sp previously
                      8: / encountered and save the lower.
                      9: / Note that because of the strange calling sequence, and the need
                     10: / for speed, the file scount.s is a hand modified version of the C
                     11: / compiler output.  The modifications are as follows:
                     12: /      Remove the epilog and prolog.
                     13: /      Recode to use scratch registers.
                     14: /      Change routine name from scount_ to scount.
                     15: / The C source is as follows:
                     16: /
                     17: /      #include "mon.h"
                     18: /      
                     19: /      struct m_flst   *_fnclst;
                     20: /      struct m_hdr    _mhdr;
                     21: /      
                     22: /      scount(pc, flp)
                     23: /      vaddr_t pc;                     /* actually passed in (sp) */
                     24: /      register struct m_flst  *flp;   /* actually passed in bx */
                     25: /      {
                     26: /              ++flp->m_data.m_ncalls;
                     27: /              if (&pc < _mhdr.m_lowsp)
                     28: /                      _mhdr.m_lowsp = &pc;
                     29: /              if (flp->m_link == NULL) {
                     30: /                      flp->m_link = _fnclst;
                     31: /                      _fnclst = flp;
                     32: /                      flp->m_data.m_addr = pc;
                     33: /              }
                     34: /      }
                     35: 
                     36:        .shri
                     37: 
                     38:        .globl  scount
                     39: 
                     40: scount:
                     41:        add     0x02(bx), $0x01
                     42:        adc     0x04(bx), $0x00
                     43:        cmp     sp, _mhdr_+0x08
                     44:        jae     L2
                     45:        mov     _mhdr_+0x08, sp
                     46: 
                     47: L2:    cmp     0x06(bx), $0x00
                     48:        jne     L1
                     49:        mov     ax, _fnclst_
                     50:        mov     0x06(bx), ax
                     51:        mov     _fnclst_, bx
                     52:        pop     ax
                     53:        push    ax
                     54:        mov     (bx), ax
                     55: 
                     56: L1:    ret

unix.superglobalmegacorp.com

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