Interrupts / Move int25 and int26 to winedos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch moves int25 and int26 to winedos and creates functions
DOSVM_RawRead and DOSVM_RawWrite. The plan is to make int21 use these
functions instead of DRIVE_RawRead and DRIVE_RawWrite. These two
DRIVE_ functions are used only by int25, int26 and int21 handlers.



Changelog:
  Moved handlers for int25 and int26 to winedos.


Files msdos/int25.c and msdos/int26.c can be removed after this patch.



Index: dlls/winedos/interrupts.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/interrupts.c,v
retrieving revision 1.10
diff -u -r1.10 interrupts.c
--- dlls/winedos/interrupts.c	24 Nov 2002 22:34:04 -0000	1.10
+++ dlls/winedos/interrupts.c	26 Nov 2002 19:40:04 -0000
@@ -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[] =




Index: dlls/winedos/dosexe.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v
retrieving revision 1.17
diff -u -r1.17 dosexe.h
--- dlls/winedos/dosexe.h	24 Nov 2002 22:34:04 -0000	1.17
+++ dlls/winedos/dosexe.h	26 Nov 2002 19:40:26 -0000
@@ -148,6 +148,14 @@
 /* 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*);
 




Index: dlls/winedos/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/winedos/Makefile.in,v
retrieving revision 1.19
diff -u -r1.19 Makefile.in
--- dlls/winedos/Makefile.in	24 Nov 2002 22:34:04 -0000	1.19
+++ dlls/winedos/Makefile.in	26 Nov 2002 19:40:38 -0000
@@ -28,6 +28,8 @@
 	int1a.c \
 	int20.c \
 	int21.c \
+	int25.c \
+	int26.c \
 	int29.c \
 	int2a.c \
 	int2f.c \




Index: include/miscemu.h
===================================================================
RCS file: /home/wine/wine/include/miscemu.h,v
retrieving revision 1.60
diff -u -r1.60 miscemu.h
--- include/miscemu.h	24 Nov 2002 22:34:04 -0000	1.60
+++ include/miscemu.h	26 Nov 2002 19:40:48 -0000
@@ -175,6 +175,7 @@
     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 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);




Index: dlls/ntdll/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/Makefile.in,v
retrieving revision 1.47
diff -u -r1.47 Makefile.in
--- dlls/ntdll/Makefile.in	24 Nov 2002 22:34:04 -0000	1.47
+++ dlls/ntdll/Makefile.in	26 Nov 2002 19:40:56 -0000
@@ -51,8 +51,6 @@
 	$(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 \




Index: dlls/kernel/kernel32.spec
===================================================================
RCS file: /home/wine/wine/dlls/kernel/kernel32.spec,v
retrieving revision 1.77
diff -u -r1.77 kernel32.spec
--- dlls/kernel/kernel32.spec	25 Nov 2002 20:51:31 -0000	1.77
+++ dlls/kernel/kernel32.spec	26 Nov 2002 19:41:06 -0000
@@ -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




--- /dev/null	Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int25.c	Tue Nov 26 21:34:39 2002
@@ -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 );
+}




--- /dev/null	Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int26.c	Tue Nov 26 21:33:10 2002
@@ -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 );
+}




-- 
Jukka Heinonen <http://www.iki.fi/jhei/>


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux