xref: /netbsd/sys/arch/i386/include/bioscall.h (revision 6550d01e)
1 /*	$NetBSD: bioscall.h,v 1.11 2008/04/28 20:23:24 martin Exp $ */
2 
3 /*-
4  * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by John Kohl and Jason R. Thorpe.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __I386_BIOSCALL_H__
33 #define __I386_BIOSCALL_H__
34 
35 /*
36  * virtual & physical address of the trampoline
37  * that we use: page 1.
38  */
39 #define BIOSTRAMP_BASE	PAGE_SIZE
40 
41 #ifndef _LOCORE
42 #define	BIOSREG_LO	0
43 #define	BIOSREG_HI	1
44 
45 typedef	union {
46 	u_char biosreg_quarter[4];
47 	u_short biosreg_half[2];
48 	u_int biosreg_long;
49 } bios_reg;
50 
51 struct bioscallregs {
52     bios_reg r_ax;
53     bios_reg r_bx;
54     bios_reg r_cx;
55     bios_reg r_dx;
56     bios_reg r_si;
57     bios_reg r_di;
58     bios_reg r_flags;
59     bios_reg r_es;
60 };
61 
62 #define	AL	r_ax.biosreg_quarter[BIOSREG_LO]
63 #define	AH	r_ax.biosreg_quarter[BIOSREG_HI]
64 #define	AX	r_ax.biosreg_half[BIOSREG_LO]
65 #define	AX_HI	r_ax.biosreg_half[BIOSREG_HI]
66 #define	EAX	r_ax.biosreg_long
67 
68 #define	BL	r_bx.biosreg_quarter[BIOSREG_LO]
69 #define	BH	r_bx.biosreg_quarter[BIOSREG_HI]
70 #define	BX	r_bx.biosreg_half[BIOSREG_LO]
71 #define	BX_HI	r_bx.biosreg_half[BIOSREG_HI]
72 #define	EBX	r_bx.biosreg_long
73 
74 #define	CL	r_cx.biosreg_quarter[BIOSREG_LO]
75 #define	CH	r_cx.biosreg_quarter[BIOSREG_HI]
76 #define	CX	r_cx.biosreg_half[BIOSREG_LO]
77 #define	CX_HI	r_cx.biosreg_half[BIOSREG_HI]
78 #define	ECX	r_cx.biosreg_long
79 
80 #define	DL	r_dx.biosreg_quarter[BIOSREG_LO]
81 #define	DH	r_dx.biosreg_quarter[BIOSREG_HI]
82 #define	DX	r_dx.biosreg_half[BIOSREG_LO]
83 #define	DX_HI	r_dx.biosreg_half[BIOSREG_HI]
84 #define	EDX	r_dx.biosreg_long
85 
86 #define	SI	r_si.biosreg_half[BIOSREG_LO]
87 #define	SI_HI	r_si.biosreg_half[BIOSREG_HI]
88 #define	ESI	r_si.biosreg_long
89 
90 #define	DI	r_di.biosreg_half[BIOSREG_LO]
91 #define	DI_HI	r_di.biosreg_half[BIOSREG_HI]
92 #define	EDI	r_di.biosreg_long
93 
94 #define	FLAGS	 r_flags.biosreg_half[BIOSREG_LO]
95 #define	FLAGS_HI r_flags.biosreg_half[BIOSREG_HI]
96 #define	EFLAGS	 r_flags.biosreg_long
97 
98 #define ES	r_es.biosreg_half[BIOSREG_LO]
99 
100 void bioscall(int /* function*/ , struct bioscallregs * /* regs */);
101 #endif
102 #endif /* __I386_BIOSCALL_H__ */
103