Re: .previous in asm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/30/07, Neo Jia <neojia@xxxxxxxxx> wrote:
hi,

Is there anybody can show me the usage of ".previous" besides the
document from AS website?

ULK 3rd edition, "10.4.5. Generating the Exception Tables and the Fixup Code"

The .previous directive forces the assembler to insert the code that
follows into
the section that was active when the last .section directive was encountered.

HTH,


For the following code,

#define __do_strncpy_from_user(dst,src,count,res)                          \
do {                                                                       \
        int __d0, __d1, __d2;                                              \
        might_sleep();                                                     \
        __asm__ __volatile__(                                              \
                "       testl %1,%1\n"                                     \
                "       jz 2f\n"                                           \
                "0:     lodsb\n"                                           \
                "       stosb\n"                                           \
                "       testb %%al,%%al\n"                                 \
                "       jz 1f\n"                                           \
                "       decl %1\n"                                         \
                "       jnz 0b\n"                                          \
                "1:     subl %1,%0\n"                                      \
                "2:\n"                                                     \
                ".section .fixup,\"ax\"\n"                                 \
                "3:     movl %5,%0\n"                                      \
                "       jmp 2b\n"                                          \
                ".previous\n"                                              \
                ".section __ex_table,\"a\"\n"                              \
                "       .align 4\n"                                        \
                "       .long 0b,3b\n"                                     \
                ".previous"                                                \
                : "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1),      \
                  "=&D" (__d2)                                             \
                : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
                : "memory");                                               \
} while (0)

Thanks,
Neo
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




--
Thanks,
Li Qun

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux