1170754Sdelphij/*
2170754Sdelphij * Copyright (c) 1998 Robert Nordier
3170754Sdelphij * All rights reserved.
4170754Sdelphij *
5170754Sdelphij * Redistribution and use in source and binary forms are freely
6170754Sdelphij * permitted provided that the above copyright notice and this
7170754Sdelphij * paragraph and the following disclaimer are duplicated in all
8170754Sdelphij * such forms.
9170754Sdelphij *
10170754Sdelphij * This software is provided "AS IS" and without any express or
11170754Sdelphij * implied warranties, including, without limitation, the implied
12170754Sdelphij * warranties of merchantability and fitness for a particular
13170754Sdelphij * purpose.
14170754Sdelphij */
15170754Sdelphij
16170754Sdelphij/*
17170754Sdelphij * $FreeBSD$
18170754Sdelphij */
19170754Sdelphij
20170754Sdelphij#ifndef _BTXV86_H_
21170754Sdelphij#define _BTXV86_H_
22170754Sdelphij
23170754Sdelphij#include <sys/types.h>
24170754Sdelphij#include <machine/psl.h>
25170754Sdelphij
26170754Sdelphij#define V86_ADDR   0x10000	/* Segment:offset address */
27170754Sdelphij#define V86_CALLF  0x20000	/* Emulate far call */
28170754Sdelphij#define V86_FLAGS  0x40000	/* Return flags */
29170754Sdelphij
30170754Sdelphijstruct __v86 {
31170754Sdelphij    uint32_t ctl;		/* Control flags */
32170754Sdelphij    uint32_t addr;		/* Interrupt number or address */
33170754Sdelphij    uint32_t es;		/* V86 ES register */
34170754Sdelphij    uint32_t ds;		/* V86 DS register */
35170754Sdelphij    uint32_t fs;		/* V86 FS register */
36170754Sdelphij    uint32_t gs;		/* V86 GS register */
37170754Sdelphij    uint32_t eax;		/* V86 EAX register */
38    uint32_t ecx;		/* V86 ECX register */
39    uint32_t edx;		/* V86 EDX register */
40    uint32_t ebx;		/* V86 EBX register */
41    uint32_t efl;		/* V86 eflags register */
42    uint32_t ebp;		/* V86 EBP register */
43    uint32_t esi;		/* V86 ESI register */
44    uint32_t edi;		/* V86 EDI register */
45};
46
47extern struct __v86 __v86;	/* V86 interface structure */
48void __v86int(void);
49
50#define v86	__v86
51#define v86int	__v86int
52
53extern u_int32_t	__base;
54extern u_int32_t	__args;
55
56#define	PTOV(pa)	((caddr_t)(pa) - __base)
57#define	VTOP(va)	((vm_offset_t)(va) + __base)
58#define	VTOPSEG(va)	(u_int16_t)(VTOP((caddr_t)va) >> 4)
59#define	VTOPOFF(va)	(u_int16_t)(VTOP((caddr_t)va) & 0xf)
60
61#define	V86_CY(x)	((x) & PSL_C)
62#define	V86_ZR(x)	((x) & PSL_Z)
63
64void __exit(int) __attribute__((__noreturn__));
65void __exec(caddr_t, ...);
66
67#endif /* !_BTXV86_H_ */
68