pmapi.h
来自「适合KS8695X」· C头文件 代码 · 共 1,149 行 · 第 1/4 页
H
1,149 行
void PMAPI PM_saveConsoleState(void *stateBuf,PM_HWND hwndConsole);
void PMAPI PM_setSuspendAppCallback(PM_saveState_cb saveState);
void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole);
void PMAPI PM_closeConsole(PM_HWND hwndConsole);
/* Functions to modify OS console information */
void PMAPI PM_setOSCursorLocation(int x,int y);
void PMAPI PM_setOSScreenWidth(int width,int height);
/* Function to emable Intel PPro/PII write combining */
int PMAPI PM_enableWriteCombine(ulong base,ulong length,uint type);
int PMAPI PM_enumWriteCombine(PM_enumWriteCombine_t callback);
/* Function to add a path separator to the end of a filename (if not present) */
void PMAPI PM_backslash(char *filename);
/* Routines to lock and unlock regions of memory under a virtual memory
* environment. These routines _must_ be used to lock all hardware
* and mouse interrupt handlers installed, _AND_ any global data that
* these handler manipulate, so that they will always be present in memory
* to handle the incoming interrupts.
*
* Note that it is important to call the correct routine depending on
* whether the area being locked is code or data, so that under 32 bit
* PM we will get the selector value correct.
*/
int PMAPI PM_lockDataPages(void *p,uint len,PM_lockHandle *lockHandle);
int PMAPI PM_unlockDataPages(void *p,uint len,PM_lockHandle *lockHandle);
int PMAPI PM_lockCodePages(__codePtr p,uint len,PM_lockHandle *lockHandle);
int PMAPI PM_unlockCodePages(__codePtr p,uint len,PM_lockHandle *lockHandle);
/* Routines to install and remove Real Time Clock interrupt handlers. The
* frequency of the real time clock can be changed by calling
* PM_setRealTimeClockFrequeny, and the value can be any power of 2 value
* from 2Hz to 8192Hz.
*
* Note that you _must_ lock the memory containing the interrupt
* handlers with the PM_lockPages() function otherwise you may encounter
* problems in virtual memory environments.
*
* NOTE: User space versions of the PM library should fail these functions.
*/
ibool PMAPI PM_setRealTimeClockHandler(PM_intHandler ih,int frequency);
void PMAPI PM_setRealTimeClockFrequency(int frequency);
void PMAPI PM_restoreRealTimeClockHandler(void);
/* Routines to install and remove hardware interrupt handlers.
*
* Note that you _must_ lock the memory containing the interrupt
* handlers with the PM_lockPages() function otherwise you may encounter
* problems in virtual memory environments.
*
* NOTE: User space versions of the PM library should fail these functions.
*/
PM_IRQHandle PMAPI PM_setIRQHandler(int IRQ,PM_irqHandler ih);
void PMAPI PM_restoreIRQHandler(PM_IRQHandle irqHandle);
/* Functions to program DMA using the legacy ISA DMA controller */
void PMAPI PM_DMACEnable(int channel);
void PMAPI PM_DMACDisable(int channel);
void PMAPI PM_DMACProgram(int channel,int mode,ulong bufferPhys,int count);
ulong PMAPI PM_DMACPosition(int channel);
/* Function to post secondary graphics controllers using the BIOS */
ibool PMAPI PM_doBIOSPOST(ushort axVal,ulong BIOSPhysAddr,void *mappedBIOS,ulong BIOSLen);
/* Function to init the AGP functions and return the AGP aperture size in MB */
ulong PMAPI PM_agpInit(void);
void PMAPI PM_agpExit(void);
/* Functions to reserve and release physical AGP memory ranges */
ibool PMAPI PM_agpReservePhysical(ulong numPages,int type,void **physContext,PM_physAddr *physAddr);
ibool PMAPI PM_agpReleasePhysical(void *physContext);
/* Functions to commit and free physical AGP memory ranges */
ibool PMAPI PM_agpCommitPhysical(void *physContext,ulong numPages,ulong startOffset,PM_physAddr *physAddr);
ibool PMAPI PM_agpFreePhysical(void *physContext,ulong numPages,ulong startOffset);
/* Functions to do I/O port manipulation directly from C code. These
* functions are portable and will work on any processor architecture
* to access I/O space registers on PCI devices.
*/
uchar PMAPI PM_inpb(int port);
ushort PMAPI PM_inpw(int port);
ulong PMAPI PM_inpd(int port);
void PMAPI PM_outpb(int port,uchar val);
void PMAPI PM_outpw(int port,ushort val);
void PMAPI PM_outpd(int port,ulong val);
/* Functions to determine the I/O port locations for COM and LPT ports.
* The functions are zero based, so for COM1 or LPT1 pass in a value of 0,
* for COM2 or LPT2 pass in a value of 1 etc.
*/
int PMAPI PM_getCOMPort(int port);
int PMAPI PM_getLPTPort(int port);
/* Internal functions that need prototypes */
void PMAPI _PM_getRMvect(int intno, long *realisr);
void PMAPI _PM_setRMvect(int intno, long realisr);
void PMAPI _PM_freeMemoryMappings(void);
/* Function to override the default debug log file location */
void PMAPI PM_setDebugLog(const char *logFilePath);
/* Function to put the process to sleep for the specified milliseconds */
void PMAPI PM_sleep(ulong milliseconds);
/* Function to block until 'milliseconds' have passed since last call */
void PMAPI PM_blockUntilTimeout(ulong milliseconds);
/* Functions for directory traversal and management */
void * PMAPI PM_findFirstFile(const char *filename,PM_findData *findData);
ibool PMAPI PM_findNextFile(void *handle,PM_findData *findData);
void PMAPI PM_findClose(void *handle);
void PMAPI PM_makepath(char *p,const char *drive,const char *dir,const char *name,const char *ext);
int PMAPI PM_splitpath(const char *fn,char *drive,char *dir,char *name,char *ext);
ibool PMAPI PM_driveValid(char drive);
void PMAPI PM_getdcwd(int drive,char *dir,int len);
uint PMAPI PM_getFileAttr(const char *filename);
void PMAPI PM_setFileAttr(const char *filename,uint attrib);
ibool PMAPI PM_getFileTime(const char *filename,ibool gmTime,PM_time *time);
ibool PMAPI PM_setFileTime(const char *filename,ibool gmTime,PM_time *time);
ibool PMAPI PM_mkdir(const char *filename);
ibool PMAPI PM_rmdir(const char *filename);
/* Functions to handle loading OS specific shared libraries */
PM_MODULE PMAPI PM_loadLibrary(const char *szDLLName);
void * PMAPI PM_getProcAddress(PM_MODULE hModule,const char *szProcName);
void PMAPI PM_freeLibrary(PM_MODULE hModule);
/* Functions and macros for 64-bit arithmetic */
void PMAPI _PM_add64(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);
void PMAPI _PM_sub64(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);
void PMAPI _PM_mul64(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);
void PMAPI _PM_div64(u32 a_low,s32 a_high,u32 b_low,s32 b_high,__i64 *result);
void PMAPI _PM_shr64(u32 a_low,s32 a_high,s32 shift,__i64 *result);
void PMAPI _PM_sar64(u32 a_low,s32 a_high,s32 shift,__i64 *result);
void PMAPI _PM_shl64(u32 a_low,s32 a_high,s32 shift,__i64 *result);
void PMAPI _PM_neg64(u32 a_low,s32 a_high,__i64 *result);
#ifdef __NATIVE_INT64__
#define PM_add64(r,a,b) (r) = (a) + (b)
#define PM_add64_32(r,a,b) (r) = (a) + (b)
#define PM_sub64(r,a,b) (r) = (a) - (b)
#define PM_sub64_32(r,a,b) (r) = (a) - (b)
#define PM_mul64(r,a,b) (r) = (a) * (b)
#define PM_mul64_32(r,a,b) (r) = (a) * (b)
#define PM_div64(r,a,b) (r) = (a) / (b)
#define PM_div64_32(r,a,b) (r) = (a) / (b)
#define PM_shr64(r,a,s) (r) = (a) >> (s)
#define PM_sar64(r,a,s) (r) = ((s64)(a)) >> (s)
#define PM_shl64(r,a,s) (r) = (u64)(a) << (s)
#define PM_neg64(r,a,s) (r) = -(a)
#define PM_not64(r,a,s) (r) = ~(a)
#define PM_eq64(a,b) (a) == (b)
#define PM_gt64(a,b) (a) > (b)
#define PM_lt64(a,b) (a) < (b)
#define PM_geq64(a,b) (a) >= (b)
#define PM_leq64(a,b) (a) <= (b)
#define PM_64to32(a) (u32)(a)
#define PM_64tos32(a) (s32)(a)
#define PM_set64(a,b,c) (a) = ((u64)(b) << 32) + (c)
#define PM_set64_32(a,b) (a) = (b)
#else
#define PM_add64(r,a,b) _PM_add64((a).low,(a).high,(b).low,(b).high,&(r))
#define PM_add64_32(r,a,b) _PM_add64((a).low,(a).high,b,0,&(r))
#define PM_sub64(r,a,b) _PM_sub64((a).low,(a).high,(b).low,(b).high,&(r))
#define PM_sub64_32(r,a,b) _PM_sub64((a).low,(a).high,b,0,&(r))
#define PM_mul64(r,a,b) _PM_mul64((a).low,(a).high,(b).low,(b).high,&(r))
#define PM_mul64_32(r,a,b) _PM_mul64((a).low,(a).high,b,0,&(r))
#define PM_div64(r,a,b) _PM_div64((a).low,(a).high,(b).low,(b).high,&(r))
#define PM_div64_32(r,a,b) _PM_div64((a).low,(a).high,b,0,&(r))
#define PM_shr64(r,a,s) _PM_shr64((a).low,(a).high,s,&(r))
#define PM_sar64(r,a,s) _PM_sar64((a).low,(a).high,s,&(r))
#define PM_shl64(r,a,s) _PM_shl64((a).low,(a).high,s,&(r))
#define PM_neg64(r,a,s) _PM_neg64((a).low,(a).high,&(r))
#define PM_not64(r,a,s) (r).low = ~(a).low, (r).high = ~(a).high
#define PM_eq64(a,b) ((a).low == (b).low && (a).high == (b).high)
#define PM_gt64(a,b) (((a).high > (b).high) || ((a).high == (b).high && (a).low > (b).low))
#define PM_lt64(a,b) (((a).high < (b).high) || ((a).high == (b).high && (a).low < (b).low))
#define PM_geq64(a,b) (PM_eq64(a,b) || PM_gt64(a,b))
#define PM_leq64(a,b) (PM_eq64(a,b) || PM_lt64(a,b))
#define PM_64to32(a) (u32)(a.low)
#define PM_64tos32(a) ((a).high < 0) ? -(a).low : (a).low)
#define PM_set64(a,b,c) (a).high = (b), (a).low = (c)
#define PM_set64_32(a,b) (a).high = 0, (a).low = (b)
#endif
/* Function to enable IOPL access if required */
int PMAPI PM_setIOPL(int iopl);
/* Function to flush the TLB and CPU caches */
void PMAPI PM_flushTLB(void);
/* DOS specific fucntions */
#ifdef __MSDOS__
uint PMAPI PMHELP_getVersion(void);
void PMAPI PM_VxDCall(VXD_regs *regs);
#endif
/* Functions to save and restore the VGA hardware state */
int PMAPI PM_getVGAStateSize(void);
void PMAPI PM_saveVGAState(void *stateBuf);
void PMAPI PM_restoreVGAState(const void *stateBuf);
void PMAPI PM_vgaBlankDisplay(void);
void PMAPI PM_vgaUnblankDisplay(void);
/* Functions to load and unload DirectDraw libraries. Only used on
* Windows platforms.
*/
void * PMAPI PM_loadDirectDraw(int device);
void PMAPI PM_unloadDirectDraw(int device);
PM_HWND PMAPI PM_getDirectDrawWindow(void);
void PMAPI PM_doSuspendApp(void);
/* Functions to install, start, stop and remove NT services. Valid only
* for Win32 apps running on Windows NT.
*/
#ifdef __WINDOWS32__
ulong PMAPI PM_installService(const char *szDriverName,const char *szServiceName,const char *szLoadGroup,ulong dwServiceType);
ulong PMAPI PM_startService(const char *szServiceName);
ulong PMAPI PM_stopService(const char *szServiceName);
ulong PMAPI PM_removeService(const char *szServiceName);
#endif
/* Routines to generate native interrupts (ie: protected mode interrupts
* for protected mode apps) using an interface the same as that use by
* int86() and int86x() in realmode. These routines are required because
* many 32 bit compilers use different register structures and different
* functions causing major portability headaches. Thus we provide our
* own and solve it all in one fell swoop, and we also get a routine to
* put stuff into 32 bit registers from real mode ;-)
*/
void PMAPI PM_segread(PMSREGS *sregs);
int PMAPI PM_int386(int intno, PMREGS *in, PMREGS *out);
int PMAPI PM_int386x(int intno, PMREGS *in, PMREGS *out,PMSREGS *sregs);
/* Call the X86 emulator or the real BIOS in our test harness */
#if defined(TEST_HARNESS) && !defined(PMLIB)
#define PM_mapRealPointer(r_seg,r_off) _PM_imports.PM_mapRealPointer(r_seg,r_off)
#define PM_getVESABuf(len,rseg,roff) _PM_imports.PM_getVESABuf(len,rseg,roff)
#define PM_callRealMode(seg,off,regs,sregs) _PM_imports.PM_callRealMode(seg,off,regs,sregs)
#define PM_int86(intno,in,out) _PM_imports.PM_int86(intno,in,out)
#define PM_int86x(intno,in,out,sregs) _PM_imports.PM_int86x(intno,in,out,sregs)
#endif
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
#endif
/* Include OS extensions for interrupt handling */
#if defined(__REALDOS__) || defined(__SMX32__)
#include "pmint.h"
#endif
#endif /* __PMAPI_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?