another asm detail

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there people (again),

<from include/asm-i386/spinlock.h>
 47 #define spin_lock_string \
 48         "\n1:\t" \
 49         "lock ; decb %0\n\t" \
 50         "js 2f\n" \
 51         LOCK_SECTION_START("") \
 52         "2:\t" \
 53         "rep;nop\n\t" \
 54         "cmpb $0,%0\n\t" \
 55         "jle 2b\n\t" \
 56         "jmp 1b\n" \
 57         LOCK_SECTION_END

I think I know how this generally works: It reads atomically %0 and if it is 0 
jumps somewhere but where is a bit unclear. Intel manual says: JLE jumps to 
location <operand> if ((SF xor OF) or ZF)=1 (SF,OF,ZF - flags in the EFLAGS 
register) but the OP is "jump if less or equal." What exactly is being 
compared of being less or equal? I assume that CMPB updates some EFLAGS 
registers but, still, i'm not sure.
It is also unclear to me, what the constraints 'b' and 'f' of the jump 
locations mean (line 50,55,56).

Thanks in advance for your help,
Boris.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA85oAiBySr3Fn37QRAiMpAJ9G1jtCGFqFZ0yQAlYOU6t24625XACeNkgx
tASYmSULfV0i/CrmDWzpBUU=
=aWJz
-----END PGP SIGNATURE-----

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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