/* dos emulator, Matthias Lautner * Extensions by Robert Sanders, 1992-93 * */ #ifndef EMU_H #define EMU_H #include #include #include "types.h" #include "cpu.h" #include "priv.h" #include "mouse.h" #include "dosemu_config.h" extern char * const *dosemu_envp; struct eflags_fs_gs { unsigned long eflags; unsigned short fs, gs; #ifdef __x86_64__ unsigned char *fsbase, *gsbase; unsigned short ds, es, ss; #endif }; extern struct eflags_fs_gs eflags_fs_gs; int vm86_init(void); int vm86_fault(unsigned trapno, unsigned err, dosaddr_t cr2); #define BIT(x) (1< IRQ3 .. IRQ15) */ int layout_auto; struct keytable_entry *keytable; struct keytable_entry *altkeytable; const char *internal_cset; const char *external_cset; unsigned short detach; char *debugout; char *pre_stroke; /* pointer to keyboard pre strokes */ /* Lock File business */ int file_lock_limit; char *tty_lockdir; /* The Lock directory */ char *tty_lockfile; /* Lock file pretext ie LCK.. */ boolean tty_lockbinary; /* Binary lock files ? */ /* LFN support */ boolean lfn; int int_hooks; int force_revect; int trace_irets; boolean force_redir; boolean dos_trace; /* SWITCHES=/Y */ /* type of mapping driver */ char *mappingdriver; /* List of temporary hacks * (at minimum 16, will be increased when needed) * * If a 'features' becomes obsolete (problem solved) it will * remain dummy for a while before re-used. * * NOTE: 'features' are not subject to permanent documentation! * * Currently assigned: * * (none) */ int features[16]; /* Time mode is TM_BIOS / TM_PIT / TM_LINUX, see iodev.h */ int timemode; /* Sound emulation */ int sound; uint16_t sb_base; uint8_t sb_dma; uint8_t sb_hdma; uint8_t sb_irq; uint16_t mpu401_base; int mpu401_irq; int mpu401_irq_mt32; int mpu401_uart_irq_mt32; char *midi_synth; char *sound_driver; char *midi_driver; char *munt_roms_dir; char *snd_plugin_params; boolean pcm_hpf; char *midi_file; char *wav_file; /* joystick */ char *joy_device[2]; /* range for joystick axis values */ int joy_dos_min; /* must be > 0 */ int joy_dos_max; /* avoid setting this to > 250 */ int joy_granularity; /* the higher, the less sensitive - for wobbly joysticks */ int joy_latency; /* delay between nonblocking linux joystick reads */ int mmio_tracing; int cli_timeout; /* cli timeout hack */ char *dos_cmd; char *unix_path; char *dos_path; char *unix_exec; char *lredir_paths; char *opl2lpt_device; int opl2lpt_type; } config_t; enum { SPKR_OFF, SPKR_NATIVE, SPKR_EMULATED }; enum { CPUVM_VM86, CPUVM_KVM, CPUVM_EMU, CPUVM_NATIVE }; /* * Right now, dosemu only supports two serial ports. */ #define SIG_SER SIGTTIN #define IO_READ 1 #define IO_WRITE 2 #define IO_RDWR (IO_READ | IO_WRITE) extern int port_readable(unsigned short); extern int port_writeable(unsigned short); extern unsigned char read_port(unsigned short); extern int write_port(unsigned int, unsigned short); extern void parent_nextscan(void); extern void disk_close(void); extern void cpu_setup(void); extern void cpu_reset(void); extern void real_run_int(int); #define run_int real_run_int extern void mfs_reset(void); extern int mfs_redirector(struct vm86_regs *regs, char *stk, int revect); extern int mfs_fat32(void); extern int mfs_lfn(void); extern int int10(void); extern int int13(void); extern int int16(void); extern int int17(void); extern void io_select(void); extern int pd_receive_packet(void); extern int printer_tick(u_long); extern void floppy_tick(void); extern void open_kmem(void); extern void close_kmem(void); extern int parse_config(const char *, const char *); extern void disk_init(void); extern void disk_reset(void); extern void serial_init(void); extern void serial_reset(void); extern void close_all_printers(void); extern void serial_close(void); extern void disk_close_all(void); extern void init_all_printers(void); extern int mfs_inte6(void); extern int mfs_helper(struct vm86_regs *regs); extern void pkt_helper(void); extern short pop_word(struct vm86_regs *); extern void __leavedos(int code, int sig, const char *s, int num); #define leavedos(n) __leavedos(n, 0, __func__, __LINE__) #define _leavedos_sig(s) __leavedos(0, s, __func__, __LINE__) #define leavedos_once(n) { \ static int __left; \ if (!__left) { \ __left = 1; \ leavedos(n); \ } \ } extern void leavedos_from_sig(int sig); extern void leavedos_from_thread(int code); #define leavedos_main(n) __leavedos_main_wrp(n, 0, __func__, __LINE__) #define _leavedos_main(n, s) __leavedos_main_wrp(n, s, __func__, __LINE__) extern void __leavedos_main_wrp(int code, int sig, const char *s, int num); extern void check_leavedos(void); extern void add_to_io_select_new(int, void(*)(void *), void *, const char *name); #define add_to_io_select(fd, func, arg) \ add_to_io_select_new(fd, func, arg, #func) extern void remove_from_io_select(int); extern void ioselect_done(void); /* * DANG_BEGIN_REMARK * The var `fatalerr` can be given a true value at any time to have DOSEMU * exit on the next return from vm86 mode. * DANG_END_REMARK */ extern int fatalerr; extern int in_leavedos; /* * DANG_BEGIN_REMARK * The var 'running_DosC' is set by the DosC kernel and is used to handle * some things differently, e.g. the redirector. * It interfaces via INTe6,0xDC (DOS_HELPER_DOSC), but only if running_DosC * is !=0. At the very startup DosC issues a INTe6,0xdcDC to set running_DosC * with the contents of BX (which is the internal DosC version). * DANG_END_REMARK */ extern void dump_config_status(void (*printfunc)(const char *, ...)); extern void signal_pre_init(void); extern void signal_init(void); extern void signal_done(void); extern void device_init(void); extern void memory_init(void); extern void map_video_bios(void); extern void map_custom_bios(void); extern void stdio_init(void); extern void time_setting_init(void); extern void timer_interrupt_init(void); extern void low_mem_init(void); extern void print_version(void); extern void keyboard_flags_init(void); extern void video_config_init(void); extern void video_post_init(void); extern void video_late_init(void); extern void video_mem_setup(void); extern void printer_init(void); extern void printer_mem_setup(void); extern void video_early_close(void); extern void video_close(void); extern void hma_exit(void); extern void ems_helper(void); extern int ems_fn(struct vm86_regs *); extern void cdrom_helper(unsigned char *, unsigned char *, unsigned int); extern void cdrom_done(void); extern int mscdex(void); extern void boot(void); extern int ipx_int7a(void); extern void read_next_scancode_from_queue (void); extern unsigned short detach (void); extern void disallocate_vt (void); extern void restore_vt (unsigned short vt); extern void HMA_init(void); extern void HMA_MAP(int HMA); extern void hardware_run(void); extern int register_exit_handler(void (*handler)(void)); typedef struct emu_hlt_s emu_hlt_t; extern void *vm86_hlt_state; extern Bit16u hlt_register_handler_vm86(emu_hlt_t handler); extern int hlt_unregister_handler_vm86(Bit16u start_addr); extern const char *Path_cdrom[]; #endif /* EMU_H */