Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Help translating Intel to AT&T
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 26th July 05:43
t.m. sommers
External User
 
Posts: 1
Default Help translating Intel to AT&T


In my comments, I assume that OpenBSD works the same as FreeBSD.

Do you really need to allocate storage for this?

I do not think this is necessary; .comm and .lcomm automatically
use the bss section.


...lcomm might be better, unless you want buf to be globally visible.

%ebx now contains the address _start will return to.


%ebx now contains argc.

%ebx now contains argv[0], which is the name of the program being
run.

Note that after these 3 pops, %esp is pointing where it ought not
point, and your program will die a horrible death when it ends.

No you do not; see above. And anyway, you do not want it in
%ebx. In BSD, arguments to syscalls are placed on the stack,
right to left, just as in C (because the kernel expects to be
called through a C function).

Should also be on the stack.

Because the kernel expects to be called through a C function, it
expects an address to be on the stack before the arguments.
Either put the int $0x80 behind a call, or push a random value on
to the stack before the int $0x80.

Assuming OpenBSD works the same as FreeBSD, the carry flag is set
when there is an error, and the error code is in %eax.

Similar problems exist in the remainder of your code.


--
Thomas M. Sommers -- tms2@ptd.net -- AB2SB
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666