=============================================================================== 400051dc : int fifo_open( pipe_control_t **pipep, rtems_libio_t *iop ) { 400051dc: 9d e3 bf a0 save %sp, -96, %sp _Mutex_Acquire( mutex ); 400051e0: 39 10 00 69 sethi %hi(0x4001a400), %i4 400051e4: 40 00 04 3f call 400062e0 <_Mutex_Acquire> 400051e8: 90 17 21 08 or %i4, 0x108, %o0 ! 4001a508 pipe = *pipep; 400051ec: fa 06 00 00 ld [ %i0 ], %i5 if (pipe == NULL) { 400051f0: 80 a7 60 00 cmp %i5, 0 400051f4: 02 80 00 17 be 40005250 400051f8: 01 00 00 00 nop 400051fc: 40 00 04 39 call 400062e0 <_Mutex_Acquire> 40005200: 90 07 60 28 add %i5, 0x28, %o0 *pipep = pipe; 40005204: fa 26 00 00 st %i5, [ %i0 ] _Mutex_Release( mutex ); 40005208: 40 00 04 51 call 4000634c <_Mutex_Release> 4000520c: 90 17 21 08 or %i4, 0x108, %o0 40005210: c2 06 40 00 ld [ %i1 ], %g1 int err; err = pipe_new(pipep); if (err) return err; pipe = *pipep; 40005214: fa 06 00 00 ld [ %i0 ], %i5 switch (LIBIO_ACCMODE(iop)) { 40005218: 82 08 60 06 and %g1, 6, %g1 4000521c: 80 a0 60 04 cmp %g1, 4 40005220: 02 80 00 36 be 400052f8 40005224: b8 07 60 28 add %i5, 0x28, %i4 40005228: 80 a0 60 06 cmp %g1, 6 4000522c: 02 80 00 6b be 400053d8 40005230: 80 a0 60 02 cmp %g1, 2 40005234: 22 80 00 4f be,a 40005370 <== ALWAYS TAKEN 40005238: c4 07 60 10 ld [ %i5 + 0x10 ], %g2 4000523c: 90 10 00 1c mov %i4, %o0 <== NOT EXECUTED 40005240: 40 00 04 43 call 4000634c <_Mutex_Release> 40005244: b0 10 20 00 clr %i0 return 0; out_error: pipe_release(pipep, iop); return err; } 40005248: 81 c7 e0 08 ret 4000524c: 81 e8 00 00 restore pipe = malloc(sizeof(pipe_control_t)); 40005250: 40 00 13 1b call 40009ebc 40005254: 90 10 20 64 mov 0x64, %o0 if (pipe == NULL) 40005258: ba 92 20 00 orcc %o0, 0, %i5 4000525c: 02 80 00 8c be 4000548c 40005260: 94 10 20 5c mov 0x5c, %o2 memset(pipe, 0, sizeof(pipe_control_t)); 40005264: 92 10 20 00 clr %o1 40005268: 40 00 2e af call 40010d24 4000526c: 90 07 60 08 add %i5, 8, %o0 pipe->Size = PIPE_BUF; 40005270: 82 10 22 00 mov 0x200, %g1 40005274: c2 27 60 04 st %g1, [ %i5 + 4 ] pipe->Buffer = malloc(pipe->Size); 40005278: 40 00 13 11 call 40009ebc 4000527c: 90 10 22 00 mov 0x200, %o0 if (pipe->Buffer == NULL) { 40005280: 80 a2 20 00 cmp %o0, 0 40005284: 02 80 00 80 be 40005484 <== NEVER TAKEN 40005288: d0 27 40 00 st %o0, [ %i5 ] _Condition_Initialize_named(struct _Condition_Control *_cond, const char *_name) { struct _Condition_Control _init = _CONDITION_NAMED_INITIALIZER(_name); *_cond = _init; 4000528c: 03 10 00 5d sethi %hi(0x40017400), %g1 40005290: 82 10 62 70 or %g1, 0x270, %g1 ! 40017670 40005294: c2 27 60 4c st %g1, [ %i5 + 0x4c ] 40005298: 03 10 00 5d sethi %hi(0x40017400), %g1 4000529c: 82 10 62 80 or %g1, 0x280, %g1 ! 40017680 400052a0: c2 27 60 60 st %g1, [ %i5 + 0x60 ] *_mutex = _init; 400052a4: 03 10 00 5d sethi %hi(0x40017400), %g1 400052a8: 82 10 62 90 or %g1, 0x290, %g1 ! 40017690 400052ac: c2 27 60 38 st %g1, [ %i5 + 0x38 ] if (c ++ == 'z') 400052b0: 05 10 00 69 sethi %hi(0x4001a400), %g2 400052b4: c6 48 a1 04 ldsb [ %g2 + 0x104 ], %g3 ! 4001a504 400052b8: 80 a0 e0 7a cmp %g3, 0x7a 400052bc: 02 80 00 5b be 40005428 400052c0: c2 08 a1 04 ldub [ %g2 + 0x104 ], %g1 400052c4: 82 00 60 01 inc %g1 _Mutex_Acquire( mutex ); 400052c8: 90 07 60 28 add %i5, 0x28, %o0 400052cc: 40 00 04 05 call 400062e0 <_Mutex_Acquire> 400052d0: c2 28 a1 04 stb %g1, [ %g2 + 0x104 ] *pipep = pipe; 400052d4: fa 26 00 00 st %i5, [ %i0 ] _Mutex_Release( mutex ); 400052d8: 40 00 04 1d call 4000634c <_Mutex_Release> 400052dc: 90 17 21 08 or %i4, 0x108, %o0 400052e0: c2 06 40 00 ld [ %i1 ], %g1 pipe = *pipep; 400052e4: fa 06 00 00 ld [ %i0 ], %i5 switch (LIBIO_ACCMODE(iop)) { 400052e8: 82 08 60 06 and %g1, 6, %g1 400052ec: 80 a0 60 04 cmp %g1, 4 400052f0: 12 bf ff ce bne 40005228 400052f4: b8 07 60 28 add %i5, 0x28, %i4 if (pipe->Writers ++ == 0) 400052f8: c4 07 60 14 ld [ %i5 + 0x14 ], %g2 pipe->writerCounter ++; 400052fc: c2 07 60 24 ld [ %i5 + 0x24 ], %g1 40005300: 82 00 60 01 inc %g1 if (pipe->Writers ++ == 0) 40005304: 86 00 a0 01 add %g2, 1, %g3 pipe->writerCounter ++; 40005308: c2 27 60 24 st %g1, [ %i5 + 0x24 ] if (pipe->Writers ++ == 0) 4000530c: 80 a0 a0 00 cmp %g2, 0 40005310: 02 80 00 51 be 40005454 <== ALWAYS TAKEN 40005314: c6 27 60 14 st %g3, [ %i5 + 0x14 ] if (pipe->Readers == 0 && LIBIO_NODELAY(iop)) { 40005318: c2 07 60 10 ld [ %i5 + 0x10 ], %g1 <== NOT EXECUTED 4000531c: 80 a0 60 00 cmp %g1, 0 40005320: 32 bf ff c8 bne,a 40005240 40005324: 90 10 00 1c mov %i4, %o0 40005328: c2 06 40 00 ld [ %i1 ], %g1 4000532c: 80 88 60 01 btst 1, %g1 40005330: 12 80 00 4d bne 40005464 40005334: 01 00 00 00 nop if (pipe->Readers == 0) { 40005338: c2 07 60 10 ld [ %i5 + 0x10 ], %g1 4000533c: 80 a0 60 00 cmp %g1, 0 40005340: 12 bf ff bf bne 4000523c <== NEVER TAKEN 40005344: b6 07 60 50 add %i5, 0x50, %i3 prevCounter = pipe->readerCounter; 40005348: f4 07 60 20 ld [ %i5 + 0x20 ], %i2 _Condition_Wait( condition_variable, mutex ); 4000534c: 92 10 00 1c mov %i4, %o1 40005350: 40 00 01 fd call 40005b44 <_Condition_Wait> 40005354: 90 10 00 1b mov %i3, %o0 } while (prevCounter == pipe->readerCounter); 40005358: c2 07 60 20 ld [ %i5 + 0x20 ], %g1 4000535c: 80 a0 40 1a cmp %g1, %i2 40005360: 02 bf ff fc be 40005350 <== NEVER TAKEN 40005364: 92 10 00 1c mov %i4, %o1 _Mutex_Release( mutex ); 40005368: 10 bf ff b6 b 40005240 4000536c: 90 10 00 1c mov %i4, %o0 pipe->readerCounter ++; 40005370: c2 07 60 20 ld [ %i5 + 0x20 ], %g1 40005374: 82 00 60 01 inc %g1 if (pipe->Readers ++ == 0) 40005378: 86 00 a0 01 add %g2, 1, %g3 pipe->readerCounter ++; 4000537c: c2 27 60 20 st %g1, [ %i5 + 0x20 ] if (pipe->Readers ++ == 0) 40005380: 80 a0 a0 00 cmp %g2, 0 40005384: 02 80 00 30 be 40005444 <== ALWAYS TAKEN 40005388: c6 27 60 10 st %g3, [ %i5 + 0x10 ] if (pipe->Writers == 0) { 4000538c: c2 07 60 14 ld [ %i5 + 0x14 ], %g1 <== NOT EXECUTED 40005390: 80 a0 60 00 cmp %g1, 0 40005394: 12 bf ff ab bne 40005240 40005398: 90 10 00 1c mov %i4, %o0 4000539c: c2 06 40 00 ld [ %i1 ], %g1 if (LIBIO_NODELAY(iop)) 400053a0: 80 88 60 01 btst 1, %g1 400053a4: 12 bf ff a7 bne 40005240 400053a8: 90 10 00 1c mov %i4, %o0 prevCounter = pipe->writerCounter; 400053ac: f4 07 60 24 ld [ %i5 + 0x24 ], %i2 PIPE_READWAIT(pipe); 400053b0: b6 07 60 3c add %i5, 0x3c, %i3 _Condition_Wait( condition_variable, mutex ); 400053b4: 92 10 00 1c mov %i4, %o1 400053b8: 40 00 01 e3 call 40005b44 <_Condition_Wait> 400053bc: 90 10 00 1b mov %i3, %o0 } while (prevCounter == pipe->writerCounter); 400053c0: c2 07 60 24 ld [ %i5 + 0x24 ], %g1 400053c4: 80 a0 40 1a cmp %g1, %i2 400053c8: 02 bf ff fc be 400053b8 <== NEVER TAKEN 400053cc: 92 10 00 1c mov %i4, %o1 _Mutex_Release( mutex ); 400053d0: 10 bf ff 9c b 40005240 400053d4: 90 10 00 1c mov %i4, %o0 if (pipe->Readers ++ == 0) 400053d8: c4 07 60 10 ld [ %i5 + 0x10 ], %g2 pipe->readerCounter ++; 400053dc: c2 07 60 20 ld [ %i5 + 0x20 ], %g1 400053e0: 82 00 60 01 inc %g1 if (pipe->Readers ++ == 0) 400053e4: 86 00 a0 01 add %g2, 1, %g3 pipe->readerCounter ++; 400053e8: c2 27 60 20 st %g1, [ %i5 + 0x20 ] if (pipe->Readers ++ == 0) 400053ec: 80 a0 a0 00 cmp %g2, 0 400053f0: 02 80 00 11 be 40005434 <== ALWAYS TAKEN 400053f4: c6 27 60 10 st %g3, [ %i5 + 0x10 ] if (pipe->Writers ++ == 0) 400053f8: c4 07 60 14 ld [ %i5 + 0x14 ], %g2 <== NOT EXECUTED pipe->writerCounter ++; 400053fc: c2 07 60 24 ld [ %i5 + 0x24 ], %g1 40005400: 82 00 60 01 inc %g1 if (pipe->Writers ++ == 0) 40005404: 86 00 a0 01 add %g2, 1, %g3 pipe->writerCounter ++; 40005408: c2 27 60 24 st %g1, [ %i5 + 0x24 ] if (pipe->Writers ++ == 0) 4000540c: 80 a0 a0 00 cmp %g2, 0 40005410: 12 bf ff 8b bne 4000523c <== NEVER TAKEN 40005414: c6 27 60 14 st %g3, [ %i5 + 0x14 ] _Condition_Broadcast( condition_variable ); 40005418: 40 00 01 de call 40005b90 <_Condition_Broadcast> 4000541c: 90 07 60 3c add %i5, 0x3c, %o0 } 40005420: 10 bf ff 88 b 40005240 40005424: 90 10 00 1c mov %i4, %o0 c = 'a'; 40005428: 82 10 20 61 mov 0x61, %g1 4000542c: 10 bf ff 74 b 400051fc 40005430: c2 28 a1 04 stb %g1, [ %g2 + 0x104 ] _Condition_Broadcast( condition_variable ); 40005434: 40 00 01 d7 call 40005b90 <_Condition_Broadcast> 40005438: 90 07 60 50 add %i5, 0x50, %o0 } 4000543c: 10 bf ff f0 b 400053fc 40005440: c4 07 60 14 ld [ %i5 + 0x14 ], %g2 _Condition_Broadcast( condition_variable ); 40005444: 40 00 01 d3 call 40005b90 <_Condition_Broadcast> 40005448: 90 07 60 50 add %i5, 0x50, %o0 } 4000544c: 10 bf ff d1 b 40005390 40005450: c2 07 60 14 ld [ %i5 + 0x14 ], %g1 _Condition_Broadcast( condition_variable ); 40005454: 40 00 01 cf call 40005b90 <_Condition_Broadcast> 40005458: 90 07 60 3c add %i5, 0x3c, %o0 } 4000545c: 10 bf ff b0 b 4000531c 40005460: c2 07 60 10 ld [ %i5 + 0x10 ], %g1 _Mutex_Release( mutex ); 40005464: 40 00 03 ba call 4000634c <_Mutex_Release> 40005468: 90 10 00 1c mov %i4, %o0 pipe_release(pipep, iop); 4000546c: 90 10 00 18 mov %i0, %o0 40005470: 92 10 00 19 mov %i1, %o1 40005474: 7f ff ff 25 call 40005108 40005478: b0 10 3f fa mov -6, %i0 return err; 4000547c: 81 c7 e0 08 ret 40005480: 81 e8 00 00 restore free(pipe); 40005484: 40 00 11 9b call 40009af0 <== NOT EXECUTED 40005488: 90 10 00 1d mov %i5, %o0 <== NOT EXECUTED 4000548c: 90 17 21 08 or %i4, 0x108, %o0 40005490: 40 00 03 af call 4000634c <_Mutex_Release> 40005494: b0 10 3f f4 mov -12, %i0 if (err) 40005498: 81 c7 e0 08 ret 4000549c: 81 e8 00 00 restore =============================================================================== 40005334 : static uint16_t rtems_pipe_no = 0; int pipe( int filsdes[2] ) { 40005334: 9d e3 bf 90 save %sp, -112, %sp rtems_libio_t *iop; int err = 0; if (filsdes == NULL) 40005338: ba 96 20 00 orcc %i0, 0, %i5 4000533c: 02 80 00 59 be 400054a0 40005340: 92 10 21 ff mov 0x1ff, %o1 rtems_set_errno_and_return_minus_one( EFAULT ); if (rtems_mkdir("/tmp", S_IRWXU | S_IRWXG | S_IRWXO) != 0) 40005344: 11 10 00 5b sethi %hi(0x40016c00), %o0 40005348: 40 00 12 59 call 40009cac 4000534c: 90 12 22 28 or %o0, 0x228, %o0 ! 40016e28 40005350: 80 a2 20 00 cmp %o0, 0 40005354: 12 80 00 51 bne 40005498 40005358: 03 10 00 6d sethi %hi(0x4001b400), %g1 return -1; /* /tmp/.fifoXXXX */ char fifopath[15]; memcpy(fifopath, "/tmp/.fifo", 10); sprintf(fifopath + 10, "%04x", rtems_pipe_no ++); 4000535c: d4 10 62 c8 lduh [ %g1 + 0x2c8 ], %o2 ! 4001b6c8 40005360: 84 02 a0 01 add %o2, 1, %g2 memcpy(fifopath, "/tmp/.fifo", 10); 40005364: 07 0b cb 99 sethi %hi(0x2f2e6400), %g3 sprintf(fifopath + 10, "%04x", rtems_pipe_no ++); 40005368: c4 30 62 c8 sth %g2, [ %g1 + 0x2c8 ] memcpy(fifopath, "/tmp/.fifo", 10); 4000536c: 86 10 e2 69 or %g3, 0x269, %g3 40005370: 05 0b dd 1b sethi %hi(0x2f746c00), %g2 40005374: 03 00 00 19 sethi %hi(0x6400), %g1 40005378: 84 10 a1 70 or %g2, 0x170, %g2 4000537c: 82 10 62 6f or %g1, 0x26f, %g1 40005380: c4 3f bf f0 std %g2, [ %fp + -16 ] sprintf(fifopath + 10, "%04x", rtems_pipe_no ++); 40005384: 95 2a a0 10 sll %o2, 0x10, %o2 memcpy(fifopath, "/tmp/.fifo", 10); 40005388: c2 37 bf f8 sth %g1, [ %fp + -8 ] sprintf(fifopath + 10, "%04x", rtems_pipe_no ++); 4000538c: 95 32 a0 10 srl %o2, 0x10, %o2 40005390: 13 10 00 5b sethi %hi(0x40016c00), %o1 40005394: 90 07 bf fa add %fp, -6, %o0 40005398: 40 00 2d bd call 40010a8c 4000539c: 92 12 62 30 or %o1, 0x230, %o1 /* Try creating FIFO file until find an available file name */ while (mkfifo(fifopath, S_IRUSR|S_IWUSR) != 0) { 400053a0: 92 10 21 80 mov 0x180, %o1 400053a4: 40 00 12 39 call 40009c88 400053a8: 90 07 bf f0 add %fp, -16, %o0 400053ac: b0 92 20 00 orcc %o0, 0, %i0 400053b0: 12 80 00 1c bne 40005420 <== NEVER TAKEN 400053b4: 13 00 00 10 sethi %hi(0x4000), %o1 return -1; /* sprintf(fifopath + 10, "%04x", rtems_pipe_no ++); */ } /* Non-blocking open to avoid waiting for writers */ filsdes[0] = open(fifopath, O_RDONLY | O_NONBLOCK); 400053b8: 7f ff f2 aa call 40001e60 400053bc: 90 07 bf f0 add %fp, -16, %o0 if (filsdes[0] < 0) { 400053c0: 80 a2 20 00 cmp %o0, 0 400053c4: 06 80 00 1b bl 40005430 400053c8: d0 27 40 00 st %o0, [ %i5 ] return &rtems_libio_iops[ fd ]; 400053cc: 83 2a 20 01 sll %o0, 1, %g1 400053d0: 05 10 00 68 sethi %hi(0x4001a000), %g2 400053d4: 90 00 40 08 add %g1, %o0, %o0 400053d8: 84 10 a0 a0 or %g2, 0xa0, %g2 400053dc: 91 2a 20 04 sll %o0, 4, %o0 __asm__ volatile ( "ta %1\n\t" : "=r" (psr) : "i" (SPARC_SWTRAP_IRQDIS)); 400053e0: 91 d0 20 09 ta 9 *obj = val & arg; 400053e4: c6 02 00 02 ld [ %o0 + %g2 ], %g3 400053e8: 86 08 ff fe and %g3, -2, %g3 400053ec: c6 22 00 02 st %g3, [ %o0 + %g2 ] __asm__ volatile ( "ta %0\nnop\n" :: "i" (SPARC_SWTRAP_IRQEN), "r" (_psr)); 400053f0: 91 d0 20 0a ta 0xa 400053f4: 01 00 00 00 nop else { /* Reset open file to blocking mode */ iop = rtems_libio_iop(filsdes[0]); rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_NO_DELAY ); filsdes[1] = open(fifopath, O_WRONLY); 400053f8: 92 10 20 01 mov 1, %o1 ! 1 <_TLS_Alignment> 400053fc: 7f ff f2 99 call 40001e60 40005400: 90 07 bf f0 add %fp, -16, %o0 if (filsdes[1] < 0) { 40005404: 80 a2 20 00 cmp %o0, 0 40005408: 06 80 00 15 bl 4000545c 4000540c: d0 27 60 04 st %o0, [ %i5 + 4 ] err = errno; close(filsdes[0]); } unlink(fifopath); 40005410: 7f ff f6 84 call 40002e20 40005414: 90 07 bf f0 add %fp, -16, %o0 } if(err != 0) 40005418: 81 c7 e0 08 ret 4000541c: 81 e8 00 00 restore if (errno != EEXIST){ 40005420: 40 00 2c 85 call 40010634 <__errno> <== NOT EXECUTED 40005424: b0 10 3f ff mov -1, %i0 <== NOT EXECUTED 40005428: 81 c7 e0 08 ret <== NOT EXECUTED 4000542c: 81 e8 00 00 restore <== NOT EXECUTED err = errno; 40005430: 40 00 2c 81 call 40010634 <__errno> 40005434: 01 00 00 00 nop 40005438: 82 10 00 08 mov %o0, %g1 unlink(fifopath); 4000543c: 90 07 bf f0 add %fp, -16, %o0 40005440: 7f ff f6 78 call 40002e20 40005444: f0 00 40 00 ld [ %g1 ], %i0 if(err != 0) 40005448: 80 a6 20 00 cmp %i0, 0 4000544c: 12 80 00 0e bne 40005484 <== ALWAYS TAKEN 40005450: 01 00 00 00 nop rtems_set_errno_and_return_minus_one(err); return 0; } 40005454: 81 c7 e0 08 ret <== NOT EXECUTED 40005458: 81 e8 00 00 restore <== NOT EXECUTED err = errno; 4000545c: 40 00 2c 76 call 40010634 <__errno> 40005460: 01 00 00 00 nop 40005464: 82 10 00 08 mov %o0, %g1 close(filsdes[0]); 40005468: d0 07 40 00 ld [ %i5 ], %o0 4000546c: 7f ff f0 59 call 400015d0 40005470: f0 00 40 00 ld [ %g1 ], %i0 unlink(fifopath); 40005474: 7f ff f6 6b call 40002e20 40005478: 90 07 bf f0 add %fp, -16, %o0 if(err != 0) 4000547c: 10 bf ff f4 b 4000544c 40005480: 80 a6 20 00 cmp %i0, 0 rtems_set_errno_and_return_minus_one(err); 40005484: 40 00 2c 6c call 40010634 <__errno> 40005488: 01 00 00 00 nop 4000548c: f0 22 00 00 st %i0, [ %o0 ] 40005490: 81 c7 e0 08 ret 40005494: 91 e8 3f ff restore %g0, -1, %o0 } 40005498: 81 c7 e0 08 ret 4000549c: 91 e8 3f ff restore %g0, -1, %o0 rtems_set_errno_and_return_minus_one( EFAULT ); 400054a0: 40 00 2c 65 call 40010634 <__errno> 400054a4: b0 10 3f ff mov -1, %i0 400054a8: 82 10 20 0e mov 0xe, %g1 400054ac: c2 22 00 00 st %g1, [ %o0 ] 400054b0: 81 c7 e0 08 ret 400054b4: 81 e8 00 00 restore =============================================================================== 400054a0 : pipe_control_t *pipe, void *buffer, size_t count, rtems_libio_t *iop ) { 400054a0: 9d e3 bf a0 save %sp, -96, %sp int chunk, chunk1, read = 0, ret = 0; PIPE_LOCK(pipe); 400054a4: b8 06 20 28 add %i0, 0x28, %i4 _Mutex_Acquire( mutex ); 400054a8: 40 00 03 8e call 400062e0 <_Mutex_Acquire> 400054ac: 90 10 00 1c mov %i4, %o0 while (PIPE_EMPTY(pipe)) { 400054b0: d4 06 20 0c ld [ %i0 + 0xc ], %o2 400054b4: 80 a2 a0 00 cmp %o2, 0 400054b8: 12 80 00 1c bne 40005528 400054bc: 80 a2 80 1a cmp %o2, %i2 goto out_locked; } /* Wait until pipe is no more empty or no writer exists */ pipe->waitingReaders ++; PIPE_READWAIT(pipe); 400054c0: 10 80 00 11 b 40005504 400054c4: ba 06 20 3c add %i0, 0x3c, %i5 _Condition_Wait( condition_variable, mutex ); 400054c8: 92 10 00 1c mov %i4, %o1 if (LIBIO_NODELAY(iop)) { 400054cc: 80 88 60 01 btst 1, %g1 400054d0: 12 80 00 3d bne 400055c4 400054d4: 90 10 00 1d mov %i5, %o0 pipe->waitingReaders ++; 400054d8: c2 06 20 18 ld [ %i0 + 0x18 ], %g1 400054dc: 82 00 60 01 inc %g1 400054e0: 40 00 01 99 call 40005b44 <_Condition_Wait> 400054e4: c2 26 20 18 st %g1, [ %i0 + 0x18 ] pipe->waitingReaders --; 400054e8: c2 06 20 18 ld [ %i0 + 0x18 ], %g1 400054ec: 82 00 7f ff add %g1, -1, %g1 400054f0: c2 26 20 18 st %g1, [ %i0 + 0x18 ] while (PIPE_EMPTY(pipe)) { 400054f4: d4 06 20 0c ld [ %i0 + 0xc ], %o2 400054f8: 80 a2 a0 00 cmp %o2, 0 400054fc: 12 80 00 0b bne 40005528 <== ALWAYS TAKEN 40005500: 80 a2 80 1a cmp %o2, %i2 if (pipe->Writers == 0) 40005504: c2 06 20 14 ld [ %i0 + 0x14 ], %g1 40005508: 80 a0 60 00 cmp %g1, 0 4000550c: 32 bf ff ef bne,a 400054c8 40005510: c2 06 c0 00 ld [ %i3 ], %g1 int chunk, chunk1, read = 0, ret = 0; 40005514: b0 10 20 00 clr %i0 _Mutex_Release( mutex ); 40005518: 40 00 03 8d call 4000634c <_Mutex_Release> 4000551c: 90 10 00 1c mov %i4, %o0 PIPE_UNLOCK(pipe); if (read > 0) return read; return ret; } 40005520: 81 c7 e0 08 ret 40005524: 81 e8 00 00 restore chunk = MIN(count - read, pipe->Length); 40005528: 18 80 00 35 bgu 400055fc 4000552c: ba 10 00 0a mov %o2, %i5 chunk1 = pipe->Size - pipe->Start; 40005530: c2 06 20 08 ld [ %i0 + 8 ], %g1 40005534: f6 06 20 04 ld [ %i0 + 4 ], %i3 memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1); 40005538: d2 06 00 00 ld [ %i0 ], %o1 chunk1 = pipe->Size - pipe->Start; 4000553c: b6 26 c0 01 sub %i3, %g1, %i3 if (chunk > chunk1) { 40005540: 80 a7 40 1b cmp %i5, %i3 40005544: 14 80 00 25 bg 400055d8 40005548: 92 02 40 01 add %o1, %g1, %o1 memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk); 4000554c: 94 10 00 1d mov %i5, %o2 40005550: 40 00 2d b6 call 40010c28 40005554: 90 10 00 19 mov %i1, %o0 pipe->Start += chunk; 40005558: c2 06 20 08 ld [ %i0 + 8 ], %g1 pipe->Length -= chunk; 4000555c: c4 06 20 0c ld [ %i0 + 0xc ], %g2 pipe->Start %= pipe->Size; 40005560: c8 06 20 04 ld [ %i0 + 4 ], %g4 pipe->Start += chunk; 40005564: 82 07 40 01 add %i5, %g1, %g1 pipe->Length -= chunk; 40005568: 84 20 80 1d sub %g2, %i5, %g2 pipe->Start %= pipe->Size; 4000556c: 81 80 20 00 wr %g0, %y 40005570: 01 00 00 00 nop 40005574: 01 00 00 00 nop 40005578: 01 00 00 00 nop 4000557c: 86 70 40 04 udiv %g1, %g4, %g3 pipe->Length -= chunk; 40005580: c4 26 20 0c st %g2, [ %i0 + 0xc ] pipe->Start %= pipe->Size; 40005584: 86 58 c0 04 smul %g3, %g4, %g3 40005588: 82 20 40 03 sub %g1, %g3, %g1 if (PIPE_EMPTY(pipe)) 4000558c: 80 a0 a0 00 cmp %g2, 0 40005590: 12 80 00 03 bne 4000559c 40005594: c2 26 20 08 st %g1, [ %i0 + 8 ] pipe->Start = 0; 40005598: c0 26 20 08 clr [ %i0 + 8 ] if (pipe->waitingWriters > 0) 4000559c: c2 06 20 1c ld [ %i0 + 0x1c ], %g1 400055a0: 80 a0 60 00 cmp %g1, 0 400055a4: 12 80 00 20 bne 40005624 400055a8: 90 10 00 1c mov %i4, %o0 400055ac: 40 00 03 68 call 4000634c <_Mutex_Release> 400055b0: b0 38 00 1d xnor %g0, %i5, %i0 if (read > 0) 400055b4: b1 3e 20 1f sra %i0, 0x1f, %i0 400055b8: b0 0f 40 18 and %i5, %i0, %i0 400055bc: 81 c7 e0 08 ret 400055c0: 81 e8 00 00 restore ret = -EAGAIN; 400055c4: b0 10 3f f5 mov -11, %i0 400055c8: 40 00 03 61 call 4000634c <_Mutex_Release> 400055cc: 90 10 00 1c mov %i4, %o0 } 400055d0: 81 c7 e0 08 ret 400055d4: 81 e8 00 00 restore memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1); 400055d8: 94 10 00 1b mov %i3, %o2 400055dc: 40 00 2d 93 call 40010c28 400055e0: 90 10 00 19 mov %i1, %o0 memcpy(buffer + read + chunk1, pipe->Buffer, chunk - chunk1); 400055e4: d2 06 00 00 ld [ %i0 ], %o1 400055e8: 94 27 40 1b sub %i5, %i3, %o2 400055ec: 40 00 2d 8f call 40010c28 400055f0: 90 06 40 1b add %i1, %i3, %o0 400055f4: 10 bf ff da b 4000555c 400055f8: c2 06 20 08 ld [ %i0 + 8 ], %g1 chunk1 = pipe->Size - pipe->Start; 400055fc: c2 06 20 08 ld [ %i0 + 8 ], %g1 40005600: f6 06 20 04 ld [ %i0 + 4 ], %i3 memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1); 40005604: d2 06 00 00 ld [ %i0 ], %o1 chunk = MIN(count - read, pipe->Length); 40005608: ba 10 00 1a mov %i2, %i5 chunk1 = pipe->Size - pipe->Start; 4000560c: b6 26 c0 01 sub %i3, %g1, %i3 if (chunk > chunk1) { 40005610: 80 a7 40 1b cmp %i5, %i3 40005614: 04 bf ff ce ble 4000554c <== ALWAYS TAKEN 40005618: 92 02 40 01 add %o1, %g1, %o1 memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1); 4000561c: 10 bf ff f0 b 400055dc <== NOT EXECUTED 40005620: 94 10 00 1b mov %i3, %o2 <== NOT EXECUTED _Condition_Broadcast( condition_variable ); 40005624: 40 00 01 5b call 40005b90 <_Condition_Broadcast> 40005628: 90 06 20 50 add %i0, 0x50, %o0 _Mutex_Release( mutex ); 4000562c: 90 10 00 1c mov %i4, %o0 40005630: 40 00 03 47 call 4000634c <_Mutex_Release> 40005634: b0 38 00 1d xnor %g0, %i5, %i0 if (read > 0) 40005638: b1 3e 20 1f sra %i0, 0x1f, %i0 4000563c: b0 0f 40 18 and %i5, %i0, %i0 40005640: 81 c7 e0 08 ret 40005644: 81 e8 00 00 restore =============================================================================== 40005108 : void pipe_release( pipe_control_t **pipep, rtems_libio_t *iop ) { 40005108: 9d e3 bf 98 save %sp, -104, %sp mutex->_Queue._name = name; } static __inline void rtems_mutex_lock( rtems_mutex *mutex ) { _Mutex_Acquire( mutex ); 4000510c: 39 10 00 69 sethi %hi(0x4001a400), %i4 pipe_control_t *pipe = *pipep; 40005110: fa 06 00 00 ld [ %i0 ], %i5 40005114: 40 00 04 73 call 400062e0 <_Mutex_Acquire> 40005118: 90 17 21 08 or %i4, 0x108, %o0 uint32_t mode; pipe_lock(); PIPE_LOCK(pipe); 4000511c: 90 07 60 28 add %i5, 0x28, %o0 40005120: 40 00 04 70 call 400062e0 <_Mutex_Acquire> 40005124: d0 27 bf fc st %o0, [ %fp + -4 ] 40005128: c2 06 40 00 ld [ %i1 ], %g1 mode = LIBIO_ACCMODE(iop); if (mode & LIBIO_FLAGS_READ) 4000512c: d0 07 bf fc ld [ %fp + -4 ], %o0 40005130: 80 88 60 02 btst 2, %g1 40005134: 02 80 00 05 be 40005148 40005138: b6 08 60 06 and %g1, 6, %i3 pipe->Readers --; 4000513c: c4 07 60 10 ld [ %i5 + 0x10 ], %g2 40005140: 84 00 bf ff add %g2, -1, %g2 40005144: c4 27 60 10 st %g2, [ %i5 + 0x10 ] if (mode & LIBIO_FLAGS_WRITE) 40005148: 80 88 60 04 btst 4, %g1 4000514c: 02 80 00 05 be 40005160 40005150: 01 00 00 00 nop pipe->Writers --; 40005154: c2 07 60 14 ld [ %i5 + 0x14 ], %g1 40005158: 82 00 7f ff add %g1, -1, %g1 4000515c: c2 27 60 14 st %g1, [ %i5 + 0x14 ] } static __inline void rtems_mutex_unlock( rtems_mutex *mutex ) { _Mutex_Release( mutex ); 40005160: 40 00 04 7b call 4000634c <_Mutex_Release> 40005164: 01 00 00 00 nop PIPE_UNLOCK(pipe); if (pipe->Readers == 0 && pipe->Writers == 0) { 40005168: c2 07 60 10 ld [ %i5 + 0x10 ], %g1 4000516c: 80 a0 60 00 cmp %g1, 0 40005170: 02 80 00 0b be 4000519c 40005174: c2 07 60 14 ld [ %i5 + 0x14 ], %g1 *pipep = NULL; } else if (pipe->Readers == 0 && mode != LIBIO_FLAGS_WRITE) /* Notify waiting Writers that all their partners left */ PIPE_WAKEUPWRITERS(pipe); else if (pipe->Writers == 0 && mode != LIBIO_FLAGS_READ) 40005178: 80 a0 60 00 cmp %g1, 0 4000517c: 12 80 00 06 bne 40005194 <== NEVER TAKEN 40005180: 80 a6 e0 02 cmp %i3, 2 40005184: 02 80 00 04 be 40005194 <== NEVER TAKEN 40005188: 01 00 00 00 nop static __inline void rtems_condition_variable_broadcast( rtems_condition_variable *condition_variable ) { _Condition_Broadcast( condition_variable ); 4000518c: 40 00 02 81 call 40005b90 <_Condition_Broadcast> 40005190: 90 07 60 3c add %i5, 0x3c, %o0 _Mutex_Release( mutex ); 40005194: 40 00 04 6e call 4000634c <_Mutex_Release> 40005198: 91 ef 21 08 restore %i4, 0x108, %o0 if (pipe->Readers == 0 && pipe->Writers == 0) { 4000519c: 80 a0 60 00 cmp %g1, 0 400051a0: 02 80 00 08 be 400051c0 400051a4: 80 a6 e0 04 cmp %i3, 4 else if (pipe->Readers == 0 && mode != LIBIO_FLAGS_WRITE) 400051a8: 02 bf ff fb be 40005194 <== NEVER TAKEN 400051ac: 90 07 60 50 add %i5, 0x50, %o0 _Condition_Broadcast( condition_variable ); 400051b0: 40 00 02 78 call 40005b90 <_Condition_Broadcast> 400051b4: b0 17 21 08 or %i4, 0x108, %i0 _Mutex_Release( mutex ); 400051b8: 40 00 04 65 call 4000634c <_Mutex_Release> 400051bc: 81 e8 00 00 restore free(pipe->Buffer); 400051c0: 40 00 12 4c call 40009af0 400051c4: d0 07 40 00 ld [ %i5 ], %o0 free(pipe); 400051c8: 40 00 12 4a call 40009af0 400051cc: 90 10 00 1d mov %i5, %o0 *pipep = NULL; 400051d0: c0 26 00 00 clr [ %i0 ] 400051d4: 40 00 04 5e call 4000634c <_Mutex_Release> 400051d8: 91 ef 21 08 restore %i4, 0x108, %o0 =============================================================================== 40005648 : pipe_control_t *pipe, const void *buffer, size_t count, rtems_libio_t *iop ) { 40005648: 9d e3 bf a0 save %sp, -96, %sp 4000564c: ba 10 00 18 mov %i0, %i5 int chunk, chunk1, written = 0, ret = 0; /* Write nothing */ if (count == 0) 40005650: 80 a6 a0 00 cmp %i2, 0 40005654: 02 80 00 60 be 400057d4 <== NEVER TAKEN 40005658: b0 10 20 00 clr %i0 return 0; PIPE_LOCK(pipe); 4000565c: a0 07 60 28 add %i5, 0x28, %l0 _Mutex_Acquire( mutex ); 40005660: 40 00 03 20 call 400062e0 <_Mutex_Acquire> 40005664: 90 10 00 10 mov %l0, %o0 if (pipe->Readers == 0) { 40005668: c2 07 60 10 ld [ %i5 + 0x10 ], %g1 4000566c: 80 a0 60 00 cmp %g1, 0 40005670: 02 80 00 4a be 40005798 40005674: 01 00 00 00 nop ret = -EPIPE; goto out_locked; } /* Write of PIPE_BUF bytes or less shall not be interleaved */ chunk = count <= pipe->Size ? count : 1; 40005678: d4 07 60 04 ld [ %i5 + 4 ], %o2 4000567c: 80 a2 80 1a cmp %o2, %i2 40005680: 0a 80 00 44 bcs 40005790 <== NEVER TAKEN 40005684: b8 10 00 1a mov %i2, %i4 40005688: b0 10 20 00 clr %i0 while (written < count) { 4000568c: a4 10 20 00 clr %l2 goto out_locked; } /* Wait until there is chunk bytes space or no reader exists */ pipe->waitingWriters ++; PIPE_WRITEWAIT(pipe); 40005690: a2 07 60 50 add %i5, 0x50, %l1 else memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk); pipe->Length += chunk; if (pipe->waitingReaders > 0) PIPE_WAKEUPREADERS(pipe); 40005694: 10 80 00 12 b 400056dc 40005698: a6 07 60 3c add %i5, 0x3c, %l3 if (LIBIO_NODELAY(iop)) { 4000569c: 80 88 60 01 btst 1, %g1 400056a0: 12 80 00 47 bne 400057bc 400056a4: 92 10 00 10 mov %l0, %o1 pipe->waitingWriters ++; 400056a8: c2 07 60 1c ld [ %i5 + 0x1c ], %g1 400056ac: 82 00 60 01 inc %g1 400056b0: c2 27 60 1c st %g1, [ %i5 + 0x1c ] _Condition_Wait( condition_variable, mutex ); 400056b4: 40 00 01 24 call 40005b44 <_Condition_Wait> 400056b8: 90 10 00 11 mov %l1, %o0 pipe->waitingWriters --; 400056bc: c2 07 60 1c ld [ %i5 + 0x1c ], %g1 400056c0: 82 00 7f ff add %g1, -1, %g1 400056c4: c2 27 60 1c st %g1, [ %i5 + 0x1c ] if (pipe->Readers == 0) { 400056c8: c2 07 60 10 ld [ %i5 + 0x10 ], %g1 400056cc: 80 a0 60 00 cmp %g1, 0 400056d0: 02 80 00 43 be 400057dc <== NEVER TAKEN 400056d4: 01 00 00 00 nop while (PIPE_SPACE(pipe) < chunk) { 400056d8: d4 07 60 04 ld [ %i5 + 4 ], %o2 400056dc: c2 07 60 0c ld [ %i5 + 0xc ], %g1 400056e0: 84 22 80 01 sub %o2, %g1, %g2 400056e4: 80 a0 80 1c cmp %g2, %i4 400056e8: 2a bf ff ed bcs,a 4000569c 400056ec: c2 06 c0 00 ld [ %i3 ], %g1 chunk = MIN(count - written, PIPE_SPACE(pipe)); 400056f0: a8 26 80 12 sub %i2, %l2, %l4 400056f4: 80 a5 00 02 cmp %l4, %g2 400056f8: 38 80 00 02 bgu,a 40005700 <== NEVER TAKEN 400056fc: a8 10 00 02 mov %g2, %l4 <== NOT EXECUTED chunk1 = pipe->Size - PIPE_WSTART(pipe); 40005700: c4 07 60 08 ld [ %i5 + 8 ], %g2 memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1); 40005704: d0 07 40 00 ld [ %i5 ], %o0 chunk1 = pipe->Size - PIPE_WSTART(pipe); 40005708: 82 00 40 02 add %g1, %g2, %g1 memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1); 4000570c: 92 06 40 12 add %i1, %l2, %o1 chunk1 = pipe->Size - PIPE_WSTART(pipe); 40005710: 81 80 20 00 wr %g0, %y 40005714: 01 00 00 00 nop 40005718: 01 00 00 00 nop 4000571c: 01 00 00 00 nop 40005720: 84 70 40 0a udiv %g1, %o2, %g2 40005724: 84 58 80 0a smul %g2, %o2, %g2 40005728: 82 20 40 02 sub %g1, %g2, %g1 4000572c: b8 22 80 01 sub %o2, %g1, %i4 if (chunk > chunk1) { 40005730: 80 a5 00 1c cmp %l4, %i4 40005734: 04 80 00 32 ble 400057fc 40005738: 90 02 00 01 add %o0, %g1, %o0 memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1); 4000573c: 40 00 2d 3b call 40010c28 40005740: 94 10 00 1c mov %i4, %o2 memcpy(pipe->Buffer, buffer + written + chunk1, chunk - chunk1); 40005744: d0 07 40 00 ld [ %i5 ], %o0 40005748: 92 04 80 1c add %l2, %i4, %o1 4000574c: 94 25 00 1c sub %l4, %i4, %o2 40005750: 40 00 2d 36 call 40010c28 40005754: 92 06 40 09 add %i1, %o1, %o1 pipe->Length += chunk; 40005758: c2 07 60 0c ld [ %i5 + 0xc ], %g1 4000575c: 82 00 40 14 add %g1, %l4, %g1 40005760: c2 27 60 0c st %g1, [ %i5 + 0xc ] if (pipe->waitingReaders > 0) 40005764: c2 07 60 18 ld [ %i5 + 0x18 ], %g1 40005768: 80 a0 60 00 cmp %g1, 0 4000576c: 12 80 00 28 bne 4000580c 40005770: 01 00 00 00 nop written += chunk; 40005774: b0 06 00 14 add %i0, %l4, %i0 while (written < count) { 40005778: 80 a6 00 1a cmp %i0, %i2 4000577c: 1a 80 00 28 bcc 4000581c <== ALWAYS TAKEN 40005780: a4 10 00 18 mov %i0, %l2 while (PIPE_SPACE(pipe) < chunk) { 40005784: d4 07 60 04 ld [ %i5 + 4 ], %o2 <== NOT EXECUTED /* Write of more than PIPE_BUF bytes can be interleaved */ chunk = 1; 40005788: 10 bf ff d5 b 400056dc <== NOT EXECUTED 4000578c: b8 10 20 01 mov 1, %i4 <== NOT EXECUTED chunk = count <= pipe->Size ? count : 1; 40005790: 10 bf ff be b 40005688 <== NOT EXECUTED 40005794: b8 10 20 01 mov 1, %i4 <== NOT EXECUTED _Mutex_Release( mutex ); 40005798: 40 00 02 ed call 4000634c <_Mutex_Release> 4000579c: 90 10 00 10 mov %l0, %o0 PIPE_UNLOCK(pipe); #ifdef RTEMS_POSIX_API /* Signal SIGPIPE */ if (ret == -EPIPE) kill(getpid(), SIGPIPE); 400057a0: 40 00 11 66 call 40009d38 400057a4: 01 00 00 00 nop 400057a8: 40 00 0e a7 call 40009244 400057ac: 92 10 20 0d mov 0xd, %o1 ! d <_TLS_Alignment+0xc> 400057b0: 82 10 3f e0 mov -32, %g1 #endif if (written > 0) return written; return ret; } 400057b4: 81 c7 e0 08 ret 400057b8: 91 e8 00 01 restore %g0, %g1, %o0 400057bc: 40 00 02 e4 call 4000634c <_Mutex_Release> 400057c0: 90 10 00 10 mov %l0, %o0 ret = -EAGAIN; 400057c4: 82 10 3f f5 mov -11, %g1 if (written > 0) 400057c8: 80 a6 20 00 cmp %i0, 0 400057cc: 04 bf ff fa ble 400057b4 400057d0: 01 00 00 00 nop } 400057d4: 81 c7 e0 08 ret 400057d8: 81 e8 00 00 restore 400057dc: 40 00 02 dc call 4000634c <_Mutex_Release> <== NOT EXECUTED 400057e0: 90 10 00 10 mov %l0, %o0 <== NOT EXECUTED kill(getpid(), SIGPIPE); 400057e4: 40 00 11 55 call 40009d38 <== NOT EXECUTED 400057e8: 01 00 00 00 nop <== NOT EXECUTED 400057ec: 40 00 0e 96 call 40009244 <== NOT EXECUTED 400057f0: 92 10 20 0d mov 0xd, %o1 ! d <_TLS_Alignment+0xc> <== NOT EXECUTED 400057f4: 10 bf ff f5 b 400057c8 <== NOT EXECUTED 400057f8: 82 10 3f e0 mov -32, %g1 <== NOT EXECUTED memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk); 400057fc: 40 00 2d 0b call 40010c28 40005800: 94 10 00 14 mov %l4, %o2 pipe->Length += chunk; 40005804: 10 bf ff d6 b 4000575c 40005808: c2 07 60 0c ld [ %i5 + 0xc ], %g1 _Condition_Broadcast( condition_variable ); 4000580c: 40 00 00 e1 call 40005b90 <_Condition_Broadcast> 40005810: 90 10 00 13 mov %l3, %o0 } 40005814: 10 bf ff d9 b 40005778 40005818: b0 06 00 14 add %i0, %l4, %i0 _Mutex_Release( mutex ); 4000581c: 40 00 02 cc call 4000634c <_Mutex_Release> 40005820: 90 10 00 10 mov %l0, %o0 40005824: 10 bf ff e9 b 400057c8 40005828: 82 10 20 00 clr %g1