Esempio n. 1
0
/****************************************************************************
REMARKS:
Determines if we have a mouse attached and functioning.
****************************************************************************/
static ibool detectMouse(void)
{
	RMREGS	regs;
	RMSREGS	sregs;
	uchar	*p;
	ibool	retval;

	regs.x.ax = 0x3533;					/* Get interrupt vector 0x33	*/
	PM_int86x(0x21,&regs,&regs,&sregs);

	/* Check that interrupt vector 0x33 is not a zero, and that the first
	 * instruction in the interrupt vector is not an IRET instruction
	 */
	p = PM_mapRealPointer(sregs.es, regs.x.bx);
	retval = (sregs.es != 0) && (regs.x.bx != 0) && (PM_getByte(p) != 207);
	return retval;
}
Esempio n. 2
0
static void InitPMCode(void)
/****************************************************************************
*
* Function:     InitPMCode  - 32 bit protected mode version
*
* Description:  Finds the address of and relocates the protected mode
*               code block from the VBE 2.0 into a local memory block. The
*               memory block is allocated with malloc() and must be freed
*               with VBE_freePMCode() after graphics processing is complete.
*
*               Note that this buffer _must_ be recopied after each mode set,
*               as the routines will change depending on the underlying
*               video mode.
*
****************************************************************************/
{
    RMREGS      regs;
    RMSREGS     sregs;
    uchar       *code;
    int         pmLen;

    if (!state->pmInfo && state->VBEVersion >= 0x200) {
	regs.x.ax = 0x4F0A;
	regs.x.bx = 0;
	PM_int86x(0x10,&regs,&regs,&sregs);
	if (regs.x.ax != VBE_SUCCESS)
	    return;
	if (VBE_shared)
	    state->pmInfo = PM_mallocShared(regs.x.cx);
	else
	    state->pmInfo = PM_malloc(regs.x.cx);
	if (state->pmInfo == NULL)
	    return;
	state->pmInfo32 = state->pmInfo;
	pmLen = regs.x.cx;

	/* Relocate the block into our local data segment */
	code = PM_mapRealPointer(sregs.es,regs.x.di);
	memcpy(state->pmInfo,code,pmLen);

	/* Now do a sanity check on the information we recieve to ensure
	 * that is is correct. Some BIOS return totally bogus information
	 * in here (Matrox is one)! Under DOS this works OK, but under OS/2
	 * we are screwed.
	 */
	if (state->pmInfo->setWindow >= pmLen ||
	    state->pmInfo->setDisplayStart >= pmLen ||
	    state->pmInfo->setPalette >= pmLen ||
	    state->pmInfo->IOPrivInfo >= pmLen) {
	    if (VBE_shared)
		PM_freeShared(state->pmInfo);
	    else
		PM_free(state->pmInfo);
	    state->pmInfo32 = state->pmInfo = NULL;
	    return;
	    }

	/* Read the IO priveledge info and determine if we need to
	 * pass a selector to MMIO registers to the bank switch code.
	 * Since we no longer support selector allocation, we no longer
	 * support this mechanism so we disable the protected mode
	 * interface in this case.
	 */
	if (state->pmInfo->IOPrivInfo && !state->MMIOSel) {
	    ushort *p = (ushort*)((uchar*)state->pmInfo + state->pmInfo->IOPrivInfo);
	    while (*p != 0xFFFF)
		p++;
	    p++;
	    if (*p != 0xFFFF)
		VBE_freePMCode();
	    }
	}
}
Esempio n. 3
0
void * PMAPI PM_getBIOSPointer(void)
{
    return PM_mapRealPointer(0, 0x400);
}
Esempio n. 4
0
/****************************************************************************
REMARKS:
Return a pointer to the real mode BIOS data area.
****************************************************************************/
void * PMAPI PM_getBIOSPointer(void)
{
    // Note that on NT this probably does not do what we expect!
    return PM_mapRealPointer(0x40, 0);
}