123 lines
4.1 KiB
Groff
123 lines
4.1 KiB
Groff
|
.\" $NetBSD: bioscall.9,v 1.1 1998/10/01 02:33:51 jtk Exp $
|
||
|
.\"
|
||
|
.\" 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
|
||
|
.Os NetBSD
|
||
|
.Sh NAME
|
||
|
.Nm bioscall
|
||
|
.Nd call system BIOS function from real mode
|
||
|
.Sh SYNOPSIS
|
||
|
.Fd #include <i386/bioscall.h>
|
||
|
.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
|
||
|
passed to the
|
||
|
BIOS from the registers in
|
||
|
.Fa regs
|
||
|
(the remainder come from the processor's flags register at the time
|
||
|
of the call):
|
||
|
.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.
|
||
|
.Sh RETURN VALUE
|
||
|
.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 <i386/bioscall.h>
|
||
|
#include <i386/apmvar.h>
|
||
|
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, ®s);
|
||
|
.Ed
|
||
|
.Pp
|
||
|
.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
|
||
|
first appeared in NetBSD-1.3.
|
||
|
.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.
|