Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Aug 2005 15:45:41 +0000
From:      "ari edelkind" <edelkind-freebsd-hackers@episec.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Using sysarch specific syscalls in assembly?
Message-ID:  <20050809154541.C057243D45@mx1.FreeBSD.org>
In-Reply-To: <20050809133109.GA15300@skatecity>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/9/2005, "alexander" <arundel@h3c.de> wrote:

[...]
>Unfortunately I'm experiencing some problems right now. From time to time
>I'm getting a
>
>'Bus error: 10 (core dumped)'
>
>This however appears randomly. One time I run the app everything works fine,=
the
>next time it core dumps. Are there any errors in my code?
>
>%define SYSARCH=09=09165=09; syscall sysarch(2)
>%define I386_SET_IOPERM 4=09; i386_set_ioperm(2) number
>
>ioperm_args=09dd=09378h
>=09=09dd=093
>=09=09dd=091
>
>OpenIO:
>=09push byte ioperm_args
>=09push dword I386_SET_IOPERM
>=09mov eax,SYSARCH
>=09Call _syscall
[...]

You need to push a _pointer_ to a structure as your second argument to
sysarch(2).  This means something more along the lines of:

ioperm_args   dd  378h
              dd  3
              dd  1

argp          dd  ioperm_args

[...]
      push dword argp
      push dword I386_SET_IOPERM
[...]


Get this wrong, and you'll have unpredictable results.

ari



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050809154541.C057243D45>