Moved handlers for int25 and int26 to winedos.

This commit is contained in:
Jukka Heinonen 2002-11-27 20:18:50 +00:00 committed by Alexandre Julliard
parent 96ad51b39b
commit 3546290285
10 changed files with 225 additions and 165 deletions

View File

@ -1053,8 +1053,7 @@
@ cdecl DOSMEM_GetBlock(long ptr) DOSMEM_GetBlock
@ cdecl DOSMEM_GetDPMISegments() DOSMEM_GetDPMISegments
@ cdecl DOSMEM_Init(long) DOSMEM_Init
@ stdcall INT_Int25Handler(ptr) INT_Int25Handler
@ stdcall INT_Int26Handler(ptr) INT_Int26Handler
@ cdecl DRIVE_OpenDevice(long long) DRIVE_OpenDevice
@ cdecl LOCAL_Alloc(long long long) LOCAL_Alloc
@ cdecl LOCAL_Compact(long long long) LOCAL_Compact
@ cdecl LOCAL_CountFree(long) LOCAL_CountFree

View File

@ -51,8 +51,6 @@ C_SRCS = \
$(TOPOBJDIR)/msdos/dosmem.c \
$(TOPOBJDIR)/msdos/dpmi.c \
$(TOPOBJDIR)/msdos/int21.c \
$(TOPOBJDIR)/msdos/int25.c \
$(TOPOBJDIR)/msdos/int26.c \
$(TOPOBJDIR)/msdos/ioports.c \
$(TOPOBJDIR)/msdos/ppdev.c \
$(TOPOBJDIR)/msdos/vxd.c \

View File

@ -28,6 +28,8 @@ C_SRCS = \
int1a.c \
int20.c \
int21.c \
int25.c \
int26.c \
int29.c \
int2a.c \
int2f.c \

View File

@ -148,6 +148,14 @@ extern void WINAPI DOSVM_Int20Handler(CONTEXT86*);
/* int21.c */
extern void WINAPI DOSVM_Int21Handler(CONTEXT86*);
/* int25.c */
BOOL DOSVM_RawRead( BYTE, DWORD, DWORD, BYTE *, BOOL );
void WINAPI DOSVM_Int25Handler( CONTEXT86 * );
/* int26.c */
BOOL DOSVM_RawWrite( BYTE, DWORD, DWORD, BYTE *, BOOL );
void WINAPI DOSVM_Int26Handler( CONTEXT86 * );
/* int29.c */
extern void WINAPI DOSVM_Int29Handler(CONTEXT86*);

112
dlls/winedos/int25.c Normal file
View File

@ -0,0 +1,112 @@
/*
* DOS interrupt 25h handler
*
* Copyright 1997 Andreas Mohr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "msdos.h"
#include "miscemu.h"
#include "drive.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(int);
/***********************************************************************
* DOSVM_RawRead
*
* Read raw sectors from a device.
*/
BOOL DOSVM_RawRead(BYTE drive, DWORD begin, DWORD nr_sect, BYTE *dataptr, BOOL fake_success)
{
int fd;
if ((fd = DRIVE_OpenDevice( drive, O_RDONLY )) != -1)
{
lseek( fd, begin * 512, SEEK_SET );
/* FIXME: check errors */
read( fd, dataptr, nr_sect * 512 );
close( fd );
}
else
{
memset( dataptr, 0, nr_sect * 512 );
if (fake_success)
{
/* FIXME: explain what happens here */
if (begin == 0 && nr_sect > 1) *(dataptr + 512) = 0xf8;
if (begin == 1) *dataptr = 0xf8;
}
else
return FALSE;
}
return TRUE;
}
/**********************************************************************
* DOSVM_Int25Handler (WINEDOS16.137)
*
* Handler for int 25h (absolute disk read).
*/
void WINAPI DOSVM_Int25Handler( CONTEXT86 *context )
{
WCHAR drivespec[4] = {'A', ':', '\\', 0};
BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
DWORD begin;
DWORD length;
drivespec[0] += AL_reg( context );
if (GetDriveTypeW( drivespec ) == DRIVE_NO_ROOT_DIR ||
GetDriveTypeW( drivespec ) == DRIVE_UNKNOWN)
{
SET_CFLAG( context );
SET_AX( context, 0x0201 ); /* unknown unit */
return;
}
if (CX_reg( context ) == 0xffff)
{
begin = *(DWORD *)dataptr;
length = *(WORD *)(dataptr + 4);
dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
*(WORD *)(dataptr + 8),
*(DWORD *)(dataptr + 6) );
}
else
{
begin = DX_reg( context );
length = CX_reg( context );
}
TRACE( "abs diskread, drive %d, sector %ld, "
"count %ld, buffer %p\n",
AL_reg( context ), begin, length, dataptr );
DOSVM_RawRead( AL_reg( context ), begin, length, dataptr, TRUE );
RESET_CFLAG( context );
}

101
dlls/winedos/int26.c Normal file
View File

