From owner-freebsd-questions@FreeBSD.ORG Mon Apr 7 12:53:05 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E3581065671 for ; Mon, 7 Apr 2008 12:53:05 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: from web57012.mail.re3.yahoo.com (web57012.mail.re3.yahoo.com [66.196.97.116]) by mx1.freebsd.org (Postfix) with SMTP id D19278FC29 for ; Mon, 7 Apr 2008 12:53:04 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: (qmail 52511 invoked by uid 60001); 7 Apr 2008 12:53:03 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=w8mw4zSB3Br4uH8vxm/lYirL7WRl09UrCsO9RGdgclaYtHWNRdwIEFKB1K+sdM7IUlK3uHOTR8RvmJ9y2cPqGSD5Z7g7N26KgL60PZImJwNjWjAVSPfAEYh+opHmAEdBacijUbF6x8QO5vX1SP3sXcMmw5NK1tdPXkxUBqKtBqI=; X-YMail-OSG: dO18RP0VM1mvVYyDv9xpTXL7OZBgKQPyvd4VDLkJAsKPqYSEdsGyIvG.r.sbyD73Q4CwsczB93poxZe7z39YEIYBx5FWMYM20E0tW3tUZXldTnolE55Xeo6zYozF Received: from [165.21.155.88] by web57012.mail.re3.yahoo.com via HTTP; Mon, 07 Apr 2008 05:53:01 PDT Date: Mon, 7 Apr 2008 05:53:01 -0700 (PDT) From: Unga To: freebsd-questions@freebsd.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <633057.52431.qm@web57012.mail.re3.yahoo.com> Subject: Re: Inline assembly under FreeBSD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2008 12:53:05 -0000 --- Ivan Voras wrote: > Wojciech Puchar wrote: > >> asm("pushfl; stc; int $0x13; setc %%al; > popfl" > >> : "+a" (ax), "+b" (bx), "=c" (cx), "+d" > (dx) > >> : : "esi", "edi"); > >> > >> if ((u8)ax) > >> return -1; /* No extended information > */ > >> else > >> return 1; /* Extended information > available */ > >> } > >> > >> When it is executing the int $0x13, it crashes > with > >> "Program received signal SIGBUS, Bus error." > >> > >> Could you guys give me a helping hand to identify > >> what's the problem? > >> > >> Input and return values are at: > >> http://en.wikipedia.org/wiki/INT_13 > > > > you are in 32-bit mode > > To be a little bore verbose: FreeBSD and all other > modern operating > systems run in some variation of "protected mode", > as opposed to DOS > which ran in "real mode". When you run any program > as a user in such an > operating system, the program doesn't have direct > access to hardware, > and the many other low-level details of the program > execution are very > much different than in DOS. Specifically in this > case, you cannot call > DOS and BIOS interrupts from protected mode. > > If you need to do something with raw data on a disk > drive, there are > ways to do it (see g_open(3) on recent versions of > FreeBSD) but the user > executing the program needs sufficient > privileges/rights for the > operation to be successful. > > Thanks Ivan and Wojciech for replies. So protected mode is the issue. I'll read more on g_open(3). Unga ____________________________________________________________________________________ You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com