Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>mov -0x24(%ebp,%eax,4),%eax </code></pre> <p>The above instruction is accessing an element of an array. This is called <code>SIB</code> addressing in x86, for Scale, Index, Base. There is also an Offset component. The array is based at an address determined by the Base register (<code>EBP</code> here) plus an offset (when using a frame pointer, local variables, including arrays, are addressed as an offset from the frame pointer). The element number is at the Index register (<code>EAX</code> here). The size of each element is determined by the Scale (<code>4</code> here). </p> <pre><code>mov 0x804a6d8,%eax mov $0xffffffff,%ecx mov %eax,-0x2c(%ebp) mov $0x0,%eax cld mov -0x2c(%ebp),%edi repnz scas %es:(%edi),%al mov %ecx,%eax not %eax sub $0x1,%eax </code></pre> <p>This is just <code>strlen(0x805a6d8)</code>. <code>ES:EDI</code> points to a string to scan (compare agains a reference byte) at <code>0x804a6d8</code>. <code>AL</code> contains the character to scan for: <code>0</code> - <code>ASCII NUL</code>. <code>cld</code> sets the direction for the scan: ascending (<code>std</code> would make the scan descending). <code>ECX</code> is initialized to <code>~0 = -1</code>: all bits 1. <code>repnz</code> repeats the <code>scas</code> (SCAN STRING) instruction decrementing <code>ECX</code> while <code>ECX</code> is not zero (which will not happen since ECX is big enough to prevent that) and the scan is not successful (NZ, while the scan (compare between the string and the reference AL) didn't set the zero flag). After that, <code>ECX</code> contains <code>-1-(steps in the scan)</code>. <code>NOT</code> makes that <code>(steps in the scan)</code>. <code>SUB</code> makes that <code>(steps in the scan) - 1 = (length of string not including the terminating NUL)</code>. Also explained at <a href="http://www.int80h.org/strlen/" rel="noreferrer">http://www.int80h.org/strlen/</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload