Re: asm directives

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

 



On Sat, Aug 14, 2004 at 10:51:25 +0200, Borislav Petkov wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi there guys,
> I have another asm question to rack your brains :)
> 
> code excerpt:
> <from include/asm-i396/system.h:300>
> 300 #define alternative(oldinstr, newinstr, feature)        \
> 301         asm volatile ("661:\n\t" oldinstr "\n662:\n"                 \
> 302                       ".section .altinstructions,\"a\"\n"            \
> 303                       "  .align 4\n"                                   \
> 304                       "  .long 661b\n"            /* label */          \
> 305                       "  .long 663f\n"            /* new instruction */         
> \
> 306                       "  .byte %c0\n"             /* feature bit */    \
> 307                       "  .byte 662b-661b\n"       /* sourcelen */      \
> 308                       "  .byte 664f-663f\n"       /* replacementlen */ \
> 309                       ".previous\n"                                             
> \
> 310                       ".section .altinstr_replacement,\"ax\"\n"                 
> \
> 311                       "663:\n\t" newinstr "\n664:\n"   /* replacement */    
> \
> 312                       ".previous" :: "i" (feature) : "memory")  
> 
> What is does the ".previous" directive do? I see that it is being used 
> extensively in kernel asm code but i could only guess (maybe is a some kind 
> of program control redirection instruction but this is pretty vague and not 
> sure). It isn't mentioned in the GAS manual so maybe it is something 
> magical? :))

I believe it's the "reverse" of the .section directive. The .section
directive tells assembly to generate code to a specific section. The
.previous tells it to generate it to the one that was in effect before
last .section. Eg. in spinlock the spinning loop is generated in
different section so it does not need to be jumped over.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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