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


  • 相关阅读:
    快速提交一个项目到github或gitee上
    微信web开发问题记录
    解决 VUE项目过大nodejs内存溢出问题
    vue使用动态渲染v-model输入框无法输入内容
    webstorm 支持vue element-ui 语法高亮属性自动补全
    spring websocket报错:No matching message handler methods.
    Failed to start bean 'stompBrokerRelayMessageHandler'; nested exception is java.lang.NoClassDefFoundError: reactor/io/codec/Codec
    远程调用appium server
    appium 特殊操作
    mac下搭建appium
  • 原文地址:https://www.cnblogs.com/mull/p/8036023.html
Copyright © 2011-2022 走看看