x86兼容遗留的问题-A20 gate

硬件遗留问题描述

  • 8086的地址线有20根,可以访问 1MB (2^20)的内存空间
  • 80286的地址线有24根
  • 80386的地址线有32根,可以访问 4GB (2^32)的内存空间
    为了保持兼容性Intel在地址线的第20位上制造了一个逻辑OR门,以便可以开启或关闭超过20位的地址总线 。
    这样,为了兼容旧的处理器,在机器开启进入实模式时A20被禁止的。进入保护模式时,将其打开。

开启A20 gate

开启A20的常用的方法是通过键盘微控制器

  /*代码来自ucore 2020课程实验lab1*/
    # Enable A20:
    #  For backwards compatibility with the earliest PCs, physical
    #  address line 20 is tied low, so that addresses higher than
    #  1MB wrap around to zero by default. This code undoes this.
seta20.1:
    inb $0x64, %al                                  # Wait for not busy(8042 input buffer empty).
    testb $0x2, %al
    jnz seta20.1

    movb $0xd1, %al                                 # 0xd1 -> port 0x64
    outb %al, $0x64                                 # 0xd1 means: write data to 8042's P2 port

seta20.2:
    inb $0x64, %al        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值