Annotation of coherent/b/lib/libc/sys/i386/wait.s, revision 1.1.1.1

1.1       root        1: //////////
                      2: / libc/sys/i386/wait.s
                      3: / wait(), waitpid().
                      4: / Both are system call #7.
                      5: / waitpid() is designated by setting all of PSW flags ZF, PF, SF, and OF.
                      6: //////////
                      7: 
                      8:        .text
                      9:        .globl  wait
                     10:        .globl  waitpid
                     11:        .globl  .cerror
                     12: 
                     13:        .set    WPMASK,0x8C4    / set (ZF|PF|SF|OF) for waitpid()
                     14:        
                     15: //////////
                     16: / int
                     17: / wait(int * stat_loc)
                     18: //////////
                     19: 
                     20: wait:
                     21:        pushfl                  / get psw
                     22:        popl    %eax
                     23:        andl    $~WPMASK,%eax   / set PSW for wait()
                     24:        pushl   %eax
                     25:        popfl
                     26:        movl    $7,%eax         / system call # to %eax
                     27:        lcall   $7,$0
                     28:        jc      .cerror
                     29:        movl    4(%esp),%ecx    / get statloc to %ecx
                     30:        jmp     done            / and do wrap-up
                     31:        
                     32: //////////
                     33: / int
                     34: / waitpid(pid_t pid, int * stat_loc, int options)
                     35: //////////
                     36: 
                     37: waitpid:
                     38:        pushfl                  / get psw
                     39:        popl    %eax
                     40:        orl     $WPMASK,%eax    / set PSW for waitpid()
                     41:        pushl   %eax
                     42:        popfl
                     43:        movl    $7,%eax         / system call # to %eax
                     44:        lcall   $7,$0
                     45:        jc      .cerror
                     46:        movl    8(%esp),%ecx    / get statloc to %ecx
                     47: done:
                     48:        orl     %ecx,%ecx       / is statloc null?
                     49:        jz      ?L0             / if null, return
                     50:        movl    %edx,(%ecx)     / if non-null, store thru the pointer
                     51: ?L0:
                     52:        ret
                     53: 
                     54: / end of libc/sys/i386/wait.s

unix.superglobalmegacorp.com

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