Chinaunix首页 | 论坛 | 博客
  • 博客访问: 179691
  • 博文数量: 47
  • 博客积分: 992
  • 博客等级: 准尉
  • 技术积分: 565
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-08 21:57
文章分类

全部博文(47)

文章存档

2019年(1)

2018年(1)

2017年(1)

2014年(6)

2013年(1)

2012年(2)

2011年(35)

我的朋友

分类: LINUX

2011-06-15 19:08:59

Kernel110615: A20注记


Email:    zcatt@163.com
Blog    http://zcatt.blog.chinaunix.net
 
声明
仅限学习交流,禁止商业用途。转载需注明出处。

版本记录
Date        Ver        Note
2011-06-15    0.1        Draft.  zcatt, Beijing


A20问题是一个历史久远的问题. 故事是这样的.
realmode下只有20bit地址线, 能访问的地址空间是1M, 0x00000 - 0xfffff. 超过1M的地址就会折回到1M中, 而这个特性确是远古时代一些软件无意要使用的. 于是, 为了即兼容支持先前的地址折回特性, 又能支持访问超1M的地址, A20出现了. A20实际上就是增加了一根地址线, 只不过这个A20的电平由cpu直接控制高低, 逻辑上是个与门. 当(A20 and 0)时兼容折回特性, 当(A20 and 1)时支持超1M地址的访问.
最初A20是使用8042键盘控制器的一个管脚实现. 后来由于速度的原因, 有机器又该进了实现方式. 有3种,

1. 8042
==================

Bit 0 is used to reset the CPU (go to real mode) - a reset happens when bit 0 is 0.
Bit 1 is used to control A20 - it is enabled when bit 1 is 1, disabled when bit 1 is 0.

One sets the output port of the keyboard controller by first writing 0xd1 to port 0x64, and the the desired value of the output port to port 0x60. One usually sees the values 0xdd and 0xdf used to disable/enable A20. Thus:

        call    empty_8042
        mov     al,#0xd1                ! command write
        out     #0x64,al
        call    empty_8042
        mov     al,#0xdf                ! A20 on
        out     #0x60,al
        call    empty_8042

where empty_8042 has to wait for the kbd to finish handling input, say

empty_8042:
        call    delay
        in      al,#0x64
        test    al,#2
        jnz     empty_8042
        ret


2. fast A20, by setting I/O port 0x92 (System Control Port A)
==================

Bit 0 (w):    writing 1 to this bit causes a fast reset (used to switch back to real mode; for MCA this took 13.4 ms).
Bit 1 (rw):    0: disable A20, 1: enable A20.
Bit 3 (rw?): 0/1: power-on password bytes (stored in CMOS bytes 0x38-0x3f or 0x36-0x3f) accessible/inaccessible. This bit can be written to only when it is 0.
Bits 6-7 (rw): 00: hard disk activity LED off, 01,10,11: hard disk activity LED on.

3. bios
==================

INT 15 AX=2400 disable A20
INT 15 AX=2401 enable A20
INT 15 AX=2402 query status A20
INT 15 AX=2403 query A20 support (kbd or port 92)

Locations of visitors to this page


阅读(605) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~