summaryrefslogtreecommitdiffstats
path: root/board/MAI/bios_emulator/scitech/src/pm/dos
diff options
context:
space:
mode:
Diffstat (limited to 'board/MAI/bios_emulator/scitech/src/pm/dos')
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/event.c296
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/pm.c762
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c392
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c60
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c2
5 files changed, 756 insertions, 756 deletions
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/event.c b/board/MAI/bios_emulator/scitech/src/pm/dos/event.c
index 12ecb298bc..a969d111b4 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/event.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/event.c
@@ -75,7 +75,7 @@ static void EVTAPI _EVT_pumpMessages(void)
_EVT_restoreInt(ps);
}
- regs.x.ax = 0x0B; // Reset Move Mouse
+ regs.x.ax = 0x0B; /* Reset Move Mouse */
PM_int86(0x33,&regs,&regs);
}
#endif
@@ -178,8 +178,8 @@ Adds a new mouse event to the event queue. This routine is called from within
the mouse interrupt subroutine, so it must be efficient.
NOTE: Interrupts MUST be OFF while this routine is called to ensure we have
- mutually exclusive access to our internal data structures for
- interrupt driven systems (like under DOS).
+ mutually exclusive access to our internal data structures for
+ interrupt driven systems (like under DOS).
****************************************************************************/
static void addMouseEvent(
uint what,
@@ -193,18 +193,18 @@ static void addMouseEvent(
event_t evt;
if (EVT.count < EVENTQSIZE) {
- /* Save information in event record. */
- evt.when = _EVT_getTicks();
- evt.what = what;
- evt.message = message;
- evt.modifiers = but_stat;
- evt.where_x = x; /* Save mouse event position */
- evt.where_y = y;
- evt.relative_x = mickeyX;
- evt.relative_y = mickeyY;
- evt.modifiers |= EVT.keyModifiers;
- addEvent(&evt); /* Add to tail of event queue */
- }
+ /* Save information in event record. */
+ evt.when = _EVT_getTicks();
+ evt.what = what;
+ evt.message = message;
+ evt.modifiers = but_stat;
+ evt.where_x = x; /* Save mouse event position */
+ evt.where_y = y;
+ evt.relative_x = mickeyX;
+ evt.relative_y = mickeyY;
+ evt.modifiers |= EVT.keyModifiers;
+ addEvent(&evt); /* Add to tail of event queue */
+ }
}
/****************************************************************************
@@ -233,47 +233,47 @@ static void EVTAPI mouseISR(
uint buttonMask;
if (mask & 1) {
- /* Save the current mouse coordinates */
- EVT.mx = x; EVT.my = y;
-
- /* If the last event was a movement event, then modify the last
- * event rather than post a new one, so that the queue will not
- * become saturated. Before we modify the data structures, we
- * MUST ensure that interrupts are off.
- */
- ps = _EVT_disableInt();
- if (EVT.oldMove != -1) {
- EVT.evtq[EVT.oldMove].where_x = x; /* Modify existing one */
- EVT.evtq[EVT.oldMove].where_y = y;
- EVT.evtq[EVT.oldMove].relative_x += mickeyX;
- EVT.evtq[EVT.oldMove].relative_y += mickeyY;
- }
- else {
- EVT.oldMove = EVT.freeHead; /* Save id of this move event */
- addMouseEvent(EVT_MOUSEMOVE,0,x,y,mickeyX,mickeyY,butstate);
- }
- _EVT_restoreInt(ps);
- }
+ /* Save the current mouse coordinates */
+ EVT.mx = x; EVT.my = y;
+
+ /* If the last event was a movement event, then modify the last
+ * event rather than post a new one, so that the queue will not
+ * become saturated. Before we modify the data structures, we
+ * MUST ensure that interrupts are off.
+ */
+ ps = _EVT_disableInt();
+ if (EVT.oldMove != -1) {
+ EVT.evtq[EVT.oldMove].where_x = x; /* Modify existing one */
+ EVT.evtq[EVT.oldMove].where_y = y;
+ EVT.evtq[EVT.oldMove].relative_x += mickeyX;
+ EVT.evtq[EVT.oldMove].relative_y += mickeyY;
+ }
+ else {
+ EVT.oldMove = EVT.freeHead; /* Save id of this move event */
+ addMouseEvent(EVT_MOUSEMOVE,0,x,y,mickeyX,mickeyY,butstate);
+ }
+ _EVT_restoreInt(ps);
+ }
if (mask & 0x2A) {
- ps = _EVT_disableInt();
- buttonMask = 0;
- if (mask & 2) buttonMask |= EVT_LEFTBMASK;
- if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
- if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
- addMouseEvent(EVT_MOUSEDOWN,buttonMask,x,y,0,0,butstate);
- EVT.oldMove = -1;
- _EVT_restoreInt(ps);
- }
+ ps = _EVT_disableInt();
+ buttonMask = 0;
+ if (mask & 2) buttonMask |= EVT_LEFTBMASK;
+ if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
+ if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
+ addMouseEvent(EVT_MOUSEDOWN,buttonMask,x,y,0,0,butstate);
+ EVT.oldMove = -1;
+ _EVT_restoreInt(ps);
+ }
if (mask & 0x54) {
- ps = _EVT_disableInt();
- buttonMask = 0;
- if (mask & 2) buttonMask |= EVT_LEFTBMASK;
- if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
- if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
- addMouseEvent(EVT_MOUSEUP,buttonMask,x,y,0,0,butstate);
- EVT.oldMove = -1;
- _EVT_restoreInt(ps);
- }
+ ps = _EVT_disableInt();
+ buttonMask = 0;
+ if (mask & 2) buttonMask |= EVT_LEFTBMASK;
+ if (mask & 8) buttonMask |= EVT_RIGHTBMASK;
+ if (mask & 32) buttonMask |= EVT_MIDDLEBMASK;
+ addMouseEvent(EVT_MOUSEUP,buttonMask,x,y,0,0,butstate);
+ EVT.oldMove = -1;
+ _EVT_restoreInt(ps);
+ }
EVT.oldKey = -1;
}
@@ -282,7 +282,7 @@ REMARKS:
Keyboard interrupt handler function.
NOTE: Interrupts are OFF when this routine is called by the keyboard ISR,
- and we leave them OFF the entire time.
+ and we leave them OFF the entire time.
****************************************************************************/
static void EVTAPI keyboardISR(void)
{
@@ -327,7 +327,7 @@ void EVTAPI EVT_init(
* while the program is initialising.
*/
while ((i = _EVT_getKeyCode()) != 0)
- addKeyEvent(EVT_KEYDOWN,i);
+ addKeyEvent(EVT_KEYDOWN,i);
}
/****************************************************************************
@@ -344,62 +344,62 @@ void EVTAPI EVT_resume(void)
PM_lockHandle lh; /* Unused in DOS */
if (_EVT_useEvents) {
- /* Initialise the event queue and enable our interrupt handlers */
- initEventQueue();
+ /* Initialise the event queue and enable our interrupt handlers */
+ initEventQueue();
#ifndef NO_KEYBOARD_INTERRUPT
- PM_setKeyHandler(keyboardISR);
+ PM_setKeyHandler(keyboardISR);
#endif
#ifndef NO_MOUSE_INTERRUPT
- if ((haveMouse = detectMouse()) != 0) {
- int oldmode = _EVT_foolMouse();
- PM_setMouseHandler(0xFFFF,mouseISR);
- _EVT_unfoolMouse(oldmode);
- }
+ if ((haveMouse = detectMouse()) != 0) {
+ int oldmode = _EVT_foolMouse();
+ PM_setMouseHandler(0xFFFF,mouseISR);
+ _EVT_unfoolMouse(oldmode);
+ }
#endif
- /* Read the keyboard modifier flags from the BIOS to get the
- * correct initialisation state. The only state we care about is
- * the correct toggle state flags such as SCROLLLOCK, NUMLOCK and
- * CAPSLOCK.
- */
- EVT.keyModifiers = 0;
- mods = PM_getByte(_EVT_biosPtr+0x17);
- if (mods & 0x10)
- EVT.keyModifiers |= EVT_SCROLLLOCK;
- if (mods & 0x20)
- EVT.keyModifiers |= EVT_NUMLOCK;
- if (mods & 0x40)
- EVT.keyModifiers |= EVT_CAPSLOCK;
-
- /* Lock all of the code and data used by our protected mode interrupt
- * handling routines, so that it will continue to work correctly
- * under real mode.
- */
- if (!locked) {
- /* It is difficult to ensure that we lock our global data, so we
- * do this by taking the address of a variable locking all data
- * 2Kb on either side. This should properly cover the global data
- * used by the module (the other alternative is to declare the
- * variables in assembler, in which case we know it will be
- * correct).
- */
- stat = !PM_lockDataPages(&EVT,sizeof(EVT),&lh);
- stat |= !PM_lockDataPages(&_EVT_biosPtr,sizeof(_EVT_biosPtr),&lh);
- stat |= !PM_lockCodePages((__codePtr)_EVT_cCodeStart,(int)_EVT_cCodeEnd-(int)_EVT_cCodeStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_EVT_codeStart,(int)_EVT_codeEnd-(int)_EVT_codeStart,&lh);
- if (stat) {
- PM_fatalError("Page locking services failed - interrupt handling not safe!");
- exit(1);
- }
- locked = 1;
- }
-
- /* Catch program termination signals so we can clean up properly */
- signal(SIGABRT, _EVT_abort);
- signal(SIGFPE, _EVT_abort);
- signal(SIGINT, _EVT_abort);
- _EVT_installed = true;
- }
+ /* Read the keyboard modifier flags from the BIOS to get the
+ * correct initialisation state. The only state we care about is
+ * the correct toggle state flags such as SCROLLLOCK, NUMLOCK and
+ * CAPSLOCK.
+ */
+ EVT.keyModifiers = 0;
+ mods = PM_getByte(_EVT_biosPtr+0x17);
+ if (mods & 0x10)
+ EVT.keyModifiers |= EVT_SCROLLLOCK;
+ if (mods & 0x20)
+ EVT.keyModifiers |= EVT_NUMLOCK;
+ if (mods & 0x40)
+ EVT.keyModifiers |= EVT_CAPSLOCK;
+
+ /* Lock all of the code and data used by our protected mode interrupt
+ * handling routines, so that it will continue to work correctly
+ * under real mode.
+ */
+ if (!locked) {
+ /* It is difficult to ensure that we lock our global data, so we
+ * do this by taking the address of a variable locking all data
+ * 2Kb on either side. This should properly cover the global data
+ * used by the module (the other alternative is to declare the
+ * variables in assembler, in which case we know it will be
+ * correct).
+ */
+ stat = !PM_lockDataPages(&EVT,sizeof(EVT),&lh);
+ stat |= !PM_lockDataPages(&_EVT_biosPtr,sizeof(_EVT_biosPtr),&lh);
+ stat |= !PM_lockCodePages((__codePtr)_EVT_cCodeStart,(int)_EVT_cCodeEnd-(int)_EVT_cCodeStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_EVT_codeStart,(int)_EVT_codeEnd-(int)_EVT_codeStart,&lh);
+ if (stat) {
+ PM_fatalError("Page locking services failed - interrupt handling not safe!");
+ exit(1);
+ }
+ locked = 1;
+ }
+
+ /* Catch program termination signals so we can clean up properly */
+ signal(SIGABRT, _EVT_abort);
+ signal(SIGFPE, _EVT_abort);
+ signal(SIGINT, _EVT_abort);
+ _EVT_installed = true;
+ }
}
/****************************************************************************
@@ -415,18 +415,18 @@ void EVTAPI EVT_setMouseRange(
RMREGS regs;
if (haveMouse) {
- int oldmode = _EVT_foolMouse();
- PM_resetMouseDriver(1);
- regs.x.ax = 7; /* Mouse function 7 - Set horizontal min and max */
- regs.x.cx = 0;
- regs.x.dx = xRes;
- PM_int86(0x33,&regs,&regs);
- regs.x.ax = 8; /* Mouse function 8 - Set vertical min and max */
- regs.x.cx = 0;
- regs.x.dx = yRes;
- PM_int86(0x33,&regs,&regs);
- _EVT_unfoolMouse(oldmode);
- }
+ int oldmode = _EVT_foolMouse();
+ PM_resetMouseDriver(1);
+ regs.x.ax = 7; /* Mouse function 7 - Set horizontal min and max */
+ regs.x.cx = 0;
+ regs.x.dx = xRes;
+ PM_int86(0x33,&regs,&regs);
+ regs.x.ax = 8; /* Mouse function 8 - Set vertical min and max */
+ regs.x.cx = 0;
+ regs.x.dx = yRes;
+ PM_int86(0x33,&regs,&regs);
+ _EVT_unfoolMouse(oldmode);
+ }
}
/****************************************************************************
@@ -441,13 +441,13 @@ void _EVT_setMousePos(
RMREGS regs;
if (haveMouse) {
- int oldmode = _EVT_foolMouse();
- regs.x.ax = 4; /* Mouse function 4 - Set mouse position */
- regs.x.cx = *x; /* New horizontal coordinate */
- regs.x.dx = *y; /* New vertical coordinate */
- PM_int86(0x33,&regs,&regs);
- _EVT_unfoolMouse(oldmode);
- }
+ int oldmode = _EVT_foolMouse();
+ regs.x.ax = 4; /* Mouse function 4 - Set mouse position */
+ regs.x.cx = *x; /* New horizontal coordinate */
+ regs.x.dx = *y; /* New vertical coordinate */
+ PM_int86(0x33,&regs,&regs);
+ _EVT_unfoolMouse(oldmode);
+ }
}
/****************************************************************************
@@ -460,28 +460,28 @@ void EVTAPI EVT_suspend(void)
uchar mods;
if (_EVT_installed) {
- /* Restore the interrupt handlers */
- PM_restoreKeyHandler();
- if (haveMouse)
- PM_restoreMouseHandler();
- signal(SIGABRT, SIG_DFL);
- signal(SIGFPE, SIG_DFL);
- signal(SIGINT, SIG_DFL);
-
- /* Set the keyboard modifier flags in the BIOS to our values */
- EVT_allowLEDS(true);
- mods = PM_getByte(_EVT_biosPtr+0x17) & ~0x70;
- if (EVT.keyModifiers & EVT_SCROLLLOCK)
- mods |= 0x10;
- if (EVT.keyModifiers & EVT_NUMLOCK)
- mods |= 0x20;
- if (EVT.keyModifiers & EVT_CAPSLOCK)
- mods |= 0x40;
- PM_setByte(_EVT_biosPtr+0x17,mods);
-
- /* Flag that we are no longer installed */
- _EVT_installed = false;
- }
+ /* Restore the interrupt handlers */
+ PM_restoreKeyHandler();
+ if (haveMouse)
+ PM_restoreMouseHandler();
+ signal(SIGABRT, SIG_DFL);
+ signal(SIGFPE, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+
+ /* Set the keyboard modifier flags in the BIOS to our values */
+ EVT_allowLEDS(true);
+ mods = PM_getByte(_EVT_biosPtr+0x17) & ~0x70;
+ if (EVT.keyModifiers & EVT_SCROLLLOCK)
+ mods |= 0x10;
+ if (EVT.keyModifiers & EVT_NUMLOCK)
+ mods |= 0x20;
+ if (EVT.keyModifiers & EVT_CAPSLOCK)
+ mods |= 0x40;
+ PM_setByte(_EVT_biosPtr+0x17,mods);
+
+ /* Flag that we are no longer installed */
+ _EVT_installed = false;
+ }
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c b/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c
index 71acd6894e..2ad9e34f91 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/pm.c
@@ -156,7 +156,7 @@ void PMAPI PM_VxDCall(
VXD_regs *regs)
{
if (_PM_VXD_sel != 0 || _PM_VXD_off != 0)
- _PM_VxDCall(regs,_PM_VXD_off,_PM_VXD_sel);
+ _PM_VxDCall(regs,_PM_VXD_off,_PM_VXD_sel);
}
/****************************************************************************
@@ -172,11 +172,11 @@ uint PMAPI PMHELP_getVersion(void)
/* Call the helper VxD to determine the version number */
if (_PM_VXD_sel != 0 || _PM_VXD_off != 0) {
- memset(&r,0,sizeof(r));
- r.eax = API_NUM(PMHELP_GETVER);
- _PM_VxDCall(&r,_PM_VXD_off,_PM_VXD_sel);
- return VXD_version = (uint)r.eax;
- }
+ memset(&r,0,sizeof(r));
+ r.eax = API_NUM(PMHELP_GETVER);
+ _PM_VxDCall(&r,_PM_VXD_off,_PM_VXD_sel);
+ return VXD_version = (uint)r.eax;
+ }
return VXD_version = 0;
}
@@ -199,7 +199,7 @@ static ibool PMHELP_connect(void)
/* Bail early if we have alread connected */
if (VXD_version != -1)
- return VXD_version != 0;
+ return VXD_version != 0;
/* Get the static SDDHELP.VXD entry point if available */
PM_segread(&sregs);
@@ -211,9 +211,9 @@ static ibool PMHELP_connect(void)
_PM_VXD_sel = sregs.es;
_PM_VXD_off = regs.x.di;
if (_PM_VXD_sel != 0 || _PM_VXD_off != 0) {
- if (PMHELP_getVersion() >= PMHELP_VERSION)
- return true;
- }
+ if (PMHELP_getVersion() >= PMHELP_VERSION)
+ return true;
+ }
/* If we get here, then either SDDHELP.VXD is not loaded, or it is an
* earlier version. In this case try to dynamically load the PMHELP.VXD
@@ -228,7 +228,7 @@ static ibool PMHELP_connect(void)
VXD_loadSel = sregs.es;
VXD_loadOff = regs.x.di;
if (VXD_loadSel == 0 && VXD_loadOff == 0)
- return VXD_version = 0;
+ return VXD_version = 0;
r.eax = 1;
r.ebx = 0;
r.edx = (uint)VXD_name;
@@ -237,7 +237,7 @@ static ibool PMHELP_connect(void)
r.es = sregs.es;
_PM_VxDCall(&r,VXD_loadOff,VXD_loadSel);
if (r.eax != 0)
- return VXD_version = 0;
+ return VXD_version = 0;
/* Get the dynamic VxD entry point so we can call it */
atexit(UnloadVxD);
@@ -249,9 +249,9 @@ static ibool PMHELP_connect(void)
_PM_VXD_sel = sregs.es;
_PM_VXD_off = regs.x.di;
if (_PM_VXD_sel == 0 && _PM_VXD_off == 0)
- return VXD_version = 0;
+ return VXD_version = 0;
if (PMHELP_getVersion() >= PMHELP_VERSION)
- return true;
+ return true;
return VXD_version = 0;
}
#endif
@@ -269,24 +269,24 @@ void PMAPI PM_init(void)
/* Check if we are running under CauseWay under real DOS */
if (_PM_haveCauseWay == -1) {
- /* Check if we are running under DPMI in which case we will not be
- * able to use our special ring 0 CauseWay functions.
- */
- _PM_haveCauseWay = false;
- regs.x.ax = 0xFF00;
- PM_int386(0x31,&regs,&regs);
- if (regs.x.cflag || !(regs.e.edi & 8)) {
- /* We are not under DPMI, so now check if CauseWay is active */
- regs.x.ax = 0xFFF9;
- PM_int386(0x31,&regs,&regs);
- if (!regs.x.cflag && regs.e.ecx == 0x43415553 && regs.e.edx == 0x45574159)
- _PM_haveCauseWay = true;
- }
-
- /* Now connect to PMHELP.VXD and initialise MTRR module */
- if (!PMHELP_connect())
- MTRR_init();
- }
+ /* Check if we are running under DPMI in which case we will not be
+ * able to use our special ring 0 CauseWay functions.
+ */
+ _PM_haveCauseWay = false;
+ regs.x.ax = 0xFF00;
+ PM_int386(0x31,&regs,&regs);
+ if (regs.x.cflag || !(regs.e.edi & 8)) {
+ /* We are not under DPMI, so now check if CauseWay is active */
+ regs.x.ax = 0xFFF9;
+ PM_int386(0x31,&regs,&regs);
+ if (!regs.x.cflag && regs.e.ecx == 0x43415553 && regs.e.edx == 0x45574159)
+ _PM_haveCauseWay = true;
+ }
+
+ /* Now connect to PMHELP.VXD and initialise MTRR module */
+ if (!PMHELP_connect())
+ MTRR_init();
+ }
#endif
}
@@ -311,14 +311,14 @@ int PMAPI PM_enableWriteCombine(
VXD_regs regs;
if (PMHELP_connect()) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_ENABLELFBCOMB);
- regs.ebx = base;
- regs.ecx = size;
- regs.edx = type;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_ENABLELFBCOMB);
+ regs.ebx = base;
+ regs.ecx = size;
+ regs.edx = type;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return regs.eax;
+ }
return MTRR_enableWriteCombine(base,size,type);
#else
return PM_MTRR_NOT_SUPPORTED;
@@ -346,9 +346,9 @@ void PMAPI PM_backslash(char *s)
{
uint pos = strlen(s);
if (s[pos-1] != '\\') {
- s[pos] = '\\';
- s[pos+1] = '\0';
- }
+ s[pos] = '\\';
+ s[pos+1] = '\0';
+ }
}
void PMAPI PM_setFatalErrorCleanup(
@@ -360,7 +360,7 @@ void PMAPI PM_setFatalErrorCleanup(
void PMAPI PM_fatalError(const char *msg)
{
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
fprintf(stderr,"%s\n", msg);
exit(1);
}
@@ -368,18 +368,18 @@ void PMAPI PM_fatalError(const char *msg)
static void ExitVBEBuf(void)
{
if (VESABuf_ptr)
- PM_freeRealSeg(VESABuf_ptr);
+ PM_freeRealSeg(VESABuf_ptr);
VESABuf_ptr = 0;
}
void * PMAPI PM_getVESABuf(uint *len,uint *rseg,uint *roff)
{
if (!VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
- return NULL;
- atexit(ExitVBEBuf);
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((VESABuf_ptr = PM_allocRealSeg(VESABuf_len, &VESABuf_rseg, &VESABuf_roff)) == NULL)
+ return NULL;
+ atexit(ExitVBEBuf);
+ }
*len = VESABuf_len;
*rseg = VESABuf_rseg;
*roff = VESABuf_roff;
@@ -429,12 +429,12 @@ void PMAPI _PM_addRealModeBlock(void *mem,uint tag)
int i;
for (i = 0; i < MAX_RM_BLOCKS; i++) {
- if (rmBlocks[i].p == NULL) {
- rmBlocks[i].p = mem;
- rmBlocks[i].tag = tag;
- return;
- }
- }
+ if (rmBlocks[i].p == NULL) {
+ rmBlocks[i].p = mem;
+ rmBlocks[i].tag = tag;
+ return;
+ }
+ }
PM_fatalError("To many real mode memory block allocations!");
}
@@ -443,9 +443,9 @@ uint PMAPI _PM_findRealModeBlock(void *mem)
int i;
for (i = 0; i < MAX_RM_BLOCKS; i++) {
- if (rmBlocks[i].p == mem)
- return rmBlocks[i].tag;
- }
+ if (rmBlocks[i].p == mem)
+ return rmBlocks[i].tag;
+ }
PM_fatalError("Could not find prior real mode memory block allocation!");
return 0;
}
@@ -469,19 +469,19 @@ const char * PMAPI PM_getNucleusPath(void)
char *env;
if ((env = getenv("NUCLEUS_PATH")) != NULL)
- return env;
+ return env;
if ((env = getenv("WINBOOTDIR")) != NULL) {
- /* Running in a Windows 9x DOS box or DOS mode */
- strcpy(path,env);
- strcat(path,"\\system\\nucleus");
- return path;
- }
+ /* Running in a Windows 9x DOS box or DOS mode */
+ strcpy(path,env);
+ strcat(path,"\\system\\nucleus");
+ return path;
+ }
if ((env = getenv("SystemRoot")) != NULL) {
- /* Running in an NT/2K DOS box */
- strcpy(path,env);
- strcat(path,"\\system32\\nucleus");
- return path;
- }
+ /* Running in an NT/2K DOS box */
+ strcpy(path,env);
+ strcat(path,"\\system32\\nucleus");
+ return path;
+ }
return "c:\\nucleus";
}
@@ -538,12 +538,12 @@ void PMAPI PM_saveConsoleState(void *stateBuf,PM_HWND hwndConsole)
sb->oldMode = regs.h.al & 0x7F;
sb->old50Lines = false;
if (sb->oldMode == 0x3) {
- regs.x.ax = 0x1130;
- regs.x.bx = 0;
- regs.x.dx = 0;
- PM_int86(0x10,&regs,&regs);
- sb->old50Lines = (regs.h.dl == 42 || regs.h.dl == 49);
- }
+ regs.x.ax = 0x1130;
+ regs.x.bx = 0;
+ regs.x.dx = 0;
+ PM_int86(0x10,&regs,&regs);
+ sb->old50Lines = (regs.h.dl == 42 || regs.h.dl == 49);
+ }
(void)hwndConsole;
}
@@ -560,10 +560,10 @@ void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole)
/* Retore 50 line mode if set */
if (sb->old50Lines) {
- regs.x.ax = 0x1112;
- regs.x.bx = 0;
- PM_int86(0x10,&regs,&regs);
- }
+ regs.x.ax = 0x1112;
+ regs.x.bx = 0;
+ PM_int86(0x10,&regs,&regs);
+ }
(void)hwndConsole;
}
@@ -587,13 +587,13 @@ void PMAPI PM_setOSScreenWidth(int width,int height)
PM_setWord(_biosPtr+0x4C,width*2);
PM_setByte(_biosPtr+0x84,height-1);
if (height > 25) {
- PM_setWord(_biosPtr+0x60,0x0607);
- PM_setByte(_biosPtr+0x85,0x08);
- }
+ PM_setWord(_biosPtr+0x60,0x0607);
+ PM_setByte(_biosPtr+0x85,0x08);
+ }
else {
- PM_setWord(_biosPtr+0x60,0x0D0E);
- PM_setByte(_biosPtr+0x85,0x016);
- }
+ PM_setWord(_biosPtr+0x60,0x0D0E);
+ PM_setByte(_biosPtr+0x85,0x016);
+ }
}
void * PMAPI PM_mallocShared(long size)
@@ -623,22 +623,22 @@ ibool PMAPI PM_doBIOSPOST(
/* Create a zero memory mapping for us to use */
if (firstTime) {
- rmZeroPtr = PM_mapPhysicalAddr(0,0x7FFF,true);
- firstTime = false;
- }
+ rmZeroPtr = PM_mapPhysicalAddr(0,0x7FFF,true);
+ firstTime = false;
+ }
/* Remap the secondary BIOS to 0xC0000 physical */
if (BIOSPhysAddr != 0xC0000L || BIOSLen > 32768) {
- /* DOS cannot virtually remap the BIOS, so we can only work if all
- * the secondary controllers are identical, and we then use the
- * BIOS on the first controller for all the remaining controllers.
- *
- * For OS'es that do virtual memory, and remapping of 0xC0000
- * physical (perhaps a copy on write mapping) should be all that
- * is needed.
- */
- return false;
- }
+ /* DOS cannot virtually remap the BIOS, so we can only work if all
+ * the secondary controllers are identical, and we then use the
+ * BIOS on the first controller for all the remaining controllers.
+ *
+ * For OS'es that do virtual memory, and remapping of 0xC0000
+ * physical (perhaps a copy on write mapping) should be all that
+ * is needed.
+ */
+ return false;
+ }
/* Save current handlers of int 10h and 6Dh */
GetRMVect(0x10,&Current10);
@@ -656,9 +656,9 @@ ibool PMAPI PM_doBIOSPOST(
/* Second the primary BIOS mappin 1:1 for 0xC0000 physical */
if (BIOSPhysAddr != 0xC0000L) {
- /* DOS does not support this */
- (void)mappedBIOS;
- }
+ /* DOS does not support this */
+ (void)mappedBIOS;
+ }
return true;
}
@@ -669,26 +669,26 @@ void PMAPI PM_sleep(ulong milliseconds)
LZTimerOnExt(&tm);
while (LZTimerLapExt(&tm) < microseconds)
- ;
+ ;
LZTimerOffExt(&tm);
}
int PMAPI PM_getCOMPort(int port)
{
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ }
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
switch (port) {
- case 0: return 0x3BC;
- case 1: return 0x378;
- case 2: return 0x278;
- }
+ case 0: return 0x3BC;
+ case 1: return 0x378;
+ case 2: return 0x278;
+ }
return 0;
}
@@ -733,15 +733,15 @@ static void convertFindData(
memset(findData,0,findData->dwSize);
findData->dwSize = dwSize;
if (blk->attrib & _A_RDONLY)
- findData->attrib |= PM_FILE_READONLY;
+ findData->attrib |= PM_FILE_READONLY;
if (blk->attrib & _A_SUBDIR)
- findData->attrib |= PM_FILE_DIRECTORY;
+ findData->attrib |= PM_FILE_DIRECTORY;
if (blk->attrib & _A_ARCH)
- findData->attrib |= PM_FILE_ARCHIVE;
+ findData->attrib |= PM_FILE_ARCHIVE;
if (blk->attrib & _A_HIDDEN)
- findData->attrib |= PM_FILE_HIDDEN;
+ findData->attrib |= PM_FILE_HIDDEN;
if (blk->attrib & _A_SYSTEM)
- findData->attrib |= PM_FILE_SYSTEM;
+ findData->attrib |= PM_FILE_SYSTEM;
findData->sizeLo = blk->size;
strncpy(findData->name,blk->name,PM_MAX_PATH);
findData->name[PM_MAX_PATH-1] = 0;
@@ -760,11 +760,11 @@ void * PMAPI PM_findFirstFile(
struct find_t *blk;
if ((blk = PM_malloc(sizeof(*blk))) == NULL)
- return PM_FILE_INVALID;
+ return PM_FILE_INVALID;
if (_dos_findfirst((char*)filename,FIND_MASK,blk) == 0) {
- convertFindData(findData,blk);
- return blk;
- }
+ convertFindData(findData,blk);
+ return blk;
+ }
return PM_FILE_INVALID;
}
@@ -779,9 +779,9 @@ ibool PMAPI PM_findNextFile(
struct find_t *blk = handle;
if (_dos_findnext(blk) == 0) {
- convertFindData(findData,blk);
- return true;
- }
+ convertFindData(findData,blk);
+ return true;
+ }
return false;
}
@@ -813,9 +813,9 @@ ibool PMAPI PM_driveValid(
{
RMREGS regs;
regs.h.dl = (uchar)(drive - 'A' + 1);
- regs.h.ah = 0x36; // Get disk information service
+ regs.h.ah = 0x36; /* Get disk information service */
PM_int86(0x21,&regs,&regs);
- return regs.x.ax != 0xFFFF; // AX = 0xFFFF if disk is invalid
+ return regs.x.ax != 0xFFFF; /* AX = 0xFFFF if disk is invalid */
}
/****************************************************************************
@@ -848,25 +848,25 @@ void PMAPI PM_setFileAttr(
DWORD attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= FILE_ATTRIBUTE_READONLY;
+ attr |= FILE_ATTRIBUTE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= FILE_ATTRIBUTE_ARCHIVE;
+ attr |= FILE_ATTRIBUTE_ARCHIVE;
if (attrib & PM_FILE_HIDDEN)
- attr |= FILE_ATTRIBUTE_HIDDEN;
+ attr |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= FILE_ATTRIBUTE_SYSTEM;
+ attr |= FILE_ATTRIBUTE_SYSTEM;
SetFileAttributes((LPSTR)filename, attr);
#else
uint attr = 0;
if (attrib & PM_FILE_READONLY)
- attr |= _A_RDONLY;
+ attr |= _A_RDONLY;
if (attrib & PM_FILE_ARCHIVE)
- attr |= _A_ARCH;
+ attr |= _A_ARCH;
if (attrib & PM_FILE_HIDDEN)
- attr |= _A_HIDDEN;
+ attr |= _A_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- attr |= _A_SYSTEM;
+ attr |= _A_SYSTEM;
_dos_setfileattr(filename,attr);
#endif
}
@@ -910,7 +910,7 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
* mapped 1:1 for this memory anyway so we just return the base address.
*/
if (physAddr < 0x100000L)
- return physAddr;
+ return physAddr;
/* Search table of existing mappings to see if we have already mapped
* a region of memory that will serve this purpose. We do this because
@@ -919,20 +919,20 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
* more mappings than necessary.
*/
for (i = 0; i < numMaps; i++) {
- if (maps[i].physical == physAddr && maps[i].limit == limit)
- return maps[i].linear;
- }
+ if (maps[i].physical == physAddr && maps[i].limit == limit)
+ return maps[i].linear;
+ }
/* Find a free slot in our physical memory mapping table */
for (i = 0; i < numMaps; i++) {
- if (maps[i].limit == 0)
- break;
- }
+ if (maps[i].limit == 0)
+ break;
+ }
if (i == numMaps) {
- i = numMaps++;
- if (i == MAX_MEMORY_MAPPINGS)
- return NULL;
- }
+ i = numMaps++;
+ if (i == MAX_MEMORY_MAPPINGS)
+ return NULL;
+ }
/* Round the physical address to a 4Kb boundary and the limit to a
* 4Kb-1 boundary before passing the values to DPMI as some extenders
@@ -950,7 +950,7 @@ ulong PMAPI DPMI_mapPhysicalToLinear(ulong physAddr,ulong limit)
r.x.di = roundedLimit & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0xFFFFFFFFUL;
+ return 0xFFFFFFFFUL;
maps[i].physical = physAddr;
maps[i].limit = limit;
maps[i].linear = ((ulong)r.x.bx << 16) + r.x.cx + baseOfs;
@@ -967,7 +967,7 @@ int PMAPI DPMI_setSelectorBase(ushort sel,ulong linAddr)
r.x.dx = linAddr & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0;
+ return 0;
return 1;
}
@@ -991,7 +991,7 @@ int PMAPI DPMI_setSelectorLimit(ushort sel,ulong limit)
r.x.dx = limit & 0xFFFF;
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return 0;
+ return 0;
return 1;
}
@@ -1011,19 +1011,19 @@ uint PMAPI DPMI_createSelector(ulong base,ulong limit)
* segment).
*/
if (limit >= 0x10000L) {
- r.x.ax = 9;
- r.x.bx = sel;
- r.x.cx = 0x40F3;
- PM_int386(0x31, &r, &r);
- }
+ r.x.ax = 9;
+ r.x.bx = sel;
+ r.x.cx = 0x40F3;
+ PM_int386(0x31, &r, &r);
+ }
/* Map physical memory and create selector */
if ((base = DPMI_mapPhysicalToLinear(base,limit)) == 0xFFFFFFFFUL)
- return 0;
+ return 0;
if (!DPMI_setSelectorBase(sel,base))
- return 0;
+ return 0;
if (!DPMI_setSelectorLimit(sel,limit))
- return 0;
+ return 0;
return sel;
}
@@ -1083,39 +1083,39 @@ static void PM_adjustPageTables(
andMask = ~0x18;
orMask = (isCached) ? 0x00 : 0x18;
if (_PM_pagingEnabled() == 1 && (PDB = _PM_getPDB()) != 0) {
- if (_PM_haveCauseWay) {
- /* CauseWay is a little different in the page table handling.
- * The code that we use for DOS4G/W does not appear to work
- * with CauseWay correctly as it does not appear to allow us
- * to map the page tables directly. Instead we can directly
- * access the page table entries in extended memory where
- * CauseWay always locates them (starting at 1024*4096*1023)
- */
- startPage = (linear >> 12);
- endPage = ((linear+limit) >> 12);
- pPageTable = (ulong*)CW_PAGE_TABLE_START;
- for (iPage = startPage; iPage <= endPage; iPage++)
- pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
- }
- else {
- pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
- if (pPDB) {
- startPDB = (linear >> 22) & 0x3FF;
- startPage = (linear >> 12) & 0x3FF;
- endPDB = ((linear+limit) >> 22) & 0x3FF;
- endPage = ((linear+limit) >> 12) & 0x3FF;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- pageTable = pPDB[iPDB] & ~0xFFF;
- pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++)
- pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
- }
- }
- }
- PM_flushTLB();
- }
+ if (_PM_haveCauseWay) {
+ /* CauseWay is a little different in the page table handling.
+ * The code that we use for DOS4G/W does not appear to work
+ * with CauseWay correctly as it does not appear to allow us
+ * to map the page tables directly. Instead we can directly
+ * access the page table entries in extended memory where
+ * CauseWay always locates them (starting at 1024*4096*1023)
+ */
+ startPage = (linear >> 12);
+ endPage = ((linear+limit) >> 12);
+ pPageTable = (ulong*)CW_PAGE_TABLE_START;
+ for (iPage = startPage; iPage <= endPage; iPage++)
+ pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
+ }
+ else {
+ pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
+ if (pPDB) {
+ startPDB = (linear >> 22) & 0x3FF;
+ startPage = (linear >> 12) & 0x3FF;
+ endPDB = ((linear+limit) >> 22) & 0x3FF;
+ endPage = ((linear+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++)
+ pPageTable[iPage] = (pPageTable[iPage] & andMask) | orMask;
+ }
+ }
+ }
+ PM_flushTLB();
+ }
#endif
}
@@ -1129,28 +1129,28 @@ void * PMAPI DPMI_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
PM_segread(&sregs);
DSBaseAddr = DPMI_getSelectorBase(sregs.ds);
if ((base < 0x100000) && (DSBaseAddr == 0)) {
- /* DS is zero based, so we can directly access the first 1Mb of
- * system memory (like under DOS4GW).
- */
- return (void*)base;
- }
+ /* DS is zero based, so we can directly access the first 1Mb of
+ * system memory (like under DOS4GW).
+ */
+ return (void*)base;
+ }
/* Map the memory to a linear address using DPMI function 0x800 */
if ((linAddr = DPMI_mapPhysicalToLinear(base,limit)) == 0xFFFFFFFF) {
- if (base >= 0x100000)
- return NULL;
- /* If the linear address mapping fails but we are trying to
- * map an area in the first 1Mb of system memory, then we must
- * be running under a Windows or OS/2 DOS box. Under these
- * environments we can use the segment wrap around as a fallback
- * measure, as this does work properly.
- */
- linAddr = base;
- }
+ if (base >= 0x100000)
+ return NULL;
+ /* If the linear address mapping fails but we are trying to
+ * map an area in the first 1Mb of system memory, then we must
+ * be running under a Windows or OS/2 DOS box. Under these
+ * environments we can use the segment wrap around as a fallback
+ * measure, as this does work properly.
+ */
+ linAddr = base;
+ }
/* Now expand the default DS selector to 4Gb so we can access it */
if (!DPMI_setSelectorLimit(sregs.ds,0xFFFFFFFFUL))
- return NULL;
+ return NULL;
/* Finally enable caching for the page tables that we just mapped in,
* since DOS4GW and PMODE/W create the page table entries without
@@ -1162,7 +1162,7 @@ void * PMAPI DPMI_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* caching) so that MMIO register regions do not screw up.
*/
if (DSBaseAddr == 0)
- PM_adjustPageTables(linAddr,limit,isCached);
+ PM_adjustPageTables(linAddr,limit,isCached);
/* Now return the base address of the memory into the default DS */
return (void*)(linAddr - DSBaseAddr);
@@ -1192,10 +1192,10 @@ void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
uint oldSeg,oldOff;
if (!crPtr) {
- /* Allocate and copy the memory block only once */
- crPtr = PM_allocRealSeg(sizeof(int6AHandler), &crRSeg, &crROff);
- memcpy(crPtr,int6AHandler,sizeof(int6AHandler));
- }
+ /* Allocate and copy the memory block only once */
+ crPtr = PM_allocRealSeg(sizeof(int6AHandler), &crRSeg, &crROff);
+ memcpy(crPtr,int6AHandler,sizeof(int6AHandler));
+ }
PM_setWord(crPtr,off); /* Plug in address to call */
PM_setWord(crPtr+2,seg);
p = PM_mapRealPointer(0,0x6A * 4);
@@ -1234,14 +1234,14 @@ void * PMAPI PM_allocLockedMem(
* helper VxD services to allocate the memory that we need.
*/
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_ALLOCLOCKED);
- regs.ebx = size;
- regs.ecx = (ulong)physAddr;
- regs.edx = contiguous | (below16Meg << 8);
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_ALLOCLOCKED);
+ regs.ebx = size;
+ regs.ecx = (ulong)physAddr;
+ regs.edx = contiguous | (below16Meg << 8);
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
/* If the memory is not contiguous, we simply need to allocate it
* using regular memory allocation services, and lock it down
@@ -1257,19 +1257,19 @@ void * PMAPI PM_allocLockedMem(
* size rounded up to the next 4K boundary.
*/
if (!contiguous)
- p = PM_malloc(roundedSize);
+ p = PM_malloc(roundedSize);
else
#endif
- p = PM_allocRealSeg(roundedSize,&r_seg,&r_off);
+ p = PM_allocRealSeg(roundedSize,&r_seg,&r_off);
if (p == NULL)
- return NULL;
+ return NULL;
roundedP = (void*)(((ulong)p + 0xFFF) & ~0xFFF);
*((ulong*)(roundedP + size)) = (ulong)p;
PM_lockDataPages(roundedP,size,&lh);
if ((*physAddr = PM_getPhysicalAddr(roundedP)) == 0xFFFFFFFF) {
- PM_freeLockedMem(roundedP,size,contiguous);
- return NULL;
- }
+ PM_freeLockedMem(roundedP,size,contiguous);
+ return NULL;
+ }
/* Disable caching for the memory since it is probably a DMA buffer */
#ifndef REALMODE
@@ -1289,22 +1289,22 @@ void PMAPI PM_freeLockedMem(void *p,uint size,ibool contiguous)
PM_lockHandle lh; /* Unused in DOS */
if (!p)
- return;
+ return;
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_FREELOCKED);
- regs.ebx = (ulong)p;
- regs.ecx = size;
- regs.edx = contiguous;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_FREELOCKED);
+ regs.ebx = (ulong)p;
+ regs.ecx = size;
+ regs.edx = contiguous;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return;
+ }
PM_unlockDataPages(p,size,&lh);
if (!contiguous)
- free(*((void**)((uchar*)p + size)));
+ free(*((void**)((uchar*)p + size)));
else
#endif
- PM_freeRealSeg(*((void**)((char*)p + size)));
+ PM_freeRealSeg(*((void**)((char*)p + size)));
}
#ifndef REALMODE
@@ -1321,11 +1321,11 @@ static pageblock *PM_addNewPageBlock(void)
/* Allocate memory for the new page block, and add to head of list */
size = PAGES_PER_BLOCK * PM_PAGE_SIZE + (PM_PAGE_SIZE-1) + sizeof(pageblock);
if ((newBlock = PM_malloc(size)) == NULL)
- return NULL;
+ return NULL;
newBlock->prev = NULL;
newBlock->next = pageBlocks;
if (pageBlocks)
- pageBlocks->prev = newBlock;
+ pageBlocks->prev = newBlock;
pageBlocks = newBlock;
/* Initialise the page aligned free list for the page block */
@@ -1334,7 +1334,7 @@ static pageblock *PM_addNewPageBlock(void)
newBlock->freeListStart = newBlock->freeList;
newBlock->freeListEnd = p + (PAGES_PER_BLOCK-1) * PM_PAGE_SIZE;
for (i = 0; i < PAGES_PER_BLOCK; i++,p = next)
- FREELIST_NEXT(p) = next = p + PM_PAGE_SIZE;
+ FREELIST_NEXT(p) = next = p + PM_PAGE_SIZE;
FREELIST_NEXT(p - PM_PAGE_SIZE) = NULL;
return newBlock;
}
@@ -1355,27 +1355,27 @@ void * PMAPI PM_allocPage(
/* Call the helper VxD for this service if we are running in a DOS box */
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_ALLOCPAGE);
- regs.ebx = locked;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_ALLOCPAGE);
+ regs.ebx = locked;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
/* Scan the block list looking for any free blocks. Allocate a new
* page block if no free blocks are found.
*/
for (block = pageBlocks; block != NULL; block = block->next) {
- if (block->freeCount)
- break;
- }
+ if (block->freeCount)
+ break;
+ }
if (block == NULL && (block = PM_addNewPageBlock()) == NULL)
- return NULL;
+ return NULL;
block->freeCount--;
p = block->freeList;
block->freeList = FREELIST_NEXT(p);
if (locked)
- PM_lockDataPages(p,PM_PAGE_SIZE,&lh);
+ PM_lockDataPages(p,PM_PAGE_SIZE,&lh);
return p;
#else
return NULL;
@@ -1395,42 +1395,42 @@ void PMAPI PM_freePage(
/* Call the helper VxD for this service if we are running in a DOS box */
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_FREEPAGE);
- regs.ebx = (ulong)p;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_FREEPAGE);
+ regs.ebx = (ulong)p;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return;
+ }
/* First find the page block that this page belongs to */
for (block = pageBlocks; block != NULL; block = block->next) {
- if (p >= block->freeListStart && p <= block->freeListEnd)
- break;
- }
+ if (p >= block->freeListStart && p <= block->freeListEnd)
+ break;
+ }
CHECK(block != NULL);
/* Now free the block by adding it to the free list */
FREELIST_NEXT(p) = block->freeList;
block->freeList = p;
if (++block->freeCount == PAGES_PER_BLOCK) {
- /* If all pages in the page block are now free, free the entire
- * page block itself.
- */
- if (block == pageBlocks) {
- /* Delete from head */
- pageBlocks = block->next;
- if (block->next)
- block->next->prev = NULL;
- }
- else {
- /* Delete from middle of list */
- CHECK(block->prev != NULL);
- block->prev->next = block->next;
- if (block->next)
- block->next->prev = block->prev;
- }
- PM_free(block);
- }
+ /* If all pages in the page block are now free, free the entire
+ * page block itself.
+ */
+ if (block == pageBlocks) {
+ /* Delete from head */
+ pageBlocks = block->next;
+ if (block->next)
+ block->next->prev = NULL;
+ }
+ else {
+ /* Delete from middle of list */
+ CHECK(block->prev != NULL);
+ block->prev->next = block->next;
+ if (block->next)
+ block->next->prev = block->prev;
+ }
+ PM_free(block);
+ }
#else
(void)p;
#endif
@@ -1444,7 +1444,7 @@ void PMAPI PM_freePage(
#ifndef MK_FP
#define MK_FP(s,o) ( (void far *)( ((ulong)(s) << 16) + \
- (ulong)(o) ))
+ (ulong)(o) ))
#endif
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
@@ -1534,7 +1534,7 @@ static uchar *zeroPtr = NULL;
void * PMAPI PM_getBIOSPointer(void)
{
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + 0x400);
}
@@ -1542,7 +1542,7 @@ void * PMAPI PM_getA0000Pointer(void)
{
static void *bankPtr;
if (!bankPtr)
- bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
+ bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);
return bankPtr;
}
@@ -1561,16 +1561,16 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* running at ring 0 (ie: under real DOS).
*/
if (VXD_version == -1)
- PM_init();
+ PM_init();
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_MAPPHYS);
- regs.ebx = base;
- regs.ecx = limit;
- regs.edx = isCached;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_MAPPHYS);
+ regs.ebx = base;
+ regs.ecx = limit;
+ regs.edx = isCached;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
/* Round the physical address to a 4Kb boundary and the limit to a
* 4Kb-1 boundary before passing the values to TNT. If we round the
@@ -1583,15 +1583,15 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
_dx_config_inf(&config, (UCHAR*)&config);
err = _dx_map_phys(config.c_ds_sel,baseAddr,(newLimit + 4095) / 4096,&offset);
if (err == 130) {
- /* If the TNT function failed, we are running in a DPMI environment
- * and this function does not work. However we know how to handle
- * DPMI properly, so we use our generic DPMI functions to do
- * what the TNT runtime libraries can't.
- */
- return DPMI_mapPhysicalAddr(base,limit,isCached);
- }
+ /* If the TNT function failed, we are running in a DPMI environment
+ * and this function does not work. However we know how to handle
+ * DPMI properly, so we use our generic DPMI functions to do
+ * what the TNT runtime libraries can't.
+ */
+ return DPMI_mapPhysicalAddr(base,limit,isCached);
+ }
if (err == 0)
- return (void*)(offset + baseOfs);
+ return (void*)(offset + baseOfs);
return NULL;
}
@@ -1611,7 +1611,7 @@ void * PMAPI PM_mapToProcess(void *base,ulong limit)
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
{
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF);
return (void*)(zeroPtr + MK_PHYS(r_seg,r_off));
}
@@ -1621,7 +1621,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
void *p;
if (_dx_real_alloc((size + 0xF) >> 4,&addr,&t) != 0)
- return 0;
+ return 0;
*r_seg = addr; /* Real mode segment address */
*r_off = 0; /* Real mode segment offset */
p = PM_mapRealPointer(*r_seg,*r_off);
@@ -1732,7 +1732,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
r.x.bx = (size + 0xF) >> 4; /* Number of paragraphs to allocate */
PM_int386(0x21, &r, &r); /* Call DOS extender */
if (r.x.cflag)
- return 0; /* Could not allocate the memory */
+ return 0; /* Could not allocate the memory */
*r_seg = r.e.eax;
*r_off = 0;
return PM_mapRealPointer(*r_seg,*r_off);
@@ -1828,19 +1828,19 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* running at ring 0 (ie: under real DOS).
*/
if (VXD_version == -1)
- PM_init();
+ PM_init();
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_MAPPHYS);
- regs.ebx = base;
- regs.ecx = limit;
- regs.edx = isCached;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_MAPPHYS);
+ regs.ebx = base;
+ regs.ecx = limit;
+ regs.edx = isCached;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
if (base > 0x100000)
- return _x386_map_physical_address((void*)base,limit);
+ return _x386_map_physical_address((void*)base,limit);
return (void*)((ulong)_x386_zero_base_ptr + base);
}
@@ -1872,7 +1872,7 @@ void PMAPI PM_availableMemory(ulong *physical,ulong *total)
/* Get physical memory available */
*physical = _X32_getPhysMem();
if (*physical > *total)
- *physical = *total;
+ *physical = *total;
}
#endif
@@ -1908,16 +1908,16 @@ void * PMAPI PM_mapPhysicalAddr(ulong base,ulong limit,ibool isCached)
* running at ring 0 (ie: under real DOS).
*/
if (VXD_version == -1)
- PM_init();
+ PM_init();
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_MAPPHYS);
- regs.ebx = base;
- regs.ecx = limit;
- regs.edx = isCached;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return (void*)regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_MAPPHYS);
+ regs.ebx = base;
+ regs.ecx = limit;
+ regs.edx = isCached;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return (void*)regs.eax;
+ }
return DPMI_mapPhysicalAddr(base,limit,isCached);
}
@@ -1932,7 +1932,7 @@ ulong PMAPI PM_getPhysicalAddr(void *p)
{
ulong physAddr;
if (!PM_getPhysicalAddrRange(p,1,&physAddr))
- return 0xFFFFFFFF;
+ return 0xFFFFFFFF;
return physAddr | ((ulong)p & 0xFFF);
}
@@ -1950,14 +1950,14 @@ ibool PMAPI PM_getPhysicalAddrRange(
* helper VxD services to find the physical address of an address.
*/
if (VXD_version) {
- memset(&regs,0,sizeof(regs));
- regs.eax = API_NUM(PMHELP_GETPHYSICALADDRRANGE);
- regs.ebx = (ulong)p;
- regs.ecx = (ulong)length;
- regs.edx = (ulong)physAddress;
- _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
- return regs.eax;
- }
+ memset(&regs,0,sizeof(regs));
+ regs.eax = API_NUM(PMHELP_GETPHYSICALADDRRANGE);
+ regs.ebx = (ulong)p;
+ regs.ecx = (ulong)length;
+ regs.edx = (ulong)physAddress;
+ _PM_VxDCall(&regs,_PM_VXD_off,_PM_VXD_sel);
+ return regs.eax;
+ }
/* Find base address for default DS selector */
PM_segread(&sregs);
@@ -1970,38 +1970,38 @@ ibool PMAPI PM_getPhysicalAddrRange(
pte = *((ulong*)p);
#ifdef DOS4GW
if (_PM_pagingEnabled() == 0) {
- int count;
- ulong linAddr = (ulong)p;
-
- /* When paging is disabled physical=linear */
- for (count = (length+0xFFF) >> 12; count > 0; count--) {
- *physAddress++ = linAddr;
- linAddr += 4096;
- }
- return true;
- }
+ int count;
+ ulong linAddr = (ulong)p;
+
+ /* When paging is disabled physical=linear */
+ for (count = (length+0xFFF) >> 12; count > 0; count--) {
+ *physAddress++ = linAddr;
+ linAddr += 4096;
+ }
+ return true;
+ }
else if ((PDB = _PM_getPDB()) != 0 && DSBaseAddr == 0) {
- int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
- ulong pageTable,*pPageTable,linAddr = (ulong)p;
- ulong limit = length-1;
-
- pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
- if (pPDB) {
- startPDB = (linAddr >> 22) & 0x3FFL;
- startPage = (linAddr >> 12) & 0x3FFL;
- endPDB = ((linAddr+limit) >> 22) & 0x3FFL;
- endPage = ((linAddr+limit) >> 12) & 0x3FFL;
- for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
- pageTable = pPDB[iPDB] & ~0xFFFL;
- pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FFL;
- for (iPage = start; iPage <= end; iPage++)
- *physAddress++ = (pPageTable[iPage] & ~0xFFF);
- }
- return true;
- }
- }
+ int startPDB,endPDB,iPDB,startPage,endPage,start,end,iPage;
+ ulong pageTable,*pPageTable,linAddr = (ulong)p;
+ ulong limit = length-1;
+
+ pPDB = (ulong*)DPMI_mapPhysicalToLinear(PDB,0xFFF);
+ if (pPDB) {
+ startPDB = (linAddr >> 22) & 0x3FFL;
+ startPage = (linAddr >> 12) & 0x3FFL;
+ endPDB = ((linAddr+limit) >> 22) & 0x3FFL;
+ endPage = ((linAddr+limit) >> 12) & 0x3FFL;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ pageTable = pPDB[iPDB] & ~0xFFFL;
+ pPageTable = (ulong*)DPMI_mapPhysicalToLinear(pageTable,0xFFF);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FFL;
+ for (iPage = start; iPage <= end; iPage++)
+ *physAddress++ = (pPageTable[iPage] & ~0xFFF);
+ }
+ return true;
+ }
+ }
#endif
return false;
}
@@ -2017,7 +2017,7 @@ void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
static uchar *zeroPtr = NULL;
if (!zeroPtr)
- zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
+ zeroPtr = PM_mapPhysicalAddr(0,0xFFFFF,true);
return (void*)(zeroPtr + MK_PHYS(r_seg,r_off));
}
@@ -2030,7 +2030,7 @@ void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
r.x.bx = (size + 0xF) >> 4; /* number of paragraphs */
PM_int386(0x31, &r, &r);
if (r.x.cflag)
- return NULL; /* DPMI call failed */
+ return NULL; /* DPMI call failed */
*r_seg = r.x.ax; /* Real mode segment */
*r_off = 0;
p = PM_mapRealPointer(*r_seg,*r_off);
@@ -2043,10 +2043,10 @@ void PMAPI PM_freeRealSeg(void *mem)
PMREGS r;
if (mem) {
- r.x.ax = 0x101; /* DPMI free DOS memory */
- r.x.dx = _PM_findRealModeBlock(mem);/* DX := selector from 0x100 */
- PM_int386(0x31, &r, &r);
- }
+ r.x.ax = 0x101; /* DPMI free DOS memory */
+ r.x.dx = _PM_findRealModeBlock(mem);/* DX := selector from 0x100 */
+ PM_int386(0x31, &r, &r);
+ }
}
static DPMI_handler_t DPMI_int10 = NULL;
@@ -2062,9 +2062,9 @@ void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
PMSREGS sr;
if (intno == 0x10 && DPMI_int10) {
- if (DPMI_int10(regs))
- return;
- }
+ if (DPMI_int10(regs))
+ return;
+ }
PM_segread(&sr);
r.x.ax = 0x300; /* DPMI issue real interrupt */
r.h.bl = intno;
@@ -2116,17 +2116,17 @@ int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
#pragma pack(1)
typedef struct {
- uint LargestBlockAvail;
- uint MaxUnlockedPage;
- uint LargestLockablePage;
- uint LinAddrSpace;
- uint NumFreePagesAvail;
- uint NumPhysicalPagesFree;
- uint TotalPhysicalPages;
- uint FreeLinAddrSpace;
- uint SizeOfPageFile;
- uint res[3];
- } MemInfo;
+ uint LargestBlockAvail;
+ uint MaxUnlockedPage;
+ uint LargestLockablePage;
+ uint LinAddrSpace;
+ uint NumFreePagesAvail;
+ uint NumPhysicalPagesFree;
+ uint TotalPhysicalPages;
+ uint FreeLinAddrSpace;
+ uint SizeOfPageFile;
+ uint res[3];
+ } MemInfo;
#pragma pack()
@@ -2144,7 +2144,7 @@ void PMAPI PM_availableMemory(ulong *physical,ulong *total)
*physical = memInfo.NumPhysicalPagesFree * 4096;
*total = memInfo.LargestBlockAvail;
if (*total < *physical)
- *physical = *total;
+ *physical = *total;
}
#endif
@@ -2212,7 +2212,7 @@ Function to get the file attributes for a specific file.
uint PMAPI PM_getFileAttr(
const char *filename)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return 0;
}
@@ -2225,7 +2225,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
@@ -2238,6 +2238,6 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c b/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c
index 74f8427a1c..eecc2daede 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/pmdos.c
@@ -160,47 +160,47 @@ void PMAPI PM_resetMouseDriver(int hardReset)
regs.x.ax = hardReset ? 0 : 33;
PM_int86(0x33, &regs, &regs);
if (oldHandler)
- PM_setMouseHandler(_PM_mouseMask, oldHandler);
+ PM_setMouseHandler(_PM_mouseMask, oldHandler);
}
void PMAPI PM_setRealTimeClockFrequency(int frequency)
{
static short convert[] = {
- 8192,
- 4096,
- 2048,
- 1024,
- 512,
- 256,
- 128,
- 64,
- 32,
- 16,
- 8,
- 4,
- 2,
- -1,
- };
+ 8192,
+ 4096,
+ 2048,
+ 1024,
+ 512,
+ 256,
+ 128,
+ 64,
+ 32,
+ 16,
+ 8,
+ 4,
+ 2,
+ -1,
+ };
int i;
/* First clear any pending RTC timeout if not cleared */
_PM_readCMOS(0x0C);
if (frequency == 0) {
- /* Disable RTC timout */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
- }
+ /* Disable RTC timout */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB & 0x0F);
+ }
else {
- /* Convert frequency value to RTC clock indexes */
- for (i = 0; convert[i] != -1; i++) {
- if (convert[i] == frequency)
- break;
- }
+ /* Convert frequency value to RTC clock indexes */
+ for (i = 0; convert[i] != -1; i++) {
+ if (convert[i] == frequency)
+ break;
+ }
- /* Set RTC timout value and enable timeout */
- _PM_writeCMOS(0x0A,0x20 | (i+3));
- _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
- }
+ /* Set RTC timout value and enable timeout */
+ _PM_writeCMOS(0x0A,0x20 | (i+3));
+ _PM_writeCMOS(0x0B,(_PM_oldCMOSRegB & 0x0F) | 0x40);
+ }
}
#ifndef REALMODE
@@ -216,18 +216,18 @@ static void PMAPI lockPMHandlers(void)
* under real mode.
*/
if (!locked) {
- PM_saveDS();
- stat = !PM_lockDataPages(&globalDataStart-2048,4096,&lh);
- stat |= !PM_lockDataPages(&_PM_pmdosDataStart,(int)&_PM_pmdosDataEnd - (int)&_PM_pmdosDataStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_PM_pmdosCodeStart,(int)_PM_pmdosCodeEnd-(int)_PM_pmdosCodeStart,&lh);
- stat |= !PM_lockDataPages(&_PM_DMADataStart,(int)&_PM_DMADataEnd - (int)&_PM_DMADataStart,&lh);
- stat |= !PM_lockCodePages((__codePtr)_PM_DMACodeStart,(int)_PM_DMACodeEnd-(int)_PM_DMACodeStart,&lh);
- if (stat) {
- printf("Page locking services failed - interrupt handling not safe!\n");
- exit(1);
- }
- locked = 1;
- }
+ PM_saveDS();
+ stat = !PM_lockDataPages(&globalDataStart-2048,4096,&lh);
+ stat |= !PM_lockDataPages(&_PM_pmdosDataStart,(int)&_PM_pmdosDataEnd - (int)&_PM_pmdosDataStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_PM_pmdosCodeStart,(int)_PM_pmdosCodeEnd-(int)_PM_pmdosCodeStart,&lh);
+ stat |= !PM_lockDataPages(&_PM_DMADataStart,(int)&_PM_DMADataEnd - (int)&_PM_DMADataStart,&lh);
+ stat |= !PM_lockCodePages((__codePtr)_PM_DMACodeStart,(int)_PM_DMACodeEnd-(int)_PM_DMACodeStart,&lh);
+ if (stat) {
+ printf("Page locking services failed - interrupt handling not safe!\n");
+ exit(1);
+ }
+ locked = 1;
+ }
}
#endif
@@ -240,7 +240,7 @@ static void PMAPI lockPMHandlers(void)
#ifndef MK_FP
#define MK_FP(s,o) ( (void far *)( ((ulong)(s) << 16) + \
- (ulong)(o) ))
+ (ulong)(o) ))
#endif
int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
@@ -256,10 +256,10 @@ void PMAPI PM_restoreMouseHandler(void)
union REGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- int86(0x33, &regs, &regs);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ int86(0x33, &regs, &regs);
+ _PM_mouseHandler = NULL;
+ }
}
void PMAPI PM_setTimerHandler(PM_intHandler th)
@@ -272,9 +272,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- _PM_setRMvect(0x8, (long)_PM_prevTimer);
- _PM_timerHandler = NULL;
- }
+ _PM_setRMvect(0x8, (long)_PM_prevTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -300,15 +300,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- _PM_setRMvect(0x70, (long)_PM_prevRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ _PM_setRMvect(0x70, (long)_PM_prevRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -321,9 +321,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- _PM_setRMvect(0x9, (long)_PM_prevKey);
- _PM_keyHandler = NULL;
- }
+ _PM_setRMvect(0x9, (long)_PM_prevKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -336,9 +336,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- _PM_setRMvect(0x15, (long)_PM_prevKey15);
- _PM_key15Handler = NULL;
- }
+ _PM_setRMvect(0x15, (long)_PM_prevKey15);
+ _PM_key15Handler = NULL;
+ }
}
void PMAPI PM_installAltBreakHandler(PM_breakHandler bh)
@@ -362,11 +362,11 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak) {
- _PM_setRMvect(0x1B, (long)_PM_prevBreak);
- _PM_setRMvect(0x23, (long)_PM_prevCtrlC);
- _PM_prevBreak = NULL;
- _PM_breakHandler = NULL;
- }
+ _PM_setRMvect(0x1B, (long)_PM_prevBreak);
+ _PM_setRMvect(0x23, (long)_PM_prevCtrlC);
+ _PM_prevBreak = NULL;
+ _PM_breakHandler = NULL;
+ }
}
void PMAPI PM_installAltCriticalHandler(PM_criticalHandler ch)
@@ -387,10 +387,10 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical) {
- _PM_setRMvect(0x24, (long)_PM_prevCritical);
- _PM_prevCritical = NULL;
- _PM_critHandler = NULL;
- }
+ _PM_setRMvect(0x24, (long)_PM_prevCritical);
+ _PM_prevCritical = NULL;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -499,7 +499,7 @@ uchar * installCallback(void (PMAPI *pmCB)(),uint *rseg, uint *roff)
/* Copy the real mode handler to real mode memory */
if ((p = PM_allocRealSeg(sizeof(realHandler),rseg,roff)) == NULL)
- return NULL;
+ return NULL;
memcpy(p,realHandler,sizeof(realHandler));
/* Skip past global variabls in real mode code segment */
@@ -516,7 +516,7 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
lockPMHandlers(); /* Ensure our handlers are locked */
if ((mousePtr = installCallback(_PM_mouseISR, &rseg, &roff)) == NULL)
- return 0;
+ return 0;
_PM_mouseHandler = mh;
/* Install the real mode mouse handler */
@@ -533,11 +533,11 @@ void PMAPI PM_restoreMouseHandler(void)
RMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int86(0x33, &regs, &regs);
- PM_freeRealSeg(mousePtr);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int86(0x33, &regs, &regs);
+ PM_freeRealSeg(mousePtr);
+ _PM_mouseHandler = NULL;
+ }
}
void PMAPI PM_getPMvect(int intno, PMFARPTR *isr)
@@ -602,9 +602,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -630,15 +630,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -651,9 +651,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -666,9 +666,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
void PMAPI PM_installAltBreakHandler(PM_breakHandler bh)
@@ -692,11 +692,11 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
- }
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
+ }
}
void PMAPI PM_installAltCriticalHandler(PM_criticalHandler ch)
@@ -717,10 +717,10 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -816,9 +816,9 @@ int installCallback(void (PMAPI *pmCB)(),uint *psel, uint *poff,
* buffer once since we cant dealloate it with X32).
*/
if (*psel == 0) {
- if (!PM_allocRealSeg(sizeof(realHandler),psel,poff,rseg,roff))
- return 0;
- }
+ if (!PM_allocRealSeg(sizeof(realHandler),psel,poff,rseg,roff))
+ return 0;
+ }
PM_memcpyfn(*psel,*poff,realHandler,sizeof(realHandler));
/* Skip past global variables in real mode code segment */
@@ -835,7 +835,7 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
lockPMHandlers(); /* Ensure our handlers are locked */
if (!installCallback(_PM_mouseISR, &mouseSel, &mouseOff, &rseg, &roff))
- return 0;
+ return 0;
_PM_mouseHandler = mh;
/* Install the real mode mouse handler */
@@ -852,10 +852,10 @@ void PMAPI PM_restoreMouseHandler(void)
RMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int86(0x33, &regs, &regs);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int86(0x33, &regs, &regs);
+ _PM_mouseHandler = NULL;
+ }
}
void PMAPI PM_getPMvect(int intno, PMFARPTR *isr)
@@ -941,9 +941,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -969,15 +969,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
void PMAPI PM_setKeyHandler(PM_intHandler kh)
@@ -990,9 +990,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -1005,9 +1005,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
void PMAPI PM_installAltBreakHandler(PM_breakHandler bh)
@@ -1031,11 +1031,11 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
- }
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
+ }
}
void PMAPI PM_installAltCriticalHandler(PM_criticalHandler ch)
@@ -1056,10 +1056,10 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
@@ -1199,10 +1199,10 @@ void PMAPI PM_restoreMouseHandler(void)
PMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int386(0x33, &regs, &regs);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int386(0x33, &regs, &regs);
+ _PM_mouseHandler = NULL;
+ }
}
#endif
@@ -1288,10 +1288,10 @@ int PMAPI PM_setMouseHandler(int mask, PM_mouseHandler mh)
/* Copy the real mode handler to real mode memory */
if ((mousePtr = PM_allocRealSeg(sizeof(mouseHandler),&rseg,&roff)) == NULL)
- return 0;
+ return 0;
memcpy(mousePtr,mouseHandler,sizeof(mouseHandler));
if (!_DPMI_allocateCallback(_PM_mousePMCB, mouseRegs, &mouseRMCB))
- PM_fatalError("Unable to allocate real mode callback!\n");
+ PM_fatalError("Unable to allocate real mode callback!\n");
PM_setLong(mousePtr,mouseRMCB);
/* Install the real mode mouse handler */
@@ -1309,12 +1309,12 @@ void PMAPI PM_restoreMouseHandler(void)
RMREGS regs;
if (_PM_mouseHandler) {
- regs.x.ax = 33;
- PM_int86(0x33, &regs, &regs);
- PM_freeRealSeg(mousePtr);
- _DPMI_freeCallback(mouseRMCB);
- _PM_mouseHandler = NULL;
- }
+ regs.x.ax = 33;
+ PM_int86(0x33, &regs, &regs);
+ PM_freeRealSeg(mousePtr);
+ _DPMI_freeCallback(mouseRMCB);
+ _PM_mouseHandler = NULL;
+ }
}
#endif
@@ -1347,9 +1347,9 @@ void PMAPI PM_setTimerHandler(PM_intHandler th)
void PMAPI PM_restoreTimerHandler(void)
{
if (_PM_timerHandler) {
- restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
- _PM_timerHandler = NULL;
- }
+ restoreISR(0x8, _PM_prevTimer, _PM_prevRealTimer);
+ _PM_timerHandler = NULL;
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -1375,15 +1375,15 @@ ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
void PMAPI PM_restoreRealTimeClockHandler(void)
{
if (_PM_rtcHandler) {
- /* Restore CMOS registers and mask RTC clock */
- _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
- PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE));
- /* Restore the interrupt vector */
- restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore the interrupt vector */
+ restoreISR(0x70, _PM_prevRTC, _PM_prevRealRTC);
+ _PM_rtcHandler = NULL;
+ }
}
PM_IRQHandle PMAPI PM_setIRQHandler(
@@ -1396,20 +1396,20 @@ PM_IRQHandle PMAPI PM_setIRQHandler(
thunkSize = (ulong)_PM_irqISRTemplateEnd - (ulong)_PM_irqISRTemplate;
if ((handle = PM_malloc(sizeof(_PM_IRQHandle) + thunkSize)) == NULL)
- return NULL;
+ return NULL;
handle->IRQ = IRQ;
handle->prevPIC = PM_inpb(0x21);
handle->prevPIC2 = PM_inpb(0xA1);
if (IRQ < 8) {
- handle->IRQVect = (IRQ + 8);
- PICmask = (1 << IRQ);
- chainPrevious = ((handle->prevPIC & PICmask) == 0);
- }
+ handle->IRQVect = (IRQ + 8);
+ PICmask = (1 << IRQ);
+ chainPrevious = ((handle->prevPIC & PICmask) == 0);
+ }
else {
- handle->IRQVect = (0x60 + IRQ + 8);
- PICmask = ((1 << IRQ) | 0x4);
- chainPrevious = ((handle->prevPIC2 & (PICmask >> 8)) == 0);
- }
+ handle->IRQVect = (0x60 + IRQ + 8);
+ PICmask = ((1 << IRQ) | 0x4);
+ chainPrevious = ((handle->prevPIC2 & (PICmask >> 8)) == 0);
+ }
/* Copy and setup the assembler thunk */
offsetAdjust = (ulong)handle->thunk - (ulong)_PM_irqISRTemplate;
@@ -1417,13 +1417,13 @@ PM_IRQHandle PMAPI PM_setIRQHandler(
*((ulong*)&handle->thunk[2]) = offsetAdjust;
*((ulong*)&handle->thunk[11+0]) = (ulong)ih;
if (chainPrevious) {
- *((ulong*)&handle->thunk[11+4]) = handle->prevHandler.off;
- *((ulong*)&handle->thunk[11+8]) = handle->prevHandler.sel;
- }
+ *((ulong*)&handle->thunk[11+4]) = handle->prevHandler.off;
+ *((ulong*)&handle->thunk[11+8]) = handle->prevHandler.sel;
+ }
else {
- *((ulong*)&handle->thunk[11+4]) = 0;
- *((ulong*)&handle->thunk[11+8]) = 0;
- }
+ *((ulong*)&handle->thunk[11+4]) = 0;
+ *((ulong*)&handle->thunk[11+8]) = 0;
+ }
*((ulong*)&handle->thunk[11+12]) = IRQ;
/* Set the real time clock interrupt handler */
@@ -1444,9 +1444,9 @@ void PMAPI PM_restoreIRQHandler(
/* Restore PIC mask for the interrupt */
if (handle->IRQ < 8)
- PICmask = (1 << handle->IRQ);
+ PICmask = (1 << handle->IRQ);
else
- PICmask = ((1 << handle->IRQ) | 0x4);
+ PICmask = ((1 << handle->IRQ) | 0x4);
PM_outpb(0xA1,(PM_inpb(0xA1) & ~(PICmask >> 8)) | (handle->prevPIC2 & (PICmask >> 8)));
PM_outpb(0x21,(PM_inpb(0x21) & ~PICmask) | (handle->prevPIC & PICmask));
@@ -1467,9 +1467,9 @@ void PMAPI PM_setKeyHandler(PM_intHandler kh)
void PMAPI PM_restoreKeyHandler(void)
{
if (_PM_keyHandler) {
- restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
- _PM_keyHandler = NULL;
- }
+ restoreISR(0x9, _PM_prevKey, _PM_prevRealKey);
+ _PM_keyHandler = NULL;
+ }
}
void PMAPI PM_setKey15Handler(PM_key15Handler kh)
@@ -1482,9 +1482,9 @@ void PMAPI PM_setKey15Handler(PM_key15Handler kh)
void PMAPI PM_restoreKey15Handler(void)
{
if (_PM_key15Handler) {
- restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
- _PM_key15Handler = NULL;
- }
+ restoreISR(0x15, _PM_prevKey15, _PM_prevRealKey15);
+ _PM_key15Handler = NULL;
+ }
}
/* Real mode Ctrl-C and Ctrl-Break handler. This handler simply sets a
@@ -1540,14 +1540,14 @@ void PMAPI PM_installBreakHandler(void)
void PMAPI PM_restoreBreakHandler(void)
{
if (_PM_prevBreak.sel) {
- restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
- restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
- _PM_prevBreak.sel = 0;
- _PM_breakHandler = NULL;
+ restoreISR(0x1B, _PM_prevBreak, prevRealBreak);
+ restoreISR(0x23, _PM_prevCtrlC, prevRealCtrlC);
+ _PM_prevBreak.sel = 0;
+ _PM_breakHandler = NULL;
#ifndef DOS4GW
- PM_freeRealSeg(_PM_ctrlBPtr);
+ PM_freeRealSeg(_PM_ctrlBPtr);
#endif
- }
+ }
}
/* Real mode Critical Error handler. This handler simply saves the AX and
@@ -1599,11 +1599,11 @@ void PMAPI PM_installCriticalHandler(void)
void PMAPI PM_restoreCriticalHandler(void)
{
if (_PM_prevCritical.sel) {
- restoreISR(0x24, _PM_prevCritical, prevRealCritical);
- PM_freeRealSeg(_PM_critPtr);
- _PM_prevCritical.sel = 0;
- _PM_critHandler = NULL;
- }
+ restoreISR(0x24, _PM_prevCritical, prevRealCritical);
+ PM_freeRealSeg(_PM_critPtr);
+ _PM_prevCritical.sel = 0;
+ _PM_critHandler = NULL;
+ }
}
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lh)
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c b/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c
index 2e78e25a8b..c3e9b6c33f 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/vflat.c
@@ -79,7 +79,7 @@ PRIVATE ibool CheckDPMI(void)
PMREGS regs;
if (haveDPMI)
- return true;
+ return true;
/* Check if we are running under DPMI in which case we will not be
* able to install our page fault handlers. We can however use the
@@ -88,7 +88,7 @@ PRIVATE ibool CheckDPMI(void)
regs.x.ax = 0xFF00;
PM_int386(0x31,&regs,&regs);
if (!regs.x.cflag && (regs.e.edi & 8))
- return (haveDPMI = true);
+ return (haveDPMI = true);
return false;
}
@@ -101,13 +101,13 @@ ibool PMAPI VF_available(void)
****************************************************************************/
{
if (!VF_zeroPtr)
- VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
+ VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
if (CheckDPMI())
- return false;
+ return false;
/* Standard DOS4GW, PMODE/W and Causeway */
if (InitPaging() == -1)
- return false;
+ return false;
ClosePaging();
return true;
}
@@ -153,21 +153,21 @@ void * PMAPI InitDOS4GW(ulong baseAddr,int bankSize,int codeLen,void *bankFunc)
int i;
if (InitPaging() == -1)
- return NULL; /* Cannot do hardware paging! */
+ return NULL; /* Cannot do hardware paging! */
/* Map 4MB of video memory into linear address space (read/write) */
if (bankSize == 64) {
- for (i = 0; i < 64; i++) {
- MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<16),16,
- PAGE_WRITE | PAGE_NOTPRESENT);
- }
- }
+ for (i = 0; i < 64; i++) {
+ MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<16),16,
+ PAGE_WRITE | PAGE_NOTPRESENT);
+ }
+ }
else {
- for (i = 0; i < 1024; i++) {
- MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<12),1,
- PAGE_WRITE | PAGE_NOTPRESENT);
- }
- }
+ for (i = 0; i < 1024; i++) {
+ MapPhysical2Linear(baseAddr,VFLAT_START_ADDR+(i<<12),1,
+ PAGE_WRITE | PAGE_NOTPRESENT);
+ }
+ }
/* Install our page fault handler and banks switch function */
InstallFaultHandler(baseAddr,bankSize);
@@ -191,13 +191,13 @@ void * PMAPI VF_init(ulong baseAddr,int bankSize,int codeLen,void *bankFunc)
****************************************************************************/
{
if (installed)
- return (void*)VFLAT_START_ADDR;
+ return (void*)VFLAT_START_ADDR;
if (codeLen > 100)
- return NULL; /* Bank function is too large! */
+ return NULL; /* Bank function is too large! */
if (!VF_zeroPtr)
- VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
+ VF_zeroPtr = PM_mapPhysicalAddr(0,0xFFFFFFFF,true);
if (CheckDPMI())
- return InitDPMI(baseAddr,bankSize,codeLen,bankFunc);
+ return InitDPMI(baseAddr,bankSize,codeLen,bankFunc);
return InitDOS4GW(baseAddr,bankSize,codeLen,bankFunc);
}
@@ -212,16 +212,16 @@ void PMAPI VF_exit(void)
****************************************************************************/
{
if (installed) {
- if (haveDPMI) {
- /* DPMI support */
- }
- else {
- /* Standard DOS4GW and PMODE/W support */
- RemoveFaultHandler();
- ClosePaging();
- }
- installed = false;
- }
+ if (haveDPMI) {
+ /* DPMI support */
+ }
+ else {
+ /* Standard DOS4GW and PMODE/W support */
+ RemoveFaultHandler();
+ ClosePaging();
+ }
+ installed = false;
+ }
}
/*-------------------------------------------------------------------------*/
diff --git a/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c
index 960ed06cd7..53ab16cf40 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/dos/ztimer.c
@@ -106,6 +106,6 @@ passed, so if this happens we will be generating erronous results.
ulong __ULZElapsedTime(ulong start,ulong finish)
{
if (finish < start)
- finish += 1573040L; /* Number of ticks in 24 hours */
+ finish += 1573040L; /* Number of ticks in 24 hours */
return finish - start;
}
OpenPOWER on IntegriCloud