* 'defines.h' file not found
@ 2005-06-21 18:36 Paul Irofti
0 siblings, 0 replies; 4+ messages in thread
From: Paul Irofti @ 2005-06-21 18:36 UTC (permalink / raw)
To: linux-assembly
i have a question, i just moved to AT&T syntax and linux assembly
programming. getting up-to-date with the new syntax and kernel syscalls
was easy
now i found on a few tutorials, meant to make your way easier on the
transition from intel and win assembly to AT&T and *nix assembly,
reffrences to a defines.h file that had the most numbers for output
souces and such already defined and passed along to a more human kind of
abordation (i.e. $1 gets to be #STDOUT).
my question is if there are this sort of headers standardized and
commonly used in the *nix asm world, or every coder makes his own.
searching google i found thousands of program samples that included the
file but no reffrence was made to it, as though it was a naturaly found
header file on every comp.
any comments on this will be very well apreciated...thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 'defines.h' file not found
@ 2005-06-22 0:04 Paul Irofti
2005-06-22 0:09 ` Paul Irofti
0 siblings, 1 reply; 4+ messages in thread
From: Paul Irofti @ 2005-06-22 0:04 UTC (permalink / raw)
To: linux-assembly
ofcourse, i need a header that has define directives as:
;output control
%define NL 10
%define STDIN 0
%define STDOUT 1
...
;syscalls
%define SYS_EXIT 1
%define SYS_READ 3
%define SYS_WRITE 4
%define SYS_IOCTL 54
....
and a sample code that can be found at www.linuxassembly.org is:
.include "defines.h"
.data
hello:
.string "hello world\n"
.globl main
main:
movl $SYS_write,%eax
movl $STDOUT,%ebx
movl $hello,%ecx
movl $12,%edx
int $0x80
ret
that's about it, i need this for an easier code writting. i can use
interrupts and numbers but a 'defines.h' would be nicer.
thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 'defines.h' file not found
2005-06-22 0:04 'defines.h' file not found Paul Irofti
@ 2005-06-22 0:09 ` Paul Irofti
[not found] ` <d03fdece5c2376836cd3ab3fed1b85ac@sonoma.edu>
0 siblings, 1 reply; 4+ messages in thread
From: Paul Irofti @ 2005-06-22 0:09 UTC (permalink / raw)
To: linux-assembly
Paul Irofti wrote:
> ofcourse, i need a header that has define directives as:
>
>
> ;output control
> %define NL 10
> %define STDIN 0
> %define STDOUT 1
> ...
> ;syscalls
> %define SYS_EXIT 1
> %define SYS_READ 3
> %define SYS_WRITE 4
> %define SYS_IOCTL 54
>
> ....
>
> and a sample code that can be found at www.linuxassembly.org is:
>
> .include "defines.h"
> .data
> hello:
> .string "hello world\n"
>
> .globl main
> main:
> movl $SYS_write,%eax
> movl $STDOUT,%ebx
> movl $hello,%ecx
> movl $12,%edx
> int $0x80
>
> ret
>
>
> that's about it, i need this for an easier code writting. i can use
> interrupts and numbers but a 'defines.h' would be nicer.
> thanks.
>
oh yeah, and the header snapshot that i gave is written in NASM syntax
which is Intel syntax similar. i need an AT&T syntax one...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 'defines.h' file not found
[not found] ` <d03fdece5c2376836cd3ab3fed1b85ac@sonoma.edu>
@ 2005-06-22 1:54 ` Paul Irofti
0 siblings, 0 replies; 4+ messages in thread
From: Paul Irofti @ 2005-06-22 1:54 UTC (permalink / raw)
To: Robert G.Plantz; +Cc: linux-assembly
Robert G.Plantz wrote:
> On Jun 21, 2005, at 5:09 PM, Paul Irofti wrote:
>
>> Paul Irofti wrote:
>
>
> The AT&T equivalent of this file:
>
>>> ;output control
>>> %define NL 10
>>> %define STDIN 0
>>> %define STDOUT 1
>>> ...
>>> ;syscalls
>>> %define SYS_EXIT 1
>>> %define SYS_READ 3
>>> %define SYS_WRITE 4
>>> %define SYS_IOCTL 54
>>>
> is:
>
> # output control
> NL = 10
> STDIN = 0
> STDOUT = 1
> ...
> # syscalls
> SYS_EXIT = 1
> SYS_READ = 3
> SYS_WRITE = 4
> SYS_IOCTL = 54
>
>
i knew that, it only came in handly in a copy-paste kindda way. thanks.
>>> and a sample code that can be found at www.linuxassembly.org is:
>>>
>>> .include "defines.h"
>>> .data
>>> hello:
>>> .string "hello world\n"
>>>
>
> Also, you'll have a problem here unless you use the
> .text
> directive so the following code goes into the text segment.
>
>>> .globl main
>>> main:
>>> movl $SYS_write,%eax
>>> movl $STDOUT,%ebx
>>> movl $hello,%ecx
>>> movl $12,%edx
>>> int $0x80
>>
>
> Your shell will be happier if you return zero:
> movl $0, $eax
>
>>> ret
>>>
>>>
>>> that's about it, i need this for an easier code writting. i can use
>>> interrupts and numbers but a 'defines.h' would be nicer.
>>> thanks.
>>>
>
> I use the assembler to assemble this
> as --gstabs helloWorld.s -o helloWorld.o
>
> and then gcc to link/load it
> gcc helloworld.o -o helloworld
>
thanks for the info, it seems simpler this way for i used a gcc-ld-wc
session for making the executable.
> If you just use ld, you need to explicitly specify the system
> libraries. But gcc recognizes that helloworld.o is an object file and
> goes directly to the ld phase and automatically links all the
> necessary libraries.
>
> You can do something like
> gcc helloworld.o -o helloworld -Wl,-M
> to see the libraries.
>
> --Bob
>
> -----------------------------------------------------
> Mac on Intel:
> Gotta stick to your principles -- until they get in your way.
>
> Bob Plantz
> plantz@mac.com
>
>
the sample helloWorld code was meant to see one of the code snipets
where i found the defines.h included.
it's not a bigdeal, i wanted the general defines.h file because i think
it contains alot of goodies that i'd like to take a look at, and use in
future apps.
thanks again Bob!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-22 1:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-22 0:04 'defines.h' file not found Paul Irofti
2005-06-22 0:09 ` Paul Irofti
[not found] ` <d03fdece5c2376836cd3ab3fed1b85ac@sonoma.edu>
2005-06-22 1:54 ` Paul Irofti
-- strict thread matches above, loose matches on Subject: below --
2005-06-21 18:36 Paul Irofti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).