Commit 07d2a789 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Moved DOS List of Lists initialization, and added the beginnings of

the DOS device structures.
parent c4cd0bf6
......@@ -58,7 +58,6 @@ typedef struct _DOSEVENT {
extern BOOL MZ_InitTask( LPDOSTASK lpDosTask );
extern void MZ_KillModule( LPDOSTASK lpDosTask );
extern LPDOSTASK MZ_AllocDPMITask( HMODULE16 hModule );
extern void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,PCONTEXT,void*), void *data );
#endif /* linux-i386 */
......@@ -69,6 +68,7 @@ extern BOOL MZ_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmdline, LPCSTR
BOOL inherit, LPSTARTUPINFOA startup,
LPPROCESS_INFORMATION info );
extern int DOSVM_Enter( PCONTEXT context );
extern void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,PCONTEXT,void*), void *data );
extern void DOSVM_PIC_ioport_out( WORD port, BYTE val );
extern void DOSVM_SetTimer( unsigned ticks );
extern unsigned DOSVM_GetTimer( void );
......
......@@ -86,6 +86,9 @@ extern DWORD DOSMEM_CollateTable;
extern DWORD DOSMEM_ErrorCall;
extern DWORD DOSMEM_ErrorBuffer;
extern struct _DOS_LISTOFLISTS * DOS_LOL;
extern DWORD DOS_LOLSeg;
extern BOOL DOSMEM_Init(HMODULE16 hModule);
extern void DOSMEM_Tick(WORD timer);
extern WORD DOSMEM_AllocSelector(WORD);
......@@ -98,6 +101,9 @@ extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
/* msdos/devices.c */
extern void DOSDEV_InstallDOSDevices(void);
/* msdos/interrupts.c */
extern FARPROC16 INT_GetPMHandler( BYTE intnum );
extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
......@@ -134,6 +140,7 @@ extern void WINAPI INT_Int15Handler(CONTEXT*);
/* msdos/int16.c */
extern void WINAPI INT_Int16Handler(CONTEXT*);
extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
/* msdos/int17.c */
extern void WINAPI INT_Int17Handler(CONTEXT*);
......
......@@ -55,6 +55,15 @@ typedef struct
typedef struct
{
DWORD next_dev;
WORD attr;
WORD strategy;
WORD interrupt;
char name[8];
} DOS_DEVICE_HEADER;
typedef struct _DOS_LISTOFLISTS
{
WORD CX_Int21_5e01; /* contents of CX from INT 21/AX=5E01h */
WORD LRU_count_FCB_cache;
WORD LRU_count_FCB_open;
......@@ -76,7 +85,7 @@ typedef struct
WORD nr_protect_FCB;
BYTE nr_block_dev;
BYTE nr_avail_drive_letters;
BYTE NUL_dev_header[18];
DOS_DEVICE_HEADER NUL_dev WINE_PACKED;
BYTE nr_drives_JOINed;
WORD ptr_spec_prg_names WINE_PACKED;
DWORD ptr_SETVER_prg_list WINE_PACKED;
......
......@@ -6,6 +6,7 @@ VPATH = @srcdir@
MODULE = msdos
C_SRCS = \
devices.c \
dosconf.c \
dosmem.c \
dpmi.c \
......
/*
* DOS devices
*
* Copyright 1999 Ove Kven
*/
#include <stdlib.h>
#include <string.h>
#include "wine/winbase16.h"
#include "msdos.h"
#include "miscemu.h"
#include "debug.h"
#include "pshpack1.h"
typedef struct {
DOS_DEVICE_HEADER hdr;
BYTE ljmp1;
RMCBPROC strategy;
BYTE ljmp2;
RMCBPROC interrupt;
} WINEDEV;
#include "poppack.h"
DOS_LISTOFLISTS * DOS_LOL;
DWORD DOS_LOLSeg;
#define NONEXT ((DWORD)-1)
#define ATTR_STDIN 0x0001
#define ATTR_STDOUT 0x0002
#define ATTR_NUL 0x0004
#define ATTR_CLOCK 0x0008
#define ATTR_FASTCON 0x0010
#define ATTR_REMOVABLE 0x0800
#define ATTR_NONIBM 0x2000 /* block devices */
#define ATTR_UNTILBUSY 0x2000 /* char devices */
#define ATTR_IOCTL 0x4000
#define ATTR_CHAR 0x8000
#define LJMP 0x9a
static void nul_strategy(CONTEXT*ctx)
{
}
static void nul_interrupt(CONTEXT*ctx)
{
}
static void con_strategy(CONTEXT*ctx)
{
}
static void con_interrupt(CONTEXT*ctx)
{
}
#define STRATEGY_OFS sizeof(DOS_DEVICE_HEADER)
#define INTERRUPT_OFS STRATEGY_OFS+5
static DOS_DEVICE_HEADER dev_nul_hdr={
NONEXT,
ATTR_CHAR|ATTR_NUL,
STRATEGY_OFS,INTERRUPT_OFS,
"NUL "
};
static WINEDEV devs={
{NONEXT,
ATTR_CHAR|ATTR_STDIN|ATTR_STDOUT|ATTR_FASTCON,
STRATEGY_OFS,INTERRUPT_OFS,
"CON "},
LJMP,con_strategy,
LJMP,con_interrupt
};
#define nr_devs (sizeof(devs)/sizeof(WINEDEV))
static void InitListOfLists()
{
/*
Output of DOS 6.22:
0133:0020 6A 13-33 01 CC 00 33 01 59 00 j.3...3.Y.
0133:0030 70 00 00 00 72 02 00 02-6D 00 33 01 00 00 2E 05 p...r...m.3.....
0133:0040 00 00 FC 04 00 00 03 08-92 21 11 E0 04 80 C6 0D .........!......
0133:0050 CC 0D 4E 55 4C 20 20 20-20 20 00 00 00 00 00 00 ..NUL ......
0133:0060 00 4B BA C1 06 14 00 00-00 03 01 00 04 70 CE FF .K...........p..
0133:0070 FF 00 00 00 00 00 00 00-00 01 00 00 0D 05 00 00 ................
0133:0080 00 FF FF 00 00 00 00 FE-00 00 F8 03 FF 9F 70 02 ..............p.
0133:0090 D0 44 C8 FD D4 44 C8 FD-D4 44 C8 FD D0 44 C8 FD .D...D...D...D..
0133:00A0 D0 44 C8 FD D0 44 .D...D
*/
DOS_LOL->CX_Int21_5e01 = 0x0;
DOS_LOL->LRU_count_FCB_cache = 0x0;
DOS_LOL->LRU_count_FCB_open = 0x0;
DOS_LOL->OEM_func_handler = -1; /* not available */
DOS_LOL->INT21_offset = 0x0;
DOS_LOL->sharing_retry_count = 3;
DOS_LOL->sharing_retry_delay = 1;
DOS_LOL->ptr_disk_buf = 0x0;
DOS_LOL->offs_unread_CON = 0x0;
DOS_LOL->seg_first_MCB = 0x0;
DOS_LOL->ptr_first_DPB = 0x0;
DOS_LOL->ptr_first_SysFileTable = 0x0;
DOS_LOL->ptr_clock_dev_hdr = 0x0;
DOS_LOL->ptr_CON_dev_hdr = 0x0;
DOS_LOL->max_byte_per_sec = 512;
DOS_LOL->ptr_disk_buf_info = 0x0;
DOS_LOL->ptr_array_CDS = 0x0;
DOS_LOL->ptr_sys_FCB = 0x0;
DOS_LOL->nr_protect_FCB = 0x0;
DOS_LOL->nr_block_dev = 0x0;
DOS_LOL->nr_avail_drive_letters = 26; /* A - Z */
DOS_LOL->nr_drives_JOINed = 0x0;
DOS_LOL->ptr_spec_prg_names = 0x0;
DOS_LOL->ptr_SETVER_prg_list = 0x0; /* no SETVER list */
DOS_LOL->DOS_HIGH_A20_func_offs = 0x0;
DOS_LOL->PSP_last_exec = 0x0;
DOS_LOL->BUFFERS_val = 99; /* maximum: 99 */
DOS_LOL->BUFFERS_nr_lookahead = 8; /* maximum: 8 */
DOS_LOL->boot_drive = 3; /* C: */
DOS_LOL->flag_DWORD_moves = 0x01; /* i386+ */
DOS_LOL->size_extended_mem = 0xf000; /* very high value */
}
void DOSDEV_InstallDOSDevices(void)
{
WINEDEV *dev;
DOS_DEVICE_HEADER *pdev;
UINT16 seg;
int n;
WORD ofs = sizeof(DOS_LISTOFLISTS)-sizeof(DOS_DEVICE_HEADER);
/* allocate DOS data segment or something */
DOS_LOLSeg = GlobalDOSAlloc16(ofs+sizeof(WINEDEV)+sizeof(devs));
seg = HIWORD(DOS_LOLSeg);
DOS_LOL = PTR_SEG_OFF_TO_LIN(LOWORD(DOS_LOLSeg), 0);
InitListOfLists();
/* copy first device (NUL) */
pdev = &(DOS_LOL->NUL_dev);
memcpy(pdev,&dev_nul_hdr,sizeof(DOS_DEVICE_HEADER));
pdev->strategy += ofs;
pdev->interrupt += ofs;
/* set up dev so we can copy over the rest */
dev = (WINEDEV*)(((char*)DOS_LOL)+ofs);
dev[0].ljmp1 = LJMP;
dev[0].strategy = (RMCBPROC)DPMI_AllocInternalRMCB(nul_strategy);
dev[0].ljmp2 = LJMP;
dev[0].interrupt = (RMCBPROC)DPMI_AllocInternalRMCB(nul_interrupt);
dev++;
ofs += sizeof(WINEDEV);
memcpy(dev,&devs,sizeof(devs));
for (n=0; n<nr_devs; n++) {
pdev->next_dev = PTR_SEG_OFF_TO_SEGPTR(seg, ofs);
dev[n].hdr.strategy += ofs;
dev[n].hdr.interrupt += ofs;
dev[n].strategy = (RMCBPROC)DPMI_AllocInternalRMCB(dev[n].strategy);
dev[n].interrupt = (RMCBPROC)DPMI_AllocInternalRMCB(dev[n].interrupt);
ofs += sizeof(WINEDEV);
pdev = &(dev[n].hdr);
}
}
......@@ -407,6 +407,7 @@ BOOL DOSMEM_Init(HMODULE16 hModule)
DOSMEM_InitCollateTable();
DOSMEM_InitErrorTable();
DOSMEM_InitDPMI();
DOSDEV_InstallDOSDevices();
}
else
{
......
......@@ -85,9 +85,6 @@ struct DosHeap {
static struct DosHeap *heap;
static WORD DosHeapHandle;
WORD sharing_retries = 3; /* number of retries at sharing violation */
WORD sharing_pause = 1; /* pause between retries */
extern char TempDirectory[];
static BOOL INT21_CreateHeap(void)
......@@ -940,64 +937,6 @@ static WORD INT21_GetCurrentPSP()
}
SEGPTR INT21_GetListOfLists()
{
static DOS_LISTOFLISTS *LOL;
static SEGPTR seg_LOL;
/*
Output of DOS 6.22:
0133:0020 6A 13-33 01 CC 00 33 01 59 00 j.3...3.Y.
0133:0030 70 00 00 00 72 02 00 02-6D 00 33 01 00 00 2E 05 p...r...m.3.....
0133:0040 00 00 FC 04 00 00 03 08-92 21 11 E0 04 80 C6 0D .........!......
0133:0050 CC 0D 4E 55 4C 20 20 20-20 20 00 00 00 00 00 00 ..NUL ......
0133:0060 00 4B BA C1 06 14 00 00-00 03 01 00 04 70 CE FF .K...........p..
0133:0070 FF 00 00 00 00 00 00 00-00 01 00 00 0D 05 00 00 ................
0133:0080 00 FF FF 00 00 00 00 FE-00 00 F8 03 FF 9F 70 02 ..............p.
0133:0090 D0 44 C8 FD D4 44 C8 FD-D4 44 C8 FD D0 44 C8 FD .D...D...D...D..
0133:00A0 D0 44 C8 FD D0 44 .D...D
*/
if (!LOL) {
LOL = SEGPTR_ALLOC(sizeof(DOS_LISTOFLISTS));
LOL->CX_Int21_5e01 = 0x0;
LOL->LRU_count_FCB_cache = 0x0;
LOL->LRU_count_FCB_open = 0x0;
LOL->OEM_func_handler = -1; /* not available */
LOL->INT21_offset = 0x0;
LOL->sharing_retry_count = sharing_retries; /* default value: 3 */
LOL->sharing_retry_delay = sharing_pause; /* default value: 1 */
LOL->ptr_disk_buf = 0x0;
LOL->offs_unread_CON = 0x0;
LOL->seg_first_MCB = 0x0;
LOL->ptr_first_DPB = 0x0;
LOL->ptr_first_SysFileTable = 0x0;
LOL->ptr_clock_dev_hdr = 0x0;
LOL->ptr_CON_dev_hdr = 0x0;
LOL->max_byte_per_sec = 512;
LOL->ptr_disk_buf_info = 0x0;
LOL->ptr_array_CDS = 0x0;
LOL->ptr_sys_FCB = 0x0;
LOL->nr_protect_FCB = 0x0;
LOL->nr_block_dev = 0x0;
LOL->nr_avail_drive_letters = 26; /* A - Z */
LOL->nr_drives_JOINed = 0x0;
LOL->ptr_spec_prg_names = 0x0;
LOL->ptr_SETVER_prg_list = 0x0; /* no SETVER list */
LOL->DOS_HIGH_A20_func_offs = 0x0;
LOL->PSP_last_exec = 0x0;
LOL->BUFFERS_val = 99; /* maximum: 99 */
LOL->BUFFERS_nr_lookahead = 8; /* maximum: 8 */
LOL->boot_drive = 3; /* C: */
LOL->flag_DWORD_moves = 0x01; /* i386+ */
LOL->size_extended_mem = 0xf000; /* very high value */
}
if (!seg_LOL) seg_LOL = SEGPTR_GET(LOL);
return seg_LOL+(WORD)&((DOS_LISTOFLISTS*)0)->ptr_first_DPB;
}
/***********************************************************************
* INT21_GetExtendedError
*/
......@@ -1723,9 +1662,9 @@ void WINAPI DOS3Call( CONTEXT *context )
SET_CFLAG(context);
break;
}
sharing_pause = CX_reg(context);
DOS_LOL->sharing_retry_delay = CX_reg(context);
if (!DX_reg(context))
sharing_retries = DX_reg(context);
DOS_LOL->sharing_retry_count = DX_reg(context);
RESET_CFLAG(context);
break;
......@@ -1909,10 +1848,8 @@ void WINAPI DOS3Call( CONTEXT *context )
case 0x52: /* "SYSVARS" - GET LIST OF LISTS */
TRACE(int21,"SYSVARS - GET LIST OF LISTS\n");
{
SEGPTR lol;
lol = INT21_GetListOfLists();
ES_reg(context) = HIWORD(lol);
BX_reg(context) = LOWORD(lol);
ES_reg(context) = ISV86(context) ? HIWORD(DOS_LOLSeg) : LOWORD(DOS_LOLSeg);
BX_reg(context) = FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB);
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment