Commit 526b2452 authored by Alexandre Julliard's avatar Alexandre Julliard

krnl386: Remove support for vm86 contexts.

parent ed6bdb3c
......@@ -84,8 +84,7 @@ extern struct DPMI_segments *DOSVM_dpmi_segments DECLSPEC_HIDDEN;
* segmented mode is recognized by checking whether 'seg' is 32-bit
* selector which is neither system selector nor zero.
*/
#define CTX_SEG_OFF_TO_LIN(context,seg,off) \
(ISV86(context) ? PTR_REAL_TO_LIN((seg),(off)) : wine_ldt_get_ptr((seg),(off)))
#define CTX_SEG_OFF_TO_LIN(context,seg,off) (wine_ldt_get_ptr((seg),(off)))
#define INT_BARF(context,num) \
ERR( "int%x: unknown/not implemented parameters:\n" \
......@@ -122,7 +121,6 @@ extern struct DPMI_segments *DOSVM_dpmi_segments DECLSPEC_HIDDEN;
#define RESET_CFLAG(context) ((context)->EFlags &= ~0x0001)
#define SET_ZFLAG(context) ((context)->EFlags |= 0x0040)
#define RESET_ZFLAG(context) ((context)->EFlags &= ~0x0040)
#define ISV86(context) ((context)->EFlags & 0x00020000)
#define SET_AX(context,val) ((void)((context)->Eax = ((context)->Eax & ~0xffff) | (WORD)(val)))
#define SET_BX(context,val) ((void)((context)->Ebx = ((context)->Ebx & ~0xffff) | (WORD)(val)))
......@@ -220,7 +218,7 @@ typedef struct
/* dosvm.c */
extern void DOSVM_Exit( WORD retval ) DECLSPEC_HIDDEN;
extern LPVOID DOSVM_AllocDataUMB(DWORD, WORD *, WORD *) DECLSPEC_HIDDEN;
extern LPVOID DOSVM_AllocDataUMB(DWORD, WORD *) DECLSPEC_HIDDEN;
extern void DOSVM_InitSegments(void) DECLSPEC_HIDDEN;
/* dma.c */
......
......@@ -175,17 +175,11 @@ static LPVOID DOSVM_AllocCodeUMB( DWORD size, WORD *selector )
* Initializes real mode segment and 16-bit protected mode selector
* for the allocated data block.
*/
LPVOID DOSVM_AllocDataUMB( DWORD size, WORD *segment, WORD *selector )
LPVOID DOSVM_AllocDataUMB( DWORD size, WORD *selector )
{
LPVOID ptr = DOSVM_AllocUMB( size );
if (segment)
*segment = (DWORD)ptr >> 4;
if (selector)
LPVOID ptr = DOSVM_AllocUMB( size );
*selector = alloc_selector( ptr, size, WINE_LDT_FLAGS_DATA );
return ptr;
return ptr;
}
......@@ -241,8 +235,7 @@ void DOSVM_InitSegments(void)
/*
* Space for 16-bit stack used by relay code.
*/
ptr = DOSVM_AllocDataUMB( DOSVM_RELAY_DATA_SIZE,
0, &DOSVM_dpmi_segments->relay_data_sel);
ptr = DOSVM_AllocDataUMB( DOSVM_RELAY_DATA_SIZE, &DOSVM_dpmi_segments->relay_data_sel);
memset( ptr, 0, DOSVM_RELAY_DATA_SIZE );
/*
......
......@@ -230,9 +230,6 @@ static void FPU_ModifyCode(CONTEXT *context, BYTE Opcode)
code[-2] = 0x9b; /* The fwait instruction */
code[-1] = Opcode; /* Insert the opcode */
if ( ISV86(context) && LOWORD(context->Eip) < 2 )
FIXME("Backed up over a real mode segment boundary in FPU code.\n");
context->Eip -= 2; /* back up the return address 2 bytes */
TRACE("Modified code in FPU int call to 0x9b 0x%x\n",Opcode);
......
......@@ -42,11 +42,10 @@ WINE_DECLARE_DEBUG_CHANNEL(io);
#define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
#define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
#define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
#define ISV86(context) ((context)->EFlags & 0x00020000)
static inline void add_stack( CONTEXT *context, int offset )
{
if (ISV86(context) || !IS_SELECTOR_32BIT(context->SegSs))
if (!IS_SELECTOR_32BIT(context->SegSs))
ADD_LOWORD( context->Esp, offset );
else
context->Esp += offset;
......@@ -54,7 +53,6 @@ static inline void add_stack( CONTEXT *context, int offset )
static inline void *make_ptr( CONTEXT *context, DWORD seg, DWORD off, int long_addr )
{
if (ISV86(context)) return (void *)((seg << 4) + LOWORD(off));
if (wine_ldt_is_system(seg)) return (void *)off;
if (!long_addr) off = LOWORD(off);
return (char *) MapSL( MAKESEGPTR( seg, 0 ) ) + off;
......@@ -62,7 +60,6 @@ static inline void *make_ptr( CONTEXT *context, DWORD seg, DWORD off, int long_a
static inline void *get_stack( CONTEXT *context )
{
if (ISV86(context)) return (void *)((context->SegSs << 4) + LOWORD(context->Esp));
return wine_ldt_get_ptr( context->SegSs, context->Esp );
}
......@@ -444,7 +441,7 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
int prefix, segprefix, prefixlen, len, repX, long_op, long_addr;
BYTE *instr;
long_op = long_addr = (!ISV86(context) && IS_SELECTOR_32BIT(context->SegCs));
long_op = long_addr = IS_SELECTOR_32BIT(context->SegCs);
instr = make_ptr( context, context->SegCs, context->Eip, TRUE );
if (!instr) return ExceptionContinueSearch;
......
......@@ -97,12 +97,6 @@ void WINAPI DOSVM_Int15Handler( CONTEXT *context )
break;
case 0xc0: /* GET CONFIGURATION */
if (ISV86(context))
{
/* real mode segment */
context->SegEs = 0xf000;
}
else
{
/* KERNEL.194: __F000H - protected mode selector */
FARPROC16 proc = GetProcAddress16( GetModuleHandle16("KERNEL"),
......
......@@ -137,7 +137,6 @@ typedef struct _INT21_HEAP {
BYTE dbcs_table[16]; /* Start/end bytes for N ranges and 00/00 as terminator */
BYTE misc_indos; /* Interrupt 21 nesting flag */
WORD misc_segment; /* Real mode segment for INT21_HEAP */
WORD misc_selector; /* Protected mode selector for INT21_HEAP */
INT21_DPB misc_dpb_list[MAX_DOS_DRIVES]; /* Drive parameter blocks for all drives */
......@@ -523,14 +522,9 @@ static INT21_HEAP *INT21_GetHeapPointer( void )
if (!heap_pointer)
{
WORD heap_segment;
WORD heap_selector;
heap_pointer = DOSVM_AllocDataUMB( sizeof(INT21_HEAP),
&heap_segment,
&heap_selector );
heap_pointer->misc_segment = heap_segment;
heap_pointer = DOSVM_AllocDataUMB( sizeof(INT21_HEAP), &heap_selector );
heap_pointer->misc_selector = heap_selector;
INT21_FillHeap( heap_pointer );
}
......@@ -548,11 +542,7 @@ static INT21_HEAP *INT21_GetHeapPointer( void )
static WORD INT21_GetHeapSelector( CONTEXT *context )
{
INT21_HEAP *heap = INT21_GetHeapPointer();
if (!ISV86(context))
return heap->misc_selector;
else
return heap->misc_segment;
return heap->misc_selector;
}
......@@ -2278,14 +2268,7 @@ static void INT21_GetPSP( CONTEXT *context )
{
TRACE( "GET CURRENT PSP ADDRESS (%02x)\n", AH_reg(context) );
/*
* FIXME: should we return the original DOS PSP upon
* Windows startup ?
*/
if (!ISV86(context))
SET_BX( context, LOWORD(GetCurrentPDB16()) );
else
SET_BX( context, DOSVM_psp );
SET_BX( context, LOWORD(GetCurrentPDB16()) );
}
static inline void setword( BYTE *ptr, WORD w )
......@@ -4734,16 +4717,9 @@ void WINAPI DOSVM_Int21Handler( CONTEXT *context )
case 0x48: /* ALLOCATE MEMORY */
TRACE( "ALLOCATE MEMORY for %d paragraphs\n", BX_reg(context) );
{
WORD selector = 0;
DWORD bytes = (DWORD)BX_reg(context) << 4;
if (!ISV86(context))
{
DWORD rv = GlobalDOSAlloc16( bytes );
selector = LOWORD( rv );
}
else
DOSMEM_AllocBlock( bytes, &selector );
DWORD rv = GlobalDOSAlloc16( bytes );
WORD selector = LOWORD( rv );
if (selector)
{
......@@ -4762,20 +4738,11 @@ void WINAPI DOSVM_Int21Handler( CONTEXT *context )
case 0x49: /* FREE MEMORY */
TRACE( "FREE MEMORY segment %04X\n", context->SegEs );
{
BOOL ok;
if (!ISV86(context))
{
ok = !GlobalDOSFree16( context->SegEs );
BOOL ok = !GlobalDOSFree16( context->SegEs );
/* If we don't reset ES_reg, we will fail in the relay code */
if (ok)
context->SegEs = 0;
}
/* If we don't reset ES_reg, we will fail in the relay code */
if (ok) context->SegEs = 0;
else
ok = DOSMEM_FreeBlock( PTR_REAL_TO_LIN(context->SegEs, 0) );
if (!ok)
{
TRACE("FREE MEMORY failed\n");
SET_CFLAG(context);
......@@ -4788,31 +4755,8 @@ void WINAPI DOSVM_Int21Handler( CONTEXT *context )
TRACE( "RESIZE MEMORY segment %04X to %d paragraphs\n",
context->SegEs, BX_reg(context) );
{
DWORD newsize = (DWORD)BX_reg(context) << 4;
if (!ISV86(context))
{
FIXME( "Resize memory block - unsupported under Win16\n" );
SET_CFLAG(context);
}
else
{
LPVOID address = (void*)(context->SegEs << 4);
UINT blocksize = DOSMEM_ResizeBlock( address, newsize, FALSE );
RESET_CFLAG(context);
if (blocksize == (UINT)-1)
{
SET_CFLAG( context );
SET_AX( context, 0x0009 ); /* illegal address */
}
else if(blocksize != newsize)
{
SET_CFLAG( context );
SET_AX( context, 0x0008 ); /* insufficient memory */
SET_BX( context, blocksize >> 4 ); /* new block size */
}
}
FIXME( "Resize memory block - unsupported under Win16\n" );
SET_CFLAG(context);
}
break;
......
......@@ -53,7 +53,6 @@ typedef struct
typedef struct
{
CDROM_DEVICE_HEADER hdr;
WORD cdrom_segment; /* Real mode segment for CDROM_HEAP */
WORD cdrom_selector; /* Protected mode selector for CDROM_HEAP */
} CDROM_HEAP;
......@@ -402,48 +401,6 @@ static void do_int2f_16( CONTEXT *context )
*/
#define PTR_AT(_ptr, _ofs, _typ) (*((_typ*)(((char*)_ptr)+(_ofs))))
/* Use #if 1 if you want full int 2f debug... normal users can leave it at 0 */
#if 0
/**********************************************************************
* MSCDEX_Dump [internal]
*
* Dumps mscdex requests to int debug channel.
*/
static void MSCDEX_Dump(char* pfx, BYTE* req, int dorealmode)
{
int i;
BYTE buf[2048];
BYTE* ptr;
BYTE* ios;
ptr = buf;
ptr += sprintf(ptr, "%s\tCommand => ", pfx);
for (i = 0; i < req[0]; i++) {
ptr += sprintf(ptr, "%02x ", req[i]);
}
switch (req[2]) {
case 3:
case 12:
ptr += sprintf(ptr, "\n\t\t\t\tIO_struct => ");
ios = (dorealmode) ? PTR_REAL_TO_LIN( PTR_AT(req, 16, WORD), PTR_AT(req, 14, WORD)) :
MapSL(MAKESEGPTR(PTR_AT(req, 16, WORD), PTR_AT(req, 14, WORD)));
for (i = 0; i < PTR_AT(req, 18, WORD); i++) {
ptr += sprintf(ptr, "%02x ", ios[i]);
if ((i & 0x1F) == 0x1F) {
*ptr++ = '\n';
*ptr = 0;
}
}
break;
}
TRACE("%s\n", buf);
}
#else
#define MSCDEX_Dump(pfx, req, drm)
#endif
#define CDFRAMES_PERSEC 75
#define CDFRAMES_PERMIN (CDFRAMES_PERSEC * 60)
#define FRAME_OF_ADDR(a) ((a)[1] * CDFRAMES_PERMIN + (a)[2] * CDFRAMES_PERSEC + (a)[3])
......@@ -502,15 +459,10 @@ static CDROM_HEAP *CDROM_GetHeap( void )
if ( !heap_pointer )
{
WORD heap_segment;
WORD heap_selector;
/* allocate a new DOS data segment */
heap_pointer = DOSVM_AllocDataUMB( sizeof(CDROM_HEAP),
&heap_segment,
&heap_selector );
heap_pointer->cdrom_segment = heap_segment;
heap_pointer = DOSVM_AllocDataUMB( sizeof(CDROM_HEAP), &heap_selector );
heap_pointer->cdrom_selector = heap_selector;
CDROM_FillHeap( heap_pointer );
}
......@@ -518,7 +470,7 @@ static CDROM_HEAP *CDROM_GetHeap( void )
return heap_pointer;
}
static void MSCDEX_Request(BYTE *driver_request, BOOL dorealmode)
static void MSCDEX_Request(BYTE *driver_request)
{
BYTE* io_stru;
BYTE Error = 255; /* No Error */
......@@ -536,8 +488,6 @@ static void MSCDEX_Request(BYTE *driver_request, BOOL dorealmode)
*/
TRACE("CDROM device driver -> command <%d>\n", driver_request[2]);
MSCDEX_Dump("Beg", driver_request, dorealmode);
/* set status to 0 */
PTR_AT(driver_request, 3, WORD) = 0;
devName[4] = 'A' + CDROM_GetHeap()->hdr.drive + driver_request[1];
......@@ -575,9 +525,7 @@ static void MSCDEX_Request(BYTE *driver_request, BOOL dorealmode)
switch (driver_request[2]) {
case 3:
io_stru = (dorealmode) ?
PTR_REAL_TO_LIN( PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD) ) :
MapSL( MAKESEGPTR(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)));
io_stru = MapSL( MAKESEGPTR(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)));
TRACE(" --> IOCTL INPUT <%d>\n", io_stru[0]);
switch (io_stru[0]) {
......@@ -743,9 +691,7 @@ static void MSCDEX_Request(BYTE *driver_request, BOOL dorealmode)
break;
case 12:
io_stru = (dorealmode) ?
PTR_REAL_TO_LIN( PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)) :
MapSL( MAKESEGPTR(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)));
io_stru = MapSL( MAKESEGPTR(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)));
TRACE(" --> IOCTL OUTPUT <%d>\n", io_stru[0]);
switch (io_stru[0]) {
......@@ -924,8 +870,6 @@ static void MSCDEX_Request(BYTE *driver_request, BOOL dorealmode)
*/
driver_request[4] |=
(data.CurrentPosition.Header.AudioStatus == AUDIO_STATUS_IN_PROGRESS) ? 3 : 1;
MSCDEX_Dump("End", driver_request, dorealmode);
}
static void MSCDEX_Handler(CONTEXT* context)
......@@ -952,11 +896,7 @@ static void MSCDEX_Handler(CONTEXT* context)
{
CDROM_HEAP* cdrom_heap = CDROM_GetHeap();
CDROM_DEVICE_HEADER* dev = &cdrom_heap->hdr;
SEGPTR ptr_dev = ISV86(context)
? MAKESEGPTR( cdrom_heap->cdrom_segment,
FIELD_OFFSET(CDROM_HEAP, hdr) )
: MAKESEGPTR( cdrom_heap->cdrom_selector,
FIELD_OFFSET(CDROM_HEAP, hdr) );
SEGPTR ptr_dev = MAKESEGPTR( cdrom_heap->cdrom_selector, FIELD_OFFSET(CDROM_HEAP, hdr) );
p = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx);
for (drive = 0; drive < dev->units; drive++) {
......@@ -1013,7 +953,7 @@ static void MSCDEX_Handler(CONTEXT* context)
}
driver_request[1] = CX_reg(context) - cdrom_heap->hdr.drive;
MSCDEX_Request(driver_request, ISV86(context));
MSCDEX_Request(driver_request);
}
break;
default:
......
......@@ -673,40 +673,26 @@ static void WINAPI DOSVM_Int2aHandler( CONTEXT *context )
*/
static void WINAPI DOSVM_Int41Handler( CONTEXT *context )
{
if ( ISV86(context) )
switch ( AX_reg(context) )
{
/* Real-mode debugger services */
switch ( AX_reg(context) )
{
default:
INT_BARF( context, 0x41 );
break;
}
}
else
{
/* Protected-mode debugger services */
switch ( AX_reg(context) )
{
case 0x4f:
case 0x50:
case 0x150:
case 0x51:
case 0x52:
case 0x152:
case 0x59:
case 0x5a:
case 0x5b:
case 0x5c:
case 0x5d:
/* Notifies the debugger of a lot of stuff. We simply ignore it
for now, but some of the info might actually be useful ... */
break;
case 0x4f:
case 0x50:
case 0x150:
case 0x51:
case 0x52:
case 0x152:
case 0x59:
case 0x5a:
case 0x5b:
case 0x5c:
case 0x5d:
/* Notifies the debugger of a lot of stuff. We simply ignore it
for now, but some of the info might actually be useful ... */
break;
default:
INT_BARF( context, 0x41 );
break;
}
default:
INT_BARF( context, 0x41 );
break;
}
}
......
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