Hi!

If started a project for Linux assembler programming using FASM.
The attached file (rename to syscall.tar.gz) is the first part of this release. It contains equates for all (> 220) Linux syscalls (as of Kernel 2.4.x).

Next release will contain documentation about the parameters of each syscall (at least for the common).

To Privalov: from where did you get the sys_write (for example O_WRONLY) equates? /usr/src/linux/include/asm-i386/fcntl.h?
Posted on 2002-12-01 06:53:08 by bazik
Here is a small example programm (call it "extended Hello World" :grin: ):



include 'elf.inc'
include 'linux.inc'

s1 db 'Please enter your Name: '
n1 = $-s1
s2 db 'Hello '
n2 = $-s2

s3 rb 0x100

start:
mov eax, sys_write ; syscall
mov ebx, stdout ; output handler
mov ecx, s1 ; buffer
mov edx, n1 ; len
int 0x80 ; kernel int

mov eax, sys_read
mov ebx, stdin
mov ecx, s3
mov edx, 0x100
int 0x80

mov byte [s3+eax-1], 0x21 ; add '!'
mov byte [s3+eax], 0xA ; add LF

mov edi, s2
mov esi, s3
add edi, n2 ; move pointer to end of string
_1:
mov bl, [esi]
mov [edi], bl
dec eax ; eax = length of input
or eax, eax
jnz _1

mov eax, sys_write
mov ebx, stdout
mov ecx, s2
mov edx, 0x100
int 0x80

mov eax, sys_exit
xor ebx, ebx
int 0x80

end.



And here the output of the above programm:



bazik@exodus development $ fasm test.asm test
flat assembler version 1.41
2 passes, 481 bytes.
bazik@exodus development $ ./test
Please enter your Name: bazik
Hello bazik!
bazik@exodus development $
Posted on 2002-12-01 06:55:19 by bazik
I'll check it out as soon as I've done some stuff in Win (I just started Windows, why didn't I check the board once more before restarting?)
Posted on 2002-12-01 07:33:56 by scientica
Works flaw less, after I allowed execution of the elf-file, under RedHat 7.3 (since I haven't begun playing with it yet, just select and MB-Click ... hehe :grin: ).

btw, bazik how do I setup a "symlink" (or is it the name just link, I mean a link that points to an other file/folder and, like the /usr/tmp and /usr/X11R6/bin/evim)?
Posted on 2002-12-04 08:27:38 by scientica

btw, bazik how do I setup a "symlink" (or is it the name just link, I mean a link that points to an other file/folder and, like the /usr/tmp and /usr/X11R6/bin/evim)?




bazik@exodus blah $ ln -s test.file blub
bazik@exodus blah $ ll
total 0
lrwxrwxrwx 1 bazik users 9 Dec 4 16:58 blub -> test.file
-rw-r--r-- 1 bazik users 0 Dec 4 16:58 test.file
bazik@exodus blah $
Posted on 2002-12-04 10:00:50 by bazik
Thanks! :)
Posted on 2002-12-04 10:30:38 by scientica
bazik,

i attached the syscall.inc i am using.

ancev
Posted on 2002-12-04 11:03:54 by ancev

bazik,

i attached the syscall.inc i am using.

ancev



Thanks :)

I saw this naming convention somewhere... unistd.h or something like that ;)

I ripped mine from "entry.S" (somewhere in the kernel sources) :alright:
Posted on 2002-12-04 11:11:06 by bazik

To Privalov: from where did you get the sys_write (for example O_WRONLY) equates? /usr/src/linux/include/asm-i386/fcntl.h?


Sorry, I forgot...
:stupid:
Posted on 2002-12-04 11:37:06 by Tomasz Grysztar



Sorry, I forgot...
:stupid:




:grin: :grin: :grin:
Posted on 2002-12-04 13:50:25 by bazik
:grin:
Posted on 2002-12-04 14:06:14 by Tomasz Grysztar
I am just curious of how any updates are coming along? I would love to help in anyway possible.
Posted on 2003-01-22 09:50:01 by gorshing
Bazik,
Is it ok if I use your files as they are in my fasm library?
Posted on 2003-06-28 17:04:30 by jInuQ
Posted on 2003-06-29 08:22:12 by bazik
Cool, Thanks sir.

The project page is http://sourceforge.net/projects/pattod/.

I am also working on writing macros for all the sys calls.

So for example you could do SysExit 0 and it would do all the mov's and the int 0x80.
I still have some more logic to add to calls like that to do xor for the 0 val instead of a mov,
but I just started writing the macros. 8^)

Anything specific you want in the credits let me know.
Posted on 2003-06-29 14:12:59 by jInuQ

Anything specific you want in the credits let me know.


My nickname with homepage address (http://0x1337.net) would be nice :)

I'll take a closer look at your project later...
Posted on 2003-06-30 01:23:34 by bazik
Okay, that not a problem at all. There is a bug in the current CVS tree that is fixed on my local tree. The problem being that my hard drive with all this information on is not working. So this problem will be fixed soon I hope.


Okay I think I kill the bug in the CVS let me know if I didn't.


Well it doesn't look like any of my cvs updates are getting commited or what not. So will see if there is any change in the morning.
Posted on 2003-06-30 02:31:28 by jInuQ