flat assembler
Message board for the users of flat assembler.

Index > Unix > FreeBSD syscalls

Author
Thread Post new topic Reply to topic
Dryobates



Joined: 13 Jul 2003
Posts: 46
Location: Poland
Dryobates 21 Feb 2005, 22:27
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: 1223 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
a16b03 06 Feb 2007, 21:18
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
jb 12 Apr 2007, 13:15
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


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.