summaryrefslogtreecommitdiffstats
path: root/board/MAI/bios_emulator/scitech/src/pm/ntdrv
diff options
context:
space:
mode:
Diffstat (limited to 'board/MAI/bios_emulator/scitech/src/pm/ntdrv')
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c1
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c47
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c79
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c281
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h3
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c347
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c201
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c29
-rw-r--r--board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c1
9 files changed, 490 insertions, 499 deletions
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c
index e72a856019..d15b07c290 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/cpuinfo.c
@@ -62,4 +62,3 @@ Read the counter and return the counter value.
(t)->low = lt.LowPart; \
(t)->high = lt.HighPart; \
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c
index f93d9c22e7..c82648b787 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/int86.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -43,7 +43,7 @@ We do have limited BIOS access under Windows NT device drivers.
****************************************************************************/
ibool PMAPI PM_haveBIOSAccess(void)
{
- // Return false unless we have full buffer passing!
+ /* Return false unless we have full buffer passing! */
return false;
}
@@ -63,8 +63,8 @@ void * PMAPI PM_getVESABuf(
uint *rseg,
uint *roff)
{
- // No buffers supported under Windows NT (Windows XP has them however if
- // we ever decide to support this!)
+ /* No buffers supported under Windows NT (Windows XP has them however if */
+ /* we ever decide to support this!) */
return NULL;
}
@@ -90,7 +90,7 @@ void * PMAPI PM_mapRealPointer(
uint r_seg,
uint r_off)
{
- // Not used for Windows NT drivers!
+ /* Not used for Windows NT drivers! */
return NULL;
}
@@ -103,7 +103,7 @@ void * PMAPI PM_allocRealSeg(
uint *r_seg,
uint *r_off)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)size;
(void)r_seg;
(void)r_off;
@@ -117,7 +117,7 @@ Free a block of real mode memory.
void PMAPI PM_freeRealSeg(
void *mem)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)mem;
}
@@ -129,7 +129,7 @@ void PMAPI DPMI_int86(
int intno,
DPMI_regs *regs)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
}
/****************************************************************************
@@ -143,7 +143,7 @@ void PMAPI PM_callRealMode(
RMREGS *regs,
RMSREGS *sregs)
{
- // TODO!!
+ /* TODO!! */
#if 0
CLIENT_STRUCT saveRegs;
@@ -151,7 +151,7 @@ void PMAPI PM_callRealMode(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS)
- return;
+ return;
TRACE("SDDHELP: Entering PM_callRealMode()\n");
Begin_Nest_V86_Exec();
@@ -174,7 +174,7 @@ int PMAPI PM_int86(
RMREGS *in,
RMREGS *out)
{
- // TODO!!
+ /* TODO!! */
#if 0
RMSREGS sregs = {0};
CLIENT_STRUCT saveRegs;
@@ -183,9 +183,9 @@ int PMAPI PM_int86(
/* Disable pass-up to our VxD handler so we directly call BIOS */
TRACE("SDDHELP: Entering PM_int86()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
Begin_Nest_V86_Exec();
LoadV86Registers(&saveRegs,in,&sregs);
Exec_Int(intno);
@@ -194,7 +194,7 @@ int PMAPI PM_int86(
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
TRACE("SDDHELP: Exiting PM_int86()\n");
#else
@@ -214,7 +214,7 @@ int PMAPI PM_int86x(
RMREGS *out,
RMSREGS *sregs)
{
- // TODO!!
+ /* TODO!! */
#if 0
CLIENT_STRUCT saveRegs;
ushort oldDisable;
@@ -223,16 +223,16 @@ int PMAPI PM_int86x(
* loaded, and not statically loaded.
*/
if (!_PM_haveBIOS) {
- *out = *in;
- return out->x.ax;
- }
+ *out = *in;
+ return out->x.ax;
+ }
/* Disable pass-up to our VxD handler so we directly call BIOS */
TRACE("SDDHELP: Entering PM_int86x()\n");
if (disableTSRFlag) {
- oldDisable = *disableTSRFlag;
- *disableTSRFlag = 0;
- }
+ oldDisable = *disableTSRFlag;
+ *disableTSRFlag = 0;
+ }
Begin_Nest_V86_Exec();
LoadV86Registers(&saveRegs,in,sregs);
Exec_Int(intno);
@@ -241,7 +241,7 @@ int PMAPI PM_int86x(
/* Re-enable pass-up to our VxD handler if previously enabled */
if (disableTSRFlag)
- *disableTSRFlag = oldDisable;
+ *disableTSRFlag = oldDisable;
TRACE("SDDHELP: Exiting PM_int86x()\n");
#else
@@ -249,4 +249,3 @@ int PMAPI PM_int86x(
#endif
return out->x.ax;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c
index bc6b4274df..9cd52047b7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/irq.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -67,41 +67,41 @@ 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,(uchar)_PM_oldCMOSRegA);
- _PM_writeCMOS(0x0B,(uchar)(_PM_oldCMOSRegB & 0x0F));
- }
+ /* Disable RTC timout */
+ _PM_writeCMOS(0x0A,(uchar)_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,(uchar)(_PM_oldCMOSRegB & 0x0F));
+ }
else {
- /* 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,(uchar)(0x20 | (i+3)));
- _PM_writeCMOS(0x0B,(uchar)((_PM_oldCMOSRegB & 0x0F) | 0x40));
- }
+ /* 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,(uchar)(0x20 | (i+3)));
+ _PM_writeCMOS(0x0B,(uchar)((_PM_oldCMOSRegB & 0x0F) | 0x40));
+ }
}
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler th,int frequency)
@@ -130,14 +130,13 @@ 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,(uchar)((PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE)));
-
- /* Restore the interrupt vector */
- _PM_restoreISR(RTC_idtEntry, &_PM_prevRTC);
- _PM_rtcHandler = NULL;
- }
+ /* Restore CMOS registers and mask RTC clock */
+ _PM_writeCMOS(0x0A,_PM_oldCMOSRegA);
+ _PM_writeCMOS(0x0B,_PM_oldCMOSRegB);
+ PM_outpb(0xA1,(uchar)((PM_inpb(0xA1) & 0xFE) | (_PM_oldRTCPIC2 & ~0xFE)));
+
+ /* Restore the interrupt vector */
+ _PM_restoreISR(RTC_idtEntry, &_PM_prevRTC);
+ _PM_rtcHandler = NULL;
+ }
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c
index b30d2be860..3128c6ae38 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/mem.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -70,7 +70,7 @@ static memlocked locked[MAX_MEMORY_LOCKED];
ulong PMAPI _PM_getPDB(void);
-// Page table entry flags
+/* Page table entry flags */
#define PAGE_FLAGS_PRESENT 0x00000001
#define PAGE_FLAGS_WRITEABLE 0x00000002
@@ -100,14 +100,14 @@ static ulong _PM_mapPhysicalToLinear(
ulong length = limit+1;
PHYSICAL_ADDRESS paIoBase = {0};
- // NT loves large Ints
+ /* NT loves large Ints */
paIoBase = RtlConvertUlongToLargeInteger( base );
- // Map IO space into Kernel
+ /* Map IO space into Kernel */
if (isCached)
- return (ULONG)MmMapIoSpace(paIoBase, length, MmCached );
+ return (ULONG)MmMapIoSpace(paIoBase, length, MmCached );
else
- return (ULONG)MmMapIoSpace(paIoBase, length, MmNonCached );
+ return (ULONG)MmMapIoSpace(paIoBase, length, MmNonCached );
}
/****************************************************************************
@@ -135,7 +135,7 @@ static void _PM_adjustPageTables(
mask &= ~PAGE_FLAGS_USER;
bits |= PAGE_FLAGS_USER;
}
-
+
/* Disable PCD bit if page table entry should be uncached */
if (!isCached) {
mask &= ~(PAGE_FLAGS_CACHE_DISABLE | PAGE_FLAGS_WRITE_THROUGH);
@@ -144,30 +144,30 @@ static void _PM_adjustPageTables(
pPDB = (ulong*)_PM_mapPhysicalToLinear(_PM_getPDB(),0xFFF,true);
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++) {
- // Set the bits in the page directory entry - required as per
- // Pentium 4 manual. This also takes care of the 4MB page entries
- pPDB[iPDB] = (pPDB[iPDB] & mask) | bits;
- if (!(pPDB[iPDB] & PAGE_FLAGS_4MB)) {
- // If we are dealing with 4KB pages then we need to iterate
- // through each of the page table entries
- pageTable = pPDB[iPDB] & ~0xFFF;
- pPageTable = (ulong*)_PM_mapPhysicalToLinear(pageTable,0xFFF,true);
- start = (iPDB == startPDB) ? startPage : 0;
- end = (iPDB == endPDB) ? endPage : 0x3FF;
- for (iPage = start; iPage <= end; iPage++) {
- pPageTable[iPage] = (pPageTable[iPage] & mask) | bits;
- }
- MmUnmapIoSpace(pPageTable,0xFFF);
- }
- }
- MmUnmapIoSpace(pPDB,0xFFF);
- PM_flushTLB();
- }
+ startPDB = (linear >> 22) & 0x3FF;
+ startPage = (linear >> 12) & 0x3FF;
+ endPDB = ((linear+limit) >> 22) & 0x3FF;
+ endPage = ((linear+limit) >> 12) & 0x3FF;
+ for (iPDB = startPDB; iPDB <= endPDB; iPDB++) {
+ /* Set the bits in the page directory entry - required as per */
+ /* Pentium 4 manual. This also takes care of the 4MB page entries */
+ pPDB[iPDB] = (pPDB[iPDB] & mask) | bits;
+ if (!(pPDB[iPDB] & PAGE_FLAGS_4MB)) {
+ /* If we are dealing with 4KB pages then we need to iterate */
+ /* through each of the page table entries */
+ pageTable = pPDB[iPDB] & ~0xFFF;
+ pPageTable = (ulong*)_PM_mapPhysicalToLinear(pageTable,0xFFF,true);
+ start = (iPDB == startPDB) ? startPage : 0;
+ end = (iPDB == endPDB) ? endPage : 0x3FF;
+ for (iPage = start; iPage <= end; iPage++) {
+ pPageTable[iPage] = (pPageTable[iPage] & mask) | bits;
+ }
+ MmUnmapIoSpace(pPageTable,0xFFF);
+ }
+ }
+ MmUnmapIoSpace(pPDB,0xFFF);
+ PM_flushTLB();
+ }
}
/****************************************************************************
@@ -183,24 +183,24 @@ void * PMAPI PM_mallocShared(
{
int i;
- // First find a free slot in our shared memory table
+ /* First find a free slot in our shared memory table */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].linear == 0)
- break;
- }
+ if (shared[i].linear == 0)
+ break;
+ }
if (i == MAX_MEMORY_SHARED)
- return NULL;
+ return NULL;
- // Allocate the paged pool
+ /* Allocate the paged pool */
shared[i].linear = ExAllocatePool(PagedPool, size);
- // Create a list to manage this allocation
+ /* Create a list to manage this allocation */
shared[i].pMdl = IoAllocateMdl(shared[i].linear,size,FALSE,FALSE,(PIRP) NULL);
- // Lock this allocation in memory
+ /* Lock this allocation in memory */
MmProbeAndLockPages(shared[i].pMdl,KernelMode,IoModifyAccess);
- // Modify bits to grant user access
+ /* Modify bits to grant user access */
_PM_adjustPageTables((ulong)shared[i].linear, size, true, true);
return (void*)shared[i].linear;
}
@@ -214,23 +214,23 @@ void PMAPI PM_freeShared(
{
int i;
- // Find a shared memory block in our table and free it
+ /* Find a shared memory block in our table and free it */
for (i = 0; i < MAX_MEMORY_SHARED; i++) {
- if (shared[i].linear == p) {
- // Unlock what we locked
- MmUnlockPages(shared[i].pMdl);
+ if (shared[i].linear == p) {
+ /* Unlock what we locked */
+ MmUnlockPages(shared[i].pMdl);
- // Free our MDL
- IoFreeMdl(shared[i].pMdl);
+ /* Free our MDL */
+ IoFreeMdl(shared[i].pMdl);
- // Free our mem
- ExFreePool(shared[i].linear);
+ /* Free our mem */
+ ExFreePool(shared[i].linear);
- // Flag that is entry is available
- shared[i].linear = 0;
- break;
- }
- }
+ /* Flag that is entry is available */
+ shared[i].linear = 0;
+ break;
+ }
+ }
}
/****************************************************************************
@@ -245,27 +245,27 @@ void * PMAPI PM_mapPhysicalAddr(
ulong linear,length = limit+1;
int i;
- // Search table of existing mappings to see if we have already mapped
- // a region of memory that will serve this purpose.
+ /* Search table of existing mappings to see if we have already mapped */
+ /* a region of memory that will serve this purpose. */
for (i = 0; i < numMappings; i++) {
- if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached) {
- _PM_adjustPageTables((ulong)maps[i].linear, maps[i].length, true, isCached);
- return (void*)maps[i].linear;
- }
- }
+ if (maps[i].physical == base && maps[i].length == length && maps[i].isCached == isCached) {
+ _PM_adjustPageTables((ulong)maps[i].linear, maps[i].length, true, isCached);
+ return (void*)maps[i].linear;
+ }
+ }
if (numMappings == MAX_MEMORY_MAPPINGS)
- return NULL;
+ return NULL;
- // We did not find any previously mapped memory region, so maps it in.
+ /* We did not find any previously mapped memory region, so maps it in. */
if ((linear = _PM_mapPhysicalToLinear(base,limit,isCached)) == 0xFFFFFFFF)
- return NULL;
+ return NULL;
maps[numMappings].physical = base;
maps[numMappings].length = length;
maps[numMappings].linear = linear;
maps[numMappings].isCached = isCached;
numMappings++;
- // Grant user access to this I/O space
+ /* Grant user access to this I/O space */
_PM_adjustPageTables((ulong)linear, length, true, isCached);
return (void*)linear;
}
@@ -278,8 +278,8 @@ void PMAPI PM_freePhysicalAddr(
void *ptr,
ulong limit)
{
- // We don't free the memory mappings in here because we cache all
- // the memory mappings we create in the system for later use.
+ /* We don't free the memory mappings in here because we cache all */
+ /* the memory mappings we create in the system for later use. */
}
/****************************************************************************
@@ -291,7 +291,7 @@ void PMAPI _PM_freeMemoryMappings(void)
int i;
for (i = 0; i < numMappings; i++)
- MmUnmapIoSpace((void *)maps[i].linear,maps[i].length);
+ MmUnmapIoSpace((void *)maps[i].linear,maps[i].length);
}
/****************************************************************************
@@ -320,10 +320,10 @@ ibool PMAPI PM_getPhysicalAddrRange(
ulong linear = (ulong)p & ~0xFFF;
for (i = (length + 0xFFF) >> 12; i > 0; i--) {
- if ((*physAddress++ = PM_getPhysicalAddr((void*)linear)) == 0xFFFFFFFF)
- return false;
- linear += 4096;
- }
+ if ((*physAddress++ = PM_getPhysicalAddr((void*)linear)) == 0xFFFFFFFF)
+ return false;
+ linear += 4096;
+ }
return true;
}
@@ -340,58 +340,58 @@ void * PMAPI PM_allocLockedMem(
int i;
PHYSICAL_ADDRESS paOurAddress;
- // First find a free slot in our shared memory table
+ /* First find a free slot in our shared memory table */
for (i = 0; i < MAX_MEMORY_LOCKED; i++) {
- if (locked[i].linear == 0)
- break;
- }
+ if (locked[i].linear == 0)
+ break;
+ }
if (i == MAX_MEMORY_LOCKED)
- return NULL;
+ return NULL;
- // HighestAcceptableAddress - Specifies the highest valid physical address
- // the driver can use. For example, if a device can only reference physical
- // memory in the lower 16MB, this value would be set to 0x00000000FFFFFF.
+ /* HighestAcceptableAddress - Specifies the highest valid physical address */
+ /* the driver can use. For example, if a device can only reference physical */
+ /* memory in the lower 16MB, this value would be set to 0x00000000FFFFFF. */
paOurAddress.HighPart = 0;
if (below16M)
- paOurAddress.LowPart = 0x00FFFFFF;
+ paOurAddress.LowPart = 0x00FFFFFF;
else
- paOurAddress.LowPart = 0xFFFFFFFF;
+ paOurAddress.LowPart = 0xFFFFFFFF;
if (contiguous) {
- // Allocate from the non-paged pool (unfortunately 4MB pages)
- locked[i].linear = MmAllocateContiguousMemory(size, paOurAddress);
- if (!locked[i].linear)
- return NULL;
+ /* Allocate from the non-paged pool (unfortunately 4MB pages) */
+ locked[i].linear = MmAllocateContiguousMemory(size, paOurAddress);
+ if (!locked[i].linear)
+ return NULL;
- // Flag no MDL
- locked[i].pMdl = NULL;
+ /* Flag no MDL */
+ locked[i].pMdl = NULL;
- // Map the physical address for the memory so we can manage
- // the page tables in 4KB chunks mapped into user space.
+ /* Map the physical address for the memory so we can manage */
+ /* the page tables in 4KB chunks mapped into user space. */
- // TODO: Map this with the physical address to the linear addresss
- locked[i].mmIoMapped = locked[i].linear;
+ /* TODO: Map this with the physical address to the linear addresss */
+ locked[i].mmIoMapped = locked[i].linear;
- // Modify bits to grant user access, flag not cached
- _PM_adjustPageTables((ulong)locked[i].mmIoMapped, size, true, false);
- return (void*)locked[i].mmIoMapped;
- }
+ /* Modify bits to grant user access, flag not cached */
+ _PM_adjustPageTables((ulong)locked[i].mmIoMapped, size, true, false);
+ return (void*)locked[i].mmIoMapped;
+ }
else {
- // Allocate from the paged pool
- locked[i].linear = ExAllocatePool(PagedPool, size);
- if (!locked[i].linear)
- return NULL;
+ /* Allocate from the paged pool */
+ locked[i].linear = ExAllocatePool(PagedPool, size);
+ if (!locked[i].linear)
+ return NULL;
- // Create a list to manage this allocation
- locked[i].pMdl = IoAllocateMdl(locked[i].linear,size,FALSE,FALSE,(PIRP) NULL);
+ /* Create a list to manage this allocation */
+ locked[i].pMdl = IoAllocateMdl(locked[i].linear,size,FALSE,FALSE,(PIRP) NULL);
- // Lock this allocation in memory
- MmProbeAndLockPages(locked[i].pMdl,KernelMode,IoModifyAccess);
+ /* Lock this allocation in memory */
+ MmProbeAndLockPages(locked[i].pMdl,KernelMode,IoModifyAccess);
- // Modify bits to grant user access, flag not cached
- _PM_adjustPageTables((ulong)locked[i].linear, size, true, false);
- return (void*)locked[i].linear;
- }
+ /* Modify bits to grant user access, flag not cached */
+ _PM_adjustPageTables((ulong)locked[i].linear, size, true, false);
+ return (void*)locked[i].linear;
+ }
}
/****************************************************************************
@@ -407,27 +407,27 @@ void PMAPI PM_freeLockedMem(
/* Find a locked memory block in our table and free it */
for (i = 0; i < MAX_MEMORY_LOCKED; i++) {
- if (locked[i].linear == p) {
- // An Mdl indicates that we used the paged pool, and locked it,
- // so now we have to unlock, free the MDL, and free paged
- if (locked[i].pMdl) {
- // Unlock what we locked and free the Mdl
- MmUnlockPages(locked[i].pMdl);
- IoFreeMdl(locked[i].pMdl);
- ExFreePool(locked[i].linear);
- }
- else {
- // TODO: Free the mmIoMap mapping for the memory!
-
- // Free non-paged pool
- MmFreeContiguousMemory(locked[i].linear);
- }
-
- // Flag that is entry is available
- locked[i].linear = 0;
- break;
- }
- }
+ if (locked[i].linear == p) {
+ /* An Mdl indicates that we used the paged pool, and locked it, */
+ /* so now we have to unlock, free the MDL, and free paged */
+ if (locked[i].pMdl) {
+ /* Unlock what we locked and free the Mdl */
+ MmUnlockPages(locked[i].pMdl);
+ IoFreeMdl(locked[i].pMdl);
+ ExFreePool(locked[i].linear);
+ }
+ else {
+ /* TODO: Free the mmIoMap mapping for the memory! */
+
+ /* Free non-paged pool */
+ MmFreeContiguousMemory(locked[i].linear);
+ }
+
+ /* Flag that is entry is available */
+ locked[i].linear = 0;
+ break;
+ }
+ }
}
/****************************************************************************
@@ -437,11 +437,11 @@ Allocates a page aligned and page sized block of memory
void * PMAPI PM_allocPage(
ibool locked)
{
- // Allocate the memory from the non-paged pool if we want the memory
- // to be locked.
+ /* Allocate the memory from the non-paged pool if we want the memory */
+ /* to be locked. */
return ExAllocatePool(
- locked ? NonPagedPoolCacheAligned : PagedPoolCacheAligned,
- PAGE_SIZE);
+ locked ? NonPagedPoolCacheAligned : PagedPoolCacheAligned,
+ PAGE_SIZE);
}
/****************************************************************************
@@ -465,11 +465,11 @@ int PMAPI PM_lockDataPages(
{
MDL *pMdl;
- // Create a list to manage this allocation
+ /* Create a list to manage this allocation */
if ((pMdl = IoAllocateMdl(p,len,FALSE,FALSE,(PIRP)NULL)) == NULL)
- return false;
+ return false;
- // Lock this allocation in memory
+ /* Lock this allocation in memory */
MmProbeAndLockPages(pMdl,KernelMode,IoModifyAccess);
*((PMDL*)(&lh->h)) = pMdl;
return true;
@@ -485,11 +485,11 @@ int PMAPI PM_unlockDataPages(
PM_lockHandle *lh)
{
if (p && lh) {
- // Unlock what we locked
- MDL *pMdl = *((PMDL*)(&lh->h));
- MmUnlockPages(pMdl);
- IoFreeMdl(pMdl);
- }
+ /* Unlock what we locked */
+ MDL *pMdl = *((PMDL*)(&lh->h));
+ MmUnlockPages(pMdl);
+ IoFreeMdl(pMdl);
+ }
return true;
}
@@ -516,4 +516,3 @@ int PMAPI PM_unlockCodePages(
{
return PM_unlockDataPages((void*)p,len,lh);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h
index 3f747bb9ce..65b7bae23c 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/oshdr.h
@@ -42,5 +42,4 @@
UNICODE_STRING * _PM_CStringToUnicodeString(const char *cstr);
void _PM_FreeUnicodeString(UNICODE_STRING *uniStr);
-#endif // __NTDRV_OSHDR_H
-
+#endif /* __NTDRV_OSHDR_H */
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c
index d4bbe228b7..c6606314c1 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/pm.c
@@ -1,7 +1,7 @@
/****************************************************************************
*
* SciTech OS Portability Manager Library
-*
+*
* ========================================================================
*
* The contents of this file are subject to the SciTech MGL Public
@@ -88,9 +88,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';
+ }
}
/****************************************************************************
@@ -116,25 +116,25 @@ void PMAPI PM_fatalError(
ULONG len;
if (fatalErrorCleanup)
- fatalErrorCleanup();
+ fatalErrorCleanup();
-#ifdef DBG // Send output to debugger, just return so as not to force a reboot
-#pragma message("INFO: building for debug, PM_fatalError() re-routed")
- DBGMSG2("SDDHELP> PM_fatalError(): ERROR: %s\n", msg);
+#ifdef DBG /* Send output to debugger, just return so as not to force a reboot */
+#pragma message("INFO: building for debug, PM_fatalError() re-routed")
+ DBGMSG2("SDDHELP> PM_fatalError(): ERROR: %s\n", msg);
return ;
#endif
- // KeBugCheckEx brings down the system in a controlled
- // manner when the caller discovers an unrecoverable
- // inconsistency that would corrupt the system if
- // the caller continued to run.
- //
- // hack - dump the first 20 chars in hex using the variables
- // provided - Each ULONG is equal to four characters...
+ /* KeBugCheckEx brings down the system in a controlled */
+ /* manner when the caller discovers an unrecoverable */
+ /* inconsistency that would corrupt the system if */
+ /* the caller continued to run. */
+ /* */
+ /* hack - dump the first 20 chars in hex using the variables */
+ /* provided - Each ULONG is equal to four characters... */
for(len = 0; len < 20; len++)
- if (msg[len] == (char)0)
- break;
+ if (msg[len] == (char)0)
+ break;
- // This looks bad but it's quick and reliable...
+ /* This looks bad but it's quick and reliable... */
p = (char *)&BugCheckCode;
if(len > 0) p[3] = msg[0];
if(len > 1) p[2] = msg[1];
@@ -165,7 +165,7 @@ void PMAPI PM_fatalError(
if(len > 18) p[1] = msg[18];
if(len > 19) p[0] = msg[19];
- // Halt the system!
+ /* Halt the system! */
KeBugCheckEx(BugCheckCode, MoreBugCheckData[0], MoreBugCheckData[1], MoreBugCheckData[2], MoreBugCheckData[3]);
}
@@ -209,50 +209,50 @@ static ibool REG_queryString(
STRING stringdata;
UNICODE_STRING unidata;
- // Convert strings to UniCode
+ /* Convert strings to UniCode */
status = false;
if ((uniKey = _PM_CStringToUnicodeString(szKey)) == NULL)
- goto Exit;
+ goto Exit;
if ((uniValue = _PM_CStringToUnicodeString(szValue)) == NULL)
- goto Exit;
+ goto Exit;
- // Open the key
+ /* Open the key */
InitializeObjectAttributes( &keyAttributes,
- uniKey,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL );
+ uniKey,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
rval = ZwOpenKey( &Handle,
- KEY_ALL_ACCESS,
- &keyAttributes );
+ KEY_ALL_ACCESS,
+ &keyAttributes );
if (!NT_SUCCESS(rval))
- goto Exit;
+ goto Exit;
- // Query the value
+ /* Query the value */
length = sizeof (KEY_VALUE_FULL_INFORMATION)
- + size * sizeof(WCHAR);
+ + size * sizeof(WCHAR);
if ((fullInfo = ExAllocatePool (PagedPool, length)) == NULL)
- goto Exit;
+ goto Exit;
RtlZeroMemory(fullInfo, length);
rval = ZwQueryValueKey (Handle,
- uniValue,
- KeyValueFullInformation,
- fullInfo,
- length,
- &length);
+ uniValue,
+ KeyValueFullInformation,
+ fullInfo,
+ length,
+ &length);
if (NT_SUCCESS (rval)) {
- // Create the UniCode string so we can convert it
- unidata.Buffer = (PWCHAR)(((PCHAR)fullInfo) + fullInfo->DataOffset);
- unidata.Length = (USHORT)fullInfo->DataLength;
- unidata.MaximumLength = (USHORT)fullInfo->DataLength + sizeof(WCHAR);
-
- // Convert unicode univalue to ansi string.
- rval = RtlUnicodeStringToAnsiString(&stringdata, &unidata, TRUE);
- if (NT_SUCCESS(rval)) {
- strcpy(value,stringdata.Buffer);
- status = true;
- }
- }
+ /* Create the UniCode string so we can convert it */
+ unidata.Buffer = (PWCHAR)(((PCHAR)fullInfo) + fullInfo->DataOffset);
+ unidata.Length = (USHORT)fullInfo->DataLength;
+ unidata.MaximumLength = (USHORT)fullInfo->DataLength + sizeof(WCHAR);
+
+ /* Convert unicode univalue to ansi string. */
+ rval = RtlUnicodeStringToAnsiString(&stringdata, &unidata, TRUE);
+ if (NT_SUCCESS(rval)) {
+ strcpy(value,stringdata.Buffer);
+ status = true;
+ }
+ }
Exit:
if (fullInfo) ExFreePool(fullInfo);
@@ -269,7 +269,7 @@ char PMAPI PM_getBootDrive(void)
{
char path[256];
if (REG_queryString(szNTWindowsKey,szNTSystemRoot,path,sizeof(path)))
- return 'c';
+ return 'c';
return path[0];
}
@@ -291,12 +291,12 @@ const char * PMAPI PM_getNucleusPath(void)
static char path[256];
if (strlen(_PM_nucleusPath) > 0) {
- strcpy(path,_PM_nucleusPath);
- PM_backslash(path);
- return path;
- }
+ strcpy(path,_PM_nucleusPath);
+ PM_backslash(path);
+ return path;
+ }
if (!REG_queryString(szNTWindowsKey,szNTSystemRoot,path,sizeof(path)))
- strcpy(path,"c:\\winnt");
+ strcpy(path,"c:\\winnt");
PM_backslash(path);
strcat(path,"system32\\nucleus");
return path;
@@ -333,9 +333,9 @@ const char * PMAPI PM_getMachineName(void)
static char name[256];
if (REG_queryString(szMachineNameKey,szMachineName,name,sizeof(name)))
- return name;
+ return name;
if (REG_queryString(szMachineNameKeyNT,szMachineName,name,sizeof(name)))
- return name;
+ return name;
return "Unknown";
}
@@ -345,7 +345,7 @@ Check if a key has been pressed.
****************************************************************************/
int PMAPI PM_kbhit(void)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
return true;
}
@@ -355,7 +355,7 @@ Wait for and return the next keypress.
****************************************************************************/
int PMAPI PM_getch(void)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
return 0xD;
}
@@ -372,7 +372,7 @@ PM_HWND PMAPI PM_openConsole(
int bpp,
ibool fullScreen)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hwndUser;
(void)device;
(void)xRes;
@@ -388,7 +388,7 @@ Find the size of the console state buffer.
****************************************************************************/
int PMAPI PM_getConsoleStateSize(void)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
return 1;
}
@@ -400,7 +400,7 @@ void PMAPI PM_saveConsoleState(
void *stateBuf,
PM_HWND hwndConsole)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)stateBuf;
(void)hwndConsole;
}
@@ -412,7 +412,7 @@ Set the suspend application callback for the fullscreen console.
void PMAPI PM_setSuspendAppCallback(
PM_saveState_cb saveState)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)saveState;
}
@@ -424,7 +424,7 @@ void PMAPI PM_restoreConsoleState(
const void *stateBuf,
PM_HWND hwndConsole)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)stateBuf;
(void)hwndConsole;
}
@@ -436,7 +436,7 @@ Close the fullscreen console.
void PMAPI PM_closeConsole(
PM_HWND hwndConsole)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hwndConsole;
}
@@ -475,7 +475,7 @@ void * PMAPI PM_mapToProcess(
void *base,
ulong limit)
{
- // Not used anymore
+ /* Not used anymore */
(void)base;
(void)limit;
return NULL;
@@ -491,7 +491,7 @@ ibool PMAPI PM_doBIOSPOST(
void *mappedBIOS,
ulong BIOSLen)
{
- // This may not be possible in NT and should be done by the OS anyway
+ /* This may not be possible in NT and should be done by the OS anyway */
(void)axVal;
(void)BIOSPhysAddr;
(void)mappedBIOS;
@@ -505,7 +505,7 @@ 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!
+ /* Note that on NT this probably does not do what we expect! */
return PM_mapPhysicalAddr(0x400, 0x1000, true);
}
@@ -525,7 +525,7 @@ Sleep for the specified number of milliseconds.
void PMAPI PM_sleep(
ulong milliseconds)
{
- // We never use this in NT drivers
+ /* We never use this in NT drivers */
(void)milliseconds;
}
@@ -535,14 +535,14 @@ Return the base I/O port for the specified COM port.
****************************************************************************/
int PMAPI PM_getCOMPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
switch (port) {
- case 0: return 0x3F8;
- case 1: return 0x2F8;
- case 2: return 0x3E8;
- case 3: return 0x2E8;
- }
+ case 0: return 0x3F8;
+ case 1: return 0x2F8;
+ case 2: return 0x3E8;
+ case 3: return 0x2E8;
+ }
return 0;
}
@@ -552,13 +552,13 @@ Return the base I/O port for the specified LPT port.
****************************************************************************/
int PMAPI PM_getLPTPort(int port)
{
- // TODO: Re-code this to determine real values using the Plug and Play
- // manager for the OS.
+ /* TODO: Re-code this to determine real values using the Plug and Play */
+ /* manager for the OS. */
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;
}
@@ -580,7 +580,7 @@ OS specific shared libraries not supported inside a VxD
PM_MODULE PMAPI PM_loadLibrary(
const char *szDLLName)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)szDLLName;
return NULL;
}
@@ -593,7 +593,7 @@ void * PMAPI PM_getProcAddress(
PM_MODULE hModule,
const char *szProcName)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hModule;
(void)szProcName;
return NULL;
@@ -606,7 +606,7 @@ OS specific shared libraries not supported inside a VxD
void PMAPI PM_freeLibrary(
PM_MODULE hModule)
{
- // Not used in NT drivers
+ /* Not used in NT drivers */
(void)hModule;
}
@@ -618,9 +618,9 @@ void *PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
- // TODO: This function should start a directory enumeration search
- // given the filename (with wildcards). The data should be
- // converted and returned in the findData standard form.
+ /* TODO: This function should start a directory enumeration search */
+ /* given the filename (with wildcards). The data should be */
+ /* converted and returned in the findData standard form. */
(void)filename;
(void)findData;
return PM_FILE_INVALID;
@@ -634,10 +634,10 @@ ibool PMAPI PM_findNextFile(
void *handle,
PM_findData *findData)
{
- // TODO: This function should find the next file in directory enumeration
- // search given the search criteria defined in the call to
- // PM_findFirstFile. The data should be converted and returned
- // in the findData standard form.
+ /* TODO: This function should find the next file in directory enumeration */
+ /* search given the search criteria defined in the call to */
+ /* PM_findFirstFile. The data should be converted and returned */
+ /* in the findData standard form. */
(void)handle;
(void)findData;
return false;
@@ -650,8 +650,8 @@ Function to close the find process
void PMAPI PM_findClose(
void *handle)
{
- // TODO: This function should close the find process. This may do
- // nothing for some OS'es.
+ /* TODO: This function should close the find process. This may do */
+ /* nothing for some OS'es. */
(void)handle;
}
@@ -671,7 +671,7 @@ numbering is:
ibool PMAPI PM_driveValid(
char drive)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)drive;
return false;
}
@@ -687,7 +687,7 @@ void PMAPI PM_getdcwd(
char *dir,
int len)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)drive;
(void)dir;
(void)len;
@@ -733,67 +733,67 @@ void PMAPI PM_setFileAttr(
char kernelFilename[PM_MAX_PATH+5];
ULONG FileAttributes = 0;
- // Convert file attribute flags
+ /* Convert file attribute flags */
if (attrib & PM_FILE_READONLY)
- FileAttributes |= FILE_ATTRIBUTE_READONLY;
+ FileAttributes |= FILE_ATTRIBUTE_READONLY;
if (attrib & PM_FILE_ARCHIVE)
- FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
+ FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
if (attrib & PM_FILE_HIDDEN)
- FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
+ FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & PM_FILE_SYSTEM)
- FileAttributes |= FILE_ATTRIBUTE_SYSTEM;
+ FileAttributes |= FILE_ATTRIBUTE_SYSTEM;
- // Add prefix for addressing the file system. "\??\" is short for "\DosDevices\"
+ /* Add prefix for addressing the file system. "\??\" is short for "\DosDevices\" */
strcpy(kernelFilename, "\\??\\");
strcat(kernelFilename, filename);
- // Convert filename string to ansi string
+ /* Convert filename string to ansi string */
if ((uniFile = _PM_CStringToUnicodeString(kernelFilename)) == NULL)
- goto Exit;
+ goto Exit;
- // Must open a file to query it's attributes
+ /* Must open a file to query it's attributes */
InitializeObjectAttributes (&ObjectAttributes,
- uniFile,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL );
+ uniFile,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
status = ZwCreateFile( &FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- NULL, //AllocationSize OPTIONAL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- FILE_RANDOM_ACCESS, //CreateOptions,
- NULL, //EaBuffer OPTIONAL,
- 0 //EaLength (required if EaBuffer)
- );
+ DesiredAccess | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL, /*AllocationSize OPTIONAL, */
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ FILE_RANDOM_ACCESS, /*CreateOptions, */
+ NULL, /*EaBuffer OPTIONAL, */
+ 0 /*EaLength (required if EaBuffer) */
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Query timestamps
+ /* Query timestamps */
status = ZwQueryInformationFile(FileHandle,
- &IoStatusBlock,
- &FileBasic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
+ &IoStatusBlock,
+ &FileBasic,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Change the four bits we change
+ /* Change the four bits we change */
FileBasic.FileAttributes &= ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE
- | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
+ | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
FileBasic.FileAttributes |= FileAttributes;
- // Set timestamps
+ /* Set timestamps */
ZwSetInformationFile( FileHandle,
- &IoStatusBlock,
- &FileBasic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
+ &IoStatusBlock,
+ &FileBasic,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation
+ );
Exit:
if (FileHandle) ZwClose(FileHandle);
@@ -821,54 +821,54 @@ uint PMAPI PM_getFileAttr(
ULONG FileAttributes = 0;
uint retval = 0;
- // Add prefix for addressing the file system. "\??\" is short for "\DosDevices\"
+ /* Add prefix for addressing the file system. "\??\" is short for "\DosDevices\" */
strcpy(kernelFilename, "\\??\\");
strcat(kernelFilename, filename);
- // Convert filename string to ansi string
+ /* Convert filename string to ansi string */
if ((uniFile = _PM_CStringToUnicodeString(kernelFilename)) == NULL)
- goto Exit;
+ goto Exit;
- // Must open a file to query it's attributes
+ /* Must open a file to query it's attributes */
InitializeObjectAttributes (&ObjectAttributes,
- uniFile,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL );
+ uniFile,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
status = ZwCreateFile( &FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- NULL, //AllocationSize OPTIONAL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- FILE_RANDOM_ACCESS, //CreateOptions,
- NULL, //EaBuffer OPTIONAL,
- 0 //EaLength (required if EaBuffer)
- );
+ DesiredAccess | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL, /*AllocationSize OPTIONAL, */
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ FILE_RANDOM_ACCESS, /*CreateOptions, */
+ NULL, /*EaBuffer OPTIONAL, */
+ 0 /*EaLength (required if EaBuffer) */
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Query timestamps
+ /* Query timestamps */
status = ZwQueryInformationFile(FileHandle,
- &IoStatusBlock,
- &FileBasic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
+ &IoStatusBlock,
+ &FileBasic,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation
+ );
if (!NT_SUCCESS (status))
- goto Exit;
+ goto Exit;
- // Translate the file attributes
+ /* Translate the file attributes */
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_READONLY)
- retval |= PM_FILE_READONLY;
+ retval |= PM_FILE_READONLY;
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_ARCHIVE)
- retval |= PM_FILE_ARCHIVE;
+ retval |= PM_FILE_ARCHIVE;
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_HIDDEN)
- retval |= PM_FILE_HIDDEN;
+ retval |= PM_FILE_HIDDEN;
if (FileBasic.FileAttributes & FILE_ATTRIBUTE_SYSTEM)
- retval |= PM_FILE_SYSTEM;
+ retval |= PM_FILE_SYSTEM;
Exit:
if (FileHandle) ZwClose(FileHandle);
@@ -883,7 +883,7 @@ Function to create a directory.
ibool PMAPI PM_mkdir(
const char *filename)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
return false;
}
@@ -895,7 +895,7 @@ Function to remove a directory.
ibool PMAPI PM_rmdir(
const char *filename)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
return false;
}
@@ -909,7 +909,7 @@ ibool PMAPI PM_getFileTime(
ibool gmTime,
PM_time *time)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
(void)gmTime;
(void)time;
@@ -925,10 +925,9 @@ ibool PMAPI PM_setFileTime(
ibool gmTime,
PM_time *time)
{
- // Not supported in NT drivers
+ /* Not supported in NT drivers */
(void)filename;
(void)gmTime;
(void)time;
return false;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c
index 856215206f..658f1c80ab 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdio.c
@@ -42,7 +42,7 @@ FILE * fopen(
const char *filename,
const char *mode)
{
- ACCESS_MASK DesiredAccess; // for ZwCreateFile...
+ ACCESS_MASK DesiredAccess; /* for ZwCreateFile... */
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG ShareAccess;
ULONG CreateDisposition;
@@ -56,86 +56,86 @@ FILE * fopen(
char kernelFilename[PM_MAX_PATH+5];
FILE *f;
- // Add prefix for addressing the file system. "\??\" is short for "\DosDevices\"
+ /* Add prefix for addressing the file system. "\??\" is short for "\DosDevices\" */
strcpy(kernelFilename, "\\??\\");
strcat(kernelFilename, filename);
if ((f = PM_malloc(sizeof(FILE))) == NULL)
- goto Error;
+ goto Error;
f->offset = 0;
f->text = (mode[1] == 't' || mode[2] == 't');
f->writemode = (mode[0] == 'w') || (mode[0] == 'a');
if (mode[0] == 'r') {
- // omode = OPEN_ACCESS_READONLY | OPEN_SHARE_COMPATIBLE;
- // action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_FAIL;
- DesiredAccess = GENERIC_READ;
- ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
- CreateDisposition = FILE_OPEN;
- }
+ /* omode = OPEN_ACCESS_READONLY | OPEN_SHARE_COMPATIBLE; */
+ /* action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_FAIL; */
+ DesiredAccess = GENERIC_READ;
+ ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ CreateDisposition = FILE_OPEN;
+ }
else if (mode[0] == 'w') {
- // omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_COMPATIBLE;
- // action = ACTION_IFEXISTS_TRUNCATE | ACTION_IFNOTEXISTS_CREATE;
- DesiredAccess = GENERIC_WRITE;
- ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
- CreateDisposition = FILE_SUPERSEDE;
- }
+ /* omode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_COMPATIBLE; */
+ /* action = ACTION_IFEXISTS_TRUNCATE | ACTION_IFNOTEXISTS_CREATE; */
+ DesiredAccess = GENERIC_WRITE;
+ ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ CreateDisposition = FILE_SUPERSEDE;
+ }
else {
- // omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_COMPATIBLE;
- // action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_CREATE;
- DesiredAccess = GENERIC_READ | GENERIC_WRITE;
- ShareAccess = FILE_SHARE_READ;
- CreateDisposition = FILE_OPEN_IF;
- }
+ /* omode = OPEN_ACCESS_READWRITE | OPEN_SHARE_COMPATIBLE; */
+ /* action = ACTION_IFEXISTS_OPEN | ACTION_IFNOTEXISTS_CREATE; */
+ DesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ ShareAccess = FILE_SHARE_READ;
+ CreateDisposition = FILE_OPEN_IF;
+ }
- // Convert filename string to ansi string and then to UniCode string
+ /* Convert filename string to ansi string and then to UniCode string */
if ((uniFile = _PM_CStringToUnicodeString(kernelFilename)) == NULL)
- return NULL;
+ return NULL;
- // Create the file
+ /* Create the file */
InitializeObjectAttributes (&ObjectAttributes,
- uniFile,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL);
+ uniFile,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
status = ZwCreateFile( &FileHandle,
- DesiredAccess | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- NULL, // AllocationSize OPTIONAL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- FILE_RANDOM_ACCESS, // CreateOptions,
- NULL, // EaBuffer OPTIONAL,
- 0 // EaLength (required if EaBuffer)
- );
+ DesiredAccess | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL, /* AllocationSize OPTIONAL, */
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ FILE_RANDOM_ACCESS, /* CreateOptions, */
+ NULL, /* EaBuffer OPTIONAL, */
+ 0 /* EaLength (required if EaBuffer) */
+ );
if (!NT_SUCCESS (status))
- goto Error;
+ goto Error;
f->handle = (int)FileHandle;
- // Determine size of the file
+ /* Determine size of the file */
status = ZwQueryInformationFile( FileHandle,
- &IoStatusBlock,
- &FileInformation,
- sizeof(FILE_STANDARD_INFORMATION),
- FileStandardInformation
- );
+ &IoStatusBlock,
+ &FileInformation,
+ sizeof(FILE_STANDARD_INFORMATION),
+ FileStandardInformation
+ );
if (!NT_SUCCESS (status))
- goto Error;
+ goto Error;
f->filesize = FileInformation.EndOfFile.LowPart;
- // Move to the end of the file if we are appending
+ /* Move to the end of the file if we are appending */
if (mode[0] == 'a') {
- FilePosition.CurrentByteOffset.HighPart = 0;
- FilePosition.CurrentByteOffset.LowPart = f->filesize;
- status = ZwSetInformationFile( FileHandle,
- &IoStatusBlock,
- &FilePosition,
- sizeof(FILE_POSITION_INFORMATION),
- FilePositionInformation
- );
- if (!NT_SUCCESS (status))
- goto Error;
- }
+ FilePosition.CurrentByteOffset.HighPart = 0;
+ FilePosition.CurrentByteOffset.LowPart = f->filesize;
+ status = ZwSetInformationFile( FileHandle,
+ &IoStatusBlock,
+ &FilePosition,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation
+ );
+ if (!NT_SUCCESS (status))
+ goto Error;
+ }
return f;
Error:
@@ -158,21 +158,21 @@ size_t fread(
IO_STATUS_BLOCK IoStatusBlock;
LARGE_INTEGER ByteOffset;
- // Read any extra bytes from the file
+ /* Read any extra bytes from the file */
ByteOffset.HighPart = 0;
ByteOffset.LowPart = f->offset;
status = ZwReadFile( (HANDLE)f->handle,
- NULL, //IN HANDLE Event OPTIONAL,
- NULL, // IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
- NULL, // IN PVOID ApcContext OPTIONAL,
- &IoStatusBlock,
- ptr, // OUT PVOID Buffer,
- size * n, //IN ULONG Length,
- &ByteOffset, //OPTIONAL,
- NULL //IN PULONG Key OPTIONAL
- );
+ NULL, /*IN HANDLE Event OPTIONAL, */
+ NULL, /* IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, */
+ NULL, /* IN PVOID ApcContext OPTIONAL, */
+ &IoStatusBlock,
+ ptr, /* OUT PVOID Buffer, */
+ size * n, /*IN ULONG Length, */
+ &ByteOffset, /*OPTIONAL, */
+ NULL /*IN PULONG Key OPTIONAL */
+ );
if (!NT_SUCCESS (status))
- return 0;
+ return 0;
f->offset += IoStatusBlock.Information;
return IoStatusBlock.Information / size;
}
@@ -192,24 +192,24 @@ size_t fwrite(
LARGE_INTEGER ByteOffset;
if (!f->writemode)
- return 0;
+ return 0;
ByteOffset.HighPart = 0;
ByteOffset.LowPart = f->offset;
status = ZwWriteFile( (HANDLE)f->handle,
- NULL, //IN HANDLE Event OPTIONAL,
- NULL, // IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
- NULL, // IN PVOID ApcContext OPTIONAL,
- &IoStatusBlock,
- (void*)ptr, // OUT PVOID Buffer,
- size * n, //IN ULONG Length,
- &ByteOffset, //OPTIONAL,
- NULL //IN PULONG Key OPTIONAL
- );
+ NULL, /*IN HANDLE Event OPTIONAL, */
+ NULL, /* IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, */
+ NULL, /* IN PVOID ApcContext OPTIONAL, */
+ &IoStatusBlock,
+ (void*)ptr, /* OUT PVOID Buffer, */
+ size * n, /*IN ULONG Length, */
+ &ByteOffset, /*OPTIONAL, */
+ NULL /*IN PULONG Key OPTIONAL */
+ );
if (!NT_SUCCESS (status))
- return 0;
+ return 0;
f->offset += IoStatusBlock.Information;
if (f->offset > f->filesize)
- f->filesize = f->offset;
+ f->filesize = f->offset;
return IoStatusBlock.Information / size;
}
@@ -220,7 +220,7 @@ NT driver implementation of the ANSI C fflush function.
int fflush(
FILE *f)
{
- // Nothing to do here as we are not doing buffered I/O
+ /* Nothing to do here as we are not doing buffered I/O */
(void)f;
return 0;
}
@@ -239,21 +239,21 @@ int fseek(
IO_STATUS_BLOCK IoStatusBlock;
if (whence == 0)
- f->offset = offset;
+ f->offset = offset;
else if (whence == 1)
- f->offset += offset;
+ f->offset += offset;
else if (whence == 2)
- f->offset = f->filesize + offset;
+ f->offset = f->filesize + offset;
FilePosition.CurrentByteOffset.HighPart = 0;
FilePosition.CurrentByteOffset.LowPart = f->offset;
status = ZwSetInformationFile( (HANDLE)f->handle,
- &IoStatusBlock,
- &FilePosition,
- sizeof(FILE_POSITION_INFORMATION),
- FilePositionInformation
- );
+ &IoStatusBlock,
+ &FilePosition,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation
+ );
if (!NT_SUCCESS (status))
- return -1;
+ return -1;
return 0;
}
@@ -289,19 +289,19 @@ char *fgets(
int len;
char *cs;
- // Read the entire buffer into memory (our functions are unbuffered!)
+ /* Read the entire buffer into memory (our functions are unbuffered!) */
if ((len = fread(s,1,n,f)) == 0)
- return NULL;
+ return NULL;
- // Search for '\n' or end of string
+ /* Search for '\n' or end of string */
if (n > len)
- n = len;
+ n = len;
cs = s;
while (--n > 0) {
- if (*cs == '\n')
- break;
- cs++;
- }
+ if (*cs == '\n')
+ break;
+ cs++;
+ }
*cs = '\0';
return s;
}
@@ -328,4 +328,3 @@ int fclose(
PM_free(f);
return 0;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c
index d7705130b7..bbf0cbf4a7 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/stdlib.c
@@ -54,7 +54,7 @@ void * calloc(
{
void *p = PM_mallocShared(nelem * size);
if (p)
- memset(p,0,nelem * size);
+ memset(p,0,nelem * size);
return p;
}
@@ -68,9 +68,9 @@ void * realloc(
{
void *p = PM_mallocShared(size);
if (p) {
- memcpy(p,ptr,size);
- PM_freeShared(ptr);
- }
+ memcpy(p,ptr,size);
+ PM_freeShared(ptr);
+ }
return p;
}
@@ -102,21 +102,21 @@ UNICODE_STRING *_PM_CStringToUnicodeString(
ANSI_STRING ansiStr;
UNICODE_STRING *uniStr;
- // Allocate memory for the string structure
+ /* Allocate memory for the string structure */
if ((uniStr = ExAllocatePool(NonPagedPool, sizeof(UNICODE_STRING))) == NULL)
- return NULL;
+ return NULL;
- // Allocate memory for the wide string itself
+ /* Allocate memory for the wide string itself */
length = (strlen(cstr) * sizeof(WCHAR)) + sizeof(WCHAR);
if ((uniStr->Buffer = ExAllocatePool(NonPagedPool, length)) == NULL) {
- ExFreePool(uniStr);
- return NULL;
- }
+ ExFreePool(uniStr);
+ return NULL;
+ }
RtlZeroMemory(uniStr->Buffer, length);
uniStr->Length = 0;
uniStr->MaximumLength = (USHORT)length;
- // Convert filename string to ansi string and then to UniCode string
+ /* Convert filename string to ansi string and then to UniCode string */
RtlInitAnsiString(&ansiStr, cstr);
RtlAnsiStringToUnicodeString(uniStr, &ansiStr, FALSE);
return uniStr;
@@ -133,8 +133,7 @@ void _PM_FreeUnicodeString(
UNICODE_STRING *uniStr)
{
if (uniStr) {
- ExFreePool(uniStr->Buffer);
- ExFreePool(uniStr);
- }
+ ExFreePool(uniStr->Buffer);
+ ExFreePool(uniStr);
+ }
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c
index ef27294107..f4c4bd41b2 100644
--- a/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c
+++ b/board/MAI/bios_emulator/scitech/src/pm/ntdrv/ztimer.c
@@ -121,4 +121,3 @@ passed, so if this happens we will be generating erronous results.
****************************************************************************/
ulong __ULZElapsedTime(ulong start,ulong finish)
{ return finish - start; }
-
OpenPOWER on IntegriCloud