Hi... On Sat, Sep 13, 2008 at 1:28 PM, Sri Ram K Vemulpali <vsriramksh@xxxxxxxxx> wrote: > Hi all, > > what is the difference between incb %al and incb $i. According to my > knowledge if you have some thing like "i++" (in c) then it is translated in > to movw $i %ebx, incw %ebx, movw %ebx $i. My question, when I explicitly > give variable as operand to increment in assembly like "incb $i", then will > that instruction execution cycle involves copying the contents from memory > to register and increment and copy back to memory. To the best I know, the answer is "no". The value will be directly incremented in the target memory address >Is this hidden > and Assembler takes care of it when writing to image file (machine codes or > elf). Not sure about Linux assembler, but I remember that in gcc, if you declare a variable as "volatile" and you do something like a++ then it will be transformed like incw $a instead of movw $a %ebx, incw %ebx, movw %ebx $a >Another question: Is incb %al is atomic operation, I mean, Is > instruction execution cycle is interrupted by an event or a process. > Thank you. yes it is atomic. The rule is: a. it is atomic when you access data not bigger than processor data bus (CMIIW if I use wrong term people). So, if your processor is 32 bit then accessing 8, 16 and 32 bit data will be done atomically... AND.... b. it is naturally aligned e.g the address is multiple of data bus width (only apply when you access memory cell directly...doesn't apply when you access CPU register). regards, Mulyadi. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