阅读:1669回复:11
关于HAL
请大虾帮忙::
windows中所谓硬件抽象层一直把我搞得糊里糊涂,一直没弄明白过。资料上都写得很笼统,根本搞不懂。请哪位知情者给我透露一下实情。在下感激不尽。 泣立。。。。。 |
|
沙发#
发布于:2005-03-21 22:51
就是把一些硬件操作封装为函数的操作...
|
|
|
板凳#
发布于:2005-03-22 09:03
由于最初的Windows NT设计为可以在多种体系架构上平台上运行,但各种平台上的硬件千差万别,举个例子,如x86下有独立I/O地址空间,有对应的I/O指令,而Alpha则没有独立的I/O地址,I/O地址是和内存地址一块编址的,访问I/O的指令就是访存指令,为了能够通用,HAL将对硬件(例子中是端口)的操作抽象出一系列函数和宏,这样驱动不用顾及具体如何实现,如访问端口就用READ_PORT_...等指令就可以,因为根据不同的平台,微软只需开发一个特定的HAL,就完全可以运行任何编写好的驱动
|
|
|
地板#
发布于:2005-03-22 09:34
谢谢bmyyyud大哥指点
有没有这方面的资料,讲的更细的点的,想参考参考,或是什么网站之类的. |
|
地下室#
发布于:2005-03-22 09:51
可以看看inside windows 2000 3 。讲的比较清楚
|
|
5楼#
发布于:2005-03-22 10:22
谢谢bmyyyud大哥指点 有关HAL的具体资料并不多见,因为它是针对各种平台有不同的实现。一般可以看看下面的,这是znsoft为大家找的 http://www.microsoft.com/whdc/default.mspx http://www.microsoft.com/china/winlogo/hardware/hwreferences.asp 其实HAL内部的代码,由于抽象到底层,代码并不复杂,关键是理解硬件 具体代码,可用Softice加载符号表反汇编一下,其中一定要注意驱动中很多都是宏实现的,在HAL并没有对应代码,而直接替换为具体平台指令,这就是为什么我们用DDK编译驱动完成后,存入i386目录的原因。 |
|
|
6楼#
发布于:2005-03-22 13:20
实际上就是一个bus driver,用来屏蔽各种硬件平台的差异。
|
|
|
7楼#
发布于:2005-03-22 14:36
实际上就是一个bus driver,用来屏蔽各种硬件平台的差异。 此话诧异 |
|
|
8楼#
发布于:2005-03-22 15:43
[quote]实际上就是一个bus driver,用来屏蔽各种硬件平台的差异。 此话诧异 [/quote] The HAL is a loadable kernel-mode module (Hal.dll) that provides the low-level interface to the hardware platform on which Windows 2000 is running. It hides hardware-dependent details such as I/O interfaces, interrupt controllers, and multiprocessor communication mechanisms―any functions that are both architecture-specific and machine-dependent. The PnP manager begins device enumeration with a virtual bus driver called Root, which represents the entire computer system and that acts as the bus driver for legacy drivers and for the HAL. The HAL acts as a BUS driver that enumerates devices directly attached to the motherboard as well as system components such as batteries. Instead of actually enumerating, the HAL relies on the hardware description the Setup process recorded in the registry to detect the primary bus (a PCI bus in most cases) and devices such as batteries and fans. |
|
|
9楼#
发布于:2005-03-22 16:20
据各位大虾说法
听着感觉好象就是一些接口函数或者宏似的,除此之外 它好象屏蔽了x86主板上很多标准设备,就象中断控制器,DMA控制器 之类的。 这些东西,完全通过他的接口去使用这些硬件设备 怪不得不能保证实时性 不知道晚生有没有理解不当,反正感觉如是 |
|
10楼#
发布于:2005-03-22 16:21
[quote][quote]实际上就是一个bus driver,用来屏蔽各种硬件平台的差异。 此话诧异 [/quote] The HAL is a loadable kernel-mode module (Hal.dll) that provides the low-level interface to the hardware platform on which Windows 2000 is running. It hides hardware-dependent details such as I/O interfaces, interrupt controllers, and multiprocessor communication mechanisms―any functions that are both architecture-specific and machine-dependent. The PnP manager begins device enumeration with a virtual bus driver called Root, which represents the entire computer system and that acts as the bus driver for legacy drivers and for the HAL. The HAL acts as a BUS driver that enumerates devices directly attached to the motherboard as well as system components such as batteries. Instead of actually enumerating, the HAL relies on the hardware description the Setup process recorded in the registry to detect the primary bus (a PCI bus in most cases) and devices such as batteries and fans. [/quote] The HAL acts as a BUS driver HAL担当一个总线驱动,这仅仅说明它的一个功能,而不是它的主要目标,因为各个机器架构不同,总线也不同,所以为了屏蔽这些区别,由HAL处理最初的差别 |
|
|
11楼#
发布于:2005-03-23 08:09
据各位大虾说法 这就是抽象之意 |
|
|