Ejemplo n.º 1
0
void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
    RMSREGS *sregs)
{
    PM_init();
    if (VRegs == NULL)
        return;

    VRegs->l.eax = in->e.eax;
    VRegs->l.ebx = in->e.ebx;
    VRegs->l.ecx = in->e.ecx;
    VRegs->l.edx = in->e.edx;
    VRegs->l.esi = in->e.esi;
    VRegs->l.edi = in->e.edi;
    VRegs->w.es = sregs->es;
    VRegs->w.ds = sregs->ds;

    VBIOScall(seg, off, VRegs, 1024);

    in->e.eax = VRegs->l.eax;
    in->e.ebx = VRegs->l.ebx;
    in->e.ecx = VRegs->l.ecx;
    in->e.edx = VRegs->l.edx;
    in->e.esi = VRegs->l.esi;
    in->e.edi = VRegs->l.edi;
    in->x.cflag = VRegs->w.flags & 0x1;
    sregs->es = VRegs->w.es;
    sregs->ds = VRegs->w.ds;
}
Ejemplo n.º 2
0
/****************************************************************************
REMARKS:
This function returns a pointer to the common graphics driver loaded in the
helper VxD. The memory for the VxD is shared between all processes via
the VxD, so that the VxD, 16-bit code and 32-bit code all see the same
state when accessing the graphics binary portable driver.
****************************************************************************/
GA_sharedInfo * NAPI GA_getSharedInfo(
    int device)
{
    /* Initialise the PM library and connect to our runtime DLL's */
    PM_init();

    /* Open our helper device driver */
    if (DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
	    FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
	    NULL))
	PM_fatalError("Unable to open SDDHELP$ helper device driver!");
    outLen = sizeof(result);
    DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,PMHELP_GETSHAREDINFO,
	NULL, 0, NULL,
	&result, outLen, &outLen);
    DosClose(hSDDHelp);
    if (result) {
	/* We have found the shared Nucleus packet. Because not all processes
	 * map to SDDPMI.DLL, we need to ensure that we connect to this
	 * DLL so that it gets mapped into our address space (that is
	 * where the shared Nucleus packet is located). Simply doing a
	 * DosLoadModule on it is enough for this.
	 */
	HMODULE hModSDDPMI;
	char    buf[80];
	DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
	}
    return (GA_sharedInfo*)result;
}
Ejemplo n.º 3
0
void main(int argc,char *argv[])
{
    PM_HWND hwndConsole;
    int     stateSize;
    void    *stateBuf;

    /* Initialise the console output routines */
    hwndConsole = PM_openConsole(0,0,0,0,0,true);
    stateSize = PM_getConsoleStateSize();
    if ((stateBuf = malloc(stateSize)) == NULL)
        PM_fatalError("Out of memory!\n");
    PM_saveConsoleState(stateBuf,hwndConsole);
    PM_init();
    CON_init();
    if (argc > 1) {
        if (atoi(argv[1]) == 25)
            CON_set25LineMode();
        else if (atoi(argv[1]) == 43)
            CON_set43LineMode();
        else if (atoi(argv[1]) == 50)
            CON_set50LineMode();
        }
    do_tests();
    do_tests_in_window();
    CON_getch();
    CON_restoreMode();
    PM_restoreConsoleState(stateBuf,hwndConsole);
    PM_closeConsole(hwndConsole);
    free(stateBuf);
}
Ejemplo n.º 4
0
int PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out)
{
    PM_init();
    if (VRegs == NULL)
        return 0;

    VRegs->l.eax = in->e.eax;
    VRegs->l.ebx = in->e.ebx;
    VRegs->l.ecx = in->e.ecx;
    VRegs->l.edx = in->e.edx;
    VRegs->l.esi = in->e.esi;
    VRegs->l.edi = in->e.edi;

    VBIOSint(intno, VRegs, 1024);

    out->e.eax = VRegs->l.eax;
    out->e.ebx = VRegs->l.ebx;
    out->e.ecx = VRegs->l.ecx;
    out->e.edx = VRegs->l.edx;
    out->e.esi = VRegs->l.esi;
    out->e.edi = VRegs->l.edi;
    out->x.cflag = VRegs->w.flags & 0x1;

    return out->x.ax;
}
Ejemplo n.º 5
0
/****************************************************************************
REMARKS:
Enables the Cyrix CPUID instruction to properly detect MediaGX and 6x86
processors.
****************************************************************************/
static void _CPU_enableCyrixCPUID(void)
{
    uchar   ccr3;

    PM_init();
    ccr3 = rdinx(0x22,0xC3);
    wrinx(0x22,0xC3,(uchar)(ccr3 | 0x10));
    wrinx(0x22,0xE8,(uchar)(rdinx(0x22,0xE8) | 0x80));
    wrinx(0x22,0xC3,ccr3);
}
Ejemplo n.º 6
0
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
{
    void *p;

    PM_init();

    if ((p = VBIOSgetmemptr(r_seg, r_off, VRegs)) == (void *)-1)
        return NULL;
    return p;
}
Ejemplo n.º 7
0
/****************************************************************************
DESCRIPTION:
Sets the location of the debug log file.

HEADER:
pmapi.h

PARAMETERS:
dllname	- Name of the Binary Portable DLL to load
bpdpath	- Place to store the actual path to the file

RETURNS:
True if found, false if not.

REMARKS:
Finds the location of a specific Binary Portable DLL, by searching all
the standard SciTech Nucleus driver locations.
****************************************************************************/
ibool PMAPI PM_findBPD(
	const char *dllname,
	char *bpdpath)
{
	char	filename[256];
	FILE	*f;
#ifndef	__WIN32_VXD__
	char	*mgl_root = getenv("MGL_ROOT");
#endif

	PM_init();
	strcpy(bpdpath,PM_getNucleusPath());
	PM_backslash(bpdpath);
	strcpy(filename,bpdpath);
	strcat(filename,dllname);
	if ((f = fopen(filename,"rb")) != NULL)
		goto Found;

	/* Next try in the MGL drivers directory relative to application */
	PM_getCurrentPath(bpdpath,PM_MAX_PATH);
	PM_backslash(bpdpath);
	strcat(bpdpath,"drivers");
	PM_backslash(bpdpath);
	strcpy(filename,bpdpath);
	strcat(filename,dllname);
	if ((f = fopen(filename,"rb")) != NULL)
		goto Found;

#ifndef	__WIN32_VXD__
	/* Next try in the directory relative to the MGL_ROOT
	 * environment variable.
	 */
	if (mgl_root) {
		strcpy(bpdpath, mgl_root);
		PM_backslash(bpdpath);
		strcat(bpdpath,"drivers");
		PM_backslash(bpdpath);
		strcpy(filename,bpdpath);
		strcat(filename,dllname);
		if ((f = fopen(filename,"rb")) != NULL)
			goto Found;
		}
#endif

	/* Whoops, couldn't open the BPD file! */
	return false;

Found:
	fclose(f);
	return true;
}
Ejemplo n.º 8
0
/****************************************************************************
DESCRIPTION:
Get the current graphics driver imports from the VxD

REMARKS:
This function returns a pointer to the common graphics driver loaded in the
helper VxD. The memory for the VxD is shared between all processes via
the VxD, so that the VxD, 16-bit code and 32-bit code all see the same
state when accessing the graphics binary portable driver.
****************************************************************************/
GA_sharedInfo * NAPI GA_getSharedInfo(
	int device)
{
	DWORD	inBuf[1];	/* Buffer to send data to VxD		*/
	DWORD	outBuf[2];	/* Buffer to receive data from VxD	*/
	DWORD	count;		/* Count of bytes returned from VxD	*/

	PM_init();
	inBuf[0] = device;
	if (DeviceIoControl(_PM_hDevice, PMHELP_GETSHAREDINFO32, inBuf, sizeof(inBuf),
			outBuf, sizeof(outBuf), &count, NULL)) {
		return (GA_sharedInfo*)outBuf[0];
		}
	return NULL;
}
Ejemplo n.º 9
0
void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
{
    if (size > 1024) {
        printf("PM_allocRealSeg: can't handle %d bytes\n", size);
        return 0;
        }
    if (rmbuf_inuse != 0) {
        printf("PM_allocRealSeg: transfer area already in use\n");
        return 0;
        }
    PM_init();
    rmbuf_inuse = 1;
    *r_seg = VBIOS_TransBufVSeg(VRegs);
    *r_off = VBIOS_TransBufVOff(VRegs);
    return (void*)VBIOS_TransBufPtr(VRegs);
}
Ejemplo n.º 10
0
int main(int argc,char *argv[])
{
    PM_init();
    if (PCI_enumerateDevices() < 1) {
        printf("No PCI display devices found!\n");
        return -1;
    }
    if (argc < 2) {
        printf("usage: uswc [-show -on -off]\n\n");
        ShowDisplayDevices();
        return -1;
    }
    if (stricmp(argv[1],"-show") == 0)
        ShowWriteCombine();
    else if (stricmp(argv[1],"-on") == 0)
        EnableWriteCombine();
    else if (stricmp(argv[1],"-off") == 0)
        DisableWriteCombine();
    return 0;
}
Ejemplo n.º 11
0
int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
    RMSREGS *sregs)
{
    PM_init();
    if (VRegs == NULL)
        return 0;

    if (intno == 0x21) {
        time_t today = time(NULL);
        struct tm *t;
        t = localtime(&today);
        out->x.cx = t->tm_year + 1900;
        out->h.dh = t->tm_mon + 1;
        out->h.dl = t->tm_mday;
        return 0;
        }
    else {
        VRegs->l.eax = in->e.eax;
        VRegs->l.ebx = in->e.ebx;
        VRegs->l.ecx = in->e.ecx;
        VRegs->l.edx = in->e.edx;
        VRegs->l.esi = in->e.esi;
        VRegs->l.edi = in->e.edi;
        VRegs->w.es = sregs->es;
        VRegs->w.ds = sregs->ds;

        VBIOSint(intno, VRegs, 1024);

        out->e.eax = VRegs->l.eax;
        out->e.ebx = VRegs->l.ebx;
        out->e.ecx = VRegs->l.ecx;
        out->e.edx = VRegs->l.edx;
        out->e.esi = VRegs->l.esi;
        out->e.edi = VRegs->l.edi;
        out->x.cflag = VRegs->w.flags & 0x1;
        sregs->es = VRegs->w.es;
        sregs->ds = VRegs->w.ds;

        return out->x.ax;
        }
}
Ejemplo n.º 12
0
/****************************************************************************
REMARKS:
We hook this function in here so that we can avoid the memory detect and
other destructive sequences in the drivers if we are loading the driver
from a Win32 application (our display drivers in contrast load them inside
the VxD directly, but the control panel applets use this function).
****************************************************************************/
static GA_devCtx * NAPI _GA_loadDriver(
	N_int32 deviceIndex,
	N_int32 shared)
{
	GA_devCtx	*dc;
	DWORD		inBuf[1];
	DWORD		outBuf[1];
	N_int32		totalMemory = 0,oldIOPL;

	if (deviceIndex >= GA_MAX_DEVICES)
		PM_fatalError("DeviceIndex too large in GA_loadDriver!");
	PM_init();
	inBuf[0] = deviceIndex;
	if (DeviceIoControl(_PM_hDevice, PMHELP_GETMEMSIZE32,
			inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), NULL, NULL))
		totalMemory = outBuf[0];
	if (totalMemory == 0)
		totalMemory = 8192;
	_GA_exports.GA_loadInGUI(shared);
	oldIOPL = PM_setIOPL(3);
	dc = ORG_GA_loadDriver(deviceIndex,shared);
	PM_setIOPL(oldIOPL);
	return dc;
}
Ejemplo n.º 13
0
/****************************************************************************
REMARKS:
Return a pointer to 0xA0000 physical VGA graphics framebuffer.
****************************************************************************/
void * PMAPI PM_getA0000Pointer(void)
{
    PM_init();
    return lowMem + 0xA0000;
}
Ejemplo n.º 14
0
/****************************************************************************
REMARKS:
Return a pointer to the real mode BIOS data area.
****************************************************************************/
void * PMAPI PM_getBIOSPointer(void)
{
    PM_init();
    return lowMem + 0x400;
}