AT&T ASSEMBLY FOR LINUX AND MAC (SYS_FORK)

Fork() in C: (sys_fork.c)

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> int main(void)
{
fork();
printf("Hello Landpack\n");
return ;
}

AT&T ASSEMBLY FOR LINUX AND MAC (SYS_FORK)

Fork() in AT&T for Linux:(sys_fork.s)

.section .rodata
msg: .ascii "Hello Landpack\n"
len = .-msg .section .bass .section .text
.globl _start
_start:
movl $,%eax # sys_fork number ()
int $0x80 # As we know,if we fork() in C
# we will run the double process
# They almost have the same code and data movl $,%eax # sys_write number ()
movl $,%ebx # STDOUT_FILENO == ()
movl $msg,%ecx # The head address of msg
movl $len,%edx # The offset of addr
int $0x80 movl $,%eax
movl $,%ebx
int $0x80

AT&T ASSEMBLY FOR LINUX AND MAC (SYS_FORK)

上一篇:WebComponent魔法堂:深究Custom Element 之 面向痛点编程


下一篇:基于jquery的消息提示框toastr.js