1
__asm__ (".L__X'%ebx = 1\n\t"
 ".L__X'%ecx = 2\n\t"
 ".L__X'%edx = 2\n\t"
 ".L__X'%eax = 3\n\t"
 ".L__X'%esi = 3\n\t"
 ".L__X'%edi = 3\n\t"
 ".L__X'%ebp = 3\n\t"
 ".L__X'%esp = 3\n\t"
 ".ifndef _BITS_SYSCALLS_ASM\n\t"
 ".set _BITS_SYSCALLS_ASM,1\n\t"
 ".macro bpushl name reg\n\t"
 ".if 1 - \\name\n\t"
 ".if 2 - \\name\n\t"
 "pushl %ebx\n\t"
 ".else\n\t"
 "xchgl \\reg, %ebx\n\t"
 ".endif\n\t"
 ".endif\n\t"
 ".endm\n\t"
 ".macro bpopl name reg\n\t"
 ".if 1 - \\name\n\t"
 ".if 2 - \\name\n\t"
 "popl %ebx\n\t"
 ".else\n\t"
 "xchgl \\reg, %ebx\n\t"
 ".endif\n\t"
 ".endif\n\t"
 ".endm\n\t"
 ".macro bmovl name reg\n\t"
 ".if 1 - \\name\n\t"
 ".if 2 - \\name\n\t"
 "movl \\reg, %ebx\n\t"
 ".endif\n\t"
 ".endif\n\t"
 ".endm\n\t"
 ".endif\n\t");

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


#define INTERNAL_SYSCALL(name, err, nr, args...) \
  ({                                                                          \
    register 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");                  \
     (int) resultvar; })

who knows the meaning of .L_X'%ebx = 1, i didn't find any syntax for this sentence in AS doc, this sentence is used for assign a value? .L_X'%ebx is not a valid symbol name, i guess does this mean a special variable cause when expand "bpushl .L_X'%k2, %k2\n\t", we need to expand .L_X'%k2, so what the result of the expansion, can some body help me, it drives me crazy and i cannot find any clue for all of this in a doc.if someone knows where i can find related info please give me a URL or doc name,thx!

Adambynes
  • 197
  • 1
  • 10
  • _"`.L_X'%ebx` is not a valid symbol name"_ Actually, it is. So `.L__X'%ebx = 1` is just declaring a local symbol with the name `.L__X'%ebx` and giving it the value 1. As for `%k2`, I'm not sure but I think that expands to the 32-bit register corresponding to the 3rd input. – Michael Feb 13 '14 at 18:04
  • even according to the GNU as doc, the symbol name can only use '._' but I try % and ' can also be used for the symbol name,so when the inline assembly .L__X'%k2 expand to assembly like .L__X'%ebx it will use the symbol defined before – Adambynes Feb 14 '14 at 07:57

0 Answers0