btxv86.h revision 226746
139165Srnordier/*
239165Srnordier * Copyright (c) 1998 Robert Nordier
339165Srnordier * All rights reserved.
439165Srnordier *
539165Srnordier * Redistribution and use in source and binary forms are freely
639165Srnordier * permitted provided that the above copyright notice and this
739165Srnordier * paragraph and the following disclaimer are duplicated in all
839165Srnordier * such forms.
939165Srnordier *
1039165Srnordier * This software is provided "AS IS" and without any express or
1139165Srnordier * implied warranties, including, without limitation, the implied
1239165Srnordier * warranties of merchantability and fitness for a particular
1339165Srnordier * purpose.
1439165Srnordier */
1539165Srnordier
1639165Srnordier/*
1750477Speter * $FreeBSD: head/sys/boot/i386/btx/lib/btxv86.h 226746 2011-10-25 19:45:12Z jhb $
1839165Srnordier */
1939165Srnordier
2039165Srnordier#ifndef _BTXV86_H_
2139165Srnordier#define _BTXV86_H_
2239165Srnordier
2339165Srnordier#include <sys/types.h>
24226746Sjhb#include <machine/psl.h>
2539165Srnordier
2639165Srnordier#define V86_ADDR   0x10000	/* Segment:offset address */
2739165Srnordier#define V86_CALLF  0x20000	/* Emulate far call */
2839165Srnordier#define V86_FLAGS  0x40000	/* Return flags */
2939165Srnordier
3039165Srnordierstruct __v86 {
3139165Srnordier    uint32_t ctl;		/* Control flags */
3239165Srnordier    uint32_t addr;		/* Interrupt number or address */
3339165Srnordier    uint32_t es;		/* V86 ES register */
3439165Srnordier    uint32_t ds;		/* V86 DS register */
3539165Srnordier    uint32_t fs;		/* V86 FS register */
3639165Srnordier    uint32_t gs;		/* V86 GS register */
3739165Srnordier    uint32_t eax;		/* V86 EAX register */
3839165Srnordier    uint32_t ecx;		/* V86 ECX register */
3939165Srnordier    uint32_t edx;		/* V86 EDX register */
4039165Srnordier    uint32_t ebx;		/* V86 EBX register */
4139165Srnordier    uint32_t efl;		/* V86 eflags register */
4239165Srnordier    uint32_t ebp;		/* V86 EBP register */
4339165Srnordier    uint32_t esi;		/* V86 ESI register */
4439165Srnordier    uint32_t edi;		/* V86 EDI register */
4539165Srnordier};
4639165Srnordier
4739165Srnordierextern struct __v86 __v86;	/* V86 interface structure */
4839441Smsmithvoid __v86int(void);
4939165Srnordier
5039441Smsmith#define v86	__v86
5139441Smsmith#define v86int	__v86int
5239441Smsmith
5339441Smsmithextern u_int32_t	__base;
5439441Smsmithextern u_int32_t	__args;
5539441Smsmith
5639901Smsmith#define	PTOV(pa)	((caddr_t)(pa) - __base)
5739901Smsmith#define	VTOP(va)	((vm_offset_t)(va) + __base)
5839901Smsmith#define	VTOPSEG(va)	(u_int16_t)(VTOP((caddr_t)va) >> 4)
5939901Smsmith#define	VTOPOFF(va)	(u_int16_t)(VTOP((caddr_t)va) & 0xf)
6039441Smsmith
61226746Sjhb#define	V86_CY(x)	((x) & PSL_C)
62226746Sjhb#define	V86_ZR(x)	((x) & PSL_Z)
63226746Sjhb
6439895Smsmithvoid __exit(int) __attribute__((__noreturn__));
6539165Srnordiervoid __exec(caddr_t, ...);
6639165Srnordier
6739165Srnordier#endif /* !_BTXV86_H_ */
68