Question

#define INLINE_SYSCALL(name, nr, args...) \
  ({                                          \
    unsigned int resultvar;                           \
    asm volatile (                                \
    LOADARGS_##nr                                 \
    "movl %1, %%eax\n\t"                              \
    "int $0x80\n\t"                               \
     RESTOREARGS_##nr                                 \
    : "=a" (resultvar)                                \
    : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc");              \
   if (resultvar >= 0xfffff001)                       \
     {                                        \
        __set_errno (-resultvar);                         \
        resultvar = 0xffffffff;                           \
      }                                       \
    (int) resultvar; })

#define LOADARGS_0
#define LOADARGS_1 \
"bpushl .L__X'%k2, %k2\n\t"                           \
"bmovl .L__X'%k2, %k2\n\t"
#define LOADARGS_2  LOADARGS_1
#define LOADARGS_3  LOADARGS_1
#define LOADARGS_4  LOADARGS_1
#define LOADARGS_5  LOADARGS_1

who knows the meaning of the following asm code

#define LOADARGS_1 \
"bpushl .L__X'%k2, %k2\n\t"                           \
"bmovl .L__X'%k2, %k2\n\t"

can someone explain this to me %2 means the third parameters in asm input and output so %k2 means what and what's meaning of .L__X bpushl and bmovl seems no such instruction for ia32

Was it helpful?

Solution

The %2 and %k2 are register constraints, which are described well here: Simple Constraints

bpushl and bmovl are macros defined by uClibc in syscalls.h, and seems to be meant to preserve the previous value in %ebx before clobbering it.

.L__X is defined in the same file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top