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


  • 相关阅读:
    BZOJ 1718: [Usaco2006 Jan] Redundant Paths 分离的路径( tarjan )
    BZOJ 1040: [ZJOI2008]骑士( 树形dp )
    BZOJ 1691: [Usaco2007 Dec]挑剔的美食家( 平衡树 )
    HDU 5667 Sequence 矩阵快速幂
    FZU 2225 小茗的魔法阵 扫描线+树状数组
    UVA 11916 Emoogle Grid 离散对数 大步小步算法
    UVA 11754 Code Feat 中国剩余定理+暴力
    FZU 2092 收集水晶 dp+bfs
    FZU2090 旅行社的烦恼 巧妙floyd 最短路
    UVA 11426 GCD
  • 原文地址:https://www.cnblogs.com/mull/p/8036023.html
Copyright © 2011-2022 走看看