Re: How can I support the BIOS function call?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Niki Estner (niki.estner_at_cube.net)
Date: 09/16/04


Date: Thu, 16 Sep 2004 10:42:05 +0200

Sorry Scott, I probably misunderstood your post then. I though you were
saying the "int" instruction can't be used at all in user mode, and would
always result in a priviledged instruction fault.

Niki

"Scott Allen" <bitmask@[nospam].fred.net> wrote in
news:65jhk05jisfulp1qmab5m7k9gq9saibqj0@4ax.com...
> Niki:
>
> The transfer of control from user mode to kernel mode is precisely
> because the INT causes the CPU to vector off to an exception handler
> in kernel mode. If you have all the registers setup correctly, you
> might get Win32 to do something interesting, like open a file or
> create a new process. If you have parameters setup for the older DOS
> INT handler, you'll get an access violation. Windows can't allow just
> any program to come along and get that close to the hardware.
>
> --
> Scott
> http://www.OdeToCode.com
>
> On Wed, 15 Sep 2004 21:54:53 +0200, "Niki Estner"
> <niki.estner@cube.net> wrote:
>
>>"Scott Allen" <bitmask@[nospam].fred.net> wrote in
>>news:nj4hk0lsfpfmgqlguo6l0jv5fe907cniji@4ax.com...
>>> Steve:
>>>
>>> No BIOS function calls from C#, that is correct. It's really more the
>>> case that the underlying platform (Win32) does not support BIOS
>>> function calls - the INT instruction will generate an access violation
>>> from user mode code. The only way to get down this low is to use the
>>> DDK and write a device driver, or look for a Win32 API that might do
>>> what you need.
>>
>>Although I must admit I'm not an expert either, I think you are wrong. In
>>the times of DOS the INT instruction was used to call BIOS and operating
>>system functions (I think "int 21h" used to be the "DOS" interrupt, but
>>I'm
>>not 100% sure about that).
>>Nowadays, this technique is used to transfer control from user mode to
>>kernel mode. Have a look at:
>>
>>http://www.sysinternals.com/ntw2k/info/ntdll.shtml
>>
>>To the OP: I'm pretty sure there is no way to do this in managed code;
>>You'll have to use MC++ for that. What are you trying to do?
>>
>>Niki
>>
>



Relevant Pages

  • Re: PSL_RF inclusion in PSL_USERCHANGE for i386
    ... PSL_RF (Flag to ensure single-step only happens once per instruction.). ... but popfl doesn't set it for me now and user mode cannot execute iret. ... CPU that sets PSL_RF for faults (for all faults or only for debug ...
    (freebsd-arch)
  • Re: Direct Linux syscalls
    ... Though of course user mode was not ... user-mode code could install a handler for it if it wanted. ... instruction took a signed 16-bit argument, ... the same process context as the CLI. ...
    (comp.os.linux.development.apps)
  • Re: 2.6.12-rc2-mm3
    ... SIGTRAP - it looks like the "int $3" ... %eip points to it, but it might be ... the instruction *after* the trap, ... Where is this patch? ...
    (Linux-Kernel)
  • Re: Unix binaries
    ... In DOS you call OS services primarily with INT 21, ... BIOS services have other interrupt numbers e.g. INT 13 for ... services in pure user mode, they would not need to be OS functions. ...
    (comp.lang.java.programmer)
  • Re: interrupting for overflow and loop termination
    ... but executed in the mode of its caller, i.e., user mode if called from user mode. ... "nature" piece wants to crack the instruction, it's inputs, and outputs ... These could be regular registers, or they could be extra new ones. ... Such routines certainly cannot be allowed to block external interrupts arbitrarily. ...
    (comp.arch)