Visite Webhosting Latino, el site sobre alojamiento web.
Help translating Intel to AT&T - Mombu the Programming Forum
Mombu the Programming Forum sponsored links

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

sponsored links

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

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 -- -- AB2SB
  Reply With Quote

  sponsored links


Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -