zoukankan      html  css  js  c++  java
  • Ubuntu下用as汇编器编写hello.S文件

     
    1.源代码
    .text                    # section declaration
    
                # we must export the entry point to the ELF linker or
        .global _start    # loader. They conventionally recognize _start as their
                # entry point. Use ld -e foo to override the default.
    
    _start:
    
    # write our string to stdout
    
        movl    $len,%edx    # third argument: message length
        movl    $msg,%ecx    # second argument: pointer to message to write
        movl    $1,%ebx        # first argument: file handle (stdout)
        movl    $4,%eax        # system call number (sys_write)
        int    $0x80        # call kernel
    
    # and exit
    
        movl    $0,%ebx        # first argument: exit code
        movl    $1,%eax        # system call number (sys_exit)
        int    $0x80        # call kernel
    
    .data                    # section declaration
    
    msg:
        .ascii    "Hello, world!\n"    # our dear string
        len = . - msg            # length of our dear string
    
    2.编译和连接步骤
     
    image 
     
    3.使用objdump –D hello 反汇编
     
    image 
     
     
    
    
  • 相关阅读:
    项目质量管理
    项目成本管理
    项目进度管理
    项目范围管理
    项目整体管理
    项目立项管理
    信息系统项目管理基础
    信息化和信息系统
    linux(3)
    Patorjk
  • 原文地址:https://www.cnblogs.com/justinzhang/p/2360513.html
Copyright © 2011-2022 走看看