[pso] [Tema1][win] Problema la interceptare sys_call

Mircea Gherzan mgherzan at anaconda.cs.pub.ro
Wed Apr 2 15:04:44 EEST 2008


Stefan Bucur wrote:
> 2008/4/2 Dragos Sbarlea <sbarlead at yahoo.com>:
>> Sper ca am inteles intrebarea:
>>
>> http://fatih.kesgin.org/mul06/intel/instr/push.html
>>  ---
>> Dragos

Efectul unei instructiuni ASM nu decide neaparat modul in care un
compilator genereaza instructiunile pentru apelul unei functii.

> Da, asa tineam minte si eu, dar doar pe x86, si in plus asta e doar ce
> ofera microprocesorul. Compilatorul (tinand cont de conventiile de ABI
> referitoare la stackframe, zic si eu :-??) poate decide sa impacheteze
> 2 parametri char intr-un registru mai mare, de exemplu. Iar poate asta
> e chiar architecture dependent. Gandesc prea complicat? :)

Ai partial dreptate: compilatorul *respecta* ABI. Pentru Linux IA32,
documentul il gasiti pe site-ul SCO (ironia sortii :) ) [1]. La pagina
36 din document e un tabel cu layout-ul stive si "legile" edificatoare:

"The stack is word aligned. Although the architecture does not require
any alignment of the stack, software convention and the operating system
requires that the stack be aligned on a word boundary."
"An argument’s size is increased, if necessary, to make it a multiple of
words. This may require tail padding, depending on the size of the
argument."

[1] www.sco.com/developers/devspecs/abi386-4.pdf

-- 
Mircea Gherzan
Faculty of Automatic Control and Computers
Politehnica University of Bucharest


More information about the pso mailing list