Sweden-Number/miscemu/interrupts.c

191 lines
4.9 KiB
C
Raw Normal View History

Release 950606 Tue Jun 6 12:11:41 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/menu.c] Fixed bug with drawing multi-column menus with vertical separator. * [debugger/debug.l] Fixed NULL-pointer reference after readline(). * [if1632/winprocs.spec] [miscemu/int21.c] [miscemu/interrupts.c] Added interrupt vector emulation. Allows to retrieve an interrupt vector and jump to it without crashing. * [loader/ldt.c] Moved ldt.c to memory directory. * [loader/task.c] Implemented LockCurrentTask() and GetInstanceData(). * [objects/bitblt.c] Fixed a bug that caused StretchBlt() to use wrong colors when stretching a monochrome bitmap to a color display. * [objects/bitmap.c] Fixed a segmented pointer bug in CreateBitmapIndirect(). * [tools/build.c] Added possibility to have arguments for register functions; used by interrupt vectors to remove the flags from the stack. Generate a new function CallTo32_LargeStack(), that allows calling a 32-bit function using the original 32-bit stack, for functions that need more that 64k of stack. Tue May 30 10:29:56 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [if1632/shell.spec] [misc/shell.c] DoEnvironmentSubst: fixed prototype * [if1632/gdi.spec] [objects/palette.c] SetSystemPaletteUse: new function * [if1632/kernel.spec] [loader/resource.c] DirectResAlloc: new function * [if1632/user.spec] [windows/keyboard.c] SetKeyboardState: new function Mon May 29 12:58:28 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [tools/build.c] Prevent interrupts from destroying the args for a 32 bit function by loading the correct value into %esp directly after %ss. * [loader/ne_image.c] [loader/module.c] The new instance must be created earlier in LoadModule(), so that fixups referencing it will be handled correctly. Initialize the local heap for a DGROUP in NE_LoadSegment(). * [objects/dib.c] Like RLE8 bitmaps, RLE4 bitmaps don't always end with a proper code. This used to crash Wine. Fixed. * [objects/text.c] Fix possible null pointer dereference in debugging output. * [misc/commdlg.c] Handle user input in the edit control better. Some bugs fixed. * [memory/local.c] Started implementing moveable blocks. This is unfinished (!), but at least it does not seem to break things. Wed May 24 13:26:36 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [loader/module.c] LoadModule(): DLLs occasionally have a data segment, and they work much better if it is loaded :-) LoadLibrary(): pass HMODULE instead of HINSTANCE to NE_InitializeDLLs. FindModule(): also strip off the last backslash of the pathnames (Winhelp tried to load C:\WINDOWS\SYSTEM\COMMDLG.DLL). GetModuleHandle(): just call MODULE_FindModule, it does the same job, only better. * [loader/ne_image.c] LocalInit() the heap of a DLL in NE_InitDLL. (This is probably not really correct, it seems that all programs and DLLs try to do this themselves. But they pass weird parameters.) NE_InitializeDLLs should also call NE_InitDLL for the passed hModule. * [loader/task.c] [misc/user.c] Finish global initializations in InitTask instead of InitApp, or all the DLLs will be initialized in InitTask without any available window classes!
1995-06-06 18:40:35 +02:00
/*
* Interrupt vectors emulation
*
* Copyright 1995 Alexandre Julliard
*/
#include "windows.h"
#include "miscemu.h"
#include "module.h"
#include "stddebug.h"
#include "debug.h"
static SEGPTR INT_Vectors[256];
/* Ordinal number for interrupt 0 handler in WINPROCS.DLL */
#define FIRST_INTERRUPT_ORDINAL 100
/**********************************************************************
* INT_Init
*/
BOOL INT_Init(void)
{
SEGPTR addr, dummyHandler;
WORD vector;
HMODULE hModule = GetModuleHandle( "WINPROCS" );
dummyHandler = MODULE_GetEntryPoint( hModule, FIRST_INTERRUPT_ORDINAL+256);
for (vector = 0; vector < 256; vector++)
{
addr = MODULE_GetEntryPoint( hModule, FIRST_INTERRUPT_ORDINAL+vector );
INT_Vectors[vector] = addr ? addr : dummyHandler;
}
return TRUE;
}
/**********************************************************************
* INT_GetHandler
*
* Return the interrupt vector for a given interrupt.
*/
SEGPTR INT_GetHandler( BYTE intnum )
{
dprintf_int( stddeb, "Get interrupt vector %02x -> %04x:%04x\n",
intnum, HIWORD(INT_Vectors[intnum]),
LOWORD(INT_Vectors[intnum]) );
return INT_Vectors[intnum];
}
/**********************************************************************
* INT_SetHandler
*
* Set the interrupt handler for a given interrupt.
*/
void INT_SetHandler( BYTE intnum, SEGPTR handler )
{
dprintf_int( stddeb, "Set interrupt vector %02x <- %04x:%04x\n",
intnum, HIWORD(handler), LOWORD(handler) );
INT_Vectors[intnum] = handler;
}
/**********************************************************************
* INT_DummyHandler
*/
void INT_DummyHandler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "Dummy handler called!\n" );
}
/**********************************************************************
* INT_Int10Handler
*/
void INT_Int10Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 10 called indirectly through handler!\n" );
do_int10( &context );
}
/**********************************************************************
* INT_Int13Handler
*/
void INT_Int13Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 13 called indirectly through handler!\n" );
do_int13( &context );
}
/**********************************************************************
* INT_Int15Handler
*/
void INT_Int15Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 15 called indirectly through handler!\n" );
do_int15( &context );
}
/**********************************************************************
* INT_Int16Handler
*/
void INT_Int16Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 16 called indirectly through handler!\n" );
do_int16( &context );
}
/**********************************************************************
* INT_Int1aHandler
*/
void INT_Int1aHandler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 1a called indirectly through handler!\n" );
do_int1a( &context );
}
/**********************************************************************
* INT_Int21Handler
*/
void INT_Int21Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 21 called indirectly through handler!\n" );
do_int21( &context );
}
/**********************************************************************
* INT_Int25Handler
*/
void INT_Int25Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 25 called indirectly through handler!\n" );
do_int25( &context );
}
/**********************************************************************
* INT_Int26Handler
*/
void INT_Int26Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 26 called indirectly through handler!\n" );
do_int26( &context );
}
/**********************************************************************
* INT_Int2aHandler
*/
void INT_Int2aHandler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 2a called indirectly through handler!\n" );
do_int2a( &context );
}
/**********************************************************************
* INT_Int2fHandler
*/
void INT_Int2fHandler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 2f called indirectly through handler!\n" );
do_int2f( &context );
}
/**********************************************************************
* INT_Int31Handler
*/
void INT_Int31Handler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 31 called indirectly through handler!\n" );
do_int31( &context );
}
/**********************************************************************
* INT_Int5cHandler
*/
void INT_Int5cHandler( struct sigcontext_struct context )
{
dprintf_int( stddeb, "int 5c called indirectly through handler!\n" );
do_int5c( &context );
}