386 .stack 20h .data Buffer byte 256 dup0 VGAB_D_FNum word 0100h Define the bus_device_fun mumber ConfigAddr word 0cf8h 定义配置地址指针 ConfigData word 0cfch 定义配置数据指针 .code Start: mov axdata mov DSax Produce the format for CONFIG_ADDRESS and store in into eax mov axVGAB_D_FNumProduce the format for bus number and eax0000ffffh Device numberfunction number shl eax8 or eax80000000hSet b31 of CONFIG_ ADDRESS Read double word from configuration data port and store it buffer lea diBuffer ReadConfig: mov dxConfigAddr Write CONFIG_ADDRESS out dxeax mov dxConfigData Read double word push eax in eaxdx mov dieax pop eax add di4 Point the next place add dl4 nc ReadConfig .exit end Start 使用上述代码读出的卡式VGA兼容控制器PCI配置地址空间头标区数据以双字为单位按小尾方式排列十六进制形式见表3。
结束 读取BUS 0段上的 PCI设备配置信息 启动计算机 改变偏移地址 结束 读取BUS 1段上的 PCI设备配置信息 改变偏移地址 存入系统信息 库并显示 END 第1期 马亲民等IA-32系统中PCI地址空间的配置 57 表3 卡式VGA兼容控制器配置地址空间头标区数据 偏移地址 数据 00 DE 10 10 01 07 00 B0 02 B2 00 00 03 00 F8 00 0010 00 00 00 EC 08 00 00 E0 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 60 00 00 00 00 00 00 00 05 01 05 01 通过表3的数据可以取得VGA设备的相关信息具体结构如图1所示对于操作系统将可以查表出其具体厂家、型号从而自动安装相应的驱动程序对于软件开发人员将可以得到全面的硬件信息而不需要依赖操作系统提供的硬件信息尤其是在操作系统不提供驱动的情况下可以编写出如EVEREST之类的应用软件对于PCI设备生产商则便于对产品进行驱动安装和升级等。
参考文献 1 白中英计算机组成原理M北京科学出版社1996 2 William Stallings计算机组织与结构性能设计第4版M 张昆藏等译北京清华大学出版1995 3 潘焕成Intel结构32位计算机技术M北京高等教育出版社2005 PCI Space Configuration in IA-32 System Structure MA Qinmin PAN Huancheng School of Electronics and Information Engineering Shenzhen Polytechnic Shenzhen Guangdong 518055China Abstract: IA-32 system structure based on PCI bus and the pattern of PCI bus are analyzed and methods for PCI configuration address space
access and source codes are introduced. Data reading from the system and its application are also discussed. Key words: IA-32 computer system architecture PCI bus configuration address space BIOS MASM
上一篇:
【精品】易语言WindowsAPI
下一篇:
关于搞好高职学生政治经济学教学的思考