首页 > 编程知识 正文

suse linux 版本 命令,c语言32位整数

时间:2023-05-04 01:06:27 阅读:34401 作者:2349

exp 1: sys _ exit % 28 % 29 % 0a % 20.section % 20.data % 0a % 20.section % 20.text % 0a % 20.globl % 20 _ start : sys _ fork % 28 % 29 % 0a % 25 % 20n % 27 % 0a % 20 len % 20 % 3d % 20.- msg % 0a % 20.section % 20.text % 0a % 20 0 fork % 20 work % 0a % 20 movl % 20 % 244 % 2c % eax % 20 % 23 for % 20 see % 20 thh % 20 his % 20 . interrupt % 0a % 20 movl % 20 % c % E3 % 83 % 8d % E3 % 83 % E3 % 83 % 88 % 20呼叫% 20 will % 20测试% 20 . % 000 % 20 ermin al % 0a % 20 int % 20 % 240 X80 020d 1: % 20 .文件% 201 % 0a % 20.section % 20.text % 0a % 20.globl % 20 _ start % 0a % 20 _ start 3360 % 0a % 20 mm nput % 0a % 20 int % 20 % 240 X80 % 00a % 20 mood % 20a % 20 exp 4: sys _ write % 28 % 29 % 0a % 20.section % 20.data % 0a a % 20.globl % 20 _ start % 0a % 20 _ start 3360 % 0a % 20 % 244 % eax % 0a % 20 % ebx % 0a % 20 movl % 20 name : % 20.ascii % 20 % 27 my文件% 27 % 0a % 20.section % 20.text % 0a % 20.globl % 20 _ start % 0a % 20 _ start int % 20 % 240 X80 % 0a % 20 movl % 241 % 20-05 % 28 finish % 29 % 0a % 20 exp 6: sys _ close % 28 % 29 % 0a % 20.section % _ start % 0a % 20 _ start : % 0a % 20 % 23 open % 20a % 20 file % 0a % 20 % 20 % 20 % 20x % 0a % 20 % 240 20 movl % 200 % 24文件名称% 2c % ebx % 20 % 23 unsigned % 20 int % 0a % 20 movl % 20 % 28 % ebx % 29 % 2c % ebx % 0a % 20 movl % 20

p>

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp7:waitpid()

#waitpid() function

#need some parament

#%ebx = pid_t

#%ecx = unsigned int cxdbq/p>

#%edx = int

.section .data

data:.int 8

.section .text

.globl _start

_start:

movl    $7,%eax

movl    $1,%ebx

movl    $data,%ecx

movl    $10,%edx

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp8:sys_creat()

#creat a file

.section .data

#const char * type

filename:.ascii "creat_file"

.section .text

.globl _start

_start:

movl    $8,%eax

movl    $filename,%ebx

movl    $777,%ecx       #the file attribute

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp9:    sys_link()

.section .data

mylink:.ascii "link_"

myfile:.ascii "myfile"

.section .text

.globl _start

_start:

movl    $5,%eax

movl    $myfile,%ebx

movl    $110,%ecx

movl    $0x0080,%edx

int     $0x80

movl    $9,%eax

movl    $myfile,%ebx

movl    $mylink,%ecx

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp10:sys_unlink()

#unlink file

.section .data

mylink:.ascii "myfile"

.section .text

.globl _start

_start:

movl    $10,%eax

movl    $mylink,%ebx

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

2014-04-06(finish)

Reference:

1//http://stackoverflow.com/questions/1242032/nasm-printing-out-time-code-doesnt-output-anything/6636239#6636239

2//http://syscalls.kernelgrok.com/

3//http://www.duntemann.com/assembly.html

4//http://www.amazon.com/exec/obidos/ASIN/0470497025/jeffduntemann-20

5//http://www.tutorialspoint.com/assembly_programming/assembly_numbers.htm

exp11:sys_execve()

#in fact it is execve()

#sys_call number 11

.section .data

run_file:

.asciz "/bin/sh"

.section .text

.globl _start

_start:

movl    $11,%eax

movl    $run_file,%ebx

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp12:sys_chdir()

#change dir just like (cd)

#number 12 sys_call

.section .data

mypath:.ascii "~/etc/network/"

.section .text

.globl _start

_start:

movl    $12,%eax

movl    $mypath,%ebx

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp13:sys_time()

#unfinish .....

#

.section .data

#data:.fill

.section .text

.globl _start

_start:

movl    $13,%eax        #sys_time

#movl   $data,%ebx

int     $0x80

movl    $1,%eax #sys_exit

movl    $0,%ebx

int     $0x80

exp14:sys_mknod()

#sys_chnod

#sys_call number 14

#%ebx=const char cxdbq/p>

#%ecx=int

#%edx=dev_t

.section .data

data:

.ascii "mydev"

.section .text

.globl _start

_start:

movl    $14,%eax

movl    $data,%ebx

movl    $1,%ecx

movl    $60,%edx        #cpu dev

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

exp15:sys_chmod()

#sys_chmod

#system call number 15

#the paramente

#%ebx=const char cxdbq/p>

#%ecx=mode_t ==unsigned int

.section .data

filename:

.ascii "myfile"

.section .text

.globl _start

_start:

movl    $15,%eax

movl    $filename,%ebx

movl    $1,%ecx

int     $0x80

movl    $1,%eax

movl    $0,%ebx

int     $0x80

2014-04-07(finish)

exp16:

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。