RTEMS-6
Annotated Report
libpipe
Sun Feb 28 23:43:26 2021
001070b4 <fifo_open>:
int fifo_open(
pipe_control_t **pipep,
rtems_libio_t *iop
)
{
1070b4: b5f8 push {r3, r4, r5, r6, r7, lr}
1070b6: 4605 mov r5, r0
_Mutex_Acquire( mutex );
1070b8: f240 1088 movw r0, #392 ; 0x188
1070bc: 460f mov r7, r1
1070be: f2c0 0020 movt r0, #32
1070c2: f000 fe31 bl 107d28 <_Mutex_Acquire>
pipe = *pipep;
1070c6: 682c ldr r4, [r5, #0]
if (pipe == NULL) {
1070c8: b1dc cbz r4, 107102 <fifo_open+0x4e>
1070ca: f104 0028 add.w r0, r4, #40 ; 0x28
1070ce: f000 fe2b bl 107d28 <_Mutex_Acquire>
_Mutex_Release( mutex );
1070d2: f240 1088 movw r0, #392 ; 0x188
*pipep = pipe;
1070d6: 602c str r4, [r5, #0]
1070d8: f2c0 0020 movt r0, #32
1070dc: f000 fe50 bl 107d80 <_Mutex_Release>
int err;
err = pipe_new(pipep);
if (err)
return err;
pipe = *pipep;
1070e0: 682c ldr r4, [r5, #0]
1070e2: 683b ldr r3, [r7, #0]
switch (LIBIO_ACCMODE(iop)) {
1070e4: f003 0306 and.w r3, r3, #6
prevCounter = pipe->writerCounter;
err = -EINTR;
/* Wait until a writer opens the pipe */
do {
PIPE_READWAIT(pipe);
1070e8: f104 0628 add.w r6, r4, #40 ; 0x28
switch (LIBIO_ACCMODE(iop)) {
1070ec: 2b04 cmp r3, #4
1070ee: d071 beq.n 1071d4 <fifo_open+0x120>
1070f0: 2b06 cmp r3, #6
1070f2: d05b beq.n 1071ac <fifo_open+0xf8>
1070f4: 2b02 cmp r3, #2
1070f6: d040 beq.n 10717a <fifo_open+0xc6> <== NEVER TAKEN
1070f8: 4630 mov r0, r6
1070fa: f000 fe41 bl 107d80 <_Mutex_Release>
PIPE_WAKEUPREADERS(pipe);
break;
}
PIPE_UNLOCK(pipe);
return 0;
1070fe: 2000 movs r0, #0
out_error:
pipe_release(pipep, iop);
return err;
}
107100: bdf8 pop {r3, r4, r5, r6, r7, pc}
pipe = malloc(sizeof(pipe_control_t));
107102: 2064 movs r0, #100 ; 0x64
107104: f003 f862 bl 10a1cc <malloc>
if (pipe == NULL)
107108: 4606 mov r6, r0
10710a: 2800 cmp r0, #0
10710c: f000 8099 beq.w 107242 <fifo_open+0x18e>
memset(pipe, 0, sizeof(pipe_control_t));
107110: 225c movs r2, #92 ; 0x5c
107112: 4621 mov r1, r4
107114: 3008 adds r0, #8
107116: f007 f883 bl 10e220 <memset>
pipe->Size = PIPE_BUF;
10711a: f44f 7000 mov.w r0, #512 ; 0x200
10711e: 6070 str r0, [r6, #4]
pipe->Buffer = malloc(pipe->Size);
107120: f003 f854 bl 10a1cc <malloc>
107124: 6030 str r0, [r6, #0]
if (pipe->Buffer == NULL) {
107126: 2800 cmp r0, #0
107128: f000 8088 beq.w 10723c <fifo_open+0x188> <== ALWAYS TAKEN
_Condition_Initialize_named(struct _Condition_Control *_cond,
const char *_name)
{
struct _Condition_Control _init = _CONDITION_NAMED_INITIALIZER(_name);
*_cond = _init;
10712c: f642 2240 movw r2, #10816 ; 0x2a40
if (c ++ == 'z')
107130: f240 1384 movw r3, #388 ; 0x184
107134: f2c0 0211 movt r2, #17
107138: f2c0 0320 movt r3, #32
10713c: 64f2 str r2, [r6, #76] ; 0x4c
10713e: f642 224c movw r2, #10828 ; 0x2a4c
107142: f2c0 0211 movt r2, #17
107146: 6632 str r2, [r6, #96] ; 0x60
*_mutex = _init;
107148: f642 2258 movw r2, #10840 ; 0x2a58
10714c: f2c0 0211 movt r2, #17
107150: 63b2 str r2, [r6, #56] ; 0x38
107152: 781a ldrb r2, [r3, #0]
107154: 2a7a cmp r2, #122 ; 0x7a
c = 'a';
107156: bf04 itt eq
107158: 2261 moveq r2, #97 ; 0x61
10715a: 701a strbeq r2, [r3, #0]
if (c ++ == 'z')
10715c: d001 beq.n 107162 <fifo_open+0xae>
10715e: 3201 adds r2, #1
107160: 701a strb r2, [r3, #0]
_Mutex_Acquire( mutex );
107162: f106 0028 add.w r0, r6, #40 ; 0x28
107166: f000 fddf bl 107d28 <_Mutex_Acquire>
_Mutex_Release( mutex );
10716a: f240 1088 movw r0, #392 ; 0x188
*pipep = pipe;
10716e: 602e str r6, [r5, #0]
107170: f2c0 0020 movt r0, #32
107174: f000 fe04 bl 107d80 <_Mutex_Release>
if (err)
107178: e7b2 b.n 1070e0 <fifo_open+0x2c>
pipe->readerCounter ++;
10717a: 6a23 ldr r3, [r4, #32]
if (pipe->Readers ++ == 0)
10717c: 6922 ldr r2, [r4, #16]
pipe->readerCounter ++;
10717e: 3301 adds r3, #1
107180: 6223 str r3, [r4, #32]
if (pipe->Readers ++ == 0)
107182: 1c53 adds r3, r2, #1
107184: 6123 str r3, [r4, #16]
107186: 2a00 cmp r2, #0
107188: d044 beq.n 107214 <fifo_open+0x160> <== NEVER TAKEN
if (pipe->Writers == 0) {
10718a: 6963 ldr r3, [r4, #20]
10718c: 2b00 cmp r3, #0
10718e: d1b3 bne.n 1070f8 <fifo_open+0x44>
107190: 683b ldr r3, [r7, #0]
if (LIBIO_NODELAY(iop))
107192: 07da lsls r2, r3, #31
107194: d4b0 bmi.n 1070f8 <fifo_open+0x44>
prevCounter = pipe->writerCounter;
107196: 6a67 ldr r7, [r4, #36] ; 0x24
PIPE_READWAIT(pipe);
107198: f104 053c add.w r5, r4, #60 ; 0x3c
_Condition_Wait( condition_variable, mutex );
10719c: 4631 mov r1, r6
10719e: 4628 mov r0, r5
1071a0: f000 fa5c bl 10765c <_Condition_Wait>
} while (prevCounter == pipe->writerCounter);
1071a4: 6a63 ldr r3, [r4, #36] ; 0x24
1071a6: 42bb cmp r3, r7
1071a8: d0f8 beq.n 10719c <fifo_open+0xe8> <== ALWAYS TAKEN
1071aa: e7a5 b.n 1070f8 <fifo_open+0x44>
pipe->readerCounter ++;
1071ac: 6a23 ldr r3, [r4, #32]
if (pipe->Readers ++ == 0)
1071ae: 6922 ldr r2, [r4, #16]
pipe->readerCounter ++;
1071b0: 3301 adds r3, #1
if (pipe->Readers ++ == 0)
1071b2: 1c51 adds r1, r2, #1
pipe->readerCounter ++;
1071b4: 6223 str r3, [r4, #32]
if (pipe->Readers ++ == 0)
1071b6: 6121 str r1, [r4, #16]
1071b8: b33a cbz r2, 10720a <fifo_open+0x156>
pipe->writerCounter ++;
1071ba: 6a63 ldr r3, [r4, #36] ; 0x24
if (pipe->Writers ++ == 0)
1071bc: 6962 ldr r2, [r4, #20]
pipe->writerCounter ++;
1071be: 3301 adds r3, #1
if (pipe->Writers ++ == 0)
1071c0: 1c51 adds r1, r2, #1
pipe->writerCounter ++;
1071c2: 6263 str r3, [r4, #36] ; 0x24
if (pipe->Writers ++ == 0)
1071c4: 6161 str r1, [r4, #20]
1071c6: 2a00 cmp r2, #0
1071c8: d196 bne.n 1070f8 <fifo_open+0x44> <== ALWAYS TAKEN
_Condition_Broadcast( condition_variable );
1071ca: f104 003c add.w r0, r4, #60 ; 0x3c
1071ce: f000 fa69 bl 1076a4 <_Condition_Broadcast>
}
1071d2: e791 b.n 1070f8 <fifo_open+0x44>
pipe->writerCounter ++;
1071d4: 6a63 ldr r3, [r4, #36] ; 0x24
1071d6: 3301 adds r3, #1
1071d8: 6263 str r3, [r4, #36] ; 0x24
if (pipe->Writers ++ == 0)
1071da: 6963 ldr r3, [r4, #20]
1071dc: 1c5a adds r2, r3, #1
1071de: 6162 str r2, [r4, #20]
1071e0: b1eb cbz r3, 10721e <fifo_open+0x16a>
if (pipe->Readers == 0 && LIBIO_NODELAY(iop)) {
1071e2: 6923 ldr r3, [r4, #16]
1071e4: 2b00 cmp r3, #0
1071e6: d187 bne.n 1070f8 <fifo_open+0x44>
1071e8: 683b ldr r3, [r7, #0]
1071ea: 07db lsls r3, r3, #31
1071ec: d41c bmi.n 107228 <fifo_open+0x174>
if (pipe->Readers == 0) {
1071ee: 6923 ldr r3, [r4, #16]
1071f0: 2b00 cmp r3, #0
1071f2: d181 bne.n 1070f8 <fifo_open+0x44> <== ALWAYS TAKEN
prevCounter = pipe->readerCounter;
1071f4: 6a27 ldr r7, [r4, #32]
PIPE_WAKEUPWRITERS(pipe);
1071f6: f104 0550 add.w r5, r4, #80 ; 0x50
_Condition_Wait( condition_variable, mutex );
1071fa: 4631 mov r1, r6
1071fc: 4628 mov r0, r5
1071fe: f000 fa2d bl 10765c <_Condition_Wait>
} while (prevCounter == pipe->readerCounter);
107202: 6a23 ldr r3, [r4, #32]
107204: 42bb cmp r3, r7
107206: d0f8 beq.n 1071fa <fifo_open+0x146> <== ALWAYS TAKEN
107208: e776 b.n 1070f8 <fifo_open+0x44>
_Condition_Broadcast( condition_variable );
10720a: f104 0050 add.w r0, r4, #80 ; 0x50
10720e: f000 fa49 bl 1076a4 <_Condition_Broadcast>
}
107212: e7d2 b.n 1071ba <fifo_open+0x106>
_Condition_Broadcast( condition_variable );
107214: f104 0050 add.w r0, r4, #80 ; 0x50
107218: f000 fa44 bl 1076a4 <_Condition_Broadcast>
}
10721c: e7b5 b.n 10718a <fifo_open+0xd6>
_Condition_Broadcast( condition_variable );
10721e: f104 003c add.w r0, r4, #60 ; 0x3c
107222: f000 fa3f bl 1076a4 <_Condition_Broadcast>
}
107226: e7dc b.n 1071e2 <fifo_open+0x12e>
_Mutex_Release( mutex );
107228: 4630 mov r0, r6
10722a: f000 fda9 bl 107d80 <_Mutex_Release>
pipe_release(pipep, iop);
10722e: 4628 mov r0, r5
107230: 4639 mov r1, r7
107232: f7ff fedf bl 106ff4 <pipe_release>
return err;
107236: f06f 0005 mvn.w r0, #5
}
10723a: bdf8 pop {r3, r4, r5, r6, r7, pc}
free(pipe);
10723c: 4630 mov r0, r6 <== NOT EXECUTED
10723e: f002 fe73 bl 109f28 <free> <== NOT EXECUTED
107242: f240 1088 movw r0, #392 ; 0x188
107246: f2c0 0020 movt r0, #32
10724a: f000 fd99 bl 107d80 <_Mutex_Release>
return -ENOMEM;
10724e: f06f 000b mvn.w r0, #11
}
107252: bdf8 pop {r3, r4, r5, r6, r7, pc}
00107040 <pipe>:
static uint16_t rtems_pipe_no = 0;
int pipe(
int filsdes[2]
)
{
107040: b530 push {r4, r5, lr}
107042: b085 sub sp, #20
rtems_libio_t *iop;
int err = 0;
if (filsdes == NULL)
107044: 2800 cmp r0, #0
107046: d076 beq.n 107136 <pipe+0xf6>
rtems_set_errno_and_return_minus_one( EFAULT );
if (rtems_mkdir("/tmp", S_IRWXU | S_IRWXG | S_IRWXO) != 0)
107048: 4605 mov r5, r0
10704a: f242 20f8 movw r0, #8952 ; 0x22f8
10704e: f240 11ff movw r1, #511 ; 0x1ff
107052: f2c0 0011 movt r0, #17
107056: f002 ff61 bl 109f1c <rtems_mkdir>
10705a: 2800 cmp r0, #0
10705c: d168 bne.n 107130 <pipe+0xf0>
return -1;
/* /tmp/.fifoXXXX */
char fifopath[15];
memcpy(fifopath, "/tmp/.fifo", 10);
10705e: f242 3200 movw r2, #8960 ; 0x2300
107062: 466b mov r3, sp
107064: f2c0 0211 movt r2, #17
107068: ca07 ldmia r2, {r0, r1, r2}
10706a: c303 stmia r3!, {r0, r1}
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
10706c: f641 41a4 movw r1, #7332 ; 0x1ca4
107070: f2c0 0120 movt r1, #32
memcpy(fifopath, "/tmp/.fifo", 10);
107074: 801a strh r2, [r3, #0]
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
107076: 880a ldrh r2, [r1, #0]
107078: f10d 000a add.w r0, sp, #10
10707c: 1c53 adds r3, r2, #1
10707e: 800b strh r3, [r1, #0]
107080: f242 310c movw r1, #8972 ; 0x230c
107084: f2c0 0111 movt r1, #17
107088: f006 ff5c bl 10df44 <sprintf>
/* Try creating FIFO file until find an available file name */
while (mkfifo(fifopath, S_IRUSR|S_IWUSR) != 0) {
10708c: f44f 71c0 mov.w r1, #384 ; 0x180
107090: 4668 mov r0, sp
107092: f002 ff3b bl 109f0c <mkfifo>
107096: 4604 mov r4, r0
107098: bb38 cbnz r0, 1070ea <pipe+0xaa>
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);
10709a: f44f 4180 mov.w r1, #16384 ; 0x4000
10709e: 4668 mov r0, sp
1070a0: f7fd ff66 bl 104f70 <open>
if (filsdes[0] < 0) {
1070a4: 2800 cmp r0, #0
filsdes[0] = open(fifopath, O_RDONLY | O_NONBLOCK);
1070a6: 6028 str r0, [r5, #0]
if (filsdes[0] < 0) {
1070a8: db26 blt.n 1070f8 <pipe+0xb8>
return &rtems_libio_iops[ fd ];
1070aa: eb00 0040 add.w r0, r0, r0, lsl #1
1070ae: f641 33a8 movw r3, #7080 ; 0x1ba8
1070b2: f2c0 0320 movt r3, #32
1070b6: 0100 lsls r0, r0, #4
__asm__ volatile (
1070b8: f3ef 8100 mrs r1, CPSR
1070bc: f041 0280 orr.w r2, r1, #128 ; 0x80
1070c0: f382 8900 msr CPSR_fc, r2
*obj = val & arg;
1070c4: 58c2 ldr r2, [r0, r3]
1070c6: f022 0201 bic.w r2, r2, #1
1070ca: 50c2 str r2, [r0, r3]
__asm__ volatile (
1070cc: f381 8900 msr CPSR_fc, r1
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);
1070d0: 2101 movs r1, #1
1070d2: 4668 mov r0, sp
1070d4: f7fd ff4c bl 104f70 <open>
if (filsdes[1] < 0) {
1070d8: 2800 cmp r0, #0
filsdes[1] = open(fifopath, O_WRONLY);
1070da: 6068 str r0, [r5, #4]
if (filsdes[1] < 0) {
1070dc: db1b blt.n 107116 <pipe+0xd6>
err = errno;
close(filsdes[0]);
}
unlink(fifopath);
1070de: 4668 mov r0, sp
1070e0: f7fe fc58 bl 105994 <unlink>
}
if(err != 0)
rtems_set_errno_and_return_minus_one(err);
return 0;
}
1070e4: 4620 mov r0, r4
1070e6: b005 add sp, #20
1070e8: bd30 pop {r4, r5, pc}
return -1;
1070ea: f04f 34ff mov.w r4, #4294967295 ; 0xffffffff <== NOT EXECUTED
if (errno != EEXIST){
1070ee: f006 fb7f bl 10d7f0 <__errno> <== NOT EXECUTED
}
1070f2: 4620 mov r0, r4 <== NOT EXECUTED
1070f4: b005 add sp, #20 <== NOT EXECUTED
1070f6: bd30 pop {r4, r5, pc} <== NOT EXECUTED
err = errno;
1070f8: f006 fb7a bl 10d7f0 <__errno>
1070fc: 4603 mov r3, r0
unlink(fifopath);
1070fe: 4668 mov r0, sp
err = errno;
107100: 681c ldr r4, [r3, #0]
unlink(fifopath);
107102: f7fe fc47 bl 105994 <unlink>
if(err != 0)
107106: 2c00 cmp r4, #0
107108: d0ec beq.n 1070e4 <pipe+0xa4> <== ALWAYS TAKEN
rtems_set_errno_and_return_minus_one(err);
10710a: f006 fb71 bl 10d7f0 <__errno>
10710e: 6004 str r4, [r0, #0]
107110: f04f 34ff mov.w r4, #4294967295 ; 0xffffffff
107114: e7e6 b.n 1070e4 <pipe+0xa4>
err = errno;
107116: f006 fb6b bl 10d7f0 <__errno>
10711a: 4603 mov r3, r0
close(filsdes[0]);
10711c: 6828 ldr r0, [r5, #0]
err = errno;
10711e: 681c ldr r4, [r3, #0]
close(filsdes[0]);
107120: f7fd fc38 bl 104994 <close>
unlink(fifopath);
107124: 4668 mov r0, sp
107126: f7fe fc35 bl 105994 <unlink>
if(err != 0)
10712a: 2c00 cmp r4, #0
10712c: d0da beq.n 1070e4 <pipe+0xa4> <== ALWAYS TAKEN
10712e: e7ec b.n 10710a <pipe+0xca>
return -1;
107130: f04f 34ff mov.w r4, #4294967295 ; 0xffffffff
107134: e7d6 b.n 1070e4 <pipe+0xa4>
rtems_set_errno_and_return_minus_one( EFAULT );
107136: f006 fb5b bl 10d7f0 <__errno>
10713a: 230e movs r3, #14
10713c: f04f 34ff mov.w r4, #4294967295 ; 0xffffffff
107140: 6003 str r3, [r0, #0]
107142: e7cf b.n 1070e4 <pipe+0xa4>
00106ff4 <pipe_release>:
void pipe_release(
pipe_control_t **pipep,
rtems_libio_t *iop
)
{
106ff4: b5f8 push {r3, r4, r5, r6, r7, lr}
106ff6: 4605 mov r5, r0
pipe_control_t *pipe = *pipep;
106ff8: 682c ldr r4, [r5, #0]
mutex->_Queue._name = name;
}
static __inline void rtems_mutex_lock( rtems_mutex *mutex )
{
_Mutex_Acquire( mutex );
106ffa: f240 1088 movw r0, #392 ; 0x188
106ffe: f2c0 0020 movt r0, #32
{
107002: 460e mov r6, r1
107004: f000 fe90 bl 107d28 <_Mutex_Acquire>
uint32_t mode;
pipe_lock();
PIPE_LOCK(pipe);
107008: f104 0728 add.w r7, r4, #40 ; 0x28
10700c: 4638 mov r0, r7
10700e: f000 fe8b bl 107d28 <_Mutex_Acquire>
107012: 6833 ldr r3, [r6, #0]
mode = LIBIO_ACCMODE(iop);
if (mode & LIBIO_FLAGS_READ)
107014: 079a lsls r2, r3, #30
mode = LIBIO_ACCMODE(iop);
107016: f003 0606 and.w r6, r3, #6
pipe->Readers --;
10701a: bf48 it mi
10701c: 6922 ldrmi r2, [r4, #16]
}
static __inline void rtems_mutex_unlock( rtems_mutex *mutex )
{
_Mutex_Release( mutex );
10701e: 4638 mov r0, r7
107020: bf44 itt mi
107022: f102 32ff addmi.w r2, r2, #4294967295 ; 0xffffffff
107026: 6122 strmi r2, [r4, #16]
if (mode & LIBIO_FLAGS_WRITE)
107028: 075b lsls r3, r3, #29
pipe->Writers --;
10702a: bf42 ittt mi
10702c: 6963 ldrmi r3, [r4, #20]
10702e: f103 33ff addmi.w r3, r3, #4294967295 ; 0xffffffff
107032: 6163 strmi r3, [r4, #20]
107034: f000 fea4 bl 107d80 <_Mutex_Release>
PIPE_UNLOCK(pipe);
if (pipe->Readers == 0 && pipe->Writers == 0) {
107038: 6923 ldr r3, [r4, #16]
10703a: b183 cbz r3, 10705e <pipe_release+0x6a>
*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)
10703c: 6963 ldr r3, [r4, #20]
10703e: 2e02 cmp r6, #2
107040: fab3 f383 clz r3, r3
107044: ea4f 1353 mov.w r3, r3, lsr #5
107048: bf08 it eq
10704a: 2300 moveq r3, #0
10704c: b9bb cbnz r3, 10707e <pipe_release+0x8a>
10704e: f240 1088 movw r0, #392 ; 0x188 <== NOT EXECUTED
rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_OPEN );
if(iop->pathinfo.ops->unlink_h(&iop->pathinfo))
return;
#endif
}
107052: e8bd 40f8 ldmia.w sp!, {r3, r4, r5, r6, r7, lr} <== NOT EXECUTED
107056: f2c0 0020 movt r0, #32 <== NOT EXECUTED
10705a: f000 be91 b.w 107d80 <_Mutex_Release> <== NOT EXECUTED
if (pipe->Readers == 0 && pipe->Writers == 0) {
10705e: 6967 ldr r7, [r4, #20]
107060: b1cf cbz r7, 107096 <pipe_release+0xa2>
else if (pipe->Readers == 0 && mode != LIBIO_FLAGS_WRITE)
107062: 2e04 cmp r6, #4
107064: d0f3 beq.n 10704e <pipe_release+0x5a> <== ALWAYS TAKEN
static __inline void rtems_condition_variable_broadcast(
rtems_condition_variable *condition_variable
)
{
_Condition_Broadcast( condition_variable );
107066: f104 0050 add.w r0, r4, #80 ; 0x50
10706a: f000 fb1b bl 1076a4 <_Condition_Broadcast>
_Mutex_Release( mutex );
10706e: f240 1088 movw r0, #392 ; 0x188
}
107072: e8bd 40f8 ldmia.w sp!, {r3, r4, r5, r6, r7, lr}
107076: f2c0 0020 movt r0, #32
10707a: f000 be81 b.w 107d80 <_Mutex_Release>
_Condition_Broadcast( condition_variable );
10707e: f104 003c add.w r0, r4, #60 ; 0x3c
107082: f000 fb0f bl 1076a4 <_Condition_Broadcast>
_Mutex_Release( mutex );
107086: f240 1088 movw r0, #392 ; 0x188
10708a: e8bd 40f8 ldmia.w sp!, {r3, r4, r5, r6, r7, lr}
10708e: f2c0 0020 movt r0, #32
107092: f000 be75 b.w 107d80 <_Mutex_Release>
free(pipe->Buffer);
107096: 6820 ldr r0, [r4, #0]
107098: f002 ff46 bl 109f28 <free>
free(pipe);
10709c: 4620 mov r0, r4
10709e: f002 ff43 bl 109f28 <free>
1070a2: f240 1088 movw r0, #392 ; 0x188
*pipep = NULL;
1070a6: 602f str r7, [r5, #0]
1070a8: f2c0 0020 movt r0, #32
}
1070ac: e8bd 40f8 ldmia.w sp!, {r3, r4, r5, r6, r7, lr}
1070b0: f000 be66 b.w 107d80 <_Mutex_Release>
00107318 <pipe_write>:
pipe_control_t *pipe,
const void *buffer,
size_t count,
rtems_libio_t *iop
)
{
107318: e92d 4ff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
int chunk, chunk1, written = 0, ret = 0;
/* Write nothing */
if (count == 0)
10731c: 4616 mov r6, r2
{
10731e: b085 sub sp, #20
return 0;
107320: 4691 mov r9, r2
if (count == 0)
107322: b91a cbnz r2, 10732c <pipe_write+0x14>
#endif
if (written > 0)
return written;
return ret;
}
107324: 4648 mov r0, r9 <== NOT EXECUTED
107326: b005 add sp, #20 <== NOT EXECUTED
107328: e8bd 8ff0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, fp, pc} <== NOT EXECUTED
PIPE_LOCK(pipe);
10732c: f100 0528 add.w r5, r0, #40 ; 0x28
_Mutex_Acquire( mutex );
107330: 4683 mov fp, r0
107332: 4628 mov r0, r5
107334: 468a mov sl, r1
107336: 461c mov r4, r3
107338: f000 fcf6 bl 107d28 <_Mutex_Acquire>
if (pipe->Readers == 0) {
10733c: f8db 2010 ldr.w r2, [fp, #16]
107340: 2a00 cmp r2, #0
107342: d05f beq.n 107404 <pipe_write+0xec>
chunk = count <= pipe->Size ? count : 1;
107344: f8db 2004 ldr.w r2, [fp, #4]
107348: f04f 0900 mov.w r9, #0
PIPE_WAKEUPREADERS(pipe);
10734c: f10b 033c add.w r3, fp, #60 ; 0x3c
PIPE_WRITEWAIT(pipe);
107350: f10b 0850 add.w r8, fp, #80 ; 0x50
while (written < count) {
107354: f8cd 9004 str.w r9, [sp, #4]
chunk = count <= pipe->Size ? count : 1;
107358: 42b2 cmp r2, r6
10735a: bf2c ite cs
10735c: 4637 movcs r7, r6
10735e: 2701 movcc r7, #1
PIPE_WAKEUPREADERS(pipe);
107360: 9302 str r3, [sp, #8]
107362: e016 b.n 107392 <pipe_write+0x7a>
107364: 6823 ldr r3, [r4, #0]
if (LIBIO_NODELAY(iop)) {
107366: 07db lsls r3, r3, #31
107368: d45b bmi.n 107422 <pipe_write+0x10a>
pipe->waitingWriters ++;
10736a: f8db 301c ldr.w r3, [fp, #28]
_Condition_Wait( condition_variable, mutex );
10736e: 4629 mov r1, r5
107370: 4640 mov r0, r8
107372: 3301 adds r3, #1
107374: f8cb 301c str.w r3, [fp, #28]
107378: f000 f970 bl 10765c <_Condition_Wait>
pipe->waitingWriters --;
10737c: f8db 301c ldr.w r3, [fp, #28]
if (pipe->Readers == 0) {
107380: f8db 2010 ldr.w r2, [fp, #16]
pipe->waitingWriters --;
107384: 3b01 subs r3, #1
107386: f8cb 301c str.w r3, [fp, #28]
if (pipe->Readers == 0) {
10738a: 2a00 cmp r2, #0
10738c: d055 beq.n 10743a <pipe_write+0x122> <== ALWAYS TAKEN
while (PIPE_SPACE(pipe) < chunk) {
10738e: f8db 2004 ldr.w r2, [fp, #4]
107392: f8db 000c ldr.w r0, [fp, #12]
107396: 1a13 subs r3, r2, r0
107398: 42bb cmp r3, r7
10739a: d3e3 bcc.n 107364 <pipe_write+0x4c>
chunk1 = pipe->Size - PIPE_WSTART(pipe);
10739c: f8db 1008 ldr.w r1, [fp, #8]
1073a0: 9203 str r2, [sp, #12]
1073a2: 4408 add r0, r1
chunk = MIN(count - written, PIPE_SPACE(pipe));
1073a4: 9901 ldr r1, [sp, #4]
1073a6: 1a77 subs r7, r6, r1
chunk1 = pipe->Size - PIPE_WSTART(pipe);
1073a8: 4611 mov r1, r2
chunk = MIN(count - written, PIPE_SPACE(pipe));
1073aa: 429f cmp r7, r3
1073ac: bf28 it cs
1073ae: 461f movcs r7, r3
chunk1 = pipe->Size - PIPE_WSTART(pipe);
1073b0: f005 fdf0 bl 10cf94 <__aeabi_uidivmod>
1073b4: 9a03 ldr r2, [sp, #12]
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
1073b6: f8db 0000 ldr.w r0, [fp]
1073ba: 9b01 ldr r3, [sp, #4]
chunk1 = pipe->Size - PIPE_WSTART(pipe);
1073bc: 1a52 subs r2, r2, r1
if (chunk > chunk1) {
1073be: 4297 cmp r7, r2
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
1073c0: 4408 add r0, r1
1073c2: eb0a 0103 add.w r1, sl, r3
if (chunk > chunk1) {
1073c6: dd43 ble.n 107450 <pipe_write+0x138>
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
1073c8: 9203 str r2, [sp, #12]
1073ca: f006 ecba blx 10dd40 <memcpy>
memcpy(pipe->Buffer, buffer + written + chunk1, chunk - chunk1);
1073ce: 9a03 ldr r2, [sp, #12]
1073d0: 9b01 ldr r3, [sp, #4]
1073d2: f8db 0000 ldr.w r0, [fp]
1073d6: 4413 add r3, r2
1073d8: 1aba subs r2, r7, r2
1073da: 4619 mov r1, r3
1073dc: 4451 add r1, sl
1073de: f006 ecb0 blx 10dd40 <memcpy>
pipe->Length += chunk;
1073e2: f8db 300c ldr.w r3, [fp, #12]
1073e6: 443b add r3, r7
1073e8: f8cb 300c str.w r3, [fp, #12]
if (pipe->waitingReaders > 0)
1073ec: f8db 3018 ldr.w r3, [fp, #24]
1073f0: bb93 cbnz r3, 107458 <pipe_write+0x140>
written += chunk;
1073f2: 44b9 add r9, r7
while (written < count) {
1073f4: 45b1 cmp r9, r6
1073f6: f8cd 9004 str.w r9, [sp, #4]
1073fa: d231 bcs.n 107460 <pipe_write+0x148> <== NEVER TAKEN
while (PIPE_SPACE(pipe) < chunk) {
1073fc: f8db 2004 ldr.w r2, [fp, #4] <== NOT EXECUTED
chunk = 1;
107400: 2701 movs r7, #1 <== NOT EXECUTED
107402: e7c6 b.n 107392 <pipe_write+0x7a> <== NOT EXECUTED
_Mutex_Release( mutex );
107404: 4628 mov r0, r5
107406: f000 fcbb bl 107d80 <_Mutex_Release>
kill(getpid(), SIGPIPE);
10740a: f002 fe4f bl 10a0ac <getpid>
10740e: 210d movs r1, #13
107410: f002 fac6 bl 1099a0 <kill>
107414: f06f 031f mvn.w r3, #31
107418: 4699 mov r9, r3
}
10741a: 4648 mov r0, r9
10741c: b005 add sp, #20
10741e: e8bd 8ff0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, fp, pc}
107422: 4628 mov r0, r5
107424: f000 fcac bl 107d80 <_Mutex_Release>
ret = -EAGAIN;
107428: f06f 030a mvn.w r3, #10
if (written > 0)
10742c: f1b9 0f00 cmp.w r9, #0
107430: ddf2 ble.n 107418 <pipe_write+0x100>
}
107432: 4648 mov r0, r9
107434: b005 add sp, #20
107436: e8bd 8ff0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, fp, pc}
10743a: 4628 mov r0, r5 <== NOT EXECUTED
10743c: f000 fca0 bl 107d80 <_Mutex_Release> <== NOT EXECUTED
kill(getpid(), SIGPIPE);
107440: f002 fe34 bl 10a0ac <getpid> <== NOT EXECUTED
107444: 210d movs r1, #13 <== NOT EXECUTED
107446: f002 faab bl 1099a0 <kill> <== NOT EXECUTED
10744a: f06f 031f mvn.w r3, #31 <== NOT EXECUTED
10744e: e7ed b.n 10742c <pipe_write+0x114> <== NOT EXECUTED
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk);
107450: 463a mov r2, r7
107452: f006 ec76 blx 10dd40 <memcpy>
107456: e7c4 b.n 1073e2 <pipe_write+0xca>
_Condition_Broadcast( condition_variable );
107458: 9802 ldr r0, [sp, #8]
10745a: f000 f923 bl 1076a4 <_Condition_Broadcast>
}
10745e: e7c8 b.n 1073f2 <pipe_write+0xda>
_Mutex_Release( mutex );
107460: 4628 mov r0, r5
107462: f000 fc8d bl 107d80 <_Mutex_Release>
107466: 2300 movs r3, #0
107468: e7e0 b.n 10742c <pipe_write+0x114>
10746a: bf00 nop