设置键盘属性

3.3.6 设置键盘属性

所以回到main函数中,继续走,下一个该执行keyboard_set_repeat()函数了。

 

  59/*

  60 * Set the keyboard repeat rate to maximum.  Unclear why this

  61 * is done here; this might be possible to kill off as stale code.

  62 */

  63static void keyboard_set_repeat(void)

  64{

  65        struct biosregs ireg;

  66        initregs(&ireg);

  67        ireg.ax = 0x0305;

  68        intcall(0x16, &ireg, NULL);

  69}

  70

这个函数不需要多说,就是触发bios的第16号中断。这个中断的参数来自于iregax寄存器,该参数的值为0x0305,其作用为设置键盘重复延时和速率。从注释我们可以看出,写代码的人也不明白为什么这个时候要触发这么一个中断,估计是为了与老代码兼容吧。

 

3.3.7 填充系统环境配置表

继续走,来看main中的query_mca()函数。这个函数来自arc/x86/boot/Mca.c

 

  18int query_mca(void)

  19{

  20        struct biosregs ireg, oreg;

  21        u16 len;

  22

  23        initregs(&ireg);

  24        ireg.ah = 0xc0;

  25        intcall(0x15, &ireg, &oreg);

  26

  27        if (oreg.eflags & X86_EFLAGS_CF)

  28                return -1;      /* No MCA present */

  29

  30        set_fs(oreg.es);

  31        len = rdfs16(oreg.bx);

  32

  33        if (len > sizeof(boot_params.sys_desc_table))

  34                len = sizeof(boot_params.sys_desc_table);

  35

  36        copy_from_fs(&boot_params.sys_desc_table, oreg.bx, len);

  37        return 0;

  38}

 

在“BIOS系统服务 —— 杂项系统服务”一篇博文中

http://blog.csdn.net/yunsongice/archive/2010/10/08/5927585.aspx

我们知道,BIOS15号服务程序用于读取系统环境,这里的query_mca()函数中执行25行代码后,oreg中的寄存器就有了博文中“配置表的地址(ES:BX)”,再通过30行将fs寄存器的值设为es,即配置表地址的基地址,内部变量len为配置表地址的偏移量。最后将系统环境配置表的内容拷贝到boot_paramssys_desc_table中。

 

3.3.8 填充IST信息

main函数里接下来一个过程是query_ist函数,位于main函数同一个文件中:

 

  71/*

  72 * Get Intel SpeedStep (IST) information.

  73 */

  74static void query_ist(void)

  75{

  76        struct biosregs ireg, oreg;

  77

  78        /* Some older BIOSes apparently crash on this call, so filter

  79           it from machines too old to have SpeedStep at all. */

  80        if (cpu.level < 6)

  81                return;

  82

  83        initregs(&ireg);

  84        ireg.ax  = 0xe980;       /* IST Support */

  85        ireg.edx = 0x47534943;   /* Request value */

  86        intcall(0x15, &ireg, &oreg);

  87

  88        boot_params.ist_info.signature  = oreg.eax;

  89        boot_params.ist_info.command    = oreg.ebx;

  90        boot_params.ist_info.event      = oreg.ecx;

  91        boot_params.ist_info.perf_level = oreg.edx;

  92}

 

该函数同样是利用第15BIOS服务程序,得到IntelIST信息。分别保存在boot_paramsist_info的四个字段中。main.c的随后两个函数query_apm_bios()query_edd()涉及到APMEDD的内容,执行过程也与query_ist差不多,分别填充了的boot_paramsapm_bios_info字段、edd_mbr_sig_buf_entries字段和eddbuf_entries字段,所以我们也就不细讲了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值