zoukankan      html  css  js  c++  java
  • a gcc 4.2.4 bug(被stos指令累加后%edi作为参数的)


    a gcc 4.2.4 bug(被stos指令累加后%edi作为参数的)

    *
     * Ok, now we can initialize the rest of the tty devices and can count
     * on memory allocations, interrupts etc..
     */
    int tty_init(void)
    {
        if (sizeof(struct tty_struct) > PAGE_SIZE)
            panic("size of tty structure > PAGE_SIZE!");

        /*
         * dev_tty_driver and dev_console_driver are actually magic
         * devices which get redirected at open time.  Nevertheless,
         * we register them so that register_chrdev is called
         * appropriately.
         */
        memset(&dev_tty_driver, 0, sizeof(struct tty_driver));
        dev_tty_driver.magic = TTY_DRIVER_MAGIC;
        dev_tty_driver.name = "tty";
        dev_tty_driver.name_base = 0;
        dev_tty_driver.major = TTY_MAJOR;
        dev_tty_driver.minor_start = 0;
        dev_tty_driver.num = 1;
        
        if (tty_register_driver(&dev_tty_driver))
            panic("Couldn't register /dev/tty driver ");
            
            
    (gdb) disassemble
    Dump of assembler code for function tty_init:
    0x0013ff5c <tty_init+0>:    push   %edi
    0x0013ff5d <tty_init+1>:    sub    $0x14,%esp
    0x0013ff60 <tty_init+4>:    mov    $0x16bb40,%edi
    0x0013ff65 <tty_init+9>:    xor    %eax,%eax
    0x0013ff67 <tty_init+11>:    mov    $0x27,%ecx
    0x0013ff6c <tty_init+16>:    cld    
    0x0013ff6d <tty_init+17>:    rep stos %eax,%es:(%edi)
    0x0013ff6f <tty_init+19>:    movl   $0x5402,0x16bb40
    0x0013ff79 <tty_init+29>:    movl   $0x1567ed,0x16bb44
    0x0013ff83 <tty_init+39>:    movl   $0x0,0x16bb48
    0x0013ff8d <tty_init+49>:    movw   $0x4,0x16bb4c
    0x0013ff96 <tty_init+58>:    movw   $0x0,0x16bb4e
    0x0013ff9f <tty_init+67>:    movw   $0x1,0x16bb50
    0x0013ffa8 <tty_init+76>:    push   %edi
    0x0013ffa9 <tty_init+77>:    call   0x13fec4 <tty_register_driver>


    注:%edi被stos又作为tty_register_driver参数,显然不对,这应该是gcc 4.2.4的bug


  • 相关阅读:
    『Nltk』常用方法
    『Kaggle』分类任务_决策树&集成模型&DataFrame向量化操作
    『Pandas』数据读取&DataFrame切片
    『TensotFlow』RNN中文文本_下_暨研究生开学感想
    『Scrapy』爬取斗鱼主播头像
    『Scrapy』爬取腾讯招聘网站
    『TensorFlow』梯度优化相关
    『Scrapy』终端调用&选择器方法
    『Scrapy』全流程爬虫demo
    使用VS2013、TFS2013和Git进行分布式团队协作
  • 原文地址:https://www.cnblogs.com/mull/p/8036023.html
Copyright © 2011-2022 走看看