Commit 35462902 authored by Jukka Heinonen's avatar Jukka Heinonen Committed by Alexandre Julliard

Moved handlers for int25 and int26 to winedos.

parent 96ad51b3
......@@ -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
......
......@@ -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 \
......
......@@ -28,6 +28,8 @@ C_SRCS = \
int1a.c \
int20.c \
int21.c \
int25.c \
int26.c \
int29.c \
int2a.c \
int2f.c \
......
......@@ -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*);
......
......@@ -34,39 +34,79 @@
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;
}
/**********************************************************************
* INT_Int25Handler (WPROCS.137)
* DOSVM_Int25Handler (WINEDOS16.137)
*
* Handler for int 25h (absolute disk read).
*/
void WINAPI INT_Int25Handler( CONTEXT86 *context )
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, length;
DWORD begin;
DWORD length;
drivespec[0] += AL_reg( context );
if (!DRIVE_IsValid(LOBYTE(context->Eax)))
if (GetDriveTypeW( drivespec ) == DRIVE_NO_ROOT_DIR ||
GetDriveTypeW( drivespec ) == DRIVE_UNKNOWN)
{
SET_CFLAG(context);
SET_AX( context, 0x0201 ); /* unknown unit */
SET_CFLAG( context );
SET_AX( context, 0x0201 ); /* unknown unit */
return;
}
if (LOWORD(context->Ecx) == 0xffff)
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) );
*(WORD *)(dataptr + 8),
*(DWORD *)(dataptr + 6) );
}
else
{
begin = LOWORD(context->Edx);
length = LOWORD(context->Ecx);
begin = DX_reg( context );
length = CX_reg( context );
}
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);
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 );
}
......@@ -32,40 +32,70 @@
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;
}
/**********************************************************************
* INT_Int26Handler (WPROCS.138)
* DOSVM_Int26Handler (WINEDOS16.138)
*
* Handler for int 26h (absolute disk read).
*/
void WINAPI INT_Int26Handler( CONTEXT86 *context )
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, length;
DWORD begin;
DWORD length;
drivespec[0] += AL_reg( context );
if (!DRIVE_IsValid(LOBYTE(context->Eax)))
if (GetDriveTypeW( drivespec ) == DRIVE_NO_ROOT_DIR ||
GetDriveTypeW( drivespec ) == DRIVE_UNKNOWN)
{
SET_CFLAG(context);
SET_AX( context, 0x0201 ); /* unknown unit */
SET_CFLAG( context );
SET_AX( context, 0x0201 ); /* unknown unit */
return;
}
if (LOWORD(context->Ecx) == 0xffff)
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) );
*(WORD *)(dataptr + 8),
*(DWORD *)(dataptr + 6) );
}
else
{
begin = LOWORD(context->Edx);
length = LOWORD(context->Ecx);
begin = DX_reg( context );
length = CX_reg( context );
}
TRACE("int26: abs diskwrite, drive %d, sector %ld, "
"count %ld, buffer %p\n",
AL_reg(context), begin, length, dataptr );
TRACE( "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);
DOSVM_RawWrite( AL_reg( context ), begin, length, dataptr, TRUE );
RESET_CFLAG( context );
}
......@@ -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[] =
......
......@@ -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);
......
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