From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 9 15:45:42 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2565316A41F for ; Tue, 9 Aug 2005 15:45:42 +0000 (GMT) (envelope-from edelkind-freebsd-hackers@episec.com) Received: from episec.com (episec.com [69.55.237.141]) by mx1.FreeBSD.org (Postfix) with SMTP id C057243D45 for ; Tue, 9 Aug 2005 15:45:41 +0000 (GMT) (envelope-from edelkind-freebsd-hackers@episec.com) Received: (qmail 62656 invoked from network); 9 Aug 2005 15:45:41 -0000 Received: from episec.com (HELO crypto.iownanisp.com) (69.55.237.141) by episec.com with SMTP; 9 Aug 2005 15:45:41 -0000 Received: from 199.172.169.7 (auth. user edelkind@episec.com) by crypto.iownanisp.com with HTTP; Tue, 09 Aug 2005 15:45:41 +0000 To: freebsd-hackers@freebsd.org Date: Tue, 09 Aug 2005 15:45:41 +0000 X-Mailer: IlohaMail/0.8.12 (On: crypto.iownanisp.com) In-Reply-To: <20050809133109.GA15300@skatecity> From: "ari edelkind" Bounce-To: "ari edelkind" Errors-To: "ari edelkind" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Message-Id: <20050809154541.C057243D45@mx1.FreeBSD.org> Subject: Re: Using sysarch specific syscalls in assembly? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2005 15:45:42 -0000 On 8/9/2005, "alexander" 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