Changes between Version 5 and Version 6 of WikiStart


Ignore:
Timestamp:
Mar 12, 2009, 10:49:06 AM (15 years ago)
Author:
lorenzo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v5 v6  
    109109  unsigned int eax;
    110110
     111  // leggi il codice da eseguire da standard input
    111112  n = read(0, buf, 1024);
     113  // forza il codice a ritornare dalla chiamata a funzione (0xC3 = ret)
    112114  buf[n] = '\xc3';
    113115
     116  // esegui il codice letto come se fosse una funzione
    114117  ptr = (void(*)()) buf;
    115118  ptr();
    116119
     120  // stampa il valore del registro EAX
    117121  __asm__("mov %%eax, %0" : "=m"(eax));
    118 
    119122  printf("EAX: %.8x\n", eax);
    120123