Annotation of researchv9/libc/sys/sbrk.s, revision 1.1.1.1

1.1       root        1: #old = sbrk(increment);
                      2: #
                      3: #sbrk gets increment more core, and returns a pointer
                      4: #      to the beginning of the new core area
                      5: #
                      6:        break = 17
                      7: .globl _sbrk
                      8: .globl _end
                      9: .globl  cerror
                     10: 
                     11: _sbrk:
                     12:        addql   #3,sp@(4)
                     13:        andl    #0xfffffffc,sp@(4)
                     14:        movl    nd,d0
                     15:        addl    sp@(4),d0
                     16:        movl    d0,sp@-
                     17:        jsr     1f
                     18:        bcc     noerr1
                     19:        addql   #4,sp
                     20:        jmp     cerror2
                     21: noerr1:
                     22:        addql   #4,sp
                     23:        movl    nd,d0
                     24:        movl    sp@(4),d1
                     25:        addl    d1,nd
                     26:        movl    d0,a0
                     27:        rts
                     28: 1:
                     29:        pea     break
                     30:        trap    #0
                     31:        rts
                     32: 
                     33: .globl _brk
                     34: # brk(value)
                     35: # as described in man2.
                     36: # returns 0 for ok, -1 for error.
                     37: 
                     38: _brk:
                     39:        pea     break
                     40:        trap    #0
                     41:        bcc     noerr2
                     42:        jmp     cerror2
                     43: noerr2:
                     44:        movl    sp@(4),nd
                     45:        clrl    d0
                     46:        lea     0,a0
                     47:        rts
                     48: 
                     49:        .data
                     50: nd:    .long   _end

unix.superglobalmegacorp.com

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