Use correct linear pointer when accessing BIOS data area.

This commit is contained in:
Jukka Heinonen 2003-09-30 00:22:12 +00:00 committed by Alexandre Julliard
parent e05044a98d
commit abbcf41325
8 changed files with 31 additions and 12 deletions

View File

@ -219,7 +219,7 @@ static void WINAPI con_interrupt(CONTEXT86*ctx)
{
int *scan;
REQUEST_HEADER *hdr = get_hdr(SYSTEM_STRATEGY_CON,(void **)&scan);
BIOSDATA *bios = BIOS_DATA;
BIOSDATA *bios = DOSVM_BiosData();
WORD CurOfs = bios->NextKbdCharPtr;
DOS_LISTOFLISTS *lol = DOSMEM_LOL();
DOS_DATASEG *dataseg = (DOS_DATASEG *)lol;

View File

@ -100,8 +100,6 @@ extern struct DPMI_segments *DOSVM_dpmi_segments;
#define VIF_MASK 0x00080000
#define VIP_MASK 0x00100000
#define BIOS_DATA ((void *)0x400)
#define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
/* module.c */
@ -123,6 +121,7 @@ extern void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVO
extern void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val );
extern void WINAPI DOSVM_SetTimer( UINT ticks );
extern UINT WINAPI DOSVM_GetTimer( void );
extern BIOSDATA *DOSVM_BiosData( void );
/* devices.c */
extern void DOSDEV_InstallDOSDevices(void);

View File

@ -706,6 +706,26 @@ void WINAPI DOSVM_AcknowledgeIRQ( CONTEXT86 *context )
}
/**********************************************************************
* DOSVM_BiosData
*
* Get pointer to BIOS data area. This is not at fixed location
* because those Win16 programs that do not use any real mode code have
* protected NULL pointer catching block at low linear memory and
* BIOS data has been moved to another location.
*/
BIOSDATA *DOSVM_BiosData( void )
{
LDT_ENTRY entry;
FARPROC16 proc;
proc = GetProcAddress16( GetModuleHandle16( "KERNEL" ),
(LPCSTR)(ULONG_PTR)193 );
wine_ldt_get_entry( LOWORD(proc), &entry );
return (BIOSDATA *)wine_ldt_get_base( &entry );
}
/**********************************************************************
* DllMain (DOSVM.Init)
*/

View File

@ -150,7 +150,7 @@ void DOSVM_Int09UpdateKbdStatusFlags(BYTE scan, BOOL extended, BIOSDATA *data, B
*/
void WINAPI DOSVM_Int09Handler( CONTEXT86 *context )
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
BYTE ascii, scan = DOSVM_Int09ReadScan(&ascii);
BYTE realscan = scan & 0x7f; /* remove 0x80 make/break flag */
BOOL modifier = FALSE;

View File

@ -789,7 +789,7 @@ static void INT10_InitializeVideoMode( BIOSDATA *data )
*/
static void INT10_HandleVESA( CONTEXT86 *context )
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
switch(AL_reg(context)) {
@ -954,7 +954,7 @@ static void INT10_HandleVESA( CONTEXT86 *context )
*/
void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
INT10_InitializeVideoMode( data );
@ -1403,7 +1403,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
*/
void WINAPI DOSVM_PutChar( BYTE ascii )
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
unsigned xpos, ypos;
TRACE("char: 0x%02x(%c)\n", ascii, ascii);

View File

@ -87,7 +87,7 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
case 0x02: /* Get Shift Flags */
/* read value from BIOS data segment's keyboard status flags field */
data = BIOS_DATA;
data = DOSVM_BiosData();
SET_AL( context, data->KbdFlags1 );
TRACE("Get Shift Flags: returning 0x%02x\n", AL_reg(context));
@ -159,7 +159,7 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
*/
int WINAPI DOSVM_Int16ReadChar(BYTE *ascii, BYTE *scan, CONTEXT86 *waitctx)
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
WORD CurOfs = data->NextKbdCharPtr;
/* check if there's data in buffer */
@ -194,7 +194,7 @@ int WINAPI DOSVM_Int16ReadChar(BYTE *ascii, BYTE *scan, CONTEXT86 *waitctx)
int WINAPI DOSVM_Int16AddChar(BYTE ascii,BYTE scan)
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
WORD CurOfs = data->FirstKbdCharPtr;
WORD NextOfs = CurOfs + 2;

View File

@ -40,7 +40,7 @@ void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context )
{
case 0x00: /* GET SYSTEM TIME */
{
BIOSDATA *data = BIOS_DATA;
BIOSDATA *data = DOSVM_BiosData();
SET_CX( context, HIWORD(data->Ticks) );
SET_DX( context, LOWORD(data->Ticks) );
SET_AL( context, 0 ); /* FIXME: midnight flag is unsupported */

View File

@ -131,7 +131,7 @@ void WINAPI DOSVM_SetTimer( UINT ticks )
*/
void WINAPI DOSVM_Int08Handler( CONTEXT86 *context )
{
BIOSDATA *bios_data = BIOS_DATA;
BIOSDATA *bios_data = DOSVM_BiosData();
CONTEXT86 nested_context = *context;
FARPROC16 int1c_proc = DOSVM_GetRMHandler( 0x1c );