@ -0,0 +1,101 @@
/*
* DOS interrupt 26h handler
*
* Copyright 1997 Andreas Mohr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "msdos.h"
#include "miscemu.h"
#include "drive.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(int);
/***********************************************************************
* DOSVM_RawWrite
*
* Write raw sectors to a device.
*/
BOOL DOSVM_RawWrite(BYTE drive, DWORD begin, DWORD nr_sect, BYTE *dataptr, BOOL fake_success)
{
int fd;
if ((fd = DRIVE_OpenDevice( drive, O_RDONLY )) != -1)
{
lseek( fd, begin * 512, SEEK_SET );
/* FIXME: check errors */
write( fd, dataptr, nr_sect * 512 );
close( fd );
}
else if (!fake_success)
return FALSE;
return TRUE;
}
/**********************************************************************
* DOSVM_Int26Handler (WINEDOS16.138)
*
* Handler for int 26h (absolute disk read).
*/
void WINAPI DOSVM_Int26Handler( CONTEXT86 *context )
{
WCHAR drivespec[4] = {'A', ':', '\\', 0};
BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
DWORD begin;
DWORD length;
drivespec[0] += AL_reg( context );
if (GetDriveTypeW( drivespec ) == DRIVE_NO_ROOT_DIR ||
GetDriveTypeW( drivespec ) == DRIVE_UNKNOWN)
{
SET_CFLAG( context );
SET_AX( context, 0x0201 ); /* unknown unit */
return;
}
if (CX_reg( context ) == 0xffff)
{
begin = *(DWORD *)dataptr;
length = *(WORD *)(dataptr + 4);
dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
*(WORD *)(dataptr + 8),
*(DWORD *)(dataptr + 6) );
}
else
{
begin = DX_reg( context );
length = CX_reg( context );
}
TRACE( "abs diskwrite, drive %d, sector %ld, "
"count %ld, buffer %p\n",
AL_reg( context ), begin, length, dataptr );
DOSVM_RawWrite( AL_reg( context ), begin, length, dataptr, TRUE );
RESET_CFLAG( context );
}

View File

@ -24,17 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(int);
/***********************************************************************
* DOSVM_Int25Handler (WINEDOS16.137)
* DOSVM_Int26Handler (WINEDOS16.138)
*
* FIXME: Interrupt handlers for interrupts implemented in other DLLs.
* These functions should be removed when the interrupt handlers have
* been moved to winedos.
*/
void WINAPI DOSVM_Int25Handler( CONTEXT86 *context ) { INT_Int25Handler(context); }
void WINAPI DOSVM_Int26Handler( CONTEXT86 *context ) { INT_Int26Handler(context); }
static FARPROC16 DOSVM_Vectors16[256];
static FARPROC48 DOSVM_Vectors48[256];
static const INTPROC DOSVM_VectorsBuiltin[] =

View File

@ -175,6 +175,7 @@ struct DPMI_segments
WORD int48_sel;
};
/* msdos/dosmem.c */
extern struct DPMI_segments DOSMEM_dpmi_segments;
extern const struct DPMI_segments *DOSMEM_GetDPMISegments(void);
@ -196,17 +197,10 @@ extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
extern DWORD IO_inport( int port, int count );
extern void IO_outport( int port, int count, DWORD value );
/* msdos/int25.c */
extern void WINAPI INT_Int25Handler(CONTEXT86*);
/* msdos/int26.c */
extern void WINAPI INT_Int26Handler(CONTEXT86*);
/* msdos/dpmi.c */
extern BOOL DPMI_LoadDosSystem(void);
/* misc/ppdev.c */
extern BOOL IO_pp_outp(int port, DWORD* res);
extern int IO_pp_inp(int port, DWORD* res);
extern char IO_pp_init(void);

View File

@ -1,72 +0,0 @@
/*
* DOS interrupt 25h handler
*
* Copyright 1997 Andreas Mohr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "msdos.h"
#include "miscemu.h"
#include "drive.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(int);
/**********************************************************************
* INT_Int25Handler (WPROCS.137)
*
* Handler for int 25h (absolute disk read).
*/
void WINAPI INT_Int25Handler( CONTEXT86 *context )
{
BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
DWORD begin, length;
if (!DRIVE_IsValid(LOBYTE(context->Eax)))
{
SET_CFLAG(context);
SET_AX( context, 0x0201 ); /* unknown unit */
return;
}
if (LOWORD(context->Ecx) == 0xffff)
{
begin = *(DWORD *)dataptr;
length = *(WORD *)(dataptr + 4);
dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
*(WORD *)(dataptr + 8), *(DWORD *)(dataptr + 6) );
}
else
{
begin = LOWORD(context->Edx);
length = LOWORD(context->Ecx);
}
TRACE("int25: abs diskread, drive %d, sector %ld, "
"count %ld, buffer %p\n",
LOBYTE(context->Eax), begin, length, dataptr);
DRIVE_RawRead(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
RESET_CFLAG(context);
}

View File

@ -1,71 +0,0 @@
/*
* DOS interrupt 26h handler
*
* Copyright 1997 Andreas Mohr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "msdos.h"
#include "miscemu.h"
#include "drive.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(int);
/**********************************************************************
* INT_Int26Handler (WPROCS.138)
*
* Handler for int 26h (absolute disk read).
*/
void WINAPI INT_Int26Handler( CONTEXT86 *context )
{
BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
DWORD begin, length;
if (!DRIVE_IsValid(LOBYTE(context->Eax)))
{
SET_CFLAG(context);
SET_AX( context, 0x0201 ); /* unknown unit */
return;
}
if (LOWORD(context->Ecx) == 0xffff)
{
begin = *(DWORD *)dataptr;
length = *(WORD *)(dataptr + 4);
dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
*(WORD *)(dataptr + 8), *(DWORD *)(dataptr + 6) );
}
else
{
begin = LOWORD(context->Edx);
length = LOWORD(context->Ecx);
}
TRACE("int26: abs diskwrite, drive %d, sector %ld, "
"count %ld, buffer %p\n",
AL_reg(context), begin, length, dataptr );
DRIVE_RawWrite(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
RESET_CFLAG(context);
}