[pso] Tema 1 Linux - Invocare de mana system call

Andrei Popa ca at i-neo.ro
Fri Mar 16 00:31:11 EET 2007


On Fri, 2007-03-16 at 00:11 +0200, Alexandru Tudose wrote:
> Am incercat sa chem de mana un system call (20 - getpid) pentru teste,
> si am folosit urmatorul cod:
> 
> --------------------------
>         int pid;
> 
>         __asm__(
>                 "movl $20, %eax    \n" 
>                 "int 0x80   \n"
>                 "movl %eax, pid    \n"
>         );
> ---------------------------
> 
> 
> Totusi codul nu compileaza din cauza ca nu as fi invocat corect
> intreruperea 80 pentru a porni syscall-ul pus in eax. 
> 
> Ma poate ajuta cineva cu un sfat unde gresesc?

   __asm__(
                "movl $20, %%eax    \n"
                "int $0x80   \n"
            "movl %%eax, %0    \n"
        :"=r"(pid)
        );

vezi: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

> 
> Multumesc frumos,
> Alexandru Tudose.
> 
> _______________________________________________
> pso mailing list
> pso at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso
-- 
Andrei Popa - 341C3



More information about the pso mailing list