pm.c
来自「适合KS8695X」· C语言 代码 · 共 540 行 · 第 1/2 页
C
540 行
}
void PMAPI PM_freePhysicalAddr(void *ptr,ulong limit)
{
/* TODO: This function will free a physical memory mapping previously */
/* allocated with PM_mapPhysicalAddr() if at all possible. If */
/* you can't free physical memory mappings, simply do nothing. */
}
ulong PMAPI PM_getPhysicalAddr(void *p)
{
/* TODO: This function should find the physical address of a linear */
/* address. */
return 0xFFFFFFFFUL;
}
void PMAPI PM_sleep(ulong milliseconds)
{
/* TODO: Put the process to sleep for milliseconds */
}
int PMAPI PM_getCOMPort(int port)
{
/* 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;
}
return 0;
}
int PMAPI PM_getLPTPort(int port)
{
/* 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;
}
return 0;
}
void * PMAPI PM_mallocShared(long size)
{
/* TODO: This is used to allocate memory that is shared between process */
/* that all access the common Nucleus drivers via a common display */
/* driver DLL. If your OS does not support shared memory (or if */
/* the display driver does not need to allocate shared memory */
/* for each process address space), this should just call PM_malloc. */
return PM_malloc(size);
}
void PMAPI PM_freeShared(void *ptr)
{
/* TODO: Free the shared memory block. This will be called in the context */
/* of the original calling process that allocated the shared */
/* memory with PM_mallocShared. Simply call free if you do not */
/* need this. */
PM_free(ptr);
}
void * PMAPI PM_mapToProcess(void *base,ulong limit)
{
/* TODO: This function is used to map a physical memory mapping */
/* previously allocated with PM_mapPhysicalAddr into the */
/* address space of the calling process. If the memory mapping */
/* allocated by PM_mapPhysicalAddr is global to all processes, */
/* simply return the pointer. */
return base;
}
void * PMAPI PM_mapRealPointer(uint r_seg,uint r_off)
{
/* No BIOS access on the BeOS */
return NULL;
}
void * PMAPI PM_allocRealSeg(uint size,uint *r_seg,uint *r_off)
{
/* No BIOS access on the BeOS */
return NULL;
}
void PMAPI PM_freeRealSeg(void *mem)
{
/* No BIOS access on the BeOS */
}
void PMAPI DPMI_int86(int intno, DPMI_regs *regs)
{
/* No BIOS access on the BeOS */
}
int PMAPI PM_int86(int intno, RMREGS *in, RMREGS *out)
{
/* No BIOS access on the BeOS */
return 0;
}
int PMAPI PM_int86x(int intno, RMREGS *in, RMREGS *out,
RMSREGS *sregs)
{
/* No BIOS access on the BeOS */
return 0;
}
void PMAPI PM_callRealMode(uint seg,uint off, RMREGS *in,
RMSREGS *sregs)
{
/* No BIOS access on the BeOS */
}
void PMAPI PM_availableMemory(ulong *physical,ulong *total)
{
/* TODO: Report the amount of available memory, both the amount of */
/* physical memory left and the amount of virtual memory left. */
/* If the OS does not provide these services, report 0's. */
*physical = *total = 0;
}
void * PMAPI PM_allocLockedMem(uint size,ulong *physAddr,ibool contiguous,ibool below16Meg)
{
/* TODO: Allocate a block of locked, physical memory of the specified */
/* size. This is used for bus master operations. If this is not */
/* supported by the OS, return NULL and bus mastering will not */
/* be used. */
return NULL;
}
void PMAPI PM_freeLockedMem(void *p,uint size,ibool contiguous)
{
/* TODO: Free a memory block allocated with PM_allocLockedMem. */
}
void PMAPI PM_setBankA(int bank)
{
/* No BIOS access on the BeOS */
}
void PMAPI PM_setBankAB(int bank)
{
/* No BIOS access on the BeOS */
}
void PMAPI PM_setCRTStart(int x,int y,int waitVRT)
{
/* No BIOS access on the BeOS */
}
ibool PMAPI PM_enableWriteCombine(ulong base,ulong length,uint type)
{
/* TODO: This function should enable Pentium Pro and Pentium II MTRR */
/* write combining for the passed in physical memory base address */
/* and length. Normally this is done via calls to an OS specific */
/* device driver as this can only be done at ring 0. */
/* */
/* NOTE: This is a *very* important function to implement! If you do */
/* not implement, graphics performance on the latest Intel chips */
/* will be severly impaired. For sample code that can be used */
/* directly in a ring 0 device driver, see the MSDOS implementation */
/* which includes assembler code to do this directly (if the */
/* program is running at ring 0). */
return false;
}
ibool PMAPI PM_doBIOSPOST(ushort axVal,ulong BIOSPhysAddr,void *mappedBIOS)
{
/* TODO: This function is used to run the BIOS POST code on a secondary */
/* controller to initialise it for use. This is not necessary */
/* for multi-controller operation, but it will make it a lot */
/* more convenicent for end users (otherwise they have to boot */
/* the system once with the secondary controller as primary, and */
/* then boot with both controllers installed). */
/* */
/* Even if you don't support full BIOS access, it would be */
/* adviseable to be able to POST the secondary controllers in the */
/* system using this function as a minimum requirement. Some */
/* graphics hardware has registers that contain values that only */
/* the BIOS knows about, which makes bring up a card from cold */
/* reset difficult if the BIOS has not POST'ed it. */
return false;
}
/****************************************************************************
REMARKS:
Function to find the first file matching a search criteria in a directory.
****************************************************************************/
ulong PMAPI PM_findFirstFile(
const char *filename,
PM_findData *findData)
{
(void)filename;
(void)findData;
return PM_FILE_INVALID;
}
/****************************************************************************
REMARKS:
Function to find the next file matching a search criteria in a directory.
****************************************************************************/
ibool PMAPI PM_findNextFile(
ulong handle,
PM_findData *findData)
{
(void)handle;
(void)findData;
return false;
}
/****************************************************************************
REMARKS:
Function to close the find process
****************************************************************************/
void PMAPI PM_findClose(
ulong handle)
{
(void)handle;
}
/****************************************************************************
REMARKS:
Function to determine if a drive is a valid drive or not. Under Unix this
function will return false for anything except a value of 3 (considered
the root drive, and equivalent to C: for non-Unix systems). The drive
numbering is:
1 - Drive A:
2 - Drive B:
3 - Drive C:
etc
****************************************************************************/
ibool PMAPI PM_driveValid(
char drive)
{
if (drive == 3)
return true;
return false;
}
/****************************************************************************
REMARKS:
Function to get the current working directory for the specififed drive.
Under Unix this will always return the current working directory regardless
of what the value of 'drive' is.
****************************************************************************/
void PMAPI PM_getdcwd(
int drive,
char *dir,
int len)
{
(void)drive;
getcwd(dir,len);
}
/****************************************************************************
REMARKS:
Function to change the file attributes for a specific file.
****************************************************************************/
void PMAPI PM_setFileAttr(
const char *filename,
uint attrib)
{
/* TODO: Set the file attributes for a file */
(void)filename;
(void)attrib;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?