blob: 4abf2e13b9d6cbad96f319b51dc45760b13988f3 [file] [log] [blame]
Alexandre Julliard9ea19e51997-01-01 17:29:55 +00001/*
2 * Interrupt vectors emulation
3 *
4 * Copyright 1995 Alexandre Julliard
5 */
6
7#include <sys/types.h>
Jim Aston2e1cafa1999-03-14 16:35:05 +00008#include "windef.h"
Alexandre Julliard4324b472000-06-03 04:52:14 +00009#include "wine/winbase16.h"
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000010#include "miscemu.h"
11#include "msdos.h"
Alexandre Julliard4324b472000-06-03 04:52:14 +000012#include "module.h"
Alexandre Julliard61fece01999-06-26 19:09:08 +000013#include "debugtools.h"
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000014
Alexandre Julliard4324b472000-06-03 04:52:14 +000015DEFAULT_DEBUG_CHANNEL(int);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000016
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000017static FARPROC16 INT_Vectors[256];
18
Alexandre Julliard4324b472000-06-03 04:52:14 +000019/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
20#define FIRST_INTERRUPT 100
21
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000022
23/**********************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000024 * INT_GetPMHandler
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000025 *
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000026 * Return the protected mode interrupt vector for a given interrupt.
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000027 */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000028FARPROC16 INT_GetPMHandler( BYTE intnum )
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000029{
Alexandre Julliard4324b472000-06-03 04:52:14 +000030 if (!INT_Vectors[intnum])
31 {
32 static HMODULE16 wprocs;
33 if (!wprocs)
34 {
Alexandre Julliard7afce0e2000-12-01 21:25:31 +000035 if (((wprocs = GetModuleHandle16( "wprocs" )) < 32) &&
36 ((wprocs = LoadLibrary16( "wprocs" )) < 32))
Alexandre Julliard4324b472000-06-03 04:52:14 +000037 {
38 ERR("could not load wprocs.dll\n");
39 return 0;
40 }
41 }
Alexandre Julliard7afce0e2000-12-01 21:25:31 +000042 if (!(INT_Vectors[intnum] = GetProcAddress16( wprocs, (LPCSTR)(FIRST_INTERRUPT + intnum))))
43 {
44 WARN("int%x not implemented, returning dummy handler\n", intnum );
45 INT_Vectors[intnum] = GetProcAddress16( wprocs, (LPCSTR)(FIRST_INTERRUPT + 256) );
46 }
Alexandre Julliard4324b472000-06-03 04:52:14 +000047 }
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000048 return INT_Vectors[intnum];
49}
50
51
52/**********************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000053 * INT_SetPMHandler
54 *
55 * Set the protected mode interrupt handler for a given interrupt.
56 */
57void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
58{
Alexandre Julliard61fece01999-06-26 19:09:08 +000059 TRACE("Set protected mode interrupt vector %02x <- %04x:%04x\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000060 intnum, HIWORD(handler), LOWORD(handler) );
61 INT_Vectors[intnum] = handler;
62}
63
64
65/**********************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +000066 * INT_DefaultHandler (WPROCS.356)
Alexandre Julliard7afce0e2000-12-01 21:25:31 +000067 *
68 * Default interrupt handler.
69 */
70void WINAPI INT_DefaultHandler( CONTEXT86 *context )
71{
72}