NetBSD/share/man/man9/man9.i386/bioscall.9

123 lines
4.1 KiB
Groff
Raw Normal View History

.\" $NetBSD: bioscall.9,v 1.7 2003/04/16 13:35:36 wiz Exp $
1998-10-01 06:33:50 +04:00
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by John Kohl.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 1, 1998
.Dt BIOSCALL 9 i386
2001-06-05 15:31:21 +04:00
.Os
1998-10-01 06:33:50 +04:00
.Sh NAME
.Nm bioscall
.Nd call system BIOS function from real mode
.Sh SYNOPSIS
.In i386/bioscall.h
1998-10-01 06:33:50 +04:00
.Ft void
.Fn bioscall "int function" "struct bioscallregs *regs"
.Sh DESCRIPTION
The
.Nm
function switches the processor into real mode, calls the BIOS interrupt
numbered
.Fa function ,
and returns to protected mode.
.Pp
This function is intended to be called during the initial system
bootstrap when necessary to probe devices or pseudo-devices.
.Pp
The register values specified by
.Fa *regs
(with one exception) are installed before the BIOS interrupt is called.
The processor flags are handled specially. Only the following flags are
2001-06-21 16:03:29 +04:00
passed to the
1998-10-01 06:33:50 +04:00
BIOS from the registers in
2001-06-21 16:03:29 +04:00
.Fa regs
1998-10-01 06:33:50 +04:00
(the remainder come from the processor's flags register at the time
2001-06-21 16:03:29 +04:00
of the call):
1998-10-01 06:33:50 +04:00
.Ar PSL_C ,
.Ar PSL_PF ,
.Ar PSL_AF ,
.Ar PSL_Z ,
.Ar PSL_N ,
.Ar PSL_D ,
.Ar PSL_V .
.Pp
The
.Va bioscallregs
structure is defined to contain structures for each register, to allow
access to 32-, 16- or 8-bit wide sections of the registers.
Definitions are provided which simplify access to the union members.
2001-09-11 03:32:29 +04:00
.Sh RETURN VALUES
1998-10-01 06:33:50 +04:00
.Nm
fills in
.Fa *regs
with the processor registers as returned from the BIOS call.
.Sh EXAMPLES
The Advanced Power Management driver calls
.Nm
by setting up a register structure with the APM installation check and
device types in registers
.Fa ax
and
.Fa bx ,
then calls the BIOS to fetch the details for calling the APM support
through a protected-mode interface. The BIOS returns these details in
the registers:
.Pp
.Bd -literal
#include \*[Lt]i386/bioscall.h\*[Gt]
#include \*[Lt]i386/apmvar.h\*[Gt]
1998-10-01 06:33:50 +04:00
struct bioscallregs regs;
regs.AX = APM_BIOS_FN(APM_INSTALLATION_CHECK);
regs.BX = APM_DEV_APM_BIOS;
regs.CX = regs.DX = 0;
regs.ESI = regs.EDI = regs.EFLAGS = 0;
bioscall(APM_SYSTEM_BIOS, \*[Am]regs);
1998-10-01 06:33:50 +04:00
.Ed
.Sh CODE REFERENCES
.Pa sys/arch/i386/i386/bioscall.s ,
.Pa sys/arch/i386/bioscall/biostramp.S
.Sh REFERENCES
.Xr apm 4
.Sh HISTORY
.Nm
2001-06-21 16:03:29 +04:00
first appeared in
.Nx 1.3 .
1998-10-01 06:33:50 +04:00
.Sh BUGS
Not all BIOS functions are safe to call through the trampoline, as they
may depend on system state which has been disturbed or used for other
purposes once the
.Nx
kernel is running.