Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Apr 2008 02:37:11 -0700 (PDT)
From:      Unga <unga888@yahoo.com>
To:        freebsd-questions@freebsd.org
Subject:   Inline assembly under FreeBSD
Message-ID:  <687872.53069.qm@web57011.mail.re3.yahoo.com>

next in thread | raw e-mail | index | archive | help
Hi all

I'm trying to execute following inline assembly code
in a C function under FreeBSD 7.0:

typedef unsigned char u8;
typedef unsigned short u16;

u8 devno= 0x80;

static int check_extensions(u8 devno)
{
	u16 ax, bx, cx, dx, di;

	ax = 0x4100;
	bx = 0x55AA;
	dx = devno;
	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

Thanks in advance.

Kind regards
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



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