flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Unix > FreeBSD syscalls

Author
Thread Post new topic Reply to topic
Dryobates



Joined: 13 Jul 2003
Posts: 46
Location: Poland
FreeBSD syscalls
Here's some FreeBSD syscalls defines (from master.syscalls) and few macros for syscalls, which I was using (when I need to use some new I just add them there).
If someone will use it and expand it, I would be thankful if he/she post it.


Description: bsdcalls
Download
Filename: bsdcall.inc
Filesize: 7.99 KB
Downloaded: 246 Time(s)


_________________
There's one more bug... Smile
Image
Post 21 Feb 2005, 22:27
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
a16b03



Joined: 24 Jan 2006
Posts: 43
Location: Riga, Latvia
Thanks
Post 06 Feb 2007, 21:18
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
jb



Joined: 26 Mar 2007
Posts: 5
Location: Holland
I recommend a slightly different way to cleanup the stack after a system call. The problem with using add is that it clears the carry bit used to indicate an error. So either lea or a number of pops (if you have a spare register) is preferable: they don't touch any flags. For instance, you could have

bsd 5,filename,0 ;open read-only
jc error

with a macro that hides all gory details

macro bsd n,[arg] {
common
local i
i = 0
reverse
push arg
i = i + 1
common
push eax
mov eax,n
int 0x80
if n <> 1
if i <= 2
times i+1 pop ebx ;3 bytes or less
else
lea esp,[esp+4*(i+1)] ;4 bytes
end if
end if
}
Post 12 Apr 2007, 13:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.