143561Skato/*
243561Skato * Copyright (c) 1998 Robert Nordier
343561Skato * All rights reserved.
443561Skato *
543561Skato * Redistribution and use in source and binary forms are freely
643561Skato * permitted provided that the above copyright notice and this
743561Skato * paragraph and the following disclaimer are duplicated in all
843561Skato * such forms.
943561Skato *
1043561Skato * This software is provided "AS IS" and without any express or
1143561Skato * implied warranties, including, without limitation, the implied
1243561Skato * warranties of merchantability and fitness for a particular
1343561Skato * purpose.
1443561Skato */
1543561Skato
1643561Skato/*
1750477Speter * $FreeBSD: stable/11/stand/pc98/btx/lib/btxv86.h 339406 2018-10-17 04:10:23Z imp $
1843561Skato */
1943561Skato
2043561Skato#ifndef _BTXV86_H_
2143561Skato#define _BTXV86_H_
2243561Skato
2343561Skato#include <sys/types.h>
24226746Sjhb#include <machine/psl.h>
2543561Skato
26339406Simp/*
27339406Simp * Memory buffer space for real mode IO.
28339406Simp * Just one page is not much, but the space is rather limited.
29339406Simp * See ../btx/btx.S for details.
30339406Simp * XXX TEST THIS XXX
31339406Simp */
32339406Simp#define	V86_IO_BUFFER		0x8000
33339406Simp#define	V86_IO_BUFFER_SIZE	0x1000
34339406Simp
3543561Skato#define V86_ADDR   0x10000	/* Segment:offset address */
3643561Skato#define V86_CALLF  0x20000	/* Emulate far call */
3743561Skato#define V86_FLAGS  0x40000	/* Return flags */
3843561Skato
3943561Skatostruct __v86 {
4043561Skato    uint32_t ctl;		/* Control flags */
4143561Skato    uint32_t addr;		/* Interrupt number or address */
4243561Skato    uint32_t es;		/* V86 ES register */
4343561Skato    uint32_t ds;		/* V86 DS register */
4443561Skato    uint32_t fs;		/* V86 FS register */
4543561Skato    uint32_t gs;		/* V86 GS register */
4643561Skato    uint32_t eax;		/* V86 EAX register */
4743561Skato    uint32_t ecx;		/* V86 ECX register */
4843561Skato    uint32_t edx;		/* V86 EDX register */
4943561Skato    uint32_t ebx;		/* V86 EBX register */
5043561Skato    uint32_t efl;		/* V86 eflags register */
5143561Skato    uint32_t ebp;		/* V86 EBP register */
5243561Skato    uint32_t esi;		/* V86 ESI register */
5343561Skato    uint32_t edi;		/* V86 EDI register */
5443561Skato};
5543561Skato
5643561Skatoextern struct __v86 __v86;	/* V86 interface structure */
5743561Skatovoid __v86int(void);
5843561Skato
5943561Skato#define v86	__v86
6043561Skato#define v86int	__v86int
6143561Skato
6243561Skatoextern u_int32_t	__base;
6343561Skatoextern u_int32_t	__args;
6443561Skato
6543561Skato#define	PTOV(pa)	((caddr_t)(pa) - __base)
6643561Skato#define	VTOP(va)	((vm_offset_t)(va) + __base)
6743561Skato#define	VTOPSEG(va)	(u_int16_t)(VTOP((caddr_t)va) >> 4)
6843561Skato#define	VTOPOFF(va)	(u_int16_t)(VTOP((caddr_t)va) & 0xf)
6943561Skato
70226746Sjhb#define	V86_CY(x)	((x) & PSL_C)
71226746Sjhb#define	V86_ZR(x)	((x) & PSL_Z)
72226746Sjhb
7343561Skatovoid __exit(int) __attribute__((__noreturn__));
7443561Skatovoid __exec(caddr_t, ...);
7543561Skato
7643561Skato#endif /* !_BTXV86_H_ */
77