This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OT: gas question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]