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$
1843561Skato */
1943561Skato
2043561Skato#ifndef _BTXV86_H_
2143561Skato#define _BTXV86_H_
2243561Skato
2343561Skato#include <sys/types.h>
24229501Sjhb#include <machine/psl.h>
2543561Skato
2643561Skato#define V86_ADDR   0x10000	/* Segment:offset address */
2743561Skato#define V86_CALLF  0x20000	/* Emulate far call */
2843561Skato#define V86_FLAGS  0x40000	/* Return flags */
2943561Skato
3043561Skatostruct __v86 {
3143561Skato    uint32_t ctl;		/* Control flags */
3243561Skato    uint32_t addr;		/* Interrupt number or address */
3343561Skato    uint32_t es;		/* V86 ES register */
3443561Skato    uint32_t ds;		/* V86 DS register */
3543561Skato    uint32_t fs;		/* V86 FS register */
3643561Skato    uint32_t gs;		/* V86 GS register */
3743561Skato    uint32_t eax;		/* V86 EAX register */
3843561Skato    uint32_t ecx;		/* V86 ECX register */
3943561Skato    uint32_t edx;		/* V86 EDX register */
4043561Skato    uint32_t ebx;		/* V86 EBX register */
4143561Skato    uint32_t efl;		/* V86 eflags register */
4243561Skato    uint32_t ebp;		/* V86 EBP register */
4343561Skato    uint32_t esi;		/* V86 ESI register */
4443561Skato    uint32_t edi;		/* V86 EDI register */
4543561Skato};
4643561Skato
4743561Skatoextern struct __v86 __v86;	/* V86 interface structure */
4843561Skatovoid __v86int(void);
4943561Skato
5043561Skato#define v86	__v86
5143561Skato#define v86int	__v86int
5243561Skato
5343561Skatoextern u_int32_t	__base;
5443561Skatoextern u_int32_t	__args;
5543561Skato
5643561Skato#define	PTOV(pa)	((caddr_t)(pa) - __base)
5743561Skato#define	VTOP(va)	((vm_offset_t)(va) + __base)
5843561Skato#define	VTOPSEG(va)	(u_int16_t)(VTOP((caddr_t)va) >> 4)
5943561Skato#define	VTOPOFF(va)	(u_int16_t)(VTOP((caddr_t)va) & 0xf)
6043561Skato
61229501Sjhb#define	V86_CY(x)	((x) & PSL_C)
62229501Sjhb#define	V86_ZR(x)	((x) & PSL_Z)
63229501Sjhb
6443561Skatovoid __exit(int) __attribute__((__noreturn__));
6543561Skatovoid __exec(caddr_t, ...);
6643561Skato
6743561Skato#endif /* !_BTXV86_H_ */
68