|
ON .data
szText1 db Getting Current Process ID...,0Ah,0Dh,0
szDone db Done!,0Ah,0Dh,0
szError db Error in int 80!,0Ah,0Dh,0
szOutput db \%d,0Ah,0Dh,0 ;printf() 的格式字符串
SECTION .text
main:
push dword szText1 ;开始信息
call printf
pop ecx
GetPID:
mov eax, dword 20 ; getpid() 系统调用
int 80h ; 系统调用中断
cmp eax, 0 ; 没有 PID 0 ! :)
jb Error
push eax ; 把返回值传递给 printf
push dword szOutput ; 把格式字符串传递给 printf
call printf
pop ecx ; 清除栈
pop ecx
push dword szD 页码:[1] [2] [3] [4] [5] [6] [7] 第3页、共7页 |