This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: OT: gas question
- From: Brian Dessent <brian at dessent dot net>
- To: I Rattan <ratta1i at cps dot cmich dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 22 Sep 2008 18:14:58 -0700
- Subject: Re: OT: gas question
- References: <Pine.GSO.4.61.0809222024340.18247@cps155.cps.cmich.edu>
- Reply-to: gcc-help at gcc dot gnu dot org
I Rattan wrote:
> Probably it may not be the group to ask the question.
> The following assembly code works on Linux on P4 but
> segfaults om Solaris-10 on AMD64 box. The instruction
> in question is int $0x80.
The syscall interface is highly OS-specific, you can't expect things to
be the same at this low level. Look at sys/trap.h on Solaris and you'll
see that it uses int 0x91 for syscalls (assuming it's not configured to
use sysenter or whatnot.) And besides, even if the interrupt number
happened to be the same there's no guarantee that the syscall numbers
are the same between the two operating systems. If you want portability
while still mucking about at this level you need to use the C API, e.g.
syscall (SYS_exit, 0).
Brian