RTEMS-6
Annotated Report
libpipe
Mon Mar 1 00:16:22 2021
0000000040024ed0 <fifo_open>:
int fifo_open(
pipe_control_t **pipep,
rtems_libio_t *iop
)
{
40024ed0: a9bd7bfd stp x29, x30, [sp, #-48]!
40024ed4: 910003fd mov x29, sp
40024ed8: a90153f3 stp x19, x20, [sp, #16]
40024edc: aa0003f4 mov x20, x0
_Mutex_Acquire( mutex );
40024ee0: 900006f3 adrp x19, 40100000 <_RTEMS_tasks_Information>
40024ee4: 910a4273 add x19, x19, #0x290
40024ee8: a9025bf5 stp x21, x22, [sp, #32]
40024eec: aa1303e0 mov x0, x19
40024ef0: aa0103f6 mov x22, x1
40024ef4: 9400041f bl 40025f70 <_Mutex_Acquire>
pipe = *pipep;
40024ef8: f9400295 ldr x21, [x20]
if (pipe == NULL) {
40024efc: b40002f5 cbz x21, 40024f58 <fifo_open+0x88>
40024f00: 9100c2a0 add x0, x21, #0x30
40024f04: 9400041b bl 40025f70 <_Mutex_Acquire>
*pipep = pipe;
40024f08: f9000295 str x21, [x20]
_Mutex_Release( mutex );
40024f0c: aa1303e0 mov x0, x19
40024f10: 94000434 bl 40025fe0 <_Mutex_Release>
40024f14: b94002c0 ldr w0, [x22]
int err;
err = pipe_new(pipep);
if (err)
return err;
pipe = *pipep;
40024f18: f9400293 ldr x19, [x20]
switch (LIBIO_ACCMODE(iop)) {
40024f1c: 121f0400 and w0, w0, #0x6
prevCounter = pipe->writerCounter;
err = -EINTR;
/* Wait until a writer opens the pipe */
do {
PIPE_READWAIT(pipe);
40024f20: 9100c275 add x21, x19, #0x30
switch (LIBIO_ACCMODE(iop)) {
40024f24: 7100101f cmp w0, #0x4
40024f28: 540006a0 b.eq 40024ffc <fifo_open+0x12c> // b.none
40024f2c: 7100181f cmp w0, #0x6
40024f30: 54000ba0 b.eq 400250a4 <fifo_open+0x1d4> // b.none
40024f34: 7100081f cmp w0, #0x2
40024f38: 540008e0 b.eq 40025054 <fifo_open+0x184> // b.none <== ALWAYS TAKEN
40024f3c: aa1503e0 mov x0, x21
40024f40: 94000428 bl 40025fe0 <_Mutex_Release>
PIPE_WAKEUPREADERS(pipe);
break;
}
PIPE_UNLOCK(pipe);
return 0;
40024f44: 52800000 mov w0, #0x0 // #0
out_error:
pipe_release(pipep, iop);
return err;
}
40024f48: a94153f3 ldp x19, x20, [sp, #16]
40024f4c: a9425bf5 ldp x21, x22, [sp, #32]
40024f50: a8c37bfd ldp x29, x30, [sp], #48
40024f54: d65f03c0 ret
pipe = malloc(sizeof(pipe_control_t));
40024f58: d2801200 mov x0, #0x90 // #144
40024f5c: 940011f9 bl 40029740 <malloc>
40024f60: aa0003f5 mov x21, x0
if (pipe == NULL)
40024f64: b4000e60 cbz x0, 40025130 <fifo_open+0x260>
memset(pipe, 0, sizeof(pipe_control_t));
40024f68: d2801102 mov x2, #0x88 // #136
40024f6c: 52800001 mov w1, #0x0 // #0
40024f70: 91002000 add x0, x0, #0x8
40024f74: 94002cdb bl 400302e0 <memset>
pipe->Size = PIPE_BUF;
40024f78: 52804001 mov w1, #0x200 // #512
40024f7c: b9000aa1 str w1, [x21, #8]
pipe->Buffer = malloc(pipe->Size);
40024f80: d2804000 mov x0, #0x200 // #512
40024f84: 940011ef bl 40029740 <malloc>
40024f88: f90002a0 str x0, [x21]
if (pipe->Buffer == NULL) {
40024f8c: b4000ce0 cbz x0, 40025128 <fifo_open+0x258> <== NEVER TAKEN
if (c ++ == 'z')
40024f90: 900006e4 adrp x4, 40100000 <_RTEMS_tasks_Information>
40024f94: 394a2081 ldrb w1, [x4, #648]
static __inline void
_Mutex_Initialize_named(struct _Mutex_Control *_mutex, const char *_name)
{
struct _Mutex_Control _init = _MUTEX_NAMED_INITIALIZER(_name);
*_mutex = _init;
40024f98: 9100c2a0 add x0, x21, #0x30
_Condition_Initialize_named(struct _Condition_Control *_cond,
const char *_name)
{
struct _Condition_Control _init = _CONDITION_NAMED_INITIALIZER(_name);
*_cond = _init;
40024f9c: 900000a3 adrp x3, 40038000 <bsp_section_rodata_begin+0x2d8>
40024fa0: 91332063 add x3, x3, #0xcc8
c = 'a';
40024fa4: 7101e83f cmp w1, #0x7a
40024fa8: 900000a2 adrp x2, 40038000 <bsp_section_rodata_begin+0x2d8>
40024fac: 91336042 add x2, x2, #0xcd8
40024fb0: 11000421 add w1, w1, #0x1
40024fb4: f90036a3 str x3, [x21, #104]
40024fb8: 52800c23 mov w3, #0x61 // #97
40024fbc: 1a810061 csel w1, w3, w1, eq // eq = none
40024fc0: f90046a2 str x2, [x21, #136]
*_mutex = _init;
40024fc4: 900000a2 adrp x2, 40038000 <bsp_section_rodata_begin+0x2d8>
40024fc8: 9133a042 add x2, x2, #0xce8
40024fcc: f9000c02 str x2, [x0, #24]
40024fd0: 390a2081 strb w1, [x4, #648]
_Mutex_Acquire( mutex );
40024fd4: 940003e7 bl 40025f70 <_Mutex_Acquire>
*pipep = pipe;
40024fd8: f9000295 str x21, [x20]
_Mutex_Release( mutex );
40024fdc: aa1303e0 mov x0, x19
40024fe0: 94000400 bl 40025fe0 <_Mutex_Release>
40024fe4: b94002c0 ldr w0, [x22]
pipe = *pipep;
40024fe8: f9400293 ldr x19, [x20]
switch (LIBIO_ACCMODE(iop)) {
40024fec: 121f0400 and w0, w0, #0x6
PIPE_READWAIT(pipe);
40024ff0: 9100c275 add x21, x19, #0x30
switch (LIBIO_ACCMODE(iop)) {
40024ff4: 7100101f cmp w0, #0x4
40024ff8: 54fff9a1 b.ne 40024f2c <fifo_open+0x5c> // b.any
if (pipe->Writers ++ == 0)
40024ffc: b9401a61 ldr w1, [x19, #24]
pipe->writerCounter ++;
40025000: b9402a60 ldr w0, [x19, #40]
if (pipe->Writers ++ == 0)
40025004: 11000422 add w2, w1, #0x1
40025008: b9001a62 str w2, [x19, #24]
pipe->writerCounter ++;
4002500c: 11000400 add w0, w0, #0x1
40025010: b9002a60 str w0, [x19, #40]
if (pipe->Writers ++ == 0)
40025014: 34000761 cbz w1, 40025100 <fifo_open+0x230> <== ALWAYS TAKEN
if (pipe->Readers == 0 && LIBIO_NODELAY(iop)) {
40025018: b9401660 ldr w0, [x19, #20]
4002501c: 35fff900 cbnz w0, 40024f3c <fifo_open+0x6c>
40025020: b94002c0 ldr w0, [x22]
40025024: 37000740 tbnz w0, #0, 4002510c <fifo_open+0x23c>
if (pipe->Readers == 0) {
40025028: b9401660 ldr w0, [x19, #20]
4002502c: 35fff880 cbnz w0, 40024f3c <fifo_open+0x6c> <== NEVER TAKEN
prevCounter = pipe->readerCounter;
40025030: b9402676 ldr w22, [x19, #36]
PIPE_WAKEUPWRITERS(pipe);
40025034: 9101c274 add x20, x19, #0x70
_Condition_Wait( condition_variable, mutex );
40025038: aa1503e1 mov x1, x21
4002503c: aa1403e0 mov x0, x20
40025040: 940001f8 bl 40025820 <_Condition_Wait>
} while (prevCounter == pipe->readerCounter);
40025044: b9402661 ldr w1, [x19, #36]
40025048: 6b16003f cmp w1, w22
4002504c: 54ffff60 b.eq 40025038 <fifo_open+0x168> // b.none <== NEVER TAKEN
40025050: 17ffffbb b 40024f3c <fifo_open+0x6c>
if (pipe->Readers ++ == 0)
40025054: b9401661 ldr w1, [x19, #20]
pipe->readerCounter ++;
40025058: b9402660 ldr w0, [x19, #36]
if (pipe->Readers ++ == 0)
4002505c: 11000422 add w2, w1, #0x1
40025060: b9001662 str w2, [x19, #20]
pipe->readerCounter ++;
40025064: 11000400 add w0, w0, #0x1
40025068: b9002660 str w0, [x19, #36]
if (pipe->Readers ++ == 0)
4002506c: 340003e1 cbz w1, 400250e8 <fifo_open+0x218> <== ALWAYS TAKEN
if (pipe->Writers == 0) {
40025070: b9401a60 ldr w0, [x19, #24]
40025074: 35fff640 cbnz w0, 40024f3c <fifo_open+0x6c>
40025078: b94002c0 ldr w0, [x22]
if (LIBIO_NODELAY(iop))
4002507c: 3707f600 tbnz w0, #0, 40024f3c <fifo_open+0x6c>
prevCounter = pipe->writerCounter;
40025080: b9402a76 ldr w22, [x19, #40]
PIPE_READWAIT(pipe);
40025084: 91014274 add x20, x19, #0x50
40025088: aa1503e1 mov x1, x21
4002508c: aa1403e0 mov x0, x20
40025090: 940001e4 bl 40025820 <_Condition_Wait>
} while (prevCounter == pipe->writerCounter);
40025094: b9402a61 ldr w1, [x19, #40]
40025098: 6b16003f cmp w1, w22
4002509c: 54ffff60 b.eq 40025088 <fifo_open+0x1b8> // b.none <== NEVER TAKEN
400250a0: 17ffffa7 b 40024f3c <fifo_open+0x6c>
if (pipe->Readers ++ == 0)
400250a4: b9401661 ldr w1, [x19, #20]
pipe->readerCounter ++;
400250a8: b9402660 ldr w0, [x19, #36]
if (pipe->Readers ++ == 0)
400250ac: 11000422 add w2, w1, #0x1
400250b0: b9001662 str w2, [x19, #20]
pipe->readerCounter ++;
400250b4: 11000400 add w0, w0, #0x1
400250b8: b9002660 str w0, [x19, #36]
if (pipe->Readers ++ == 0)
400250bc: 340001c1 cbz w1, 400250f4 <fifo_open+0x224> <== ALWAYS TAKEN
if (pipe->Writers ++ == 0)
400250c0: b9401a61 ldr w1, [x19, #24]
pipe->writerCounter ++;
400250c4: b9402a60 ldr w0, [x19, #40]
if (pipe->Writers ++ == 0)
400250c8: 11000422 add w2, w1, #0x1
400250cc: b9001a62 str w2, [x19, #24]
pipe->writerCounter ++;
400250d0: 11000400 add w0, w0, #0x1
400250d4: b9002a60 str w0, [x19, #40]
if (pipe->Writers ++ == 0)
400250d8: 35fff321 cbnz w1, 40024f3c <fifo_open+0x6c> <== NEVER TAKEN
_Condition_Broadcast( condition_variable );
400250dc: 91014260 add x0, x19, #0x50
400250e0: 940001ec bl 40025890 <_Condition_Broadcast>
}
400250e4: 17ffff96 b 40024f3c <fifo_open+0x6c>
_Condition_Broadcast( condition_variable );
400250e8: 9101c260 add x0, x19, #0x70
400250ec: 940001e9 bl 40025890 <_Condition_Broadcast>
}
400250f0: 17ffffe0 b 40025070 <fifo_open+0x1a0>
_Condition_Broadcast( condition_variable );
400250f4: 9101c260 add x0, x19, #0x70
400250f8: 940001e6 bl 40025890 <_Condition_Broadcast>
}
400250fc: 17fffff1 b 400250c0 <fifo_open+0x1f0>
_Condition_Broadcast( condition_variable );
40025100: 91014260 add x0, x19, #0x50
40025104: 940001e3 bl 40025890 <_Condition_Broadcast>
}
40025108: 17ffffc4 b 40025018 <fifo_open+0x148>
_Mutex_Release( mutex );
4002510c: aa1503e0 mov x0, x21
40025110: 940003b4 bl 40025fe0 <_Mutex_Release>
pipe_release(pipep, iop);
40025114: aa1403e0 mov x0, x20
40025118: aa1603e1 mov x1, x22
4002511c: 97ffff25 bl 40024db0 <pipe_release>
return err;
40025120: 128000a0 mov w0, #0xfffffffa // #-6
40025124: 17ffff89 b 40024f48 <fifo_open+0x78>
free(pipe);
40025128: aa1503e0 mov x0, x21 <== NOT EXECUTED
4002512c: 94001071 bl 400292f0 <free> <== NOT EXECUTED
40025130: aa1303e0 mov x0, x19
40025134: 940003ab bl 40025fe0 <_Mutex_Release>
return -ENOMEM;
40025138: 12800160 mov w0, #0xfffffff4 // #-12
4002513c: 17ffff83 b 40024f48 <fifo_open+0x78>
0000000040024f40 <pipe>:
static uint16_t rtems_pipe_no = 0;
int pipe(
int filsdes[2]
)
{
40024f40: a9bd7bfd stp x29, x30, [sp, #-48]!
40024f44: 910003fd mov x29, sp
40024f48: a90153f3 stp x19, x20, [sp, #16]
rtems_libio_t *iop;
int err = 0;
if (filsdes == NULL)
40024f4c: b4000a00 cbz x0, 4002508c <pipe+0x14c>
rtems_set_errno_and_return_minus_one( EFAULT );
if (rtems_mkdir("/tmp", S_IRWXU | S_IRWXG | S_IRWXO) != 0)
40024f50: aa0003f4 mov x20, x0
40024f54: 52803fe1 mov w1, #0x1ff // #511
40024f58: 900000a0 adrp x0, 40038000 <IMFS_memfile_handlers+0x8>
40024f5c: 9105c000 add x0, x0, #0x170
40024f60: 94001134 bl 40029430 <rtems_mkdir>
40024f64: 35000900 cbnz w0, 40025084 <pipe+0x144>
return -1;
/* /tmp/.fifoXXXX */
char fifopath[15];
memcpy(fifopath, "/tmp/.fifo", 10);
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
40024f68: f00006e0 adrp x0, 40103000 <rtems_libio_iops+0x20>
40024f6c: 79430802 ldrh w2, [x0, #388]
memcpy(fifopath, "/tmp/.fifo", 10);
40024f70: d28e85e4 mov x4, #0x742f // #29743
40024f74: f2ae0da4 movk x4, #0x706d, lsl #16
40024f78: 528decc3 mov w3, #0x6f66 // #28518
40024f7c: f2c5c5e4 movk x4, #0x2e2f, lsl #32
40024f80: f2ed2cc4 movk x4, #0x6966, lsl #48
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
40024f84: 11000441 add w1, w2, #0x1
40024f88: 79030801 strh w1, [x0, #388]
40024f8c: 9100abe0 add x0, sp, #0x2a
40024f90: 900000a1 adrp x1, 40038000 <IMFS_memfile_handlers+0x8>
40024f94: 9105e021 add x1, x1, #0x178
memcpy(fifopath, "/tmp/.fifo", 10);
40024f98: f90013e4 str x4, [sp, #32]
40024f9c: 790053e3 strh w3, [sp, #40]
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
40024fa0: 94002ba2 bl 4002fe28 <sprintf>
/* Try creating FIFO file until find an available file name */
while (mkfifo(fifopath, S_IRUSR|S_IWUSR) != 0) {
40024fa4: 910083e0 add x0, sp, #0x20
40024fa8: 52803001 mov w1, #0x180 // #384
40024fac: 94001119 bl 40029410 <mkfifo>
40024fb0: 2a0003f3 mov w19, w0
40024fb4: 35000380 cbnz w0, 40025024 <pipe+0xe4> <== NEVER TAKEN
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);
40024fb8: 910083e0 add x0, sp, #0x20
40024fbc: 52880001 mov w1, #0x4000 // #16384
40024fc0: 97fff1c4 bl 400216d0 <open>
40024fc4: b9000280 str w0, [x20]
if (filsdes[0] < 0) {
40024fc8: 37f803a0 tbnz w0, #31, 4002503c <pipe+0xfc>
return &rtems_libio_iops[ fd ];
40024fcc: 52800a02 mov w2, #0x50 // #80
40024fd0: d00006e1 adrp x1, 40102000 <_Configuration_Scheduler_priority_dflt+0x15d0>
40024fd4: 913f8021 add x1, x1, #0xfe0
40024fd8: 9b227c00 smull x0, w0, w2
__asm__ volatile (
40024fdc: d53b4222 mrs x2, daif
40024fe0: d50342df msr daifset, #0x2
*obj = val & arg;
40024fe4: b8616803 ldr w3, [x0, x1]
40024fe8: 121f7863 and w3, w3, #0xfffffffe
40024fec: b8216803 str w3, [x0, x1]
__asm__ volatile (
40024ff0: 92407c40 and x0, x2, #0xffffffff
40024ff4: d51b4220 msr daif, x0
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);
40024ff8: 52800021 mov w1, #0x1 // #1
40024ffc: 910083e0 add x0, sp, #0x20
40025000: 97fff1b4 bl 400216d0 <open>
40025004: b9000680 str w0, [x20, #4]
if (filsdes[1] < 0) {
40025008: 37f802e0 tbnz w0, #31, 40025064 <pipe+0x124>
err = errno;
close(filsdes[0]);
}
unlink(fifopath);
4002500c: 910083e0 add x0, sp, #0x20
40025010: 97fff5ec bl 400227c0 <unlink>
}
if(err != 0)
rtems_set_errno_and_return_minus_one(err);
return 0;
}
40025014: 2a1303e0 mov w0, w19
40025018: a94153f3 ldp x19, x20, [sp, #16]
4002501c: a8c37bfd ldp x29, x30, [sp], #48
40025020: d65f03c0 ret
if (errno != EEXIST){
40025024: 94002a1e bl 4002f89c <__errno> <== NOT EXECUTED
return -1;
40025028: 12800013 mov w19, #0xffffffff // #-1 <== NOT EXECUTED
}
4002502c: 2a1303e0 mov w0, w19 <== NOT EXECUTED
40025030: a94153f3 ldp x19, x20, [sp, #16] <== NOT EXECUTED
40025034: a8c37bfd ldp x29, x30, [sp], #48 <== NOT EXECUTED
40025038: d65f03c0 ret <== NOT EXECUTED
err = errno;
4002503c: 94002a18 bl 4002f89c <__errno>
40025040: aa0003e1 mov x1, x0
unlink(fifopath);
40025044: 910083e0 add x0, sp, #0x20
err = errno;
40025048: b9400033 ldr w19, [x1]
unlink(fifopath);
4002504c: 97fff5dd bl 400227c0 <unlink>
if(err != 0)
40025050: 34fffe33 cbz w19, 40025014 <pipe+0xd4> <== NEVER TAKEN
rtems_set_errno_and_return_minus_one(err);
40025054: 94002a12 bl 4002f89c <__errno>
40025058: b9000013 str w19, [x0]
4002505c: 12800013 mov w19, #0xffffffff // #-1
40025060: 17ffffed b 40025014 <pipe+0xd4>
err = errno;
40025064: 94002a0e bl 4002f89c <__errno>
40025068: b9400013 ldr w19, [x0]
close(filsdes[0]);
4002506c: b9400280 ldr w0, [x20]
40025070: 97ffef28 bl 40020d10 <close>
unlink(fifopath);
40025074: 910083e0 add x0, sp, #0x20
40025078: 97fff5d2 bl 400227c0 <unlink>
if(err != 0)
4002507c: 34fffcd3 cbz w19, 40025014 <pipe+0xd4> <== NEVER TAKEN
40025080: 17fffff5 b 40025054 <pipe+0x114>
return -1;
40025084: 12800013 mov w19, #0xffffffff // #-1
40025088: 17ffffe3 b 40025014 <pipe+0xd4>
rtems_set_errno_and_return_minus_one( EFAULT );
4002508c: 94002a04 bl 4002f89c <__errno>
40025090: 12800013 mov w19, #0xffffffff // #-1
40025094: 528001c1 mov w1, #0xe // #14
40025098: b9000001 str w1, [x0]
4002509c: 17ffffde b 40025014 <pipe+0xd4>
0000000040025140 <pipe_read>:
pipe_control_t *pipe,
void *buffer,
size_t count,
rtems_libio_t *iop
)
{
40025140: a9bc7bfd stp x29, x30, [sp, #-64]!
40025144: 910003fd mov x29, sp
40025148: a90153f3 stp x19, x20, [sp, #16]
4002514c: aa0003f3 mov x19, x0
40025150: aa0303f4 mov x20, x3
40025154: a90363f7 stp x23, x24, [sp, #48]
int chunk, chunk1, read = 0, ret = 0;
PIPE_LOCK(pipe);
40025158: 9100c018 add x24, x0, #0x30
_Mutex_Acquire( mutex );
4002515c: aa1803e0 mov x0, x24
{
40025160: a9025bf5 stp x21, x22, [sp, #32]
40025164: aa0103f5 mov x21, x1
40025168: aa0203f6 mov x22, x2
4002516c: 94000381 bl 40025f70 <_Mutex_Acquire>
while (PIPE_EMPTY(pipe)) {
40025170: b9401265 ldr w5, [x19, #16]
40025174: 35000365 cbnz w5, 400251e0 <pipe_read+0xa0>
goto out_locked;
}
/* Wait until pipe is no more empty or no writer exists */
pipe->waitingReaders ++;
PIPE_READWAIT(pipe);
40025178: 91014277 add x23, x19, #0x50
4002517c: 1400000e b 400251b4 <pipe_read+0x74>
40025180: b9400282 ldr w2, [x20]
_Condition_Wait( condition_variable, mutex );
40025184: aa1803e1 mov x1, x24
40025188: aa1703e0 mov x0, x23
if (LIBIO_NODELAY(iop)) {
4002518c: 370006c2 tbnz w2, #0, 40025264 <pipe_read+0x124>
pipe->waitingReaders ++;
40025190: b9401e64 ldr w4, [x19, #28]
40025194: 11000484 add w4, w4, #0x1
40025198: b9001e64 str w4, [x19, #28]
4002519c: 940001a1 bl 40025820 <_Condition_Wait>
pipe->waitingReaders --;
400251a0: b9401e64 ldr w4, [x19, #28]
while (PIPE_EMPTY(pipe)) {
400251a4: b9401265 ldr w5, [x19, #16]
pipe->waitingReaders --;
400251a8: 51000484 sub w4, w4, #0x1
400251ac: b9001e64 str w4, [x19, #28]
while (PIPE_EMPTY(pipe)) {
400251b0: 35000185 cbnz w5, 400251e0 <pipe_read+0xa0> <== ALWAYS TAKEN
if (pipe->Writers == 0)
400251b4: b9401a60 ldr w0, [x19, #24]
400251b8: 35fffe40 cbnz w0, 40025180 <pipe_read+0x40>
400251bc: d2800014 mov x20, #0x0 // #0
_Mutex_Release( mutex );
400251c0: aa1803e0 mov x0, x24
400251c4: 94000387 bl 40025fe0 <_Mutex_Release>
PIPE_UNLOCK(pipe);
if (read > 0)
return read;
return ret;
}
400251c8: aa1403e0 mov x0, x20
400251cc: a94153f3 ldp x19, x20, [sp, #16]
400251d0: a9425bf5 ldp x21, x22, [sp, #32]
400251d4: a94363f7 ldp x23, x24, [sp, #48]
400251d8: a8c47bfd ldp x29, x30, [sp], #64
400251dc: d65f03c0 ret
chunk1 = pipe->Size - pipe->Start;
400251e0: 29410660 ldp w0, w1, [x19, #8]
chunk = MIN(count - read, pipe->Length);
400251e4: 2a0503e5 mov w5, w5
memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1);
400251e8: f9400262 ldr x2, [x19]
chunk = MIN(count - read, pipe->Length);
400251ec: eb1600bf cmp x5, x22
400251f0: 9a9690b4 csel x20, x5, x22, ls // ls = plast
chunk1 = pipe->Size - pipe->Start;
400251f4: 4b010016 sub w22, w0, w1
if (chunk > chunk1) {
400251f8: 6b16029f cmp w20, w22
memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1);
400251fc: 8b214041 add x1, x2, w1, uxtw
if (chunk > chunk1) {
40025200: 5400036c b.gt 4002526c <pipe_read+0x12c>
memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk);
40025204: aa1503e0 mov x0, x21
40025208: 93407e82 sxtw x2, w20
4002520c: 94002c1a bl 40030274 <memcpy>
pipe->Start += chunk;
40025210: 29410263 ldp w3, w0, [x19, #8]
pipe->Length -= chunk;
40025214: b9401262 ldr w2, [x19, #16]
pipe->Start += chunk;
40025218: 0b140001 add w1, w0, w20
if (pipe->waitingWriters > 0)
4002521c: b9402264 ldr w4, [x19, #32]
pipe->Length -= chunk;
40025220: 6b140042 subs w2, w2, w20
pipe->Start %= pipe->Size;
40025224: 1ac30820 udiv w0, w1, w3
40025228: 1b038400 msub w0, w0, w3, w1
pipe->Start = 0;
4002522c: 1a9f1000 csel w0, w0, wzr, ne // ne = any
pipe->Length -= chunk;
40025230: 29018a60 stp w0, w2, [x19, #12]
if (pipe->waitingWriters > 0)
40025234: 35000304 cbnz w4, 40025294 <pipe_read+0x154>
40025238: aa1803e0 mov x0, x24
4002523c: 94000369 bl 40025fe0 <_Mutex_Release>
if (read > 0)
40025240: 7100029f cmp w20, #0x0
40025244: 540002ed b.le 400252a0 <pipe_read+0x160> <== NEVER TAKEN
return read;
40025248: 93407e94 sxtw x20, w20
}
4002524c: aa1403e0 mov x0, x20
40025250: a94153f3 ldp x19, x20, [sp, #16]
40025254: a9425bf5 ldp x21, x22, [sp, #32]
40025258: a94363f7 ldp x23, x24, [sp, #48]
4002525c: a8c47bfd ldp x29, x30, [sp], #64
40025260: d65f03c0 ret
40025264: 92800154 mov x20, #0xfffffffffffffff5 // #-11
40025268: 17ffffd6 b 400251c0 <pipe_read+0x80>
memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1);
4002526c: 93407ed7 sxtw x23, w22
40025270: aa1503e0 mov x0, x21
40025274: aa1703e2 mov x2, x23
40025278: 94002bff bl 40030274 <memcpy>
memcpy(buffer + read + chunk1, pipe->Buffer, chunk - chunk1);
4002527c: f9400261 ldr x1, [x19]
40025280: 4b160296 sub w22, w20, w22
40025284: 8b1702a0 add x0, x21, x23
40025288: 93407ec2 sxtw x2, w22
4002528c: 94002bfa bl 40030274 <memcpy>
40025290: 17ffffe0 b 40025210 <pipe_read+0xd0>
_Condition_Broadcast( condition_variable );
40025294: 9101c260 add x0, x19, #0x70
40025298: 9400017e bl 40025890 <_Condition_Broadcast>
}
4002529c: 17ffffe7 b 40025238 <pipe_read+0xf8>
400252a0: d2800014 mov x20, #0x0 // #0 <== NOT EXECUTED
return ret;
400252a4: 17ffffc9 b 400251c8 <pipe_read+0x88> <== NOT EXECUTED
...
0000000040024db0 <pipe_release>:
void pipe_release(
pipe_control_t **pipep,
rtems_libio_t *iop
)
{
40024db0: a9bc7bfd stp x29, x30, [sp, #-64]!
40024db4: 910003fd mov x29, sp
40024db8: a9025bf5 stp x21, x22, [sp, #32]
40024dbc: aa0003f5 mov x21, x0
40024dc0: aa0103f6 mov x22, x1
40024dc4: a90153f3 stp x19, x20, [sp, #16]
mutex->_Queue._name = name;
}
static __inline void rtems_mutex_lock( rtems_mutex *mutex )
{
_Mutex_Acquire( mutex );
40024dc8: 900006f4 adrp x20, 40100000 <_RTEMS_tasks_Information>
40024dcc: 910a4294 add x20, x20, #0x290
pipe_control_t *pipe = *pipep;
40024dd0: f94002b3 ldr x19, [x21]
40024dd4: aa1403e0 mov x0, x20
{
40024dd8: f9001bf7 str x23, [sp, #48]
40024ddc: 94000465 bl 40025f70 <_Mutex_Acquire>
uint32_t mode;
pipe_lock();
PIPE_LOCK(pipe);
40024de0: 9100c277 add x23, x19, #0x30
40024de4: aa1703e0 mov x0, x23
40024de8: 94000462 bl 40025f70 <_Mutex_Acquire>
40024dec: b94002c1 ldr w1, [x22]
mode = LIBIO_ACCMODE(iop);
40024df0: 121f0436 and w22, w1, #0x6
if (mode & LIBIO_FLAGS_READ)
40024df4: 36080081 tbz w1, #1, 40024e04 <pipe_release+0x54>
pipe->Readers --;
40024df8: b9401660 ldr w0, [x19, #20]
40024dfc: 51000400 sub w0, w0, #0x1
40024e00: b9001660 str w0, [x19, #20]
if (mode & LIBIO_FLAGS_WRITE)
40024e04: 36100081 tbz w1, #2, 40024e14 <pipe_release+0x64>
pipe->Writers --;
40024e08: b9401a60 ldr w0, [x19, #24]
40024e0c: 51000400 sub w0, w0, #0x1
40024e10: b9001a60 str w0, [x19, #24]
}
static __inline void rtems_mutex_unlock( rtems_mutex *mutex )
{
_Mutex_Release( mutex );
40024e14: aa1703e0 mov x0, x23
40024e18: 94000472 bl 40025fe0 <_Mutex_Release>
PIPE_UNLOCK(pipe);
if (pipe->Readers == 0 && pipe->Writers == 0) {
40024e1c: b9401660 ldr w0, [x19, #20]
40024e20: 34000160 cbz w0, 40024e4c <pipe_release+0x9c>
*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)
40024e24: b9401a60 ldr w0, [x19, #24]
40024e28: 7100001f cmp w0, #0x0
40024e2c: 7a420ac4 ccmp w22, #0x2, #0x4, eq // eq = none
40024e30: 54000261 b.ne 40024e7c <pipe_release+0xcc> // b.any <== ALWAYS TAKEN
40024e34: aa1403e0 mov x0, x20 <== NOT EXECUTED
rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_OPEN );
if(iop->pathinfo.ops->unlink_h(&iop->pathinfo))
return;
#endif
}
40024e38: a94153f3 ldp x19, x20, [sp, #16] <== NOT EXECUTED
40024e3c: a9425bf5 ldp x21, x22, [sp, #32] <== NOT EXECUTED
40024e40: f9401bf7 ldr x23, [sp, #48] <== NOT EXECUTED
40024e44: a8c47bfd ldp x29, x30, [sp], #64 <== NOT EXECUTED
40024e48: 14000466 b 40025fe0 <_Mutex_Release> <== NOT EXECUTED
if (pipe->Readers == 0 && pipe->Writers == 0) {
40024e4c: b9401a60 ldr w0, [x19, #24]
40024e50: 34000260 cbz w0, 40024e9c <pipe_release+0xec>
else if (pipe->Readers == 0 && mode != LIBIO_FLAGS_WRITE)
40024e54: 710012df cmp w22, #0x4
40024e58: 54fffee0 b.eq 40024e34 <pipe_release+0x84> // b.none <== NEVER TAKEN
static __inline void rtems_condition_variable_broadcast(
rtems_condition_variable *condition_variable
)
{
_Condition_Broadcast( condition_variable );
40024e5c: 9101c260 add x0, x19, #0x70
40024e60: 9400028c bl 40025890 <_Condition_Broadcast>
_Mutex_Release( mutex );
40024e64: aa1403e0 mov x0, x20
}
40024e68: a94153f3 ldp x19, x20, [sp, #16]
40024e6c: a9425bf5 ldp x21, x22, [sp, #32]
40024e70: f9401bf7 ldr x23, [sp, #48]
40024e74: a8c47bfd ldp x29, x30, [sp], #64
40024e78: 1400045a b 40025fe0 <_Mutex_Release>
_Condition_Broadcast( condition_variable );
40024e7c: 91014260 add x0, x19, #0x50
40024e80: 94000284 bl 40025890 <_Condition_Broadcast>
_Mutex_Release( mutex );
40024e84: aa1403e0 mov x0, x20
40024e88: a94153f3 ldp x19, x20, [sp, #16]
40024e8c: a9425bf5 ldp x21, x22, [sp, #32]
40024e90: f9401bf7 ldr x23, [sp, #48]
40024e94: a8c47bfd ldp x29, x30, [sp], #64
40024e98: 14000452 b 40025fe0 <_Mutex_Release>
free(pipe->Buffer);
40024e9c: f9400260 ldr x0, [x19]
40024ea0: 94001114 bl 400292f0 <free>
free(pipe);
40024ea4: aa1303e0 mov x0, x19
40024ea8: 94001112 bl 400292f0 <free>
*pipep = NULL;
40024eac: f90002bf str xzr, [x21]
40024eb0: aa1403e0 mov x0, x20
}
40024eb4: a94153f3 ldp x19, x20, [sp, #16]
40024eb8: a9425bf5 ldp x21, x22, [sp, #32]
40024ebc: f9401bf7 ldr x23, [sp, #48]
40024ec0: a8c47bfd ldp x29, x30, [sp], #64
40024ec4: 14000447 b 40025fe0 <_Mutex_Release>
...
00000000400252b0 <pipe_write>:
)
{
int chunk, chunk1, written = 0, ret = 0;
/* Write nothing */
if (count == 0)
400252b0: b5000062 cbnz x2, 400252bc <pipe_write+0xc> <== ALWAYS TAKEN
return 0;
400252b4: d2800000 mov x0, #0x0 // #0 <== NOT EXECUTED
#endif
if (written > 0)
return written;
return ret;
}
400252b8: d65f03c0 ret <== NOT EXECUTED
{
400252bc: a9b97bfd stp x29, x30, [sp, #-112]!
400252c0: 910003fd mov x29, sp
400252c4: a90153f3 stp x19, x20, [sp, #16]
400252c8: aa0003f3 mov x19, x0
400252cc: aa0303f4 mov x20, x3
400252d0: a9025bf5 stp x21, x22, [sp, #32]
PIPE_LOCK(pipe);
400252d4: 9100c015 add x21, x0, #0x30
_Mutex_Acquire( mutex );
400252d8: aa1503e0 mov x0, x21
400252dc: aa0203f6 mov x22, x2
{
400252e0: a9046bf9 stp x25, x26, [sp, #64]
400252e4: aa0103f9 mov x25, x1
400252e8: 94000322 bl 40025f70 <_Mutex_Acquire>
if (pipe->Readers == 0) {
400252ec: b9401660 ldr w0, [x19, #20]
400252f0: 34000820 cbz w0, 400253f4 <pipe_write+0x144>
chunk = count <= pipe->Size ? count : 1;
400252f4: b9400a62 ldr w2, [x19, #8]
PIPE_WAKEUPREADERS(pipe);
400252f8: 91014260 add x0, x19, #0x50
chunk = count <= pipe->Size ? count : 1;
400252fc: 5280001a mov w26, #0x0 // #0
40025300: a90363f7 stp x23, x24, [sp, #48]
PIPE_WRITEWAIT(pipe);
40025304: 9101c278 add x24, x19, #0x70
chunk = count <= pipe->Size ? count : 1;
40025308: eb2242df cmp x22, w2, uxtw
4002530c: a90573fb stp x27, x28, [sp, #80]
40025310: 9a9f96d7 csinc x23, x22, xzr, ls // ls = plast
while (written < count) {
40025314: d280001b mov x27, #0x0 // #0
PIPE_WAKEUPREADERS(pipe);
40025318: f90033e0 str x0, [sp, #96]
4002531c: 1400000f b 40025358 <pipe_write+0xa8>
40025320: b9400280 ldr w0, [x20]
if (LIBIO_NODELAY(iop)) {
40025324: 370007e0 tbnz w0, #0, 40025420 <pipe_write+0x170>
pipe->waitingWriters ++;
40025328: b9402262 ldr w2, [x19, #32]
_Condition_Wait( condition_variable, mutex );
4002532c: aa1503e1 mov x1, x21
40025330: aa1803e0 mov x0, x24
40025334: 11000442 add w2, w2, #0x1
40025338: b9002262 str w2, [x19, #32]
4002533c: 94000139 bl 40025820 <_Condition_Wait>
pipe->waitingWriters --;
40025340: b9402260 ldr w0, [x19, #32]
if (pipe->Readers == 0) {
40025344: b9401661 ldr w1, [x19, #20]
pipe->waitingWriters --;
40025348: 51000400 sub w0, w0, #0x1
4002534c: b9002260 str w0, [x19, #32]
if (pipe->Readers == 0) {
40025350: 34000821 cbz w1, 40025454 <pipe_write+0x1a4> <== NEVER TAKEN
while (PIPE_SPACE(pipe) < chunk) {
40025354: b9400a62 ldr w2, [x19, #8]
40025358: b9401261 ldr w1, [x19, #16]
4002535c: 4b010040 sub w0, w2, w1
40025360: 6b17001f cmp w0, w23
40025364: 54fffde3 b.cc 40025320 <pipe_write+0x70> // b.lo, b.ul, b.last
chunk1 = pipe->Size - PIPE_WSTART(pipe);
40025368: b9400e63 ldr w3, [x19, #12]
chunk = MIN(count - written, PIPE_SPACE(pipe));
4002536c: cb1b02c4 sub x4, x22, x27
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
40025370: f9400266 ldr x6, [x19]
chunk1 = pipe->Size - PIPE_WSTART(pipe);
40025374: 0b030023 add w3, w1, w3
chunk = MIN(count - written, PIPE_SPACE(pipe));
40025378: eb00009f cmp x4, x0
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
4002537c: 8b1b0321 add x1, x25, x27
chunk = MIN(count - written, PIPE_SPACE(pipe));
40025380: 9a80909c csel x28, x4, x0, ls // ls = plast
chunk1 = pipe->Size - PIPE_WSTART(pipe);
40025384: 1ac20865 udiv w5, w3, w2
40025388: 1b028ca3 msub w3, w5, w2, w3
4002538c: 4b030057 sub w23, w2, w3
if (chunk > chunk1) {
40025390: 6b17039f cmp w28, w23
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
40025394: 8b2340c0 add x0, x6, w3, uxtw
if (chunk > chunk1) {
40025398: 540006cd b.le 40025470 <pipe_write+0x1c0>
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk1);
4002539c: 93407ee2 sxtw x2, w23
400253a0: f90037e2 str x2, [sp, #104]
400253a4: 94002bb4 bl 40030274 <memcpy>
memcpy(pipe->Buffer, buffer + written + chunk1, chunk - chunk1);
400253a8: 4b170397 sub w23, w28, w23
400253ac: f9400260 ldr x0, [x19]
400253b0: f94037e2 ldr x2, [sp, #104]
400253b4: 8b020361 add x1, x27, x2
400253b8: 93407ee2 sxtw x2, w23
400253bc: 8b010321 add x1, x25, x1
400253c0: 94002bad bl 40030274 <memcpy>
pipe->Length += chunk;
400253c4: b9401260 ldr w0, [x19, #16]
if (pipe->waitingReaders > 0)
400253c8: b9401e61 ldr w1, [x19, #28]
pipe->Length += chunk;
400253cc: 0b1c0000 add w0, w0, w28
400253d0: b9001260 str w0, [x19, #16]
if (pipe->waitingReaders > 0)
400253d4: 35000541 cbnz w1, 4002547c <pipe_write+0x1cc>
written += chunk;
400253d8: 0b1c035a add w26, w26, w28
while (written < count) {
400253dc: 93407f5b sxtw x27, w26
400253e0: eb16037f cmp x27, x22
400253e4: 54000522 b.cs 40025488 <pipe_write+0x1d8> // b.hs, b.nlast <== ALWAYS TAKEN
while (PIPE_SPACE(pipe) < chunk) {
400253e8: b9400a62 ldr w2, [x19, #8] <== NOT EXECUTED
chunk = 1;
400253ec: 52800037 mov w23, #0x1 // #1 <== NOT EXECUTED
400253f0: 17ffffda b 40025358 <pipe_write+0xa8> <== NOT EXECUTED
_Mutex_Release( mutex );
400253f4: aa1503e0 mov x0, x21
400253f8: 940002fa bl 40025fe0 <_Mutex_Release>
kill(getpid(), SIGPIPE);
400253fc: 94001065 bl 40029590 <getpid>
40025400: 528001a1 mov w1, #0xd // #13
40025404: 94000d87 bl 40028a20 <kill>
40025408: 928003e0 mov x0, #0xffffffffffffffe0 // #-32
}
4002540c: a94153f3 ldp x19, x20, [sp, #16]
40025410: a9425bf5 ldp x21, x22, [sp, #32]
40025414: a9446bf9 ldp x25, x26, [sp, #64]
40025418: a8c77bfd ldp x29, x30, [sp], #112
4002541c: d65f03c0 ret
40025420: aa1503e0 mov x0, x21
40025424: 940002ef bl 40025fe0 <_Mutex_Release>
ret = -EAGAIN;
40025428: 92800140 mov x0, #0xfffffffffffffff5 // #-11
return written;
4002542c: 7100035f cmp w26, #0x0
40025430: 93407f5a sxtw x26, w26
40025434: 9a9ad000 csel x0, x0, x26, le
}
40025438: a94153f3 ldp x19, x20, [sp, #16]
4002543c: a9425bf5 ldp x21, x22, [sp, #32]
40025440: a94363f7 ldp x23, x24, [sp, #48]
40025444: a9446bf9 ldp x25, x26, [sp, #64]
40025448: a94573fb ldp x27, x28, [sp, #80]
4002544c: a8c77bfd ldp x29, x30, [sp], #112
40025450: d65f03c0 ret
40025454: aa1503e0 mov x0, x21 <== NOT EXECUTED
40025458: 940002e2 bl 40025fe0 <_Mutex_Release> <== NOT EXECUTED
kill(getpid(), SIGPIPE);
4002545c: 9400104d bl 40029590 <getpid> <== NOT EXECUTED
40025460: 528001a1 mov w1, #0xd // #13 <== NOT EXECUTED
40025464: 94000d6f bl 40028a20 <kill> <== NOT EXECUTED
40025468: 928003e0 mov x0, #0xffffffffffffffe0 // #-32 <== NOT EXECUTED
4002546c: 17fffff0 b 4002542c <pipe_write+0x17c> <== NOT EXECUTED
memcpy(pipe->Buffer + PIPE_WSTART(pipe), buffer + written, chunk);
40025470: 93407f82 sxtw x2, w28
40025474: 94002b80 bl 40030274 <memcpy>
40025478: 17ffffd3 b 400253c4 <pipe_write+0x114>
_Condition_Broadcast( condition_variable );
4002547c: f94033e0 ldr x0, [sp, #96]
40025480: 94000104 bl 40025890 <_Condition_Broadcast>
}
40025484: 17ffffd5 b 400253d8 <pipe_write+0x128>
_Mutex_Release( mutex );
40025488: aa1503e0 mov x0, x21
4002548c: 940002d5 bl 40025fe0 <_Mutex_Release>
40025490: d2800000 mov x0, #0x0 // #0
40025494: 17ffffe6 b 4002542c <pipe_write+0x17c>
...