c语言求救!!!
#include<conio.h>#include<dos.h>
#include<stdlib.h>
#include<stdio.h>
#include<bios.h>
#include<process.h>
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
#define PDI_BUS_SHIFT 8
#define PDI_BUS_SIZE 8
#define PDI_BUS_MAX 0xFF
#define PDI_BUS_MASK 0xFF00
#define PDI_DEVICE_SHIFT 3
#define PDI_DEVICE_SIZE 5
#define PDI_DEVICE_MAX 0x1F
#define PDI_DEVICE_MASK 0x00F8
#define PDI_FUNCTION_SHIFT 0
#define PDI_FUNCTION_SIZE 3
#define PDI_FUNCTION_MAX 0x7
#define PDI_FUNCTION_MASK 0x0007
#define MK_PDI(bus,dev,func) (WORD)((bus&PDI_BUS_MAX)<<PDI_DEVICE_SIZE|(dev&PDI_DEVICE_MAX)<<PDI_DEVICE_SHIFT|(func&PDI_FUNCTION_MAX) )
#define PCI_CONFIG_ADDRESS 0xCF8
#define PCI_CONFIG_DATA 0xCFC
#define MK_PCICFGADDR(bus,dev,func) (DWORD)(0x80000000L|(DWORD)MK_PDI(bus,dev,func)<<8)
DWORD inpd(int portid)
{
DWORD dwRet;
_asm("mov dx,portid");
_asm("lea bx,dwRet");
__emit__(
0x66,0x50,
0x66,0xED,
0x66,0x89,0x07,
0x66,0x58);
return dwRet;
}
void outpd(int portid,DWORD dwVal)
{
_asm("mov dx,portid");
_asm("lea bx,dwVal");
__emit__(
0x66,0x50,
0x66,0x8B,0x07,
0x66,0xEF,
0x66,0x58);
return;
}
int main(void)
{
int bus,dev,func;
int i;
DWORD dwAddr;
DWORD dwData;
FILE*hF;
char szFile[0x10];
printf("\n");
printf("Bus#\tDevice#\tFunc#\tVendor\tDevice\tClass\tIRQ\tIntPin\n");
for(bus=0;bus<=PDI_BUS_MAX;++bus)
{
for(dev=0;dev<=PDI_DEVICE_MAX;++dev)
{
for(func=0;func<=PDI_FUNCTION_MAX;++func)
{
dwAddr=MK_PCICFGADDR(bus,dev,func);
outpd(PCI_CONFIG_ADDRESS,dwAddr);
dwData=inpd(PCI_CONFIG_DATA);
if ((WORD)dwData!=0xFFFF)
{
printf("%2.2X\t%2.2X\t%1X\t",bus,dev,func);
printf("%4.4X\t%4.4X\t",(WORD)dwData,dwData>>16);
outpd(PCI_CONFIG_ADDRESS, dwAddr|0x8);
dwData = inpd(PCI_CONFIG_DATA);
printf("%6.6lX\t", dwData>>8);
outpd(PCI_CONFIG_ADDRESS,dwAddr|0x3C);
dwData=inpd(PCI_CONFIG_DATA);
printf("%d\t",(BYTE)dwData);
printf("%d",(BYTE)(dwData>>8));
printf("\n");
sprintf(szFile,"PCI%2.2X%2.2X%X.bin",bus,dev,func);
hF=fopen(szFile,"wb");
if(hF!=NULL)
{
for(i=0;i<0x100;i+=4)
{
outpd(PCI_CONFIG_ADDRESS,dwAddr|i);
dwData=inpd(PCI_CONFIG_DATA);
fwrite(&dwData,sizeof(dwData),1,hF);
}
fclose(hF);
}
}
}
}
}
return 0;
}
运行后报:linker error:undefined symbol '__asm' in module pci.c
_asm("lea bx,dwVal");在tc2.0中运行没问题,asm lea bx,dwVal就报错!
求救!!!急急!!