Add support for EMS emulation to doscmd. This requires changing the
interface for callbacks to doscmd from DOS, obsoleting the instbsdi redirector. (redir.com replaces it) A temporary hack is in place so the instbsdi program will (hopefully) work in the short term. Submitted by: Helmut F. Wirth <hfwirth@ping.at>
This commit is contained in:
parent
0f45f2fb69
commit
d41bb2bc87
@ -5,11 +5,12 @@
|
||||
PROG= doscmd
|
||||
MAN1= doscmd.1
|
||||
SRCS= AsyncIO.c ParseBuffer.c bios.c callback.c cpu.c dos.c cmos.c config.c \
|
||||
cwd.c debug.c disktab.c doscmd.c exe.c i386-pinsn.c int.c int10.c \
|
||||
int13.c int14.c int16.c int17.c int1a.c int2f.c intff.c mem.c mouse.c \
|
||||
net.c port.c setver.c signal.c timer.c trace.c trap.c tty.c xms.c
|
||||
cwd.c debug.c disktab.c doscmd.c ems.c emuint.c exe.c i386-pinsn.c \
|
||||
int.c int10.c int13.c int14.c int16.c int17.c int1a.c int2f.c intff.c \
|
||||
mem.c mouse.c net.c port.c setver.c signal.c timer.c trace.c trap.c \
|
||||
tty.c xms.c
|
||||
|
||||
CLEANFILES= doscmd.kernel crt0.o doscmd_loader.o instbsdi.exe
|
||||
CLEANFILES= doscmd.kernel crt0.o doscmd_loader.o redir.com emsdriv.sys
|
||||
|
||||
BINGRP= kmem
|
||||
EXEGRP= bin
|
||||
@ -31,13 +32,18 @@ afterinstall:
|
||||
install ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
|
||||
doscmd.kernel ${DESTDIR}/usr/libexec/doscmd.kernel
|
||||
install -c -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
|
||||
instbsdi.exe ${DESTDIR}/usr/libdata/doscmd/
|
||||
redir.com ${DESTDIR}/usr/libdata/doscmd/
|
||||
install -c -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
|
||||
emsdriv.sys ${DESTDIR}/usr/libdata/doscmd/
|
||||
|
||||
doscmd: doscmd.kernel ${LIBCRT0} doscmd_loader.o instbsdi.exe
|
||||
doscmd: doscmd.kernel ${LIBCRT0} doscmd_loader.o redir.com emsdriv.sys
|
||||
ld -e start -dc -dp -o doscmd /usr/lib/crt0.o doscmd_loader.o -lgcc -lc
|
||||
|
||||
instbsdi.exe: instbsdi.exe.uu
|
||||
uudecode ${.CURDIR}/instbsdi.exe.uu
|
||||
redir.com: redir.com.uu
|
||||
uudecode ${.CURDIR}/redir.com.uu
|
||||
|
||||
emsdriv.sys: emsdriv.sys.uu
|
||||
uudecode ${.CURDIR}/emsdriv.sys.uu
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
|
47
usr.bin/doscmd/Makefile.dos
Normal file
47
usr.bin/doscmd/Makefile.dos
Normal file
@ -0,0 +1,47 @@
|
||||
# Special makefile for the as86/ld86 tools
|
||||
#
|
||||
# This is used only to make the dos tools. It is not used in the normal
|
||||
# build process, except one of the *.S files is changed. The ready to
|
||||
# use tools are included as uuencoded files.
|
||||
# To use this makefile you must have Bruce Evans bcc package installed
|
||||
#
|
||||
|
||||
AS86 = as86
|
||||
LD86 = ld86
|
||||
|
||||
OBJS = redir.o emsdriv.o
|
||||
DOSPROG = redir.com emsdriv.sys
|
||||
DOSDIST = redir.com.uu emsdriv.sys.uu
|
||||
|
||||
all: ${DOSPROG} ${DOSDIST}
|
||||
|
||||
redir.com: redir.o
|
||||
$(LD86) -T 0 -s -o ${.PREFIX}.tmp ${.ALLSRC}
|
||||
dd if=${.PREFIX}.tmp of=${.TARGET} bs=1 skip=288
|
||||
rm -f ${.PREFIX}.tmp
|
||||
|
||||
emsdriv.sys: emsdriv.o
|
||||
$(LD86) -T 0 -s -o ${.PREFIX}.tmp ${.ALLSRC}
|
||||
dd if=${.PREFIX}.tmp of=${.TARGET} bs=1 skip=32
|
||||
rm -f ${.PREFIX}.tmp
|
||||
|
||||
redir.com.uu: redir.com
|
||||
uuencode redir.com redir.com > redir.com.uu
|
||||
|
||||
emsdriv.sys.uu: emsdriv.sys
|
||||
uuencode emsdriv.sys emsdriv.sys > emsdriv.sys.uu
|
||||
|
||||
clean:
|
||||
rm -f ${DOSPROG} ${OBJS}
|
||||
|
||||
allclean:
|
||||
rm -f ${DOSPROG} ${DOSDIST} ${OBJS}
|
||||
|
||||
|
||||
# Rule for as86
|
||||
.S.o:
|
||||
$(AS86) -0 -o ${.TARGET} ${.IMPSRC}
|
||||
|
||||
|
||||
|
||||
|
@ -29,10 +29,10 @@ To install DOS on a pseudo hard disk under doscmd:
|
||||
|
||||
2) Insert a floppy disk into the A: drive which is bootable to MS-DOS
|
||||
and has the commands fdisk, format and sys on it. You should also
|
||||
copy the file instbsdi.exe onto the floppy by either mounting it
|
||||
copy the file redir.com onto the floppy by either mounting it
|
||||
with the msdos file system type or by using mtools.
|
||||
|
||||
(i.e. mwrite instbsdi.exe a:)
|
||||
(i.e. mwrite redir.com a:)
|
||||
|
||||
3) run doscmd.
|
||||
|
||||
@ -72,18 +72,26 @@ To install DOS on a pseudo hard disk under doscmd:
|
||||
^Z
|
||||
> copy con: autoexec.bat
|
||||
@echo off
|
||||
instbsdi.exe
|
||||
redir.com
|
||||
^Z
|
||||
|
||||
|
||||
16) Quit doscmd.
|
||||
|
||||
17) You know have a bootable pseudo disk which will automatically call
|
||||
the magic "instbsdi" program, which installs BSDI disks. To use
|
||||
17) You now have a bootable pseudo disk which will automatically call
|
||||
the magic "redir" program, which installs FreeBSD disks. To use
|
||||
them add lines to your .doscmdrc such as:
|
||||
|
||||
assign D: /usr/dos
|
||||
assign P: -ro /usr/prb
|
||||
|
||||
Not ethat you will not always be able to access every file due to
|
||||
Note that you will not always be able to access every file due to
|
||||
naming problems.
|
||||
|
||||
18) To use the new EMS memory you need to copy the file emsdriv.sys
|
||||
to your DOS boot disk (disk image) in the same way you copied
|
||||
redir.com. The use it in your "config.sys" from DOS:
|
||||
device=C:\emsdriv.sys
|
||||
where C: is your boot drive (supply the correct letter, if needed)
|
||||
and emsdriv.sys is the driver. You could load it high. It should
|
||||
report "Doscmd EMS 4.0 driver installed".
|
||||
|
@ -37,7 +37,7 @@
|
||||
.Nd run a subset of real-mode DOS programs
|
||||
.Sh SYNOPSIS
|
||||
.Nm doscmd
|
||||
.Fl 23AbDEfHIMOPRrtVvxz
|
||||
.Fl 23AbDEfHIMOPRrtVvXxYz
|
||||
.Fl c Ar file
|
||||
.Fl d Ar file
|
||||
.Fl i Ar port Ns Xo
|
||||
@ -263,6 +263,11 @@ can be used with or without
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.It Fl Y
|
||||
Enable debugging of the EMS operations.
|
||||
.\"
|
||||
.\"
|
||||
.\"
|
||||
.It Fl z
|
||||
Cause
|
||||
.Nm doscmd
|
||||
@ -315,7 +320,7 @@ to be assigned as the specified drive. If the
|
||||
.Fl ro
|
||||
flag is specified, it is a read only file system.
|
||||
These assignments will not take place when booting DOS until the
|
||||
.Pa /usr/dos/instbsdi.exe
|
||||
.Pa /usr/libdata/doscmd/redir.com
|
||||
binary is run.
|
||||
.\"
|
||||
.\"
|
||||
@ -622,10 +627,10 @@ must exist, so use the command touch to create it.
|
||||
.It 2
|
||||
Insert a floppy disk into the A: drive which is bootable to MS-DOS
|
||||
and has the commands fdisk, format and sys on it. You should also
|
||||
copy the file instbsdi.exe onto the floppy by either mounting it
|
||||
copy the file redir.com onto the floppy by either mounting it
|
||||
with the msdos file system type or by using mtools
|
||||
(e.g.,
|
||||
.Li mwrite instbsdi.exe a: ).
|
||||
.Li mwrite redir.com a: ).
|
||||
.It 3
|
||||
run doscmd.
|
||||
.It 4
|
||||
@ -672,7 +677,7 @@ LASTDRIVE=Z
|
||||
^Z
|
||||
> copy con: autoexec.bat
|
||||
@echo off
|
||||
instbsdi.exe
|
||||
redir.com
|
||||
^Z
|
||||
.Ed
|
||||
.It 15
|
||||
@ -680,8 +685,8 @@ Quit doscmd.
|
||||
.It 16
|
||||
You know have a bootable pseudo disk which will automatically call
|
||||
the magic
|
||||
.Li instbsdi
|
||||
program, which installs BSD/OS disks. To use
|
||||
.Li redir
|
||||
program, which installs FreeBSD disks. To use
|
||||
them add lines to your .doscmdrc such as:
|
||||
.Bd -literal -offset indent
|
||||
assign D: /usr/dos
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI doscmd.c,v 2.3 1996/04/08 19:32:30 bostic Exp
|
||||
*
|
||||
* $Id: doscmd.c,v 1.1 1997/08/09 01:42:41 dyson Exp $
|
||||
* $Id: doscmd.c,v 1.2 1997/08/15 23:41:23 jlemon Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -489,7 +489,7 @@ do_args(int argc, char *argv[])
|
||||
FILE *fp;
|
||||
char *col;
|
||||
|
||||
while ((c = getopt (argc, argv, "234Oc:TkCIEMPRLAU:S:HDtzvVxXfbri:o:d:")) != -1) {
|
||||
while ((c = getopt (argc, argv, "234Oc:TkCIEMPRLAU:S:HDtzvVxXYfbri:o:d:")) != -1) {
|
||||
switch (c) {
|
||||
case 'd':
|
||||
if (fp = fopen(optarg, "w")) {
|
||||
@ -572,6 +572,9 @@ do_args(int argc, char *argv[])
|
||||
case 'X':
|
||||
debug_flags |= D_XMS;
|
||||
break;
|
||||
case 'Y':
|
||||
debug_flags |= D_EMS;
|
||||
break;
|
||||
case 'L':
|
||||
debug_flags |= D_PRINTER;
|
||||
break;
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
|
||||
*
|
||||
* $Id: doscmd.h,v 1.1 1997/08/09 01:43:09 dyson Exp $
|
||||
* $Id: doscmd.h,v 1.2 1997/08/15 23:41:24 jlemon Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -107,6 +107,7 @@ extern int debug_flags;
|
||||
#define D_DEBUGIN 0x0400000
|
||||
#define D_DOSCALL 0x0800000 /* MS-DOS function results */
|
||||
#define D_XMS 0x1000000 /* XMS calls */
|
||||
#define D_EMS 0x2000000 /* EMS calls */
|
||||
|
||||
#define TTYF_ECHO 0x00000001
|
||||
#define TTYF_ECHONL 0x00000003
|
||||
@ -179,6 +180,9 @@ extern void mem_change_owner(int addr, int owner);
|
||||
extern int int2f_11(regcontext_t *REGS);
|
||||
extern void intff(regcontext_t *REGS);
|
||||
|
||||
/* emuint.c */
|
||||
extern void emuint(regcontext_t *REGS);
|
||||
|
||||
/* trap.c */
|
||||
extern void fake_int(regcontext_t *REGS, int);
|
||||
extern void sigtrap(struct sigframe *sf);
|
||||
@ -235,6 +239,11 @@ extern void get_raw_extmemory_info(regcontext_t *REGS);
|
||||
extern void initHMA(void);
|
||||
extern u_long xms_maxsize;
|
||||
|
||||
/* ems.c */
|
||||
extern int ems_init();
|
||||
extern void ems_entry(regcontext_t *REGS);
|
||||
extern u_long ems_frame_addr;
|
||||
|
||||
/****************************** dirty below here ******************************/
|
||||
|
||||
extern u_long pending[]; /* pending interrupts */
|
||||
|
1696
usr.bin/doscmd/ems.c
Normal file
1696
usr.bin/doscmd/ems.c
Normal file
File diff suppressed because it is too large
Load Diff
313
usr.bin/doscmd/ems.h
Normal file
313
usr.bin/doscmd/ems.h
Normal file
@ -0,0 +1,313 @@
|
||||
/*-
|
||||
* Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, witout modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef EMS_H
|
||||
#define EMS_H
|
||||
|
||||
/* Header for ems.c, the EMS emulation */
|
||||
|
||||
/* Global definitions, some of them will be configurable in the future */
|
||||
|
||||
#define EMS_NUM_HANDLES 256 /* Includes OS handle 0 */
|
||||
#define EMS_MAXSIZE 1024 /* In kbytes */
|
||||
#define EMS_MAX_PHYS 4 /* Frame is 64kB */
|
||||
#define EMS_FRAME_ADDR 0xe0000
|
||||
#define EMS_VERSION 0x40 /* Version 4.0 */
|
||||
#define EMS_PAGESIZE (16 *1024) /* page size in bytes */
|
||||
#define EMS_SAVEMAGIC 0xAFFE /* magic number */
|
||||
|
||||
/* These are the LIM EMS 3.0 calls */
|
||||
#define GET_MANAGER_STATUS 0x40
|
||||
#define GET_PAGE_FRAME_SEGMENT 0x41
|
||||
#define GET_PAGE_COUNTS 0x42
|
||||
#define GET_HANDLE_AND_ALLOCATE 0x43
|
||||
#define MAP_UNMAP 0x44
|
||||
#define DEALLOCATE_HANDLE 0x45
|
||||
#define GET_EMM_VERSION 0x46
|
||||
#define SAVE_PAGE_MAP 0x47
|
||||
#define RESTORE_PAGE_MAP 0x48
|
||||
#define RESERVED_1 0x49
|
||||
#define RESERVED_2 0x4a
|
||||
#define GET_HANDLE_COUNT 0x4b
|
||||
#define GET_PAGES_OWNED 0x4c
|
||||
#define GET_PAGES_FOR_ALL 0x4d
|
||||
|
||||
/* LIM EMS 4.0 calls */
|
||||
/* Global subfunctions for the LIM EMS 4.0 calls */
|
||||
#define GET 0x0
|
||||
#define SET 0x1
|
||||
/* Modes for Map/Unmap and AlterandCall/AlterAndJump */
|
||||
#define PHYS_ADDR 0x0
|
||||
#define SEG_ADDR 0x0
|
||||
|
||||
/* Page map functions */
|
||||
#define PAGE_MAP 0x4e
|
||||
#define PAGE_MAP_PARTIAL 0x4f
|
||||
/* Page map subfunctions */
|
||||
#define GET_SET 0x2
|
||||
#define GET_SIZE 0x3
|
||||
|
||||
#define MAP_UNMAP_MULTI_HANDLE 0x50
|
||||
|
||||
#define REALLOC_PAGES 0x51
|
||||
|
||||
#define HANDLE_ATTRIBUTES 0x52
|
||||
/* Subfunctions */
|
||||
#define HANDLE_CAPABILITY 0x2
|
||||
|
||||
#define HANDLE_NAME 0x53
|
||||
|
||||
#define HANDLE_DIRECTORY 0x54
|
||||
#define HANDLE_SEARCH 0x1
|
||||
#define GET_TOTAL_HANDLES 0x2
|
||||
|
||||
#define ALTER_PAGEMAP_JUMP 0x55
|
||||
#define ALTER_PAGEMAP_CALL 0x56
|
||||
/* Subfunction for call */
|
||||
#define GET_STACK_SIZE 0x2
|
||||
|
||||
#define MOVE_MEMORY_REGION 0x57
|
||||
/* Subfunctions */
|
||||
#define MOVE 0x0
|
||||
#define EXCHANGE 0x1
|
||||
|
||||
#define GET_MAPPABLE_PHYS_ADDR 0x58
|
||||
/* Subfunctions */
|
||||
#define GET_ARRAY 0x0
|
||||
#define GET_ARRAY_ENTRIES 0x1
|
||||
|
||||
#define GET_HW_CONFIGURATION 0x59
|
||||
/* Subfunctions */
|
||||
#define GET_HW_ARRAY 0x0
|
||||
#define GET_RAW_PAGE_COUNT 0x1
|
||||
|
||||
#define ALLOCATE_PAGES 0x5a
|
||||
/* Subfunctions */
|
||||
#define ALLOC_STANDARD 0x0
|
||||
#define ALLOC_RAW 0x1
|
||||
|
||||
#define ALTERNATE_MAP_REGISTER 0x5b
|
||||
/* Subfunctions */
|
||||
#define GET_SAVE_ARRAY_SIZE 0x2
|
||||
#define ALLOCATE_REGISTER_SET 0x3
|
||||
#define DEALLOCATE_REGISTER_SET 0x4
|
||||
#define ALLOCATE_DMA 0x5
|
||||
#define ENABLE_DMA 0x6
|
||||
#define DISABLE_DMA 0x7
|
||||
#define DEALLOCATE_DMA 0x8
|
||||
|
||||
#define PREPARE_WARMBOOT 0x5c
|
||||
|
||||
#define OS_FUNCTION_SET 0x5d
|
||||
/* Subfunctions */
|
||||
#define ENABLE 0x0
|
||||
#define DISABLE 0x1
|
||||
#define RETURN_KEY 0x2
|
||||
|
||||
/* End of call definitions */
|
||||
|
||||
/* EMS errors */
|
||||
|
||||
#define EMS_SUCCESS 0x0
|
||||
#define EMS_SW_MALFUNC 0x80
|
||||
#define EMS_HW_MALFUNC 0x81
|
||||
#define EMS_INV_HANDLE 0x83
|
||||
#define EMS_FUNC_NOSUP 0x84
|
||||
#define EMS_OUT_OF_HANDLES 0x85
|
||||
#define EMS_SAVED_MAP 0x86
|
||||
#define EMS_OUT_OF_PHYS 0x87
|
||||
#define EMS_OUT_OF_LOG 0x88
|
||||
#define EMS_ZERO_PAGES 0x89
|
||||
#define EMS_LOGPAGE_TOOBIG 0x8a
|
||||
#define EMS_ILL_PHYS 0x8b
|
||||
#define EMS_NO_ROOM_TO_SAVE 0x8c
|
||||
#define EMS_ALREADY_SAVED 0x8d
|
||||
#define EMS_NO_SAVED_CONTEXT 0x8e
|
||||
#define EMS_INVALID_SUB 0x8f
|
||||
#define EMS_INVALID_ATTR 0x90
|
||||
#define EMS_FEAT_NOSUP 0x91
|
||||
#define EMS_MOVE_OVERLAP1 0x92
|
||||
#define EMS_MOVE_OVERFLOW 0x93
|
||||
#define EMS_PAGEOFFSET 0x95
|
||||
#define EMS_MOVE_OVERLAP2 0x97
|
||||
#define EMS_HNAME_NOT_FOUND 0xa0
|
||||
#define EMS_NAME_EXISTS 0xa1
|
||||
#define EMS_SAVED_CONTEXT_BAD 0xa3
|
||||
#define EMS_FUNCTION_DISABLED 0xa4
|
||||
|
||||
/*
|
||||
* EMS handles: The handle contains at its end an array of pointers to
|
||||
* its allocated pages. The array is of size npages. Handle structs are
|
||||
* malloced at runtime.
|
||||
* Page numbering: Every page is 16kB, always. The pages are numbered
|
||||
* from 0 to highest page, depending on total EMS memory. Every handle
|
||||
* has pages allocated and this pages too are numbered from 0 to highest
|
||||
* page allocated. This are *not* the same numbers, because there may be
|
||||
* holes in the allocation.
|
||||
* Page numbers are unsigned short, which will give us 65536 * 16 kB (1GB)
|
||||
* pages to handle at maximum. This should be enough for the next years.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
short handle[4]; /* Handle for each mapping */
|
||||
u_char pos_mapped[4]; /* Boolean value, 1 if something is mapped */
|
||||
u_char pos_pagenum[4]; /* Page number currently mapped into position */
|
||||
} EMS_mapping_context;
|
||||
|
||||
|
||||
/* This union is for copying operations of the handle name only */
|
||||
typedef union {
|
||||
u_char uc_hn[8];
|
||||
u_long ul_hn[2];
|
||||
} Hname;
|
||||
|
||||
typedef struct {
|
||||
Hname hname;
|
||||
u_long npages;
|
||||
/* The mapping context for save/restore page map */
|
||||
EMS_mapping_context *mcontext;
|
||||
/* The pagenum here is the number in the system page array. The
|
||||
* logical page number connected with this handle is the index into
|
||||
* this array.
|
||||
*/
|
||||
u_short pagenum[0];
|
||||
/* Will grow here, depending on allocation */
|
||||
} EMS_handle;
|
||||
|
||||
/*
|
||||
* The connection between every page in the system and the handles is
|
||||
* maintained by an array of these structs. The array is indexed by the
|
||||
* page numbers.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
short handle; /* The handle this page belongs to */
|
||||
#define EMS_FREE 0
|
||||
#define EMS_ALLOCED 1
|
||||
#define EMS_MAPPED 2
|
||||
u_short status; /* room for misc information */
|
||||
} EMS_page;
|
||||
|
||||
/*
|
||||
* The combined pointer into EMS memory: offs is the offset into an EMS
|
||||
* page, page is the page index inside the region allocated to a handle.
|
||||
* This depends on EMS_PAGESIZE.
|
||||
* This is used for copy and move operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_long offs:14;
|
||||
u_long page:18;
|
||||
} EMS_combi;
|
||||
|
||||
typedef union {
|
||||
u_long ua_addr; /* Conventional address pointer */
|
||||
EMS_combi ua_emsaddr; /* EMS address pointer */
|
||||
} EMS_addr;
|
||||
|
||||
#define EMS_OFFS(u) u.ua_emsaddr.offs
|
||||
#define EMS_PAGE(u) u.ua_emsaddr.page
|
||||
#define EMS_PTR(u) u.ua_addr
|
||||
|
||||
/*
|
||||
* EMS info structure, only used to pass information to and from
|
||||
* DOS
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short handle __attribute__ ((packed)); /* handle */
|
||||
u_short npages __attribute__ ((packed)); /* pages allocated */
|
||||
} EMShandlepage;
|
||||
|
||||
/*
|
||||
* EMS map/unmap multiple, only used to pass information to and from
|
||||
* DOS
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short log __attribute__ ((packed)); /* logical page number */
|
||||
u_short phys __attribute__ ((packed)); /* physical page (position) or
|
||||
segment address inside frame */
|
||||
} EMSmapunmap;
|
||||
|
||||
/*
|
||||
* EMS handle directory, only used to pass information to and from
|
||||
* DOS
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short log __attribute__ ((packed)); /* logical page number */
|
||||
Hname name __attribute__ ((packed)); /* Handle name */
|
||||
|
||||
} EMShandledir;
|
||||
|
||||
/*
|
||||
* Structure for get/set page map: This structure is used to save and
|
||||
* restore the page map from DOS memory. A program can get the mapping
|
||||
* context and later set (restore) it. To avoid errors we add a magic
|
||||
* number and a checksum.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short magic; /* Magic number */
|
||||
u_short checksum; /* Checksum over entire structure */
|
||||
EMS_mapping_context ems_saved_context;
|
||||
} EMScontext;
|
||||
|
||||
/*
|
||||
* EMS physical address array, only used to pass information to and from
|
||||
* DOS
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short segm __attribute__ ((packed)); /* segment address inside frame */
|
||||
u_short phys __attribute__ ((packed)); /* physical page (position) */
|
||||
} EMSaddrarray;
|
||||
|
||||
/*
|
||||
* EMS move memory call structure, only used to pass information to and from
|
||||
* DOS
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_long length __attribute__ ((packed)); /* length of region */
|
||||
#define EMS_MOVE_CONV 0
|
||||
#define EMS_MOVE_EMS 1
|
||||
u_char src_type __attribute__ ((packed)); /* source type (0,1) */
|
||||
u_short src_handle __attribute__ ((packed)); /* source handle */
|
||||
u_short src_offset __attribute__ ((packed)); /* source offset */
|
||||
u_short src_seg __attribute__ ((packed)); /* source type */
|
||||
u_char dst_type __attribute__ ((packed)); /* destination type (0,1) */
|
||||
u_short dst_handle __attribute__ ((packed)); /* destination handle */
|
||||
u_short dst_offset __attribute__ ((packed)); /* destination offset */
|
||||
u_short dst_seg __attribute__ ((packed)); /* destination type */
|
||||
} EMSmovemem;
|
||||
|
||||
#endif /* EMS_H */
|
261
usr.bin/doscmd/emsdriv.S
Normal file
261
usr.bin/doscmd/emsdriv.S
Normal file
@ -0,0 +1,261 @@
|
||||
! Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
|
||||
! All rights reserved.
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice immediately at the beginning of the file, witout modification,
|
||||
! this list of conditions, and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the author may not be used to endorse or promote products
|
||||
! derived from this software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
! OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
! IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
! NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
! THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
! $Id$
|
||||
|
||||
|
||||
!
|
||||
! This driver is needed for Expanded Memory emulation (EMS). A driver
|
||||
! is needed here, because EMS drivers are installed as DOS devices
|
||||
! with the name "EMMXXXX0" and programs look for such a device while
|
||||
! checking the existence of EMS.
|
||||
! The driver is installed by CONFIG.SYS, it has no options. It uses
|
||||
! the emulator callback interrupt 0xff to initialize the EMS subsystem.
|
||||
! If EMS is not configured or if there is an error inside the emulator
|
||||
! the driver reports failure and does not install itself.
|
||||
! If all works, the driver changes the interrupt vector for int 0x67 to
|
||||
! point at itself. The resident part of the drivers simlpy routes calls
|
||||
! to int 0x67 to the correct subfunction of the emulator callback interrupt.
|
||||
|
||||
use16
|
||||
|
||||
.text
|
||||
.bss
|
||||
.data
|
||||
.align 0
|
||||
|
||||
.org 0
|
||||
|
||||
NumFunc = 15
|
||||
|
||||
! Emulator interrupt entry
|
||||
EmulatorINT = 0xFF
|
||||
|
||||
! Emulator EMS callback function
|
||||
EMU_EMS = 0x2
|
||||
EMU_EMS_CTL = 0
|
||||
EMU_EMS_CALL = 1
|
||||
|
||||
! DOS print message
|
||||
DOSMesg = 0x9
|
||||
|
||||
cr = 0xd
|
||||
lf = 0xa
|
||||
eom = '$' ! DOS end of string
|
||||
|
||||
EMSintnum = 0x67
|
||||
Intoffset = (EMSintnum * 4)
|
||||
|
||||
.globl _main
|
||||
_main:
|
||||
|
||||
driverhead:
|
||||
.long -1 ! link to next device driver
|
||||
.word 0xC000 ! attribute word for driver
|
||||
.word Strategy ! ptr to strategy routine
|
||||
.word Interrupt ! ptr to interrupt service routine
|
||||
.ascii "EMMXXXX0" ! logical device name
|
||||
|
||||
reqhead:
|
||||
.long 0
|
||||
|
||||
vectordone:
|
||||
.word 0 ! != 0 , if vector installed
|
||||
|
||||
FuncTable:
|
||||
.word InitDrv ! initialize driver
|
||||
.word Noop ! media Check
|
||||
.word Noop ! build BPB
|
||||
.word Noop ! Ioctl
|
||||
.word Noop ! read
|
||||
.word Noop ! non destructive read
|
||||
.word Noop ! input status
|
||||
.word Noop ! flush input
|
||||
.word Noop ! write
|
||||
.word Noop ! write with verify
|
||||
.word Noop ! output status
|
||||
.word Noop ! flush output
|
||||
.word Noop ! ioctl output
|
||||
.word Noop ! open device
|
||||
.word Noop ! close device
|
||||
.word Noop ! removeable media check
|
||||
|
||||
Strategy:
|
||||
seg cs
|
||||
mov [reqhead], bx
|
||||
seg cs
|
||||
mov [reqhead+2],es
|
||||
retf
|
||||
|
||||
Interrupt:
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push ds
|
||||
push es
|
||||
push di
|
||||
push si
|
||||
push bp
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
les di,[reqhead] ! load pointer to request header
|
||||
|
||||
seg es
|
||||
movb bl,[di+2]
|
||||
xorb bh,bh
|
||||
cmp bx, #NumFunc
|
||||
jle dointr
|
||||
call errorhandler
|
||||
jmp intrend
|
||||
|
||||
dointr:
|
||||
shl bx,#1
|
||||
call [bx+FuncTable]
|
||||
les di,[reqhead] ! load pointer to request header
|
||||
|
||||
intrend:
|
||||
or ax,#0x100 ! done bit
|
||||
seg es
|
||||
mov [di+3],ax
|
||||
|
||||
pop bp
|
||||
pop si
|
||||
pop di
|
||||
pop es
|
||||
pop ds
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
retf
|
||||
|
||||
errorhandler:
|
||||
mov ax,#0x8003 ! report error to caller
|
||||
ret
|
||||
|
||||
|
||||
! This is done for all functions except init. It supports the different
|
||||
! methods for an EMS installation check described in the LIM EMS 4.0 spec
|
||||
Noop:
|
||||
call installvector
|
||||
xor ax,ax
|
||||
ret
|
||||
|
||||
! The interrupt vector installed for int 0x67 points to this routine
|
||||
intr67:
|
||||
push ax ! Save original AX
|
||||
mov ah, #EMU_EMS ! Emuint function
|
||||
mov al, #EMU_EMS_CALL ! Emuint subfunction
|
||||
int EmulatorINT ! Call emulator for EMS
|
||||
iret
|
||||
|
||||
installvector:
|
||||
push cs
|
||||
pop ds ! load DS to use local data
|
||||
mov ax,[vectordone]
|
||||
cmp ax,#0
|
||||
jne isinstalled ! already installed
|
||||
|
||||
push di ! save request header pointer
|
||||
push es
|
||||
|
||||
mov ax, #0 ! write the new interrupt vector
|
||||
mov es, ax
|
||||
mov di, #Intoffset
|
||||
seg es
|
||||
mov [di], #intr67
|
||||
seg es
|
||||
mov [di+2], cs
|
||||
|
||||
pop es
|
||||
pop di
|
||||
|
||||
mov ax,#1
|
||||
mov [vectordone],ax
|
||||
|
||||
isinstalled:
|
||||
ret
|
||||
|
||||
InitDrv:
|
||||
push cs
|
||||
pop ds
|
||||
push ax
|
||||
mov ah, #EMU_EMS ! Emuint function
|
||||
mov al, #EMU_EMS_CTL ! Emuint subfunction
|
||||
int EmulatorINT
|
||||
cmp ax,#0 ! check if successful
|
||||
je Fail
|
||||
|
||||
call installvector
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
mov ah, #DOSMesg
|
||||
mov dx, #Success
|
||||
int 0x21
|
||||
|
||||
seg es
|
||||
mov [di+14], #InitDrv ! address break for driver
|
||||
seg es
|
||||
mov [di+16], cs
|
||||
|
||||
xor ax,ax
|
||||
ret
|
||||
|
||||
Fail:
|
||||
push cs
|
||||
pop ds
|
||||
mov ah, #DOSMesg
|
||||
mov dx, #Failure
|
||||
int 0x21
|
||||
|
||||
seg es
|
||||
movb [di+13],#0
|
||||
seg es
|
||||
mov [di+20],cs
|
||||
seg es
|
||||
mov [di+14],#0 ! address break == 0, no driver
|
||||
seg es
|
||||
mov [di+16],cs
|
||||
ret
|
||||
|
||||
|
||||
Success:
|
||||
.ascii "Doscmd EMS 4.0 driver installed"
|
||||
.byte cr,lf,eom
|
||||
|
||||
Failure:
|
||||
.byte cr,lf,lf
|
||||
.ascii "EMS emulation is disabled"
|
||||
.byte cr,lf
|
||||
.ascii "Driver not installed"
|
||||
.byte cr,lf,lf,eom
|
||||
|
||||
end
|
11
usr.bin/doscmd/emsdriv.sys.uu
Normal file
11
usr.bin/doscmd/emsdriv.sys.uu
Normal file
@ -0,0 +1,11 @@
|
||||
begin 644 emsdriv.sys
|
||||
M_____P#`.`!#`$5-35A86%@P````````M`"``(``@`"``(``@`"``(``@`"`
|
||||
M`(``@`"``(``@``NB1X2`"Z,!A0`RU!345(>!E=650X?Q#X2`":*70(P_X/[
|
||||
M#WX%Z!P`ZPG1X_]7&,0^$@`-``$FB44#75Y?!Q]:65M8R[@#@,/H"P`QP,-0
|
||||
MM`*P`<W_SPX?H18`/0``=1M7!K@``([`OYP!)L<%A@`FC$T"!U^X`0"C%@##
|
||||
M#A]0M`*P`,W_/0``=!GHR?\.'[0)NO@`S2$FQT4.M``FC$T0,<###A^T";H:
|
||||
M`<TA)L9%#0`FC$T4)L=%#@``)HQ-$,-$;W-C;60@14U3(#0N,"!D<FEV97(@
|
||||
M:6YS=&%L;&5D#0HD#0H*14U3(&5M=6QA=&EO;B!I<R!D:7-A8FQE9`T*1')I
|
||||
5=F5R(&YO="!I;G-T86QL960-"@HD
|
||||
`
|
||||
end
|
111
usr.bin/doscmd/emuint.c
Normal file
111
usr.bin/doscmd/emuint.c
Normal file
@ -0,0 +1,111 @@
|
||||
/*-
|
||||
* Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, witout modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <ctype.h>
|
||||
#include "doscmd.h"
|
||||
#include "emuint.h"
|
||||
|
||||
/* The central entry point for the emulator interrupt. This is used by
|
||||
* different special programs to call the emulator from VM86 space.
|
||||
* Look at emuint.h for definitions and a list of the currently defined
|
||||
* subfunctions.
|
||||
* To call emuint from VM86 space do:
|
||||
* push ax Save original ax value (*must be done* !)
|
||||
* mov ah, funcnum Emuint function number to ah
|
||||
* mov al, subfunc Subfunction number, optional, depening on func
|
||||
* int 0xff
|
||||
* ..
|
||||
* ..
|
||||
* Emuint saves the function and subfunction numbers internally, then
|
||||
* pops ax off the stack and calls the function handler with the original
|
||||
* value in ax.
|
||||
*/
|
||||
void
|
||||
emuint(regcontext_t *REGS)
|
||||
{
|
||||
u_short func, subfunc;
|
||||
|
||||
/* Remove function number from stack */
|
||||
func = R_AH;
|
||||
subfunc = R_AL;
|
||||
|
||||
R_AX = N_POP(REGS);
|
||||
|
||||
/* Call the function handler, subfunction is ignored, if unused */
|
||||
switch (func)
|
||||
{
|
||||
/* The redirector call */
|
||||
case EMU_REDIR:
|
||||
intff(REGS);
|
||||
break;
|
||||
|
||||
/* EMS call, used by emsdriv.sys */
|
||||
case EMU_EMS:
|
||||
{
|
||||
switch (subfunc)
|
||||
{
|
||||
case EMU_EMS_CTL:
|
||||
R_AX = (u_short)ems_init();
|
||||
break;
|
||||
|
||||
case EMU_EMS_CALL:
|
||||
ems_entry(REGS);
|
||||
break;
|
||||
|
||||
default:
|
||||
debug(D_ALWAYS, "Undefined subfunction for EMS call\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
debug(D_ALWAYS, "Emulator interrupt called with undefined function %02x\n", func);
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* temporary backwards compatability with instbsdi.exe
|
||||
* remove after a while.
|
||||
*/
|
||||
fprintf(stderr, "***\n*** WARNING - unknown emuint function\n");
|
||||
fprintf(stderr, "*** Continuing; assuming instbsdi redirector.\n");
|
||||
fprintf(stderr, "*** Please install the new redirector");
|
||||
fprintf(stderr, " `redir.com' as soon as possible.\n");
|
||||
fprintf(stderr, "*** This compatability hack is not permanent.\n");
|
||||
fprintf(stderr, "***\n");
|
||||
N_PUSH(R_AX, REGS);
|
||||
R_BX = R_ES;
|
||||
R_DX = R_DI;
|
||||
R_DI = R_DS;
|
||||
intff(REGS);
|
||||
break;
|
||||
}
|
||||
}
|
50
usr.bin/doscmd/emuint.h
Normal file
50
usr.bin/doscmd/emuint.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, witout modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The emulator helper interrupt:
|
||||
*
|
||||
* Interrupt 0xFF is used by some emulator functions. It is a portal into
|
||||
* the emulator and cannot be used by ordinary DOS applications directly
|
||||
* The interrupt 0xFF is called by helper functions under DOS (such as
|
||||
* the redirector interfcae and the EMS emulation).
|
||||
* There are functions and subfunctions defined. (See emuint.c for details)
|
||||
*/
|
||||
|
||||
/* The redirector interface (formerly instbsdi.exe) */
|
||||
#define EMU_REDIR 0x1 /* Function for redirector interface */
|
||||
/* No subfunctions defined */
|
||||
|
||||
/* Expanded memory (EMS) driver callback */
|
||||
#define EMU_EMS 0x2 /* Function for EMS driver control */
|
||||
/* subfunctions for EMS */
|
||||
#define EMU_EMS_CTL 0x0 /* Control function, used during init */
|
||||
#define EMU_EMS_CALL 0x1 /* Callback, calls are routed via this */
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1996
|
||||
* Berkeley Software Design, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Berkeley Software
|
||||
* Design, Inc.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* BSDI instbsdi.c,v 2.2 1996/04/08 19:32:39 bostic Exp
|
||||
*/
|
||||
|
||||
#include <dos.h>
|
||||
#include <string.h>
|
||||
|
||||
main(int ac, char **av)
|
||||
{
|
||||
union REGS in, out, tmp;
|
||||
struct SREGS seg, stmp;
|
||||
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.h.ah = 0x52;
|
||||
int86x(0x21, &out, &tmp, &stmp);
|
||||
|
||||
seg.es = stmp.es;
|
||||
in.x.di = tmp.x.bx;
|
||||
|
||||
out.x.ax = 0x5D06;
|
||||
int86x(0x21, &out, &tmp, &stmp);
|
||||
|
||||
seg.ds = stmp.ds;
|
||||
in.x.si = tmp.x.si;
|
||||
|
||||
int86x(0xff, &in, &out, &seg);
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
begin 644 instbsdi.exe
|
||||
M35JK``8`!``@`($`__^+```(.VR.````'@````$`"@!P`)D````C`0``G@!P
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````58OLN#H`Z+T"N`X`
|
||||
M4"O`4(U&SE#H80:#Q`;&1L]2C4;J4(U&\E"-1LY0N"$`4.BS!8/$"(M&ZHE&
|
||||
MQHM&](E&YL=&S@9=C4;J4(U&\E"-1LY0N"$`4.B,!8/$"(M&\(E&S(M&^HE&
|
||||
MY(U&QE"-1LY0C4;<4+C_`%#H:@6+Y5W#M##-(3P"<P+-(+]L`(LV`@`K]X'^
|
||||
M`!!R`[X`$/J.UX'$[@'[<Q`6'^CW`3/`4.AV!+C_3,TA@^3^-HDF2``VB29$
|
||||
M`(O&L033X$@VHT(``_>)-@(`C,,KWO?;M$K-(3:,'KD`%@?\O^P!N?`!*\\S
|
||||
MP/.J%A_H.P`6'^B2`^@!`C/M_S;:`/\VV`#_-M8`Z/+^4.CB`+AL`([8N`,`
|
||||
M-L<&1@`$`E#H>P'H_0.X_P!0_Q9&`+0PS2&CNP"X`#7-(8D>IP",!JD`#A^X
|
||||
M`"6Z(@'-(18?BPX(`>,NC@:Y`":+-BP`Q08*`8S:,]LV_QX&`7,%%A_I30$V
|
||||
MQ08.`8S:NP,`-O\>!@$6'XX&N0`FBPXL`.,VCL$S_R:`/0!T++D,`+Z:`/.F
|
||||
M=`NY_W\SP/*N=1GKY08>!Q^+][_"`*R8D:S^P'0!2*KB]Q8?NP0`@*?"`+^X
|
||||
M`$3-(7(*]L*`=`6`C\(`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O!B^F+^4F+
|
||||
M-BP`"_9T$([&)H`^````=`;RKD6N=?I%ET`D_HO]T>4#Q18?5[\)`.B%`%^+
|
||||
MSXO]`_B)+MH`'@>.WC/V2>,3@3P[0W0%B7X`146LJ@K`=?KB[8E.`!8?78OE
|
||||
M7<-5B^Q65QX'BU8$OAH!K3O"=!!`EG0,ES/`N?__\JZ+]^OKEE]>B^5=P@(`
|
||||
M58OL5_]V!.C+_PO`=!22B_HSP+G___*N]]%)NP(`M$#-(5^+Y5W"`@"+T`,&
|
||||
M2`!R-3D&0@!S)04/`%#1V+$#T^B,V8L>N0`KRP/!CL.+V+1*S2%8<A`D\$BC
|
||||
M0@"5BRY(``$62`##B\?ID?MR$S/`B^5=PW/X4.@8`%B+Y5W#<P?H#@"X__^9
|
||||
MB^5=PS+DZ`$`PZ*^``KD=2.`/KL``W(-/")S#3P@<@6P!>L'D#P3=@*P$[OP
|
||||
M`->8H[,`PXK$Z_=5B^Q65QZ#[`K&1O3-BT8$B$;U/"5T"CPF=`;&1O;+ZPS&
|
||||
M1OC+QD;W1,9&]D2,5O*-1O2)1O"+?@:+!8M=`HM-!(M5!HMU"/]U"HM^"HX%
|
||||
MCET&7U7_7O!=_%<>%A^+?@J,!8]%!HM^"(D%B5T"B4T$B54&B74(CT4*<@0S
|
||||
M]NL(Z$K_O@$`BP6)=0R#Q`H?7UZ+Y5W#58OLB]>,V([`BWX$B]^+3@CC%8I&
|
||||
M!HK@]\<!`'0"JDG1Z?.K$\GSJHOZDUW#`````````````````````````$U3
|
||||
M(%)U;BU4:6UE($QI8G)A<GD@+2!#;W!Y<FEG:'0@*&,I(#$Y.#@L($UI8W)O
|
||||
M<V]F="!#;W)P$0``````&P(``&P`````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M`````````$@`.T-?1DE,15])3D9/````````````````````````````````
|
||||
M```4`(&!@0$!````````````````````````````X`!L`$,`````````````
|
||||
M`/`"````%@("&`T)#`P,!P@6%O\2#1("_P``````````````````/#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'TP0P/#EV`@0GJHO""\-UXH@%3ZR&!8A$_XU$`3O'<O)87UZ+Y5W#
|
||||
M``````````````````````````````!-4R!2=6XM5&EM92!,:6)R87)Y("T@
|
||||
M0V]P>7)I9VAT("AC*2`Q.3@X+"!-:6-R;W-O9G0@0V]R<!$`3$],(&ES(&%T
|
||||
M("4P-'@Z)3`T>`H`4T1!(&ES(&%T("4P-'@Z)3`T>`H``````#L"``"$`0``
|
||||
M````````````````````````````````````````````````````````````
|
||||
M``````````````````````````````````````!R`#M#7T9)3$5?24Y&3P``
|
||||
M````````````````````````````````%`"!@8$!`0``````````````````
|
||||
M``````````H!A`%#``````````````"@"@```!8"`A@-"0P,#`<(%A;_$@T2
|
||||
M`O\``*`%``"@!0$``````````@$````````"`@```````(0#`````````@0`
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M```````````````````````````````````````!```"````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M``````````````````#(`2AN=6QL*0`H;G5L;"D`*RT@(P``````````````
|
||||
M```````````@`````/`"\`+P`O`"\`(``````````````````````````!0&
|
||||
M/#Q.35-'/CX``%(V,#`P#0HM('-T86-K(&]V97)F;&]W#0H``P!2-C`P,PT*
|
||||
M+2!I;G1E9V5R(&1I=FED92!B>2`P#0H`"0!2-C`P.0T*+2!N;W0@96YO=6=H
|
||||
M('-P86-E(&9O<B!E;G9I<F]N;65N=`T*`/P`#0H`_P!R=6XM=&EM92!E<G)O
|
||||
M<B```@!2-C`P,@T*+2!F;&]A=&EN9R!P;VEN="!N;W0@;&]A9&5D#0H``0!2
|
||||
E-C`P,0T*+2!N=6QL('!O:6YT97(@87-S:6=N;65N=`T*`/___V5D
|
||||
`
|
||||
end
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI intff.c,v 2.2 1996/04/08 19:32:56 bostic Exp
|
||||
*
|
||||
* $Id: intff.c,v 1.8 1996/09/23 09:59:25 miff Exp $
|
||||
* $Id: intff.c,v 1.1 1997/08/09 01:42:51 dyson Exp $
|
||||
*/
|
||||
|
||||
#include "doscmd.h"
|
||||
@ -787,17 +787,17 @@ init_drives(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
intff(regcontext_t *REGS)
|
||||
{
|
||||
|
||||
if (lol && sda) { /* already been called? */
|
||||
if (lol && sda) { /* already been called? */
|
||||
debug(D_REDIR, "redirector duplicate install ignored\n");
|
||||
return;
|
||||
}
|
||||
lol = (LOL *)N_GETPTR(R_ES, R_DI); /* where DOS keeps its goodies */
|
||||
sda = (SDA *)N_GETPTR(R_DS, R_SI);
|
||||
|
||||
lol = (LOL *)N_GETPTR(R_BX, R_DX); /* where DOS keeps its goodies */
|
||||
sda = (SDA *)N_GETPTR(R_DI, R_SI);
|
||||
init_drives();
|
||||
|
||||
/* initialise dispatcher */
|
||||
|
122
usr.bin/doscmd/redir.S
Normal file
122
usr.bin/doscmd/redir.S
Normal file
@ -0,0 +1,122 @@
|
||||
! Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
|
||||
! All rights reserved.
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice immediately at the beginning of the file, witout modification,
|
||||
! this list of conditions, and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the author may not be used to endorse or promote products
|
||||
! derived from this software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
! OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
! IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
! NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
! THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
! $Id$
|
||||
|
||||
|
||||
!
|
||||
! This is the new redirector program, it replaces instbsdi.exe
|
||||
! The program fetches some pointers from DOS and reports them back to
|
||||
! the emulator via the emulator interrupt 0xff. It does not stay resident.
|
||||
|
||||
use16
|
||||
|
||||
.text
|
||||
.bss
|
||||
.data
|
||||
.align 0
|
||||
|
||||
! Emulator interrupt entry
|
||||
EmulatorINT = 0xFF
|
||||
! Emulator redirector function
|
||||
EmulatorRED = 0x1
|
||||
|
||||
! DOS interrupt
|
||||
DOSInt = 0x21
|
||||
|
||||
! DOS get list of lists call, returns pointer to system vars in ES:BX
|
||||
DOSGetList = 0x52
|
||||
|
||||
! DOS get swappable area, returns DOS swappable area in DS:SI
|
||||
DOSGetSwapD = 0x5D06
|
||||
|
||||
! DOS terminate program with return code
|
||||
DOSExit = 0x4C
|
||||
|
||||
! DOS print message
|
||||
DOSMesg = 0x9
|
||||
|
||||
cr = 0xd
|
||||
lf = 0xa
|
||||
eom = '$' ! DOS end of string
|
||||
|
||||
.org 0x100
|
||||
|
||||
.globl _main
|
||||
_main:
|
||||
|
||||
mov ah, #DOSGetList
|
||||
int DOSInt
|
||||
jc Fail
|
||||
mov [_list], bx
|
||||
mov ax, es
|
||||
mov [_list+2], ax
|
||||
push ds
|
||||
mov ax, #DOSGetSwapD
|
||||
int DOSInt
|
||||
mov ax, ds
|
||||
pop ds
|
||||
jc Fail
|
||||
mov [_swap], si
|
||||
mov [_swap+2], ax
|
||||
push ax
|
||||
mov ah, #EmulatorRED
|
||||
mov dx, [_list]
|
||||
mov bx, [_list+2]
|
||||
mov si, [_swap]
|
||||
mov di, [_swap+2]
|
||||
int EmulatorINT
|
||||
xor al, al ! return 0
|
||||
jmp Exit
|
||||
Fail:
|
||||
mov ah, #DOSMesg
|
||||
mov dx, #ErrorMessage
|
||||
int DOSInt
|
||||
mov al, #1 ! return 1
|
||||
Exit:
|
||||
mov ah, #DOSExit
|
||||
int DOSInt
|
||||
!
|
||||
! Should never get to this point
|
||||
!
|
||||
nop
|
||||
nop
|
||||
hlt
|
||||
|
||||
! The two pointers are found using the DOS calls
|
||||
! and passed to the redirector interface via int FF
|
||||
! The two pointers are passed in BX:DX (list) and DI:SI (swap)
|
||||
|
||||
.align 2
|
||||
|
||||
_list: .word 0
|
||||
.word 0
|
||||
_swap: .word 0
|
||||
.word 0
|
||||
|
||||
ErrorMessage:
|
||||
.ascii "Error installing redirector interface"
|
||||
.byte cr,lf,eom, 0
|
6
usr.bin/doscmd/redir.com.uu
Normal file
6
usr.bin/doscmd/redir.com.uu
Normal file
@ -0,0 +1,6 @@
|
||||
begin 644 redir.com
|
||||
MM%+-(7(TB1Y*`8S`HTP!'K@&7<TAC-@?<B")-DX!HU`!4+0!BQ9*`8L>3`&+
|
||||
M-DX!BSY0`<W_,,#K";0)NE(!S2&P`;1,S2&0D/0``````````$5R<F]R(&EN
|
||||
B<W1A;&QI;F<@<F5D:7)E8W1O<B!I;G1E<F9A8V4-"B0`````
|
||||
`
|
||||
end
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI trap.c,v 2.3 1996/04/08 19:33:08 bostic Exp
|
||||
*
|
||||
* $Id: trap.c,v 1.10 1996/10/02 00:31:43 miff Exp $
|
||||
* $Id: trap.c,v 1.1 1997/08/09 01:42:58 dyson Exp $
|
||||
*/
|
||||
|
||||
#include "doscmd.h"
|
||||
@ -63,7 +63,7 @@ fake_int(regcontext_t *REGS, int intnum)
|
||||
int2f(®S->sc);
|
||||
break;
|
||||
case 0xff: /* doscmd special */
|
||||
intff(REGS);
|
||||
emuint(REGS);
|
||||
break;
|
||||
default: /* should not get here */
|
||||
if (vflag) dump_regs(REGS);
|
||||
@ -581,7 +581,7 @@ sigalrm(struct sigframe *sf)
|
||||
update_counter = 0; /* remember we've updated */
|
||||
video_update(®S->sc);
|
||||
hardint(0x08);
|
||||
/* debug(D_ALWAYS,"\n"); */
|
||||
/* debug(D_ALWAYS,"\n"); */
|
||||
|
||||
if (tmode)
|
||||
tracetrap(REGS);
|
||||
@ -604,6 +604,9 @@ sigfpe(struct sigframe *sf)
|
||||
regcontext_t *REGS = (regcontext_t *)(&sf->sf_sc);
|
||||
|
||||
if (R_EFLAGS & PSL_VM) {
|
||||
dump_regs(REGS);
|
||||
debug(D_ALWAYS, "DOS program caused floating point fault\n");
|
||||
/*XXX Look into that !! */
|
||||
fake_int(REGS, 0); /* call handler XXX rather bogus, eh? */
|
||||
return;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: xms.c,v 1.2 1997/08/15 23:41:25 jlemon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -111,7 +111,10 @@ xms_init(void)
|
||||
add_block(&UMB_freelist, create_block(0xd0000, 64*1024));
|
||||
/*XXX check for EMS emulation, when it is done! */
|
||||
/* 0xE0000 to 0xEffff */
|
||||
add_block(&UMB_freelist, create_block(0xe0000, 64*1024));
|
||||
|
||||
/* This is used as window for EMS, will be configurable ! */
|
||||
/* add_block(&UMB_freelist, create_block(0xe0000, 64*1024)); */
|
||||
|
||||
merge_blocks();
|
||||
|
||||
xms_vector = insert_generic_trampoline(
|
||||
@ -142,8 +145,7 @@ add_block(UMB_block **listp, UMB_block *blk)
|
||||
if (*listp == NULL) {
|
||||
*listp = blk;
|
||||
blk->next = NULL;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Insert at the start */
|
||||
bp = obp = *listp;
|
||||
if (blk->addr < bp->addr) {
|
||||
@ -156,8 +158,7 @@ add_block(UMB_block **listp, UMB_block *blk)
|
||||
if (blk->addr > bp->addr) {
|
||||
obp = bp;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
obp->next = blk;
|
||||
blk->next = bp;
|
||||
return;
|
||||
@ -228,10 +229,10 @@ merge_blocks()
|
||||
bp->size += mergebp->size;
|
||||
bp->next = mergebp->next;
|
||||
free(mergebp);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
/* Goto next block */
|
||||
bp = bp->next;
|
||||
}
|
||||
} while (bp != NULL);
|
||||
}
|
||||
|
||||
@ -485,13 +486,19 @@ static void
|
||||
xms_entry(regcontext_t *REGS)
|
||||
{
|
||||
|
||||
if (R_AH != 0) {
|
||||
if (HMA_a20 < 0) { /* This feature is disabled */
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_HMA_NOT_MANAGED;
|
||||
return;
|
||||
}
|
||||
if (R_AH != 0)
|
||||
vec_grabbed = 1;
|
||||
|
||||
/* If the HMA feature is disabled these calls are "not managed" */
|
||||
if (HMA_a20 < 0) {
|
||||
if (R_AH == XMS_ALLOCATE_HIGH_MEMORY || R_AH == XMS_FREE_HIGH_MEMORY ||
|
||||
R_AH == XMS_GLOBAL_ENABLE_A20 || R_AH == XMS_GLOBAL_DISABLE_A20 ||
|
||||
R_AH == XMS_LOCAL_ENABLE_A20 || R_AH == XMS_LOCAL_DISABLE_A20 ||
|
||||
R_AH == XMS_QUERY_A20) {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_HMA_NOT_MANAGED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (R_AH) {
|
||||
@ -513,8 +520,7 @@ xms_entry(regcontext_t *REGS)
|
||||
if (HMA_allocated) {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_HMA_ALREADY_USED;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
HMA_allocated = 1;
|
||||
R_AX = 0x1;
|
||||
R_BL = XMS_SUCCESS;
|
||||
@ -527,8 +533,7 @@ xms_entry(regcontext_t *REGS)
|
||||
HMA_allocated = 0;
|
||||
R_AX = 0x1;
|
||||
R_BL = XMS_SUCCESS;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_HMA_NOT_ALLOCATED;
|
||||
}
|
||||
@ -588,8 +593,19 @@ xms_entry(regcontext_t *REGS)
|
||||
break;
|
||||
|
||||
case XMS_QUERY_FREE_EXTENDED_MEMORY:
|
||||
R_AX = R_DX = xms_free_mem / 1024;
|
||||
R_BL = XMS_SUCCESS;
|
||||
/* DOS MEM.EXE chokes, if the HMA is enabled and the reported
|
||||
* free space includes the HMA. So we subtract 64kB from the
|
||||
* space reported, if the HMA is enabled.
|
||||
*/
|
||||
if (HMA_a20 < 0)
|
||||
R_EAX = R_EDX = xms_free_mem / 1024;
|
||||
else
|
||||
R_EAX = R_EDX = (xms_free_mem / 1024) - 64;
|
||||
|
||||
if (xms_free_mem == 0)
|
||||
R_BL = XMS_FULL;
|
||||
else
|
||||
R_BL = XMS_SUCCESS;
|
||||
debug(D_XMS, "XMS: Query free EMM: Returned %dkB\n", R_AX);
|
||||
break;
|
||||
|
||||
@ -626,10 +642,10 @@ xms_entry(regcontext_t *REGS)
|
||||
* but with no memory attached ? XMS specs are unclear on
|
||||
* that point. Linux implementation does it this way.
|
||||
*/
|
||||
if (req_siz == 0)
|
||||
if (req_siz == 0) {
|
||||
/* This handle is reserved, but has size 0 and no address */
|
||||
xms_hand[hindx].addr = XMS_NULL_ALLOC;
|
||||
else {
|
||||
} else {
|
||||
if ((mem = malloc(req_siz)) == NULL)
|
||||
fatal("XMS: Cannot malloc !");
|
||||
xms_hand[hindx].addr = (u_long)mem;
|
||||
@ -663,13 +679,13 @@ xms_entry(regcontext_t *REGS)
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_INVALID_HANDLE;
|
||||
debug(D_XMS, " Invalid handle\n");
|
||||
}
|
||||
else if (xms_hand[hindx].num_locks > 0) {
|
||||
|
||||
} else if (xms_hand[hindx].num_locks > 0) {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_BLOCK_IS_LOCKED;
|
||||
debug(D_XMS, " Is locked\n");
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
if (xms_hand[hindx].addr != XMS_NULL_ALLOC) {
|
||||
free((void *)xms_hand[hindx].addr);
|
||||
xms_free_mem += xms_hand[hindx].size;
|
||||
@ -724,7 +740,7 @@ xms_entry(regcontext_t *REGS)
|
||||
srcoffs = eptr->src_offset;
|
||||
dstoffs = eptr->dst_offset;
|
||||
n = eptr->nbytes;
|
||||
/* Lenght must be even, see XMS spec */
|
||||
/* Length must be even, see XMS spec */
|
||||
if (n & 1) {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_INVALID_LENGTH;
|
||||
@ -746,8 +762,7 @@ xms_entry(regcontext_t *REGS)
|
||||
break;
|
||||
}
|
||||
srcptr += srcoffs;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
srcptr = VECPTR(srcoffs);
|
||||
/* Sanity check: Don't allow srcptr pointing to
|
||||
* emulator data above 1M
|
||||
@ -775,8 +790,7 @@ xms_entry(regcontext_t *REGS)
|
||||
break;
|
||||
}
|
||||
dstptr += dstoffs;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dstptr = VECPTR(dstoffs);
|
||||
/* Sanity check: Don't allow dstptr pointing to
|
||||
* emulator data above 1M
|
||||
@ -863,7 +877,7 @@ xms_entry(regcontext_t *REGS)
|
||||
{
|
||||
int hnum,hindx;
|
||||
|
||||
debug(D_XMS, "XMS: Get handle information: DX=%04x\n, R_DX");
|
||||
debug(D_XMS, "XMS: Get handle information: DX=%04x\n", R_DX);
|
||||
hnum = R_DX;
|
||||
if (hnum > NUM_HANDLES || hnum == 0) {
|
||||
R_AX = 0x0;
|
||||
@ -933,8 +947,7 @@ xms_entry(regcontext_t *REGS)
|
||||
fatal("XMS: Cannot malloc !");
|
||||
xms_hand[hindx].addr = (u_long)mem;
|
||||
xms_hand[hindx].size = req_siz;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ((mem = realloc((void *)xms_hand[hindx].addr,req_siz))
|
||||
== NULL)
|
||||
fatal("XMS: Cannot realloc !");
|
||||
@ -978,13 +991,13 @@ xms_entry(regcontext_t *REGS)
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_NO_UMBS_AVAILABLE;
|
||||
R_DX = 0x0;
|
||||
}
|
||||
else if (bp->size < req_siz) {
|
||||
|
||||
} else if (bp->size < req_siz) {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_REQUESTED_UMB_TOO_BIG;
|
||||
R_DX = bp->size / 16;
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
UMB_block *newbp;
|
||||
/* Found a block large enough. Split it into the size
|
||||
* we need, rest remains on the free list. New block
|
||||
@ -1011,8 +1024,7 @@ xms_entry(regcontext_t *REGS)
|
||||
if ((blk = find_allocated_block(req_addr)) == NULL) {
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_INVALID_UMB_SEGMENT;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Move the block from the alloc list to the free list
|
||||
* and try to do garbage collection
|
||||
*/
|
||||
@ -1037,6 +1049,27 @@ xms_entry(regcontext_t *REGS)
|
||||
R_BL = XMS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
/* Some test programs use this call */
|
||||
case XMS_QUERY_FREE_EXTENDED_MEMORY_LARGE:
|
||||
/* DOS MEM.EXE chokes, if the HMA is enabled and the reported
|
||||
* free space includes the HMA. So we subtract 64kB from the
|
||||
* space reported, if the HMA is enabled.
|
||||
*/
|
||||
if (HMA_a20 < 0)
|
||||
R_EAX = R_EDX = xms_free_mem / 1024;
|
||||
else
|
||||
R_EAX = R_EDX = (xms_free_mem / 1024) - 64;
|
||||
/* ECX should return the highest address of any memory block
|
||||
* We return 1MB + size of extended memory
|
||||
*/
|
||||
R_ECX = 1024 * 1024 + xms_maxsize -1;
|
||||
if (xms_free_mem == 0)
|
||||
R_BL = XMS_FULL;
|
||||
else
|
||||
R_BL = XMS_SUCCESS;
|
||||
debug(D_XMS, "XMS: Query free EMM(large): Returned %dkB\n", R_AX);
|
||||
break;
|
||||
|
||||
/* These are the same as the above functions, but they use 32 bit
|
||||
* registers (i.e. EDX instead of DX). This is for allocations of
|
||||
* more than 64MB. I think this will hardly be used in the emulator
|
||||
@ -1044,10 +1077,9 @@ xms_entry(regcontext_t *REGS)
|
||||
* spec. If something breaks because they are not here, I can implement
|
||||
* them
|
||||
*/
|
||||
case XMS_QUERY_FREE_EXTENDED_MEMORY_LARGE:
|
||||
case XMS_ALLOCATE_EXTENDED_MEMORY_LARGE:
|
||||
case XMS_FREE_EXTENDED_MEMORY_LARGE:
|
||||
debug(D_XMS, "XMS: 8x function called, not implemented\n");
|
||||
debug(D_XMS, "XMS: %02x function called, not implemented\n", R_AH);
|
||||
R_AX = 0x0;
|
||||
R_BL = XMS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user