以前在学校学了汇编,学完就忘了,
今天打开UNIX OS的汇编码,怎么感觉不认得了.哪位有简易说明或将下面的例子(syscall解释一下?
- / syscall
- .globl _syscall,csv,cret,cerror
- _syscall:
- jsr r5,csv
- mov r5,r2
- add $04,r2
- mov $9f,r3
- mov (r2)+,r0
- bic $!0377,r0
- bis $sys,r0
- mov r0,(r3)+
- mov (r2)+,r0
- mov (r2)+,r1
- mov (r2)+,(r3)+
- mov (r2)+,(r3)+
- mov (r2)+,(r3)+
- mov (r2)+,(r3)+
- mov (r2)+,(r3)+
- sys 0; 9f
- bec 1f
- jmp cerror
- 1:
- jmp cret
- .data
- 9: .=.+12.
复制代码
调用:
- execl(name, arg1, a2, a3, a4, a5)
- char *name, arg1, a2, a3, a4, a5;
- {
- char *args[6];
- args[0] = arg1;
- args[1] = a2;
- args[2] = a3;
- args[3] = a4;
- args[4] = a5;
- args[5] = 0;
- syscall(11, 0, 0, name, args, 0);
- }
复制代码
[ 本帖最后由 zhhui2000 于 2006-9-21 11:33 编辑 ] |