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


  • 相关阅读:
    jmeter接口自动化-读取CSV文件执行测试用例
    文件流下载excel表格
    如何查看死锁的表
    学习笔记
    当你需要验证数组是否都是0
    实验二
    centos8 https访问报错
    Linux命令常用搜集持续更新
    一文搞懂C语言中指针、数组、指针数组、数组指针、函数指针、指针函数
    11
  • 原文地址:https://www.cnblogs.com/mull/p/8036023.html
Copyright © 2011-2022 走看看