⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compiler.h

📁 远程桌面连接工具
💻 H
📖 第 1 页 / 共 3 页
字号:
#endif /* FAKEIT */#endif /* defined(mips) */#endif /* defined(AlphaArchitecture) && defined(LinuxArchitecture) */#else /* __GNUC__ */#if !defined(AMOEBA) && !defined(MINIX)# if defined(__STDC__) && (__STDC__ == 1)#  ifndef asm#   define asm __asm#  endif# endif# ifdef SVR4#  include <sys/types.h>#  ifndef __HIGHC__#   ifndef __USLC__#    define __USLC__#   endif#  endif# endif# ifndef PC98#  ifndef SCO325#   include <sys/inline.h>#  else#   include "scoasm.h"#  endif# else#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968)#define PW_PORT 0x600extern short chipID;#if NeedFunctionPrototypesextern void *mmioBase;#elseextern unsigned char *mmioBase;#endifextern unsigned short _port_tbl[];#define	port_convert(x)	_port_tbl[(unsigned short)x]#endif #if defined(PC98_TGUI) || defined(PC98_MGA)#if NeedFunctionPrototypesextern void *mmioBase;#elseextern unsigned char *mmioBase;#endif#endifasm     void _outl(port,val){%reg	port,val;	movl	port, %edx	movl	val, %eax	outl	(%dx)%reg	port; mem	val;	movl	port, %edx	movl    val, %eax	outl	(%dx)%mem	port; reg	val;	movw	port, %dx	movl	val, %eax	outl	(%dx)%mem	port,val;	movw	port, %dx	movl    val, %eax	outl	(%dx)}asm	void _outw(port,val){%reg	port,val;	movl	port, %edx	movl	val, %eax	data16	outl	(%dx)%reg	port; mem	val;	movl	port, %edx	movw	val, %ax	data16	outl	(%dx)%mem	port; reg	val;	movw	port, %dx	movl	val, %eax	data16	outl	(%dx)%mem	port,val;	movw	port, %dx	movw	val, %ax	data16	outl	(%dx)}asm	void _outb(port,val){%reg	port,val;	movl	port, %edx	movl	val, %eax	outb	(%dx)%reg	port; mem	val;	movl	port, %edx	movb	val, %al	outb	(%dx)%mem	port; reg	val;	movw	port, %dx	movl	val, %eax	outb	(%dx)%mem	port,val;	movw	port, %dx	movb	val, %al	outb	(%dx)}asm     int _inl(port){%reg	port;	movl	port, %edx	inl	(%dx)%mem	port;	movw	port, %dx	inl	(%dx)}asm	int _inw(port){%reg	port;	subl    %eax, %eax	movl	port, %edx	data16	inl	(%dx)%mem	port;	subl    %eax, %eax	movw	port, %dx	data16	inl	(%dx)}asm	int _inb(port){%reg	port;	subl    %eax, %eax	movl	port, %edx	inb	(%dx)%mem	port;	subl    %eax, %eax	movw	port, %dx	inb	(%dx)}#if defined(PC98_WAB) ||  defined(PC98_GANB_WAP)static unsigned shortport_convert(unsigned short port){     port <<= 8;     port &= 0x7f00; /* Mask 0111 1111 0000 0000 */     port |= 0xE0;     return port;}#endif /* PC98_WAB || PC98_GANB_WAP */#if defined(PC98_WABEP)static unsigned shortport_convert(unsigned short port){     port &= 0x7f; /* Mask 0000 0000 0111 1111 */     port |= 0x0f00;     return port;}#endif /* PC98_WABEP */#ifdef PC98_WSNAstatic unsigned shortport_convert(unsigned short port){     port <<= 8;     port &= 0x7f00; /* Mask 0111 1111 0000 0000 */     port |= 0xE2;     return port;}#endif /* PC98_WSNA */#ifdef PC98_NKVNEC#ifdef	PC98_NEC_CIRRUS2static unsigned shortport_convert(unsigned short port){     port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050;     return port;}#elsestatic unsigned shortport_convert(unsigned short port){     port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0;     return port;}#endif /* PC98_NEC_CIRRUS2 */#endif /* PC98_NKVNEC */static void outl(port,val){#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \    defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \    defined(PC98_XKB) || defined(PC98_NEC)   unsigned short tmp;   tmp=port_convert(port);   port=tmp;#endif#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)   *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val);#else   _outl(port,val);#endif}static void outw(port,val){#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \    defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \    defined(PC98_XKB) || defined(PC98_NEC)   unsigned short tmp;   tmp=port_convert(port);   port=tmp;#endif#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)   *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val);#else   _outw(port,val);#endif}static void outb(port,val){#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \    defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \    defined(PC98_XKB) || defined(PC98_NEC)   unsigned short tmp;   tmp=port_convert(port);   port=tmp;#endif#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)   *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val);#else   _outb(port,val);#endif}static int inl(port){   unsigned int ret;#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \    defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \    defined(PC98_XKB) || defined(PC98_NEC)   unsigned short tmp;   tmp=port_convert(port);   port=tmp;#endif#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)   ret =*(volatile unsigned int *)((char *)mmioBase+(port));#else   ret = _inl(port);#endif   return ret;}static int inw(port){   unsigned short ret;#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \    defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \    defined(PC98_XKB) || defined(PC98_NEC)   unsigned short tmp;   tmp=port_convert(port);   port=tmp;#endif#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)   ret =*(volatile unsigned short *)((char *)mmioBase+(port));#else   ret = _inw(port);#endif   return ret;}static int inb(port){   unsigned char ret;#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \    defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \    defined(PC98_XKB) || defined(PC98_NEC)   unsigned short tmp;   tmp=port_convert(port);   port=tmp;#endif#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA)   ret =*(volatile unsigned char *)((char *)mmioBase+(port));#else   ret = _inb(port);#endif   return ret;}# endif /* PC98 */# if !defined(__HIGHC__) && !defined(SCO325)#  pragma asm partial_optimization outl#  pragma asm partial_optimization outw#  pragma asm partial_optimization outb#  pragma asm partial_optimization inl#  pragma asm partial_optimization inw#  pragma asm partial_optimization inb# endif#endif#define ldq_u(p)	(*((unsigned long  *)(p)))#define ldl_u(p)	(*((unsigned int   *)(p)))#define ldw_u(p)	(*((unsigned short *)(p)))#define stq_u(v,p)	((unsigned long  *)(p)) = (v)#define stl_u(v,p)	((unsigned int   *)(p)) = (v)#define stw_u(v,p)	((unsigned short *)(p)) = (v)#define mem_barrier()   /* NOP */#define write_mem_barrier()   /* NOP */#endif /* __GNUC__ */#if defined(IODEBUG) && defined(__GNUC__)#undef inb#undef inw#undef inl#undef outb#undef outw#undef outl#define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})#define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})#define inl(a) __extension__ ({unsigned long __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})#define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b))#define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b))#define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b))#endif/* * This header sometimes gets included where is isn't needed, and on some * OSs this causes problems because the following functions generate * references to inb() and outb() which can't be resolved.  Defining * NO_COMPILER_H_EXTRAS avoids this problem. */#ifndef NO_COMPILER_H_EXTRAS/* *----------------------------------------------------------------------- * Port manipulation convenience functions *----------------------------------------------------------------------- */#ifndef __GNUC__#define __inline__ /**/#endif/* * rdinx - read the indexed byte port 'port', index 'ind', and return its value */static __inline__ unsigned char #ifdef __STDC__rdinx(unsigned short int port, unsigned char ind)#elserdinx(port, ind)unsigned short int port;unsigned char ind;#endif{	if (port == 0x3C0)		/* reset attribute flip-flop */		(void) inb(0x3DA);	outb(port, ind);	return(inb(port+1));}/* * wrinx - write 'val' to port 'port', index 'ind' */static __inline__ void #ifdef __STDC__wrinx(unsigned short int port, unsigned char ind, unsigned char val)#elsewrinx(port, ind, val)unsigned short int port;unsigned char ind, val;#endif{	outb(port, ind);	outb(port+1, val);}/* * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new'; *	    the other bits are unchanged. */static __inline__ void#ifdef __STDC__modinx(unsigned short int port, unsigned char ind,        unsigned char mask, unsigned char new)#elsemodinx(port, ind, mask, new)unsigned short int port;unsigned char ind, mask, new;#endif{	unsigned char tmp;	tmp = (rdinx(port, ind) & ~mask) | (new & mask);	wrinx(port, ind, tmp);}/* * tstrg - returns true iff the bits in 'mask' of register 'port' are *	   readable & writable. */static __inline__ int#ifdef __STDC__testrg(unsigned short int port, unsigned char mask)#elsetstrg(port, mask)unsigned short int port;unsigned char mask;#endif{	unsigned char old, new1, new2;	old = inb(port);	outb(port, old & ~mask);	new1 = inb(port) & mask;	outb(port, old | mask);	new2 = inb(port) & mask;	outb(port, old);	return((new1 == 0) && (new2 == mask));}/* * testinx2 - returns true iff the bits in 'mask' of register 'port', index *	      'ind' are readable & writable. */static __inline__ int#ifdef __STDC__testinx2(unsigned short int port, unsigned char ind, unsigned char mask)#elsetestinx2(port, ind, mask)unsigned short int port;unsigned char ind, mask;#endif{	unsigned char old, new1, new2;	old = rdinx(port, ind);	wrinx(port, ind, old & ~mask);	new1 = rdinx(port, ind) & mask;	wrinx(port, ind, old | mask);	new2 = rdinx(port, ind) & mask;	wrinx(port, ind, old);	return((new1 == 0) && (new2 == mask));}/* * testinx - returns true iff all bits of register 'port', index 'ind' are  *     	     readable & writable. */static __inline__ int#ifdef __STDC__testinx(unsigned short int port, unsigned char ind)#elsetestinx(port, ind, mask)unsigned short int port;unsigned char ind;#endif{	return(testinx2(port, ind, 0xFF));}#endif /* NO_COMPILER_H_EXTRAS */#endif /* NO_INLINE */#endif /* _COMPILER_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -