mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
ded3038c1c
Wed Jul 5 19:06:35 1995 Alexandre Julliard <julliard@sunsite.unc.edu> * [controls/scroll.c] Fixed drawing bug that caused part of a non-client scroll bar to be painted even when the scroll-bar was hidden. * [debugger/break.c] [debugger/dbg.y] Rewrote breakpoint handling to work in 16-bit mode. Implemented single-stepping ('step' and 'next' instructions). * [debugger/debug.l] Format specifier is now a separate token. Entering an empty line at the debugger prompt causes the previous command to be repeated, like under gdb. * [debugger/debug.l] [debugger/registers.c] Differentiate 16-bit and 32-bit registers without taking current mode into account ($eax is always 32-bit, $ax always 16-bit). * [debugger/stack.c] Fixed stack information routines to differentiate between 16-bit and 32-bit stacks. * [loader/task.c] Option -debug now sets a breakpoint at the first instruction of every loaded task. * [miscemu/instr.c] Added handling of lock, repe and repne prefixes. * [objects/dib.c] Changed StretchDIBits() to do the correct thing, even if it's still not really optimal. * [windows/graphics.c] Fixes in RoundRect(), thanks to Babak Masalehdan. * [windows/message.c] Tried to fix mouse event handling with respect to disabled windows. * [windows/painting.c] Clear WIN_NEEDS_NCPAINT flag before sending WM_NCPAINT to avoid infinite loops. * [windows/win.c] Fixed IsWindowVisible() to return FALSE when one of the parent windows is hidden. Sat Jul 1 22:08:21 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/compobj.spec][misc/compobj.c] CoGetMalloc: New function Added relay entries for COMPOBJ ordinals above 100 CoInitialize: Changed parameter to DWORD * [if1632/ole2.spec] Exported implementation of OleBuildVersion * [if1632/ole2disp.spec][misc/ole2disp.c][misc/Imakefile] ole2disp.c: New file SysAllocString, SysReallocString, SysAllocStringLen, SysReAllocStringLen, SysFreeString, SysStringLen: new functions * [if1632/ole2nls.spec][include/winnls.h][misc/ole2nls.c] CompareStringA: New function Thu Jun 29 19:42:02 1995 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de> * [objects/font.c] [if1632/gdi.spec] New stubs for CreateScalableFontResource, GetGlyphOutline. Thu Jun 29 13:47:08 GMT 1995 Göran Thyni (goran@norrsken.bildbasen.se) * [misc/commdlg.c] Extensive changes and bug fixes to FileDialog handling, behaves more like native Windows. Wed Jun 28 13:04:44 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] [controls/combo.c] Some minor optimizations. * [memory/local.c] LOCAL_FindFreeBlock(): Never use the last one. * [memory/global.c] GlobalReAlloc(): GMEM_MODIFY must not be ignored when size==0. * [misc/file.c] read() returns an error when length==0. This is not what Windows programs expect, so pay attention to this in _lread(). Changed this in _lwrite(), _hread(), _hwrite(), too. * [loader/resource.c] LoadIcon(): Ignore bih->biSizeImage, some icons have wrong values in there. * [if1632/shell.spec] [misc/shell.c] Wrong spec file entries caused havoc: HKEY has 32 bit, not 16. Accept some more combinations of parameters in the Reg..() functions. * [if1632/toolhelp.spec] Make InterruptRegister() and InterruptUnregister() return false. * [windows/hook.c] CallNextHookEx() used to crash when called with a null hhook. Fixed. Wed Jun 28 10:14:34 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [include/neexe.h][loader/ne_image.c] NE_LoadSegment: Detect iterated segments * [misc/ole2nls.c] LOCALE_SLONGDATE: fixed typo * [miscemu/int5c.c] Reordered include files to avoid conflicts with Linux libc.5.1 * [rc/winerc.c] Added -b option to process binary resource files into C arrays * [include/callback.h] CallWndProc: Added dummy ds parameter for libwine * [include/gdi.h][include/user.h] USER_HEAP_ALLOC, GDI_HEAP_ALLOC: dropped flags parameter * [include/ldt.h][include/stackframe.h] defined segment conversion macros for libwine * [misc/atom.c] Defined USER_HeapSel for libwine * [misc/main.c] Disable -dll option for libwine * [misc/user.c] removed GetFreeSystemResources, SystemHeapInfo from libwine for now * [toolkit/heap.c] fixed LocalLock prototype * [toolkit/sup.c] sync'ed load_mz_header, load_ne_header with structures * [toolkit/winmain.c] Disabled resource DLLs for libwine for now Mon Jun 26 19:30:24 1995 Hans de Graaff (graaff@twi72.twi.tudelft.nl) * [misc/main.c] Fixed -enhanced option to report a 386 CPU instead of a 286. Fri Jun 23 23:18:25 1995 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de> * [misc/dos_fs.c] Remove maximum open dosdirent limit (fixing the winfile.exe problem) by using telldir()/seekdir(). Fri Jun 23 13:42:25 1995 Hans de Graaff (graaff@twi72.twi.tudelft.nl) * [misc/profile.c] Fixed problem parsing empty lines within sections in .ini files.
207 lines
5.1 KiB
C
207 lines
5.1 KiB
C
/*
|
|
* Emulation of priviledged instructions
|
|
*
|
|
* Copyright 1995 Alexandre Julliard
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "windows.h"
|
|
#include "dos_fs.h"
|
|
#include "ldt.h"
|
|
#include "miscemu.h"
|
|
#include "registers.h"
|
|
|
|
|
|
static int do_int(int intnum, struct sigcontext_struct *context)
|
|
{
|
|
switch(intnum)
|
|
{
|
|
case 0x10: return do_int10(context);
|
|
|
|
case 0x11:
|
|
AX = DOS_GetEquipment();
|
|
return 1;
|
|
|
|
case 0x12:
|
|
AX = 640;
|
|
return 1; /* get base mem size */
|
|
|
|
case 0x13: return do_int13(context);
|
|
case 0x15: return do_int15(context);
|
|
case 0x16: return do_int16(context);
|
|
case 0x1a: return do_int1a(context);
|
|
case 0x21: return do_int21(context);
|
|
|
|
case 0x22:
|
|
AX = 0x1234;
|
|
BX = 0x5678;
|
|
CX = 0x9abc;
|
|
DX = 0xdef0;
|
|
return 1;
|
|
|
|
case 0x25: return do_int25(context);
|
|
case 0x26: return do_int26(context);
|
|
case 0x2a: return do_int2a(context);
|
|
case 0x2f: return do_int2f(context);
|
|
case 0x31: return do_int31(context);
|
|
case 0x3d: return 1;
|
|
case 0x5c: return do_int5c(context);
|
|
|
|
default:
|
|
fprintf(stderr,"int%02x: Unimplemented!\n", intnum);
|
|
break;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* INSTR_EmulateInstruction
|
|
*
|
|
* Emulate a priviledged instruction. Returns TRUE if emulation successful.
|
|
*/
|
|
BOOL INSTR_EmulateInstruction( struct sigcontext_struct *context )
|
|
{
|
|
int prefix, segprefix, long_op, long_addr;
|
|
BYTE *instr = (BYTE *) PTR_SEG_OFF_TO_LIN( CS, IP );
|
|
|
|
/* First handle any possible prefix */
|
|
|
|
long_op = long_addr = (GET_SEL_FLAGS(CS) & LDT_FLAGS_32BIT) != 0;
|
|
segprefix = 0; /* no prefix */
|
|
prefix = 1;
|
|
while(prefix)
|
|
{
|
|
switch(*instr)
|
|
{
|
|
case 0x2e:
|
|
segprefix = 1; /* CS */
|
|
break;
|
|
case 0x36:
|
|
segprefix = 2; /* SS */
|
|
break;
|
|
case 0x3e:
|
|
segprefix = 3; /* DS */
|
|
break;
|
|
case 0x26:
|
|
segprefix = 4; /* ES */
|
|
break;
|
|
case 0x64:
|
|
segprefix = 5; /* FS */
|
|
break;
|
|
case 0x65:
|
|
segprefix = 6; /* GS */
|
|
break;
|
|
case 0x66:
|
|
long_op = !long_op; /* opcode size prefix */
|
|
break;
|
|
case 0x67:
|
|
long_addr = !long_addr; /* addr size prefix */
|
|
break;
|
|
case 0xf0: /* lock */
|
|
case 0xf2: /* repne */
|
|
case 0xf3: /* repe */
|
|
break;
|
|
default:
|
|
prefix = 0; /* no more prefixes */
|
|
break;
|
|
}
|
|
if (prefix)
|
|
{
|
|
instr++;
|
|
EIP++;
|
|
}
|
|
}
|
|
|
|
/* Now look at the actual instruction */
|
|
|
|
switch(*instr)
|
|
{
|
|
case 0xcd: /* int <XX> */
|
|
instr++;
|
|
/* FIXME: should check if handler has been changed */
|
|
if (!do_int(*instr, context))
|
|
{
|
|
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
|
|
return FALSE;
|
|
}
|
|
EIP += 2; /* Bypass the int instruction */
|
|
break;
|
|
|
|
case 0xcf: /* iret */
|
|
if (long_op)
|
|
{
|
|
/* FIXME: should check the stack 'big' bit */
|
|
DWORD *stack = (WORD *)PTR_SEG_OFF_TO_LIN( SS, SP );
|
|
EIP = *stack++;
|
|
CS = *stack++;
|
|
EFL = *stack;
|
|
SP += 3*sizeof(DWORD); /* Pop the return address and flags */
|
|
}
|
|
else
|
|
{
|
|
/* FIXME: should check the stack 'big' bit */
|
|
WORD *stack = (WORD *)PTR_SEG_OFF_TO_LIN( SS, SP );
|
|
EIP = *stack++;
|
|
CS = *stack++;
|
|
EFL = (EFL & 0xffff0000) | *stack;
|
|
SP += 3*sizeof(WORD); /* Pop the return address and flags */
|
|
}
|
|
break;
|
|
|
|
case 0xe4: /* inb al,XX */
|
|
inportb_abs(context);
|
|
EIP += 2;
|
|
break;
|
|
|
|
case 0xe5: /* in ax,XX */
|
|
inport_abs( context, long_op );
|
|
EIP += 2;
|
|
break;
|
|
|
|
case 0xe6: /* outb XX,al */
|
|
outportb_abs(context);
|
|
EIP += 2;
|
|
break;
|
|
|
|
case 0xe7: /* out XX,ax */
|
|
outport_abs( context, long_op );
|
|
EIP += 2;
|
|
break;
|
|
|
|
case 0xec: /* inb al,dx */
|
|
inportb(context);
|
|
EIP++;
|
|
break;
|
|
|
|
case 0xed: /* in ax,dx */
|
|
inport( context, long_op );
|
|
EIP++;
|
|
break;
|
|
|
|
case 0xee: /* outb dx,al */
|
|
outportb(context);
|
|
EIP++;
|
|
break;
|
|
|
|
case 0xef: /* out dx,ax */
|
|
outport( context, long_op );
|
|
EIP++;
|
|
break;
|
|
|
|
case 0xfa: /* cli, ignored */
|
|
EIP++;
|
|
break;
|
|
|
|
case 0xfb: /* sti, ignored */
|
|
EIP++;
|
|
break;
|
|
|
|
default:
|
|
fprintf(stderr, "Unexpected Windows program segfault"
|
|
" - opcode = %x\n", *instr);
|
|
return FALSE; /* Unable to emulate it */
|
|
}
|
|
return TRUE;
|
|
}
|