View Single Post
  #6   (View Single Post)  
Old 6th October 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

Both Linux and BSD use AT&T syntax assembly on i386/amd64 systems, but for system calls.. arguments must be passed on the stack instead of in registers (..DOS/Windows do it the Linux way as well, Unix systems traditionally use the stack).

Creating x86 assembly programs on OpenBSD is is a little difficult, but a few (..nefarious) tutorials exist on the mater.

As mentioned in that guide, OpenBSD needs a special section to brand the ELF executable.. because otherwise the ELF loader confuses it for something wanting to use a compat_*(8) layer.

While learning assembly is commendable, portability is definitely something you should consider.. and while both OpenBSD and Linux may share a few historic Unix system calls (..perhaps even numbering) it is not a guarantee and behaviour of these aforementioned routines may not be identical.

In summary, you may be able to adapt Linux assembly programs for OpenBSD.. but this will be difficult for a novice, source compatibility on Unix-like systems end at the C API level.

Good luck..
Reply With Quote