//---------------------------------------------------------------- // showid.s // // Here is one solution to Question V on the Final Exam. // // programmer: ALLAN CRUSE // written on: 11 DEC 2003 //---------------------------------------------------------------- .data uid: .int 0 # holds the user-id pid: .int 0 # holds the process-id fmt: .asciz "\npid=%d uid=%d \n\n" # output format-string .text main: call getuid # return the user-id movl %eax, uid # save function-value call getpid # return process-id movl %eax, pid # save function-value pushl uid # argument #3 pushl pid # argument #2 pushl $fmt # argument #1 call printf # call runtime library addl $12, %esp # discard parameters ret # return to shell .globl main # make entry visible