0000000000010b36 : ; ra = return address ; a0 = buffer ; a1 = size ; a2 = count ; a3 = stream ; -- Entry through symbol fwrite ; Function protocol 10b36: 7139 addi sp,sp,-64 ; Check an internal word in the FILE to see if it needs to lock 10b38: 08c6a783 lw a5,140(a3) 10b3c: f426 sd s1,40(sp) ; Set s1 = 1 if a1/size is non-zero 10b3e: 00b034b3 snez s1,a1 10b42: f822 sd s0,48(sp) 10b44: f04a sd s2,32(sp) 10b46: ec4e sd s3,24(sp) ; Set s1 = -1 if a1/size is non-zero 10b48: 409004b3 neg s1,s1 10b4c: fc06 sd ra,56(sp) 10b4e: e852 sd s4,16(sp) ; Set s0 = size * count 10b50: 02c58433 mul s0,a1,a2 ; Set s2 = stream 10b54: 8936 mv s2,a3 ; Set s3 = size 10b56: 89ae mv s3,a1 ; Set s1 = count if size is non-zero, or 0 if size is zero 10b58: 8cf1 and s1,s1,a2 ; Branch to lock path if needed: 10b5a: 0207d463 bgez a5,10b82 ; -- exit through bgez: likely branch 10b5e, rare branch 10b82 ; -- entry through branch at 10b5a ; Call through to __fwritex 10b5e: 8636 mv a2,a3 10b60: 85a2 mv a1,s0 10b62: f27ff0ef jal 10a88 <__fwritex> ; -- exit through jal to 10a88, return address 10b66 ; -- Entry through return address, call at 10b62 ; Check the return value from __fwritex to see if we wrote ; all requested bytes. 10b66: 8a2a mv s4,a0 10b68: 01440463 beq s0,s4,10b70 ; -- exit through beq: likely 10b6c, rare 10b70 ; -- Entry through jump at 10ba6 ; -- Entry through jump at 10baa ; Note this overlaps the previous trace! ; Check the return value from __fwritex to see if we wrote ; all requested bytes. 10b68: 01440463 beq s0,s4,10b70 ; -- exit through beq: likely 10b6c, rare 10b70 ; -- Entry through branch at 10b68 ; Divide to the count in records from the count in bytes 10b6c: 033a54b3 divu s1,s4,s3 ; Function outro 10b70: 70e2 ld ra,56(sp) 10b72: 7442 ld s0,48(sp) 10b74: 7902 ld s2,32(sp) 10b76: 69e2 ld s3,24(sp) 10b78: 6a42 ld s4,16(sp) 10b7a: 8526 mv a0,s1 10b7c: 74a2 ld s1,40(sp) 10b7e: 6121 addi sp,sp,64 10b80: 8082 ret ; -- exit through ret ; -- Entry through from 10b68 ; Return the original record count, skipping the division. ; Note this overlaps the previous trace! 10b70: 70e2 ld ra,56(sp) 10b72: 7442 ld s0,48(sp) 10b74: 7902 ld s2,32(sp) 10b76: 69e2 ld s3,24(sp) 10b78: 6a42 ld s4,16(sp) 10b7a: 8526 mv a0,s1 10b7c: 74a2 ld s1,40(sp) 10b7e: 6121 addi sp,sp,64 10b80: 8082 ret ; -- exit through ret ; -- entry through branch at 10b5a ; Lock the FILE if needed ; Call through to __lockfile 10b82: 8a2a mv s4,a0 10b84: 8536 mv a0,a3 10b86: e456 sd s5,8(sp) 10b88: c95ff0ef jal 1081c <__lockfile> ; -- exit through jal to 1081c - return address 10b8c ; -- entry through return address, call at 10b88 ; Call through to __fwritex 10b8c: 8aaa mv s5,a0 10b8e: 864a mv a2,s2 10b90: 8552 mv a0,s4 10b92: 85a2 mv a1,s0 10b94: ef5ff0ef jal 10a88 <__fwritex> ; -- exit through jal to 10a88; return address 10b98 ; -- entry through return address, call at 10b94 10b98: 8a2a mv s4,a0 10b9a: 000a8763 beqz s5,10ba8 ; -- exit through beqz; likely branch 10b9e, rare branch 10ba8 ; -- entry through branch from 10b9a ; Call through to __unlockfile 10b9e: 854a mv a0,s2 10ba0: d25ff0ef jal 108c4 <__unlockfile> ; -- exit through jal to 108c4; return address 10ba4 ; -- entry through return address, call from 10ba0 10ba4: 6aa2 ld s5,8(sp) 10ba6: b7c9 j 10b68 ; -- exit through jump to 10b68 ; -- entry point from branch at 10b9a ; Head back to the exit path 10ba8: 6aa2 ld s5,8(sp) 10baa: bf7d j 10b68 ; -- exit through jump to 10b68