AT&T Assembly for Linux and Mac (sys_write)
2015-04-15 22:11
639 查看
Write() in C : (sys_write.c)
![](http://images.cnitblog.com/blog2015/739685/201504/152156530575163.png)
Write() in AT&T for Linux:(sys_write.s)
![](http://images.cnitblog.com/blog2015/739685/201504/152208159178313.png)
Write() in AT&T for Mac: (sys_write.s):
#include <stdio.h> int main(void) { printf("Hello Landpack\n"); return 0; }
![](http://images.cnitblog.com/blog2015/739685/201504/152156530575163.png)
Write() in AT&T for Linux:(sys_write.s)
.section .data _data: .ascii "Hello Landpack\n" len = .-_data .section .text .globl _start _start: movl $4, %eax #for write movl $_data, %ecx #The address of data movl $len, %edx #The len of string movl $0, %ebx #exit with 0 int $0x80 movl $1, %eax #sys_exit movl $0, %ebx #exit with 0 int $0x80
![](http://images.cnitblog.com/blog2015/739685/201504/152208159178313.png)
Write() in AT&T for Mac: (sys_write.s):
.globl _main _main: pushq %rbp #movq %rsp, %rbp leaq _data(%rip),%rdi callq _puts xorl %eax, %eax popq %rbp ret .section _TEXT,_cstring,cstring_literals _data: .ascii "Hello Landpack"
![](http://images.cnitblog.com/blog2015/739685/201504/152210579955164.png)
相关文章推荐
- AT&T ASSEMBLY FOR LINUX AND MAC (SYS_FORK)
- AT&T Assembly for Linux and Mac (sys_exit)
- Vysor破解助手for Linux and macOS
- Timer Class for both Unix/Linux/Mac and Windows system
- Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting
- I2C tool for linux i2c interface read and write
- The Linux Page Cache and pdflush:Theory of Operation and Tuning for Write-Heavy Loads
- Ubuntu Hacks : Tips & Tools for Exploring, Using, and Tuning Linux
- AT&T Assembly on Linux
- Pluggable Authentication Modules: The Definitive Guide to PAM for Linux SysAdmins and C Developers
- IEEE格式检查报错(字体未嵌入)的处理方法(for linux & mac)
- Linux AT&T 汇编错误:Error: invalid instruction suffix for `push'
- Microsoft/Git-Credential-Manager-for-Mac-and-Linux
- Pluggable Authentication Modules: The Definitive Guide to PAM for Linux SysAdmins and C Developers
- Set up SSH for Git and Mercurial on Mac OSX/Linux
- Assembly Intro - Intel and AT&T Syntax
- linux AT &T Assembly
- The pros and "conns" of Intel's ConnMan for Linux
- 【Linux】psql: FATAL: Ident authentication failed for user "username" Error and Solution