LCOV - code coverage report
Current view: top level - strace_git/linux/x86_64 - get_syscall_args.c (source / functions) Hit Total Coverage
Test: strace-4.16.0.69.f1ea-dirty Code Coverage Lines: 16 22 72.7 %
Date: 2017-03-18 00:38:52 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 4 75.0 %

           Branch data     Line data    Source code
       1                 :            : /* Return -1 on error or 1 on success (never 0!). */
       2                 :            : static int
       3                 :   11661614 : get_syscall_args(struct tcb *tcp)
       4                 :            : {
       5         [ +  + ]:   11661614 :         if (x86_io.iov_len != sizeof(i386_regs)) {
       6                 :            :                 /* x86-64 or x32 ABI */
       7         [ -  + ]:   11558440 :                 if (tcp->s_ent->sys_flags & COMPAT_SYSCALL_TYPES) {
       8                 :            :                         /*
       9                 :            :                          * X32 compat syscall: zero-extend from 32 bits.
      10                 :            :                          * Use truncate_klong_to_current_wordsize(tcp->u_arg[N])
      11                 :            :                          * in syscall handlers
      12                 :            :                          * if you need to use *sign-extended* parameter.
      13                 :            :                          */
      14                 :          0 :                         tcp->u_arg[0] = (uint32_t) x86_64_regs.rdi;
      15                 :          0 :                         tcp->u_arg[1] = (uint32_t) x86_64_regs.rsi;
      16                 :          0 :                         tcp->u_arg[2] = (uint32_t) x86_64_regs.rdx;
      17                 :          0 :                         tcp->u_arg[3] = (uint32_t) x86_64_regs.r10;
      18                 :          0 :                         tcp->u_arg[4] = (uint32_t) x86_64_regs.r8;
      19                 :          0 :                         tcp->u_arg[5] = (uint32_t) x86_64_regs.r9;
      20                 :            :                 } else {
      21                 :   11558440 :                         tcp->u_arg[0] = x86_64_regs.rdi;
      22                 :   11558440 :                         tcp->u_arg[1] = x86_64_regs.rsi;
      23                 :   11558440 :                         tcp->u_arg[2] = x86_64_regs.rdx;
      24                 :   11558440 :                         tcp->u_arg[3] = x86_64_regs.r10;
      25                 :   11558440 :                         tcp->u_arg[4] = x86_64_regs.r8;
      26                 :   11558440 :                         tcp->u_arg[5] = x86_64_regs.r9;
      27                 :            :                 }
      28                 :            :         } else {
      29                 :            :                 /*
      30                 :            :                  * i386 ABI: zero-extend from 32 bits.
      31                 :            :                  * Use truncate_klong_to_current_wordsize(tcp->u_arg[N])
      32                 :            :                  * in syscall handlers
      33                 :            :                  * if you need to use *sign-extended* parameter.
      34                 :            :                  */
      35                 :     103174 :                 tcp->u_arg[0] = (uint32_t) i386_regs.ebx;
      36                 :     103174 :                 tcp->u_arg[1] = (uint32_t) i386_regs.ecx;
      37                 :     103174 :                 tcp->u_arg[2] = (uint32_t) i386_regs.edx;
      38                 :     103174 :                 tcp->u_arg[3] = (uint32_t) i386_regs.esi;
      39                 :     103174 :                 tcp->u_arg[4] = (uint32_t) i386_regs.edi;
      40                 :     103174 :                 tcp->u_arg[5] = (uint32_t) i386_regs.ebp;
      41                 :            :         }
      42                 :   11661614 :         return 1;
      43                 :            : }

Generated by: LCOV version 1.12