Re: Inline assembly under FreeBSD

2008-04-07 Thread Unga

--- Ivan Voras <[EMAIL PROTECTED]> 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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Inline assembly under FreeBSD

2008-04-07 Thread Ivan Voras
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.



signature.asc
Description: OpenPGP digital signature


Re: Inline assembly under FreeBSD

2008-04-07 Thread Wojciech Puchar

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



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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"