EDI: The Destination Index
Every loop that generates data must store the result in memory, and
doing so requires a moving pointer. The destination index, EDI, is that
pointer. The destination index holds the implied write address of all
string operations. The most useful string instruction, remarkably
enough, is the seldom-used STOS. STOS copies data from the
accumulator into memory and increments the destination index. This
one-byte instruction is perfect, since the final result of any calculation
should be in the accumulator anyhow, and storing results in a moving
memory address is a common task.
The RAX, RBX, RCX, RDX, RBP, RSI, RDI, and RSP registers are used by
both 32-bit and 64-bit binaries. However, in 32-bit mode, only the low
32 bits of these registers are accessible by 32-bit binaries. In the x86
architecture, these registers are EAX, EBX, ECX, EDX, EBP, ESI, EDI,
| Related Discussion |
knut st. osmundsen 2007-02-09 18:29:55 EST
Description of problem:
Crashing at __lll_mutex_timedlock_wait+148 (/lib64/tls/libpthread.so.0):
lock cmpxchg %edx,(%rdi)
Because the syscall wasn't made and %rdi hasn't been loaded with %r12
Version-Release number of selected component (if applicable):
How to fix:
Move the mov %r12,%rdi instruction up somewhere before the je 8f.
How to reproduce:
This isn't easy to reproduce and I'm not going to write a testcase for it
since it's a very obvious bug in the code. But, my from the situation I
get it in is that it requires a 2nd thread to signal the condition variable
/mutex (I'm not quite sure which it is) while the crashing thread is
engaging a sleep.
| Variation |
Hardware 64 bit.
Windows OS 32 bit so uses EDI.
GNU/Linux 64 bit version so used RDI.