199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1998 Robert Nordier
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms are freely
199767f8919635c4928607450d9e0abb932109ceToomas Soome * permitted provided that the above copyright notice and this
199767f8919635c4928607450d9e0abb932109ceToomas Soome * paragraph and the following disclaimer are duplicated in all
199767f8919635c4928607450d9e0abb932109ceToomas Soome * such forms.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This software is provided "AS IS" and without any express or
199767f8919635c4928607450d9e0abb932109ceToomas Soome * implied warranties, including, without limitation, the implied
199767f8919635c4928607450d9e0abb932109ceToomas Soome * warranties of merchantability and fitness for a particular
199767f8919635c4928607450d9e0abb932109ceToomas Soome * purpose.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _BTXV86_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _BTXV86_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/types.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <machine/psl.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define V86_ADDR 0x10000 /* Segment:offset address */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define V86_CALLF 0x20000 /* Emulate far call */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define V86_FLAGS 0x40000 /* Return flags */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct __v86 {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t ctl; /* Control flags */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t addr; /* Interrupt number or address */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t es; /* V86 ES register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t ds; /* V86 DS register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t fs; /* V86 FS register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t gs; /* V86 GS register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t eax; /* V86 EAX register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t ecx; /* V86 ECX register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t edx; /* V86 EDX register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t ebx; /* V86 EBX register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t efl; /* V86 eflags register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t ebp; /* V86 EBP register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t esi; /* V86 ESI register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t edi; /* V86 EDI register */
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct __v86 __v86; /* V86 interface structure */
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid __v86int(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define v86 __v86
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define v86int __v86int
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern u_int32_t __base;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern u_int32_t __args;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PTOV(pa) ((caddr_t)(pa) - __base)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define VTOP(va) ((vm_offset_t)(va) + __base)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define V86_CY(x) ((x) & PSL_C)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define V86_ZR(x) ((x) & PSL_Z)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid __exit(int) __attribute__((__noreturn__));
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid __exec(caddr_t, ...);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_BTXV86_H_ */