1 /* 2 * Copyright (c) 1998 Robert Nordier 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are freely 6 * permitted provided that the above copyright notice and this 7 * paragraph and the following disclaimer are duplicated in all 8 * such forms. 9 * 10 * This software is provided "AS IS" and without any express or 11 * implied warranties, including, without limitation, the implied 12 * warranties of merchantability and fitness for a particular 13 * purpose. 14 */ 15 16 /* 17 */ 18 19 #ifndef _BTXV86_H_ 20 #define _BTXV86_H_ 21 22 #include <sys/types.h> 23 #include <machine/psl.h> 24 25 /* 26 * Memory buffer space for real mode IO. 27 * Just one page is not much, but the space is rather limited. 28 * See ../btx/btx.S for details. 29 */ 30 #define V86_IO_BUFFER 0x8000 31 #define V86_IO_BUFFER_SIZE 0x1000 32 33 #define V86_ADDR 0x10000 /* Segment:offset address */ 34 #define V86_CALLF 0x20000 /* Emulate far call */ 35 #define V86_FLAGS 0x40000 /* Return flags */ 36 37 struct __v86 { 38 uint32_t ctl; /* Control flags */ 39 uint32_t addr; /* Interrupt number or address */ 40 uint32_t es; /* V86 ES register */ 41 uint32_t ds; /* V86 DS register */ 42 uint32_t fs; /* V86 FS register */ 43 uint32_t gs; /* V86 GS register */ 44 uint32_t eax; /* V86 EAX register */ 45 uint32_t ecx; /* V86 ECX register */ 46 uint32_t edx; /* V86 EDX register */ 47 uint32_t ebx; /* V86 EBX register */ 48 uint32_t efl; /* V86 eflags register */ 49 uint32_t ebp; /* V86 EBP register */ 50 uint32_t esi; /* V86 ESI register */ 51 uint32_t edi; /* V86 EDI register */ 52 }; 53 54 extern struct __v86 __v86; /* V86 interface structure */ 55 void __v86int(void); 56 57 #define v86 __v86 58 #define v86int __v86int 59 60 extern uint32_t __base; 61 extern uint32_t __args; 62 63 #define PTOV(pa) ((caddr_t)(pa) - __base) 64 #define VTOP(va) ((vm_offset_t)(va) + __base) 65 #define VTOPSEG(va) (uint16_t)(VTOP((caddr_t)va) >> 4) 66 #define VTOPOFF(va) (uint16_t)(VTOP((caddr_t)va) & 0xf) 67 68 #define V86_CY(x) ((x) & PSL_C) 69 #define V86_ZR(x) ((x) & PSL_Z) 70 71 void __exit(int) __attribute__((__noreturn__)); 72 void __exec(caddr_t, ...); 73 74 #endif /* !_BTXV86_H_ */ 75